<!--



function check_userpass() {
e_k=event.keyCode
if ((e_k < 13) || (e_k >13 && e_k < 45) || (e_k > 45 && e_k < 48) || (e_k > 57 && e_k < 65) || (e_k > 90 && e_k < 95) || (e_k > 95 && e_k < 97) || (e_k > 122)) {
event.returnValue = false;
alert("ต้องเป็นตัวอักษรภาษาอังกฤษ (a-z, A-Z), ตัวเลข (0-9), เครื่องหมาย \"-\", เครื่องหมาย \"_\" เท่านั้น  \nและห้ามมีการเว้นวรรคเด็ดขาด กรุณาตรวจสอบข้อมูลของท่านอีกครั้ง... \n(Must be at letters(a-z, A-Z), number (0-9), \"-\" sign, \"_\" sign, but no space \nPlease enter your information again...)");
}
}



function check_email() {
e_k=event.keyCode
if ((e_k > 160)) {
event.returnValue = false;
alert("ต้องเป็นตัวอักษรภาษาอังกฤษเท่านั้น และห้ามมีการเว้นวรรคเด็ดขาด \nกรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...\n(Must be at English characters Please enter your information again...)");
}
}



function check_number() {
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && (e_k < 48) || (e_k > 57)) {
event.returnValue = false;
alert("ต้องเป็นตัวเลขเท่านั้น กรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...\n(Must be at Number Please enter your information again...)");
}
}



function check_price() {
e_k=event.keyCode
//if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k != 13 && e_k != 46 && ( (e_k < 48) || (e_k > 57) ) ) {
event.returnValue = false;
alert("ต้องเป็นค่าเงินเท่านั้น เช่น 1000.00 กรุณาตรวจสอบข้อมูลของท่านอีกครั้ง...\n(Must be at Price Please enter your information again...)");
}
}



function check_user_shopname_url(vname,vurl) {
 cusuwinpopup=window.open(vurl+'?vquery='+vname.value,'','toolbar=no,location=no,directories=no,menubar=no,status=yes,scrollbars=yes,resizable=no,width=380,height=200');
}


function character_count(fieldfrom,fieldto,fieldmaxlimit) {
if (fieldfrom.value.length > fieldmaxlimit)
fieldfrom.value = fieldfrom.value.substring(0, fieldmaxlimit);
else 
fieldto.value=fieldfrom.value.length;
}





function Window_Popup( iStrUrl , iStrWindowName , iIntToolbar , iIntLocation , iIntStatus , iIntMenubar , iIntScrollbars , iIntResizable , iIntWidth , iIntHeight ) {

	// --- iStrUrl [Str]
	// --- iStrWindowName [Str]
	// --- iIntToolbar to iIntResizable [Int] ( 0 --> No , 1 --> Yes )
	// --- iIntWidth , iIntHeight [Int]

	var vStrWindow_Popup = window.open( iStrUrl , iStrWindowName , 'toolbar=' + iIntToolbar + ' , location=' + iIntLocation + ' , directories=0 , status=' + iIntStatus + ' , menubar=' + iIntMenubar + ' , scrollbars=' + iIntScrollbars + ' , resizable=' + iIntResizable + ' , width=' + iIntWidth + ', height=' + iIntHeight );
	vStrWindow_Popup.focus();

}


function Window_Popup_Html( iStrCodeHtml , iStrWindowName , iIntToolbar , iIntLocation , iIntStatus , iIntMenubar , iIntScrollbars , iIntResizable , iIntWidth , iIntHeight ) {

	// --- iStrCodeHtml [Str]
	// --- iStrWindowName [Str]
	// --- iIntToolbar to iIntResizable [Int] ( 0 --> No , 1 --> Yes )
	// --- iIntWidth , iIntHeight [Int]

	var vStrWindow_Popup_Html = window.open( '' , iStrWindowName , 'toolbar=' + iIntToolbar + ' , location=' + iIntLocation + ' , directories=0 , status=' + iIntStatus + ' , menubar=' + iIntMenubar + ' , scrollbars=' + iIntScrollbars + ' , resizable=' + iIntResizable + ' , width=' + iIntWidth + ', height=' + iIntHeight );
	vStrWindow_Popup_Html.document.write( iStrCodeHtml );

}



function Delete_Sure(dsrUrl)
{
if (confirm("Are you sure you want to delete ?                        "))
window.location = dsrUrl;
}



  function DeleteCheckBoxAll()
  {
    for (var i=0;i<document.FormName.elements.length;i++)
    {
      var e = document.FormName.elements[i];
      var boolValue = document.FormName.selectAll.checked;
      if (e.name != 'selectAll')
	  {
        e.checked = boolValue;
	  }
    }
  }


function check_form(e,vl){
	var pic_c = e.type_picture;
	
	if(e.cat_name.value == ""){
		alert("กรุณาเลือกหมวดหมู่สินค้าตลาด.คอม...\n(Please choose Tarad.com's product category ...)");
		e.buttoncate.focus();
		return false;
	}
	
	if(vl == "te"){
		if(e.title_th.value == ""){
			alert("กรุณาเติมชื่อสินค้า ภาษาไทย...\n(Please fill Product name in Thai ...)");
			e.title_th.focus();
			return false;
		}

		if(e.title_en.value == ""){
			alert("กรุณาเติมชื่อสินค้า ภาษาอังกฤษ...\n(Please fill Product name in English ...)");
			e.title_en.focus();
			return false;
		}

	}

	if(vl=="th"){
		if(e.title_th.value == ""){
			alert("กรุณาเติมชื่อสินค้า ภาษาไทย...\n(Please fill Product name in Thai ...)");
			e.title_th.focus();
			return false;
		}

	}

	if(vl=="en"){
		if(e.title_en.value == ""){
			alert("กรุณาเติมชื่อสินค้า ภาษาอังกฤษ...\n(Please fill Product name in English ...)");
			e.title_en.focus();
			return false;
		}

	}

	if(e.price.value == ""){
		alert("กรุณาเติม ราคา...\n(Please fill Product 's Price ...)");
		e.price.focus();
			return false;
	}

	if(e.price_decimal.value == ""){
		alert("กรุณาเติม ทศนิยม...\n(Please fill Product 's decimal Price ...)");
		e.price_decimal.focus();
			return false;
	}

	if(vl == "te"){
		if(e.description_th.value == ""){
			alert("กรุณาเติมรายละเอียด ภาษาไทย...\n(Please fill Product description in Thai ...)");
			e.description_th.focus();
			return false;
		}

		if(e.description_en.value == ""){
			alert("กรุณาเติมรายละเอียด ภาษาอังกฤษ...\n(Please fill Product description in English ...)");
			e.description_en.focus();
			return false;
		}

	}

	if(vl=="th"){
		if(e.description_th.value == ""){
			alert("กรุณาเติมรายละเอียด ภาษาไทย...\n(Please fill Product description in Thai ...)");
			e.description_th.focus();
			return false;
		}

	}

	if(vl=="en"){
		if(e.description_en.value == ""){
			alert("กรุณาเติมรายละเอียด ภาษาอังกฤษ...\n(Please fill Product description in English ...)");
			e.description_en.focus();
			return false;
		}

	}


	if(pic_c[1].checked && e.file.value == ""){
			alert("กรุณาเลือกรูปภาพ...\n(Please browse for picture ...)");
			e.file.focus();
			return false;
	}

	if(pic_c[1].checked && e.file.value != ""){
		if(e.file.value.lastIndexOf(".jpg")==-1 && e.file.value.lastIndexOf(".JPG")==-1 && e.file.value.lastIndexOf(".Jpg")==-1) {
			alert("กรุณาเลือกรูปภาพที่มีนามสกุล .jpg เท่านั้น...\n(Please upload only .jpg  extention file..)");
			e.file.focus();
			return false;
		}

	}

	if(e.shownow[0].checked == false){
		if(e.endinfinity[1].checked == false && e.startdate.value == ""){
			alert("กรุณาเลือกวันที่เริ่มต้นแสดงสินค้า...\n(Please select start date for show product...)");
				e.startdate.focus();
				return false;
		}
		else if(e.endinfinity[0].checked == false && e.startdate.value == "" && e.stopdate.value == ""){
			alert("กรุณาเลือกวันที่เริ่มต้นแสดงสินค้า...\n(Please select start date for show product ...) \nกรุณาเลือกวันที่สิ้นสุดแสดงสินค้า...\n(Please select end date for show product ...)");
				e.startdate.focus();
				return false;
		}
		else if(e.endinfinity[0].checked == false && e.startdate.value == "" ){
			alert("กรุณาเลือกวันที่เริ่มต้นแสดงสินค้า...\n(Please select start date for show product ...)");
				e.startdate.focus();
				return false;
		}
		else if(e.endinfinity[0].checked == false && e.stopdate.value == "" ){
			alert("กรุณาเลือกวันที่สิ้นสุดแสดงสินค้า...\n(Please select end date for show product ...)");
				e.stopdate.focus();
				return false;
		}					
		}

}
//-->
