// JavaScript Document
function openWind(pid) {
	bigWindow = window.open('big_image.php?PID='+ pid +'&POS=P','test','height=535,width=535,top=0,left=0,toolbar=no,titlebar=no,location=no,scrollbars=1')
	bigWindow.focus();
}
////////////////////////////
function test(obj,msg){
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	if (regex.test(obj.value)){
		return true;
	}else{
		alert(msg);
		obj.focus();
		return false;
	}
}
function checkempty(obj,msg){
	if(obj.value==''){
		alert(msg);
		obj.focus()
		return false;
	}
	return true;
}
function confirmpass(obj,obj1,msg){
	if(obj1.value!=obj.value){
		alert(msg);
		obj1.focus()
		return false;
	}
	return true;
}
function checkdate(obj,msg){
	if(obj.value==''){
		alert(msg);
		document.all.trigger.focus();
		return false;
	}
	return true;
}
/////////////////////
function checkAll(theForm, cName, allNo_stat){
	var n=theForm.elements.length;
	for (var i=0;i<n;i++){
		if (theForm.elements[i].className.indexOf(cName) !=-1){
			if (allNo_stat.checked) {
				theForm.elements[i].checked = true;
			}else{
				theForm.elements[i].checked = false;
			}
		}
	}
}
/////////////////////
function chkAddUser(){
	if(checkempty(document.frmAddUser.txtFName,"Information: Please type first name")){}else{return false};
	if(checkempty(document.frmAddUser.txtLName,"Information: Please type last name")){}else{return false};
	if(test(document.frmAddUser.txtEmail,"Information: Please type email")){}else{return false};
	if(checkempty(document.frmAddUser.txtPass,"Information: Please type password")){}else{return false};
	if(checkempty(document.frmAddUser.txtCPass,"Information: Please type confirm password")){}else{return false};
	if(confirmpass(document.frmAddUser.txtPass,document.frmAddUser.txtCPass,"Information: Please type same password")){}else{return false};
	if(checkempty(document.frmAddUser.IDQuestion,"Information:Please select any id question")){}else{return false};
	if(checkempty(document.frmAddUser.txtIDAnswer,"Information: Please type answer of id question")){}else{return false};
	if(checkempty(document.frmAddUser.txtCompName,"Information: Please type company name")){}else{return false};
	if(checkempty(document.frmAddUser.Gender,"Information: Please select any gender")){}else{return false};
	if(checkdate(document.frmAddUser.txtdob,"Information: Please select date of birth from the calendar.\nClick on the button next to field to open calendar")){}else{return false};
	if(checkempty(document.frmAddUser.txtPhone,"Information: Please type phone")){}else{return false};
	if(checkempty(document.frmAddUser.txtAddress,"Information: Please type Address")){}else{return false};
	if(checkempty(document.frmAddUser.txtCity,"Information: Please type city")){}else{return false};
	if(checkempty(document.frmAddUser.txtState,"Information: Please type state")){}else{return false};
	if(checkempty(document.frmAddUser.txtPCode,"Information: Please type postal code")){}else{return false};
	if(checkempty(document.frmAddUser.SCountry,"Information: Please select country")){}else{return false};
	return true;
}
function chkEditProfile(){
	if(checkempty(document.frmEditProfile.txtFName,"Information: Please type first name")){}else{return false};
	if(checkempty(document.frmEditProfile.txtLName,"Information: Please type last name")){}else{return false};
	if(checkempty(document.frmEditProfile.txtPass,"Information: Please type password")){}else{return false};
	if(checkempty(document.frmEditProfile.IDQuestion,"Information:Please select any id question")){}else{return false};
	if(checkempty(document.frmEditProfile.txtIDAnswer,"Information: Please type answer of id question")){}else{return false};
	if(checkempty(document.frmEditProfile.txtCompName,"Information: Please type company name")){}else{return false};
	if(checkempty(document.frmEditProfile.Gender,"Information: Please select any gender")){}else{return false};
	if(checkdate(document.frmEditProfile.txtdob,"Information: Please select date of birth from the calendar.\nClick on the button next to field to open calendar")){}else{return false};
	if(checkempty(document.frmEditProfile.txtPhone,"Information: Please type phone")){}else{return false};
	if(checkempty(document.frmEditProfile.txtAddress,"Information: Please type Address")){}else{return false};
	if(checkempty(document.frmEditProfile.txtCity,"Information: Please type city")){}else{return false};
	if(checkempty(document.frmEditProfile.txtState,"Information: Please type state")){}else{return false};
	if(checkempty(document.frmEditProfile.txtPCode,"Information: Please type postal code")){}else{return false};
	if(checkempty(document.frmEditProfile.SCountry,"Information: Please select country")){}else{return false};
	return true;
}
function chkAddress(){
//	if(checkempty(document.frmAddress.txtAttention,"Information: Enter Attention")){}else{return false};
	if(checkempty(document.frmAddress.txtFName,"Information: Enter First Name")){}else{return false};
	if(checkempty(document.frmAddress.txtLName,"Information: Enter Last Name")){}else{return false};
	if(checkempty(document.frmAddress.txtAddress1,"Information: Enter Address")){}else{return false};
	if(checkempty(document.frmAddress.txtCity,"Information: Enter City")){}else{return false};
	if(checkempty(document.frmAddress.cmbState,"Information: Enter State")){}else{return false};
	if(checkempty(document.frmAddress.cmbCountry,"Information: Select Country")){}else{return false};
	if(checkempty(document.frmAddress.txtPCode,"Information: Enter Postal Code")){}else{return false};
	if(checkempty(document.frmAddress.txtPhone,"Information: Enter Phone")){}else{return false};
	if(test(document.frmAddress.txtEmail,"Information: Enter Email Address")){}else{return false};
}

function ChkBill(){
	if(checkempty(document.frmAddress.cmbBill,"Information: Select Address from the list")){
		document.FrmAction.hidBill.value = document.frmAddress.cmbBill.value
		document.FrmAction.submit();
	}else{return false};
}
function chkSearch(){
	if(checkempty(document.frmSearch.txtSWord,"Information: Enter Search words")==false) return false;
	return true;
}
function chkLogin(){
	if(test(document.frmlogin.uname,"Information: Enter Username")){}else{return false};
	if(checkempty(document.frmlogin.pass,"Information: Enter Password")){}else{return false};
	return true;
}
function chkLogin2(){
	if(test(document.frmlogin2.uname,"Information: Enter Username")){}else{return false};
	if(checkempty(document.frmlogin2.pass,"Information: Enter Password")){}else{return false};
	return true;
}
function chkNl(){
	if(test(document.frmNl.email,"Information: Enter Valid Email")==false) return false;
	return true;
}
function chkDelbook(){
	if(document.frmActions.act.value=='delbook'){
		if(confirm("Are you sure you want to deleted selected address?")){
			return true;
		}else{
			return false;
		}
	}else{
		return true;
	}
}
function chkMList(){
	if(test(document.frmMList.txtEmail,"Information: Enter Email")){}else{return false};
	return true;
}
function chkCart(){
	if(document.frmcart.act.value=="delsel"){
		if(confirm("Are you Sure you want to remove selected items")){
			return true;
		}else{
			return false;
		}
	}else{
		return true;
	}
}