document.write("<script language='JavaScript' src='script/general.js'></script>");
function username_validate(form)
{
	if(form.Username.value=='')
	{
		str="Please enter the User name.";
		alert(str);
		form.Username.focus();
		return false;
	}
}

function validate_contest(form)
{
	if(form.txtcontestname.value=='')
	{
		str="Please enter the contest name.";
		alert(str);
		form.txtcontestname.focus();
		return false;
	}
	if(form.txtamount.value=='')
	{
		str="Please enter the amount.";
		alert(str);
		form.txtamount.focus();
		return false;
	}
	if(isNaN(form.txtamount.value))
  	{ 
   		status= 'Amount must contain only numbers.';
		alert(status);
		form.txtamount.focus();
    	return false;
 	}
	if(form.txtdesc.value=='')
	{
		str="Please enter the description.";
		alert(str);
		form.txtdesc.focus();
		return false;
	}
}

function validate_sendmail(form)
{
	if(form.cat_id.value=="")
	{
		str="Please select the category.";
		alert(str);
		form.cat_id.focus();
		return false;
	}
	if(form.prod_id.value=="")
	{
		str="Please select the product.";
		alert(str);
		form.prod_id.focus();
		return false;
	}
	if(form.subject.value=="")
	{
		str="Please enter the mail subject.";
		alert(str);
		form.subject.focus();
		return false;
	}
	if(form.message.value=="")
	{
		str="Please enter the mail content.";
		alert(str);
		form.message.focus();
		return false;
	}
}

function validate_addcomment(form)
{
	if(form.vcharName.value=='')
	{
		str="Please enter your name.";
		alert(str);
		form.vcharName.focus();
		return false;
	}
	if(validate_name_new(form.vcharName.value))
	{
		str = "Name must not have spaces, special characters at first position."
		alert(str);
		form.vcharName.focus();
		return false;
	}
	if(!isNaN(form.vcharName.value))
  	{ 
   		status= 'Name must not contain only numbers.';
		alert(status);
		form.vcharName.focus();
    	return false;
 	}
	if(form.message.value=='')
	{
		str="Please enter your comment.";
		alert(str);
		form.message.focus();
		return false;
	}
}


function dtform(dt)// the date fromat dt to be passed must be DD-MM-YYYY
{
	if(trim(dt)=="")
		return false;
	var from = dt.split("/");
	var from_dt = new Date(from[1]+"/"+from[0]+"/"+from[2]);	
	return from_dt;
}

/* Validation of the New User Registration.*/
function reg_validate(form)
{
	var email = form.txtemail.value;
	var str="";
	if(email=="")
	{
		str="Please enter your email address.";
		alert(str);
		form.txtemail.focus();
		return false;
	}
	else
	{
		var result = checkEmail(email);
		if(!result)
		{
			str="Invalid email address! Please re-enter.";
			alert(str);
		    form.txtemail.focus();
			return false;
		}
	}
	return true;
}

/* Validation of the Login page.*/
function login(form)
{
	var str="";
	if(form.username.value=="")
	{
		str="Please provide your username.";
		alert(str);
		form.username.focus();
		return false;
	}
	else
	{
		if(!checkEmail(form.username.value))
		{
			str="Invalid username! Please re-enter.";
			alert(str);
		    form.username.focus();
			return false;
		}
	}
	if(form.password.value=="")
	{
		str = "Please provide your password."
		alert(str);
		form.password.focus();
		return false;
	}
	else
	{
		if(checkSpaces(form.password.value))
		{
			str = "Invalid password! Blank spaces are not allowed."
			alert(str);
			form.password.focus();
			return false;
		}
	}
	return true;
}

/* Validation of the Change Password.*/
function changepass_validate(form)
{
	if(form.txtoldpass.value=='')
	{
		str = "Please enter old password.";
		alert(str);
		form.txtoldpass.focus();
		return false;
	}
	else
	{
		if(checkSpaces(form.txtoldpass.value))
		{
			str = "Invalid old password! Blank spaces are not allowed."
			alert(str);
			form.txtoldpass.focus();
			return false;
		}
		if(form.txtoldpass.value.length <4 || form.txtoldpass.value.length >10)
		{
			str = "Old password can be of 4-10 characters."
			alert(str);
			form.txtoldpass.focus();
			return false;
		}
	}
	if(form.txtnewpass.value=='')
	{
		str = "Please enter new password.";
		alert(str);
		form.txtnewpass.focus();
		return false;
	}
	if((form.txtoldpass.value)==(form.txtnewpass.value))
	{
	alert("Old password should not be same as  new password");
	form.txtnewpass.focus();
	return false;
	}	
	if(form.txtnewpass.value!='')
	{
		if(checkSpaces(form.txtnewpass.value))
		{
			str = "Invalid new password! Blank spaces are not allowed."
			alert(str);
			form.txtnewpass.focus();
			return false;
		}
		if(form.txtnewpass.value.length <4 || form.txtnewpass.value.length >10)
		{
			str = "New password can be of 4-10 characters."
			alert(str);
			form.txtnewpass.focus();
			return false;
		}
		if(form.txtconfirm.value=='')
		{
			str = "Please enter confirm password.";
			alert(str);
			form.txtconfirm.focus();
			return false;
		}
		if(form.txtconfirm.value!='')
		{
			if(checkSpaces(form.txtconfirm.value))
			{
				str = "Invalid new password! Blank spaces are not allowed."
				alert(str);
				form.txtconfirm.focus();
				return false;
			}
			if(form.txtconfirm.value.length <4 || form.txtconfirm.value.length >10)
			{
				str = "Confirm password can be of 4-10 characters."
				alert(str);
				form.txtconfirm.focus();
				return false;
			}
			if(form.txtnewpass.value != form.txtconfirm.value)
			{
				str = "Confirm password mismatch with new password.";
				alert(str);
				form.txtconfirm.focus();
				return false;
			}
		}
	}
	return true;
}


/* Validation for Manage About Us */
function validate_aboutus(form)
{
	
	if(form.txthidden.value=="")
	{  
		str = "Please enter the content.";
		alert(str);
		return false;
	}
	return true;
}

/* Validation For Contact Us */
function validate_contactus(form)
{
	if(form.txtname.value=="")
	{
		str = "Please enter the name.";
		alert(str);
		form.txtname.select();
		return false;
	}
	if(form.txtemail.value=="")
	{
		str = "Please enter the email address.";
		alert(str);
		form.txtemail.select();
		return false;
	}
	else
	{
		if (!checkEmail(form.txtemail.value))
		{
			alert("Invalid e-mail address! Please re-enter.");
			form.txtemail.select();
			return false;
		}
	}
	if(form.txtsubject.value=="")
	{
		str = "Please enter the subject.";
		alert(str);
		form.txtsubject.select();
		return false;
	}
	if(form.txtdescription.value=="")
	{
		str = "Please enter the message.";
		alert(str);
		form.txtdescription.select();;
		return false;
	}
    return true;
}

/*New site configuration validation*/
function validate_siteconf(form)
{
	var email = form.txtemail.value;
	var str="";
	if(email=="")
	{
		str="Please enter Admin email address.";
		alert(str);
		form.txtemail.focus();
		return false;
	}
	else
	{
		var result = checkEmail(email);
		if(!result)
		{
			str="Invalid Admin email address! Please re-enter.";
			alert(str);
		    form.txtemail.focus();
			return false;
		}
	}
	var email2 = form.txtsupportemail.value;
	var str="";
	if(email2!="")
	{
		var result = checkEmail(email2);
		if(!result)
		{
			str="Invalid Support email address! Please re-enter.";
			alert(str);
		    form.txtsupportemail.focus();
			return false;
		}
	}
	var email3 = form.txtsalesemail.value;
	var str="";
	if(email3!="")
	{
		var result = checkEmail(email3);
		if(!result)
		{
			str="Invalid Sales email address! Please re-enter.";
			alert(str);
		    form.txtsalesemail.focus();
			return false;
		}
	}
	var email4 = form.txtaccountsemail.value;
	var str="";
	if(email4!="")
	{
		var result = checkEmail(email4);
		if(!result)
		{
			str="Invalid Accounts email address! Please re-enter.";
			alert(str);
		    form.txtaccountsemail.focus();
			return false;
		}
	}
	return true;
}

/* validation for payments*/
function validate_payments(form)
{
	var email = form.txtemail.value;
	var str="";
	if(email=="")
	{
		str="Please enter your paypal email address.";
		alert(str);
		form.txtemail.focus();
		return false;
	}
	else
	{
		var result = checkEmail(email);
		if(!result)
		{
			str="Invalid email address! Please re-enter.";
			alert(str);
		    form.txtemail.focus();
			return false;
		}
	}
	if(form.txttransactionurl.value=="")
	{
		str="Please enter your paypal transaction url.";
		alert(str);
		form.txttransactionurl.focus();
		return false;
	}
}

/* Validation for FAQS*/
function validate_faq(form)
{
	if(form.txtquestion.value=="")
	{
		str = "Please enter the Question.";
		alert(str);
		form.txtquestion.focus();
		return false;
	}
	if(form.txtanswer.value=="")
	{
		str = "Please enter the Answer.";
		alert(str);
		form.txtanswer.focus();
		return false;
	}
	return true;
}

/* Validation for Category*/
function validate_category(form)
{
	
	if(form.txtcategoryname.value=="")
	{
		str = "Please enter the Category Name.";
		alert(str);
		form.txtcategoryname.focus();
		return false;
	}
	
	if(validate_name_new(form.txtcategoryname.value))
	{
		str = "Category must not have spaces, special characters at first position."
		alert(str);
		form.txtcategoryname.focus();
		return false;
	}
	if(form.txtcategoryname.value.length <3)
	{
		str = "Category must not be less than 3 characters."
		alert(str);
		form.txtcategoryname.focus();
		return false;
	}
	if(form.image.value!="")
	{
		if(!checkFileType(form.image.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image.focus();
			return false;
		}
	}
}

/* Validation for products*/
function validate_addproducts(form,val)
{
	if(form.txtproductname.value=="")
	{
		str = "Please enter the Product Name.";
		alert(str);
		form.txtproductname.focus();
		return false;
	}
	if(validate_name_new(form.txtproductname.value))
	{
		str = "Product Name must not have spaces, special characters at first position."
		alert(str);
		form.txtproductname.focus();
		return false;
	}
	if(form.txtdescription.value=="")
	{
		str = "Please enter the Product Description.";
		alert(str);
		form.txtdescription.focus();
		return false;
	}
	if(form.image1.value!="")
	{
		if(!checkFileType(form.image1.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image1.focus();
			return false;
		}
				 
	}
	if(form.image2.value!="")
	{
		if(!checkFileType(form.image2.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image2.focus();
			return false;
		}

	}		
	if(form.image3.value!="")
	{
		if(!checkFileType(form.image3.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image3.focus();
			return false;
		}
	}
	if(form.txtproductno.value=="")
	{
		str = "Please enter the Product-ID.";
		alert(str);
		form.txtproductno.focus();
		return false;
	}
	if(validate_name_new(form.txtproductno.value))
	{
		str = "Product-ID must not have spaces, special characters at first position."
		alert(str);
		form.txtproductno.focus();
		return false;
	}
	if(form.categoryid.value=="")
	{
		str = "Please select the product category.";
		alert(str);
		form.categoryid.focus();
		return false;
	}
	
	var chkselect=0; 
	for(var i=0; i<val; i++)
	{
		var field = document.getElementById("txtsizeid_"+i);
		if(field.checked)
		{
			chkselect=1;
			var txtfield = document.getElementById("quant_"+i);
			var txtfield_new = document.getElementById("invent_"+i);
			var txtfield_new_price = document.getElementById("price_"+i);
			var fieldvalue = txtfield.value;
			var fieldvalue_new = txtfield_new.value;
			var fieldvalue_new_price = txtfield_new_price.value;
						
			if(fieldvalue=='')
			{
				alert('Please enter the Quantity.');
				txtfield.select();
				return false;
			}
			if(isNaN(fieldvalue))
  			{ 
   	 			status= 'Quantity must contain only numbers.';
				alert(status);
				txtfield.select();
    			return false;
 			}
			if(fieldvalue<0)
			{
				str = "Please enter valid Quantity.";
				alert(str);
				txtfield.focus();
				return false;
			}
			
			if(fieldvalue_new=='')
			{
				alert('Please enter the inventory number.');
				txtfield_new.select();
				return false;
			}
			
			if(isNaN(fieldvalue_new))
  			{ 
   	 			status= 'Inventory number must contain only numbers.';
				alert(status);
				txtfield_new.select();
    			return false;
 			}
			
			if(fieldvalue_new<0)
			{
				str = "Please enter valid Inventory number.";
				alert(str);
				txtfield_new.focus();
				return false;
			}
			
			if(fieldvalue_new_price=='')
			{
				alert('Please enter the Price.');
				txtfield_new_price.select();
				return false;
			}
			
			if(isNaN(fieldvalue_new_price))
  			{ 
   	 			status= 'Price must contain only numbers.';
				alert(status);
				txtfield_new_price.select();
    			return false;
 			}
			
			if(fieldvalue_new_price<=0)
			{
				str = "Please enter valid Price.";
				alert(str);
				txtfield_new_price.focus();
				return false;
			}
		}
	}
	if(chkselect==0)
	{
		alert('Please select size.');
		return false;
	}
	
	
	/*if(form.txtprice.value=="")
	{
		str = "Please enter the price.";
		alert(str);
		form.txtprice.focus();
		return false;
	}
	if(form.txtprice.value!='')
	{
		if(isNaN(form.txtprice.value))
		{
			str = "Price must contain only digits.";
			alert (str);
			form.txtprice.focus();
			return false;
		}
		if(form.txtprice.value<=0)
		{
			str = "Please enter valid amount.";
			alert(str);
			form.txtprice.focus();
			return false;
		}
	}*/

}

/* Validation for prices
function validate_prices(form)
{
	if(form.intProductid.value=="")
	{
		str = "Please select the product name.";
		alert(str);
		form.intProductid.focus();
		return false;
	}
	if(form.txtprice.value=="")
	{
		str = "Please enter the Price.";
		alert(str);
		form.txtprice.focus();
		return false;
	}
	if(isNaN(form.txtprice.value))
	{
		str = "Price must contain only digits.";
		alert (str);
		form.txtprice.focus();
		return false;
	}
	if(form.txtprice.value<=0)
	{
		str = "Please enter valid amount.";
		alert(str);
		form.txtprice.focus();
		return false;
	}
	if(form.txtwef.value=="")
	{
		str = "Please select the Date.";
		alert(str);
		form.txtwef.focus();
		return false;
	}
}*/

/* Validation for sizes*/
function validate_sizes(form)
{
	if(form.txtsize.value=="")
	{
		str = "Please enter the Size.";
		alert(str);
		form.txtsize.focus();
		return false;
	}
	if(validate_name_new(form.txtsize.value))
	{
		str = "Size must not have spaces, special characters at first position."
		alert(str);
		form.txtsize.focus();
		return false;
	}
}

/* Validation for Hot news*/
function validate_hotnews(form)
{
	if(form.txttitle.value=="")
	{   
		str = "Please enter the Title.";
		alert(str);
		form.txttitle.select();
		return false;
	}
	if(form.image.value!="")
	{
		if(!checkFileType(form.image.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image.focus();
			return false;
		}
	}
	if(form.txthidden.value=="")
	{   
		str = "Please enter the Description.";
		alert(str);
		return false;
	}
	return true;
}

/*To enable the input fields in add stock*/
function enable(id) 
{
	if(document.frmaddpurchase.elements["txtsizeid_"+id].checked==true)
	{				
		document.frmaddpurchase.elements["quant_"+id].disabled=false;
	}
	else
	{
		document.frmaddpurchase.elements["quant_"+id].disabled=true;
	}
}

/*To enable the input fields in add products*/
function enable_new(id) 
{
	if(document.frmaddproducts.elements["txtsizeid_"+id].checked==true)
	{				
		document.frmaddproducts.elements["quant_"+id].disabled=false;
		document.frmaddproducts.elements["invent_"+id].disabled=false;
		document.frmaddproducts.elements["price_"+id].disabled=false;
	}
	else
	{
		document.frmaddproducts.elements["quant_"+id].disabled=true;
		document.frmaddproducts.elements["invent_"+id].disabled=true;
		document.frmaddproducts.elements["price_"+id].disabled=true;
	}
}


/*To enable the input fields in edit products*/
function enable_new_one(id) 
{
	if(document.frmeditproducts.elements["txtsizeid_"+id].checked==true)
	{				
		document.frmeditproducts.elements["quant_"+id].disabled=false;
		document.frmeditproducts.elements["invent_"+id].disabled=false;
		document.frmeditproducts.elements["price_"+id].disabled=false;
	}
	else
	{
		document.frmeditproducts.elements["quant_"+id].disabled=true;
		document.frmeditproducts.elements["invent_"+id].disabled=true;
		document.frmeditproducts.elements["price_"+id].disabled=true;
	}
}

function CheckCheck(fmobj)
{
	var TotalBoxes = 0;
	var TotalOn = 0;
	var chk = 0;
	var totalchk = document.getElementById("txtelements").value;

	for (var i=0;i<fmobj.elements.length;i++)
	{
		var e = fmobj.elements[i];
		if ((e.type=='checkbox') && (e.checked==true) && (e.name!='chkall'))
		{
			chk = chk+1;
		}
	}
}

function show_hide(form)
{
	document.getElementById("disp").style.display = "block";
	return false;
}

function validate_purchase(form,val)
{
	if(form.txtproduct.value=="")
	{   
		str = "Please select the product.";
		alert(str);
		form.txtproduct.focus();
		return false;
	}
	var chkselect=0; 
	for(var i=0; i<val; i++)
	{
		var field = document.getElementById("txtsizeid_"+i);
		if(field.checked)
		{
			chkselect=1;
			var txtfield = document.getElementById("quant_"+i);
			var fieldvalue = txtfield.value;
						
			if(fieldvalue=='')
			{
				alert('Please enter the Quantity.');
				txtfield.select();
				return false;
			}
			else if(isNaN(fieldvalue))
  			{ 
   	 			status= 'Quantity must contain only numbers.';
				alert(status);
				txtfield.select();
    			return false;
 			}
			else if(fieldvalue<=0)
			{
				str = "Please enter valid amount.";
				alert(str);
				txtfield.focus();
				return false;
			}
		}
	}
	if(chkselect==0)
	{
		alert('Please select size.');
		return false;
	}
	
	if(form.rate.value=="")
	{   
		str = "Please enter the rate.";
		alert(str);
		form.rate.focus();
		return false;
	}
	if(isNaN(form.rate.value))
	{
		str = "Rate must contain only digits.";
		alert (str);
		form.rate.focus();
		return false;
	}
	if(form.rate.value<=0)
	{
		str = "Please enter valid amount.";
		alert(str);
		form.rate.focus();
		return false;
	}
	
	if(form.txtwef.value=="")
	{
		str = "Please select the Date.";
		alert(str);
		form.txtwef.focus();
		return false;
	}
}

/* validate add to cart*/
function  validate_addtocart(form,val)
{
	var qty = false;
	for(var i=0; i<val; i++)
	{
		var field = document.getElementById("quant_"+i);
		if(field && qty == true)
		{
			var fieldvalue = field.value;
			if(fieldvalue!='')
			{
				if(isNaN(fieldvalue))
				{ 
					status= 'Quantity must contain only numbers.';
					alert(status);
					field.select();
					return false;
				}
				else if(fieldvalue<=0)
				{
					str = "Please enter valid quantity.";
					alert(str);
					field.focus();
					return false;
				}
			}
		}
		else if(field)
		{
			var fieldvalue = field.value;
			if(fieldvalue!='')
			{
				if(isNaN(fieldvalue))
				{ 
					status= 'Quantity must contain only numbers.';
					alert(status);
					field.select();
					return false;
				}
				else if(fieldvalue<=0)
				{
					str = "Please enter valid quantity.";
					alert(str);
					field.focus();
					return false;
				}
				qty = true;
			}			
		}
	}
	if(!qty)
	{
		alert('Please enter the Quantity.');
		return false;
	}
}

/* product detailed view : amount,total*/
function addamount(form,rows,price)
{
	var val=0;
	var sum=0;
	var total_sum=0;
	for(var i=0; i<rows; i++)
	{
		field = document.getElementById('quant_'+i);		
		if(field && field.value)
		{
			sum = field.value*price;
			total_sum += sum;
			document.getElementById('total_'+i).value = sum;
		}
		else
		{
			document.getElementById('total_'+i).value = '';
			
		}
	}
	document.getElementById('total_sum').innerHTML = '$ '+total_sum;
	document.getElementById('total_grand').value = total_sum;
}

function validate_billship(form)
{
	//billing info
	if(form.txtBillname.value=="")
	{   
		str = "Please enter the Billing name.";
		alert(str);
		form.txtBillname.focus();
		return false;
	}
	if(validate_name_new(form.txtBillname.value))
	{
		str = "Billing name must not have spaces, special characters at first position."
		alert(str);
		form.txtBillname.focus();
		return false;
	}
	if(form.txtBilladdr1.value=="")
	{   
		str = "Please enter the billing address.";
		alert(str);
		form.txtBilladdr1.focus();
		return false;
	}
	if(form.txtBillcity.value=="")
	{   
		str = "Please enter the billing city.";
		alert(str);
		form.txtBillcity.focus();
		return false;
	}
	if(!isNaN(form.txtBillcity.value))
  	{ 
   	 	status= 'Please enter valid billing city name.';
		alert(status);
		form.txtBillcity.focus();
    	return false;
 	}
	if(form.vcharbillCountry.value=="")
	{   
		str = "Please select the billing country.";
		alert(str);
		form.vcharbillCountry.focus();
		return false;
	}
	if(form.vcharbillState.value=="")
	{   
		str = "Please enter the billing state.";
		alert(str);
		form.vcharbillState.focus();
		return false;
	}
	if(form.txtBillzip.value=="")
	{   
		str = "Please enter the billing zip code.";
		alert(str);
		form.txtBillzip.focus();
		return false;
	}
	/*if(isNaN(form.txtBillzip.value))
  	{ 
   	 	status= 'Please enter valid billing zip code.';
		alert(status);
		form.txtBillzip.focus();
    	return false;
 	}*/
	var email = form.vcharUsername.value;
	var str="";
	if(email=="")
	{
		str="Please enter your billing email address.";
		alert(str);
		form.vcharUsername.focus();
		return false;
	}
	else
	{
		var result = checkEmail(email);
		if(!result)
		{
			str="Invalid billing email address! Please re-enter.";
			alert(str);
		    form.vcharUsername.focus();
			return false;
		}
	}
	if(form.txtBillphone.value=="")
	{   
		str = "Please enter the billing phone number.";
		alert(str);
		form.txtBillphone.focus();
		return false;
	}
	/*else
	{   
		if(isNaN(form.txtBillphone.value))
  		{ 
   	 		status= 'Please enter valid billing phone number.';
			alert(status);
			form.txtBillphone.focus();
    		return false;
 		}
	}*/
	
	//shipping info
	if(form.txtShipname.value=="")
	{   
		str = "Please enter the shipping name.";
		alert(str);
		form.txtShipname.focus();
		return false;
	}
	if(validate_name_new(form.txtShipname.value))
	{
		str = "Shipping name must not have spaces, special characters at first position."
		alert(str);
		form.txtShipname.focus();
		return false;
	}
	if(form.txtShipaddr1.value=="")
	{   
		str = "Please enter the shipping address.";
		alert(str);
		form.txtShipaddr1.focus();
		return false;
	}
	if(form.txtShipcity.value=="")
	{   
		str = "Please enter the shipping city.";
		alert(str);
		form.txtShipcity.focus();
		return false;
	}
	if(!isNaN(form.txtShipcity.value))
  	{ 
   	 	status= 'Please enter valid shipping city name.';
		alert(status);
		form.txtShipcity.focus();
    	return false;
 	}
	if(form.vcharshipCountry.value=="")
	{   
		str = "Please select the shipping country.";
		alert(str);
		form.vcharshipCountry.focus();
		return false;
	}
	if(form.vcharshipState.value=="")
	{   
		str = "Please enter the shipping state.";
		alert(str);
		form.vcharshipState.focus();
		return false;
	}
	
	if(form.txtShipzip.value=="")
	{   
		str = "Please enter the shipping zip code.";
		alert(str);
		form.txtShipzip.focus();
		return false;
	}
	/*if(isNaN(form.txtShipzip.value))
  	{ 
   	 	status= 'Please enter valid shipping zip code.';
		alert(status);
		form.txtShipzip.focus();
    	return false;
 	}*/
	var email = form.vcharshipUsername.value;
	var str="";
	if(email=="")
	{
		str="Please enter your shipping email address.";
		alert(str);
		form.vcharshipUsername.focus();
		return false;
	}
	else
	{
		var result = checkEmail(email);
		if(!result)
		{
			str="Invalid shipping email address! Please re-enter.";
			alert(str);
		    form.vcharshipUsername.focus();
			return false;
		}
	}
	if(form.txtShipphone.value=="")
	{   
		str = "Please enter the shipping phone number.";
		alert(str);
		form.txtShipphone.focus();
		return false;
	}
	/*else
	{   
		if(isNaN(form.txtShipphone.value))
  		{ 
   	 		status= 'Please enter valid shipping phone number.';
			alert(status);
			form.txtShipphone.focus();
    		return false;
 		}
	}
	if(trim(form.shipptype.value)=="")
	{
		alert ("Please select the shipping method");
		form.shipptype.focus();
		return false
	}
	if(trim(form.scost.value)=="0.00" || trim(form.scost.value)<0)
	{
		alert ("Please reselect the shipping method");
		form.shipptype.value="";
		form.shipptype.focus();
		return false
	}*/
	
	if(form.cc_type.value=="")
	{
		str = "Please selec the Card Name.";
		alert(str);
		form.cc_type.focus();
		return false;
	}
	if(form.cc_number.value=="")
	{
		str = "Please enter Card Number.";
		alert(str);
		form.cc_number.focus();
		return false;
	}
	if(isNaN(form.cc_number.value))
  	{ 
   	 	status= 'Please enter valid Credit Card Number.';
		alert(status);
		form.cc_number.focus();
    	return false;
 	}
	if(form.card_expiry_date.value=="")
	{
		str = "Please select the card expiry month.";
		alert(str);
		form.card_expiry_date.focus();
		return false;
	}
	if(form.card_expiry_year.value=="")
	{
		str = "Please select the card expiry year.";
		alert(str);
		form.card_expiry_year.focus();
		return false;
	}
	if(form.name_cc.value=="")
	{
		str = "Please enter card holders name.";
		alert(str);
		form.name_cc.focus();
		return false;
	}
	if(form.ccv2.value=="")
	{
		str = "Please enter ccv2.";
		alert(str);
		form.ccv2.focus();
		return false;
	}
	if(isNaN(form.ccv2.value))
  	{ 
   	 	status= 'Please enter valid ccv2.';
		alert(status);
		form.ccv2.focus();
    	return false;
 	}
	
}

function validate_submitdesign(form)
{
	if(form.txtname.value=="")
	{
		str = "Please enter the your Name.";
		alert(str);
		form.txtname.focus();
		return false;
	}
	
	if(validate_name_new(form.txtname.value))
	{
		str = "Name must not have spaces, special characters at first position."
		alert(str);
		form.txtname.focus();
		return false;
	}
	var str="";
	if(form.txtemail.value=="")
	{
		str="Please provide your email.";
		alert(str);
		form.txtemail.focus();
		return false;
	}
	else
	{
		if(!checkEmail(form.txtemail.value))
		{
			str="Invalid email! Please re-enter.";
			alert(str);
		    form.txtemail.focus();
			return false;
		}
	}
	if(form.txtdesignname.value=="")
	{
		str = "Please enter the Design Name.";
		alert(str);
		form.txtdesignname.focus();
		return false;
	}
	if(form.image1.value=="")
	{
		str = "Please upload image file.";
		alert(str);
		form.image1.focus();
		return false;
	}
	if(form.image1.value!="")
	{
		if(!checkFileType(form.image1.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image1.focus();
			return false;
		}
	}
	if(form.vcharPhone.value=="")
	{
		alert ("Please enter phone number.");
		form.vcharPhone.focus();
		return false;
	}
	if(checkPhone(form.vcharPhone.value))
	{
		alert("Phone number must contain only digits,-,(,).");
		form.vcharPhone.focus();
		return false;
	}
	if(form.vcharPhone.value.length <8)
	{
		alert("Phone number should be minimum 8 digits.");
		form.vcharPhone.focus();
		return false;
	}
	if(form.vcharPhone.value.length > 16)
	{
		alert("Phone number can be of maximun 16 digits.");
		form.vcharPhone.focus();
		return false;
	}
	 if(trim(form.vcharPhone.value)=="")
	  { 
	  str = "Please enter valid Phone number.";
	  alert(str);
	  form.vcharPhone.select()
	  return false;
	  }
}


function validate_editdesign(form)
{
	if(form.txtname.value=="")
	{
		str = "Please enter the your Name.";
		alert(str);
		form.txtname.focus();
		return false;
	}
	
	if(validate_name_new(form.txtname.value))
	{
		str = "Name must not have spaces, special characters at first position."
		alert(str);
		form.txtname.focus();
		return false;
	}
	var str="";
	if(form.txtemail.value=="")
	{
		str="Please provide your email.";
		alert(str);
		form.txtemail.focus();
		return false;
	}
	else
	{
		if(!checkEmail(form.txtemail.value))
		{
			str="Invalid email! Please re-enter.";
			alert(str);
		    form.txtemail.focus();
			return false;
		}
	}
	if(form.txtdesignname.value=="")
	{
		str = "Please enter the Design Name.";
		alert(str);
		form.txtdesignname.focus();
		return false;
	}
	if(form.image1.value!="")
	{
		if(!checkFileType(form.image1.value))
		{
			alert("Only .jpg,.gif,.jpeg,.png files can be uploaded");
			form.image1.focus();
			return false;
		}
	}
}

/*courier validation*/
function validate_courier(form)
{
	if(form.txtcourier.value=="")
	{
		str = "Please enter the courier service name.";
		alert(str);
		form.txtcourier.focus();
		return false;
	}
	if(validate_name_new(form.txtcourier.value))
	{
		str = "Courier name must not have spaces, special characters at first position."
		alert(str);
		form.txtcourier.focus();
		return false;
	}
	if(!isNaN(form.txtcourier.value))
  	{ 
   	 	status= 'Please enter valid Courier name.';
		alert(status);
		form.txtcourier.focus();
    	return false;
 	}
}

/*to change the display image*/
function change_image(src)
{
	document.getElementById("dest").src=src;
}
function validate_friends(form)
{
	if(trim(form.txtname1.value)=="")
	{
        alert("Please Enter Your Name "); 
        form.txtname1.focus();
        return false
     } 
	if(validate_name_new(form.txtname1.value))
	{
		str = "Name must not have spaces, special characters at first position."
		alert(str);
		form.txtname1.focus();
		return false;
	}
	if(!isNaN(form.txtname1.value))
	{
		str = "Please enter valid name"
		alert(str);
		form.txtname1.focus();
		return false;
	}
	
	if(form.txtem1.value=="")
	{
       alert("Please Enter Your Email-Id");
	   form.txtem1.focus();
	   return false
	 }
    if (checkEmail(form.txtem1.value)==false)
	{
		alert("Invalid E-mail Address! Please Re-enter.");
		form.txtem1.focus()
		return false   
     }
	if(trim(form.txtname2.value)==""){
        alert("Please Enter Recipient's Name "); 
        form.txtname2.focus();
        return false
     }
	if(validate_name_new(form.txtname2.value))
	{
		str = "Recipient's Name must not have spaces, special characters at first position."
		alert(str);
		form.txtname2.focus();
		return false;
	}
	if(!isNaN(form.txtname2.value))
	{
		str = "Please enter valid Recipient name"
		alert(str);
		form.txtname2.focus();
		return false;
	}
	if(form.txtem2.value=="")
	{
       alert("Please Enter Recipient's Email-Id");
	   form.txtem2.focus();
	   return false
	 }
    if (checkEmail(form.txtem2.value)==false)
	{
		alert("Invalid E-mail Address! Please Re-enter.");
		form.txtem2.focus()
		return false   
     }
	 if(form.txtem1.value == form.txtem2.value)
			{
				str = "Sender and Recipient email addresses should not be the same";
				alert(str);
				form.txtconfirm.focus();
				return false;
			}
}

function validate_dispatch(form)
{
	if(form.order_no.value=="")
	{
       alert("Please select the order number");
	   form.order_no.focus();
	   return false
	}
	if(form.txtdispatchnumber.value=="")
	{
       alert("Please enter the dispatch number");
	   form.txtdispatchnumber.focus();
	   return false
	}
	if(validate_name_new(form.txtdispatchnumber.value))
	{
		str = "Dispatch number must not have spaces, special characters at first position."
		alert(str);
		form.txtdispatchnumber.focus();
		return false;
	}
}
function validate_profile(form)
{   

	if(form.vcharFirstname.value=="")
	{ 
		str = "Please enter firstname.";
		alert (str);
		form.vcharFirstname.focus();
		return false;
	}
	else if(trim(form.vcharFirstname.value)=="")
	  { 
	  str = "Please enter valid firstname.";
	  alert(str);
	  form.vcharFirstname.select()
	  return false;
	  }
	else if(textbox(form.vcharFirstname.value))
	{
		alert("Please enter valid firstname.");
		form.vcharFirstname.select();
		return false;
	}
   if(form.vcharLastname.value=="")
	{ 
		str = "Please enter lastname.";
		alert (str);
		form.vcharLastname.focus();
		return false;
	}
	else if(trim(form.vcharLastname.value)=="")
	  { 
	  str = "Please enter valid lastname.";
	  alert(str);
	  form.vcharLastname.select()
	  return false;
	  }
	else if(textbox(form.vcharLastname.value))
	{
		alert("Please enter valid lastname.");
		form.vcharLastname.select();
		return false;
	}
	// Address validation 
	if(form.vcharAddress.value=="")
	{
		str = "Please enter Address.";
		alert (str);
		form.vcharAddress.focus();
		return false;
	}
	else if(trim(form.vcharAddress.value)=="")
	  { 
	  str = "Please enter valid Address.";
	  alert(str);
	  form.vcharAddress.select()
	  return false;
	  }
	  
	// City validation
	if(form.vcharCity.value=="")
	{
		str = "Please enter City.";
		alert (str);
		form.vcharCity.focus();
		return false;
	}
	else if(trim(form.vcharCity.value)=="")
	  { 
	  str = "Please enter valid organization name.";
	  alert(str);
	  form.vcharCity.select()
	  return false;
	  }
	else if(textbox(form.vcharCity.value))
		{
		alert("Please enter valid organization name.");
		form.vcharCity.select();
		return false;
		}
	
	//State validation
	/*if(form.vcharState.value=="")
	{
		str = "Please enter State.";
		alert (str);
		form.vcharState.focus();
		return false;
	}
	else if(trim(form.vcharState.value)=="")
	  { 
	  str = "Please enter valid State.";
	  alert(str);
	  form.vcharState.select()
	  return false;
	  }
	else if(textbox(form.vcharState.value))
		{
		alert("Please enter valid State.");
		form.vcharState.select();
		return false;
		}*/
		
	// Zip validation
	if(form.vcharZip.value=="")
	{
		str = "Please enter zip code";
		alert (str);
		form.vcharZip.focus();
		return false;
	}
	if(isNaN(form.vcharZip.value))
	{
		str = "Zip code must contain only digits.";
		alert (str);
		form.vcharZip.focus();
		return false;
	}
	if(form.vcharZip.value.length < 5)
	{
		str = "Please enter atleast 5 digits for your zip code";
		alert (str);
		form.vcharZip.focus();
		return false;
	}
	if(form.vcharZip.value.length > 6)
	{
		str = "Zip code can be maximun 6 digits.";
		alert (str);
		form.vcharZip.focus();
		return false;
	}
	else if(trim(form.vcharZip.value)=="")
	  { 
	 // alert("form.txtname.value");
	  str = "Please enter valid Zip.";
	  alert(str);
	  form.vcharZip.select()
	  return false;
	  }

	//Country validation
	if(form.vcharCountry.value=="")
	{
		str = "Please select country.";
		alert (str);
		form.vcharCountry.focus();
		return false;
	}
	if(form.vcharPhone.value=="")
	{
		alert ("Please enter phone number.");
		form.vcharPhone.focus();
		return false;
	}
	if(checkPhone(form.vcharPhone.value))
	{
		alert("Phone number must contain only digits,-,(,).");
		form.vcharPhone.focus();
		return false;
	}
	if(form.vcharPhone.value.length <8)
	{
		alert("Phone number should be minimum 8 digits.");
		form.vcharPhone.focus();
		return false;
	}
	if(form.vcharPhone.value.length > 16)
	{
		alert("Phone number can be of maximun 16 digits.");
		form.vcharPhone.focus();
		return false;
	}
	 if(trim(form.vcharPhone.value)=="")
	  { 
	 // alert("form.txtname.value");
	  str = "Please enter valid Phone number.";
	  alert(str);
	  form.vcharPhone.select()
	  return false;
	  }
}

function validate_ship(form)
{
	if(form.country_code.value=="")
	{
		alert("Please select the country.");
		form.country_code.focus();
		return false;
	}
	if(form.txtbaserate.value=="")
	{
		alert("Please enter the Base rate.");
		form.txtbaserate.focus();
		return false;
	}
	if(isNaN(form.txtbaserate.value))
	{
		str = "Base rate must contain only digits.";
		alert(str);
		form.txtbaserate.focus();
		return false;
	}
	if(form.txtaddrate.value=="")
	{
		alert("Please enter the Additional rate.");
		form.txtaddrate.focus();
		return false;
	}
	if(isNaN(form.txtaddrate.value))
	{
		str = "Additional rate must contain only digits.";
		alert(str);
		form.txtaddrate.focus();
		return false;
	}
	if(form.txtwef.value=="")
	{
		alert("Please select the date.");
		form.txtwef.focus();
		return false;
	}
	
}
function validate_addtax(form)
{
	if(form.salestax.value=="")
	{
		alert("Please enter the tax.");
		form.salestax.focus();
		return false;
	}
	if(isNaN(form.salestax.value))
	{
		str = "Tax must contain only digits.";
		alert(str);
		form.salestax.focus();
		return false;
	}
	if(form.txtwef.value=="")
	{
		alert("Please select the date.");
		form.txtwef.focus();
		return false;
	}
	if(trim(form.txtwef.value)!="")
	{
		curdate = dtform(trim(form.current_date.value));
		from_dt = dtform(trim(form.txtwef.value));
		if(from_dt < curdate)
		{
			alert("With effect from date should not be less than current date");
			form.txtwef.focus()
			return false
		}
	}
}

