<!-- empty validation -->
function notEmpty(element, Msg){
	
	if(element.value.length == 0){
		alert(Msg);
		return false;
	}
	return true;
	
}

<!-- char validation -->
function alphaNumericCheck(theChar) {

	if ((theChar < 48) || (theChar > 122) || 
	   ((theChar > 57) && (theChar < 65)) || 
	   ((theChar > 90) && (theChar < 97))   ) {
		return false;
	} else {
		return true;
	}
}

<!-- canada post code validation -->
function isPostCode(entry){ // checks Canadian codes only
	strlen=entry.length; if (strlen!==7){return false;}
	entry=entry.toUpperCase();  // in case of lowercase
	// Check for legal characters in string - note index starts at zero
	if('ABCEGHJKLMNPRSTVXY'.indexOf(entry.charAt(0))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(1))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(2))<0) {return false;}
	if(' '.indexOf(entry.charAt(3))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(4))<0) {return false;}
	if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(5))<0) {return false;}
	if('0123456789'.indexOf(entry.charAt(6))<0) {return false;}
	return true;
}

<!-- USA pin code test -->
function isZip(s) 
{

     // Check for correct zip code
     reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

     if (!reZip.test(s)) {
          alert("Zip Code Is Not Valid");
          return false;
     }

return true;
}

<!-- numeric validation -->
function isNumeric(element, Msg){
	var numericExpression = /^[0-9]+$/;
		if(element.value.match(numericExpression)){
		    return true;
		}
		else{
			alert(Msg);
			return false;
		}
}

<!-- email validation -->
function emailValidator(element){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(element.value.match(emailExp)){
		return true;
	}
	else{
		return false;
	}
}

<!-- length restriction -->
function lengthRestriction(element, min, max){
	var uInput = element.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}
	else{
		//alert("Please enter exact number of value!");
		return false;
	}
}

<!-- selection validation -->
function madeSelection(element, Msg){
	if(element.value == "0"){
		alert(Msg);
		return false;
	}
	else{
		return true;
	}
}

//------------------- get key code --------------------
function getKeyCode(e){
		if (window.event)
			return window.event.keyCode;
		else if (e)
			return e.which;
		else
			return null;
}
//------------------- end of get key code -------------

//------------------- key restrict --------------------
function keyRestrict(e, validchars){
	    //alert('hi');
		var key='', keychar='';
		key = getKeyCode(e);
		if (key == null) return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		validchars = validchars.toLowerCase();
		if (validchars.indexOf(keychar) != -1)
			return true;
		if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
			return true;
		//alert("Plese enter a valid character.");
		return false;
}
//------------------ end of key restrict ----------------

//-------------- compare date ---------------------------
function compareDate(userDate){
	
	var length = userDate.length;
	var year = userDate.substring(0,4);
	var month = userDate.substring(5,7);
	var day = userDate.substring(8,10); 
	
	var currentTime = new Date();
	var year_c = currentTime.getFullYear();
	var month_c = currentTime.getMonth()+1;
	var day_c = currentTime.getDate();
	
	if(year_c>year){
		return false;
    }
	
	if(month_c>month){
		return false;
    }
	
	if(day_c>day){
		return false;
    }
	
	return true;

}
//-------------- end of compare date --------------------

//------------------- start of phone number -------------
function PhoneNumber(){
            // Declaring required variables
				var digits = "0123456789";
			// non-digit characters which are allowed in phone numbers
				var phoneNumberDelimiters = "()- ";
			// characters which are allowed in international phone numbers
			// (a leading + is OK)
				var validWorldPhoneChars = phoneNumberDelimiters + "+";
			// Minimum no of digits in an international phone no.
				var minDigitsInIPhoneNumber = 10;

			function isInteger(s){   
				var i;
				for (i = 0; i < s.length; i++)
				{   
					// Check that current character is number.
					var c = s.charAt(i);
					if (((c < "0") || (c > "9"))) return false;
				}
				// All characters are numbers.
				return true;
			}
			
			function trim(s){   
				var i;
				var returnString = "";
				// Search through string's characters one by one.
				// If character is not a whitespace, append to returnString.
				for (i = 0; i < s.length; i++)
				{   
					// Check that current character isn't whitespace.
					var c = s.charAt(i);
					if (c != " ") returnString += c;
				}
				return returnString;
			}
			
			function stripCharsInBag(s, bag){   
				var i;
				var returnString = "";
				// Search through string's characters one by one.
				// If character is not in bag, append to returnString.
				for (i = 0; i < s.length; i++)
				{   
					// Check that current character isn't whitespace.
					var c = s.charAt(i);
					if (bag.indexOf(c) == -1) returnString += c;
				}
				return returnString;
			}

			function checkInternationalPhone(strPhone){
				var bracket=3
				strPhone=trim(strPhone)
				if(strPhone.indexOf("+")>1) return false
				if(strPhone.indexOf("-")!=-1)bracket=bracket+1
				if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
				var brchr=strPhone.indexOf("(")
				if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
				if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
				s=stripCharsInBag(strPhone,validWorldPhoneChars);
				return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
			}
			
			function checkMobile(strPhone){
				strPhone=trim(strPhone)
				return (isInteger(strPhone) && strPhone.length >= minDigitsInIPhoneNumber);
			}	
}
//----------------------- end of phone validation ---------------------------------------------------


//-----------------------------------------------------------------------------------
function ValidateForm(){
    
	if(document.account.logid.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:2px;">Please enter user name!</div></center>';
	    window.location.href = '#section1';
		document.account.logid.focus();
		return false;
	}
	
	if(document.account.pswd.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter password!</div></center>';
	    window.location.href = '#section1';
		document.account.pswd.focus();
		return false;
	}
	
	
	if(lengthRestriction(document.account.pswd, 6, 16) == false){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Password should be greater than 6 characters!</div></center>';
	    window.location.href = '#section1';
		document.account.pswd.focus();
		return false;
	}
	
	if(document.account.pswdver.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter confirm password!</div></center>';
	    window.location.href = '#section1';
		document.account.pswdver.focus();
		return false;
	}
	
	if(document.account.pswd.value!=document.account.pswdver.value){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Password did not match!</div></center>';
	    window.location.href = '#section1';
		document.account.pswdver.value="";
		document.account.pswdver.focus();
		return false;
	}
	
	if(document.account.fname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter first name!</div></center>';
	    window.location.href = '#section1';
		document.account.fname.focus();
		return false;
	}
	
	if(document.account.lname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter last name!</div></center>';
	    window.location.href = '#section1';
		document.account.lname.focus();
		return false;
	}
	
	if(document.account.addr1.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter address1!</div></center>';
	    window.location.href = '#section1';
		document.account.addr1.focus();
		return false;
	}
	
	if(document.account.city.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter city!</div></center>';
	    window.location.href = '#section1';
		document.account.city.focus();
		return false;
	}
	
	if(document.account.county.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter county / state!</div></center>';
	    window.location.href = '#section1';
		document.account.county.focus();
		return false;
	}
	
	if(document.account.post.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter post code!</div></center>';
	    window.location.href = '#section1';
		document.account.post.focus();
		return false;
	}
	
	if(document.account.country.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter country!</div></center>';
	    window.location.href = '#section1';
		document.account.country.focus();
		return false;
	}
	
	if(document.account.phone.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter phone!</div></center>';
	    window.location.href = '#section1';
		document.account.phone.focus();
		return false;
	}
	
	if(document.account.email.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter email!</div></center>';
	    window.location.href = '#section1';
		document.account.email.focus();
		return false;
	}
	
	if(emailValidator(document.account.email)==false){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter valid email!</div></center>';
	    window.location.href = '#section1';
		document.account.email.value="";
		document.account.email.focus();
		return false;
	}	

}
//----------------------------------------------------------------------------------------------


//-----------------------------------------------------------------------------------
function ValidateFormUpdate(){
	
    if(document.account_update.logid.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:2px;">Please enter user name!</div></center>';
	    window.location.href = '#section1';
		document.account_update.logid.focus();
		return false;
	}
	
	if(document.account_update.fname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter first name!</div></center>';
	    window.location.href = '#section1';
		document.account_update.fname.focus();
		return false;
	}
	
	if(document.account_update.lname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter last name!</div></center>';
	    window.location.href = '#section1';
		document.account_update.lname.focus();
		return false;
	}
	
	if(document.account_update.addr1.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter address1!</div></center>';
	    window.location.href = '#section1';
		document.account_update.addr1.focus();
		return false;
	}
	
	if(document.account_update.city.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter city!</div></center>';
	    window.location.href = '#section1';
		document.account_update.city.focus();
		return false;
	}
	
	if(document.account_update.county.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter county / state!</div></center>';
	    window.location.href = '#section1';
		document.account_update.county.focus();
		return false;
	}
	
	if(document.account_update.post.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter post code!</div></center>';
	    window.location.href = '#section1';
		document.account_update.post.focus();
		return false;
	}
	
	if(document.account_update.country.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter country!</div></center>';
	    window.location.href = '#section1';
		document.account_update.country.focus();
		return false;
	}
	
	if(document.account_update.phone_number.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter phone!</div></center>';
	    window.location.href = '#section1';
		document.account_update.phone_number.focus();
		return false;
	}
	
	if(document.account_update.email.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter email!</div></center>';
	    window.location.href = '#section1';
		document.account_update.email.focus();
		return false;
	}
	
	if(emailValidator(document.account_update.email)==false){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter valid email!</div></center>';
	    window.location.href = '#section1';
		document.account_update.email.value="";
		document.account_update.email.focus();
		return false;
	}	
}
//----------------------------------------------------------------------------------------------



//-------------------- start of quote validation ------------------------------------------
function validQuote(){
	
	 if(document.quote.firstname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter first name!</div></center>';
	    window.location.href = '#section1';
		document.quote.firstname.focus();
		return false;
	}
	
	if(document.quote.lastname.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter last name!</div></center>';
	    window.location.href = '#section1';
		document.quote.lastname.focus();
		return false;
	}
	
	if(document.quote.address.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter address!</div></center>';
	    window.location.href = '#section1';
		document.quote.address.focus();
		return false;
	}
	
	if(document.quote.town.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter town/city!</div></center>';
	    window.location.href = '#section1';
		document.quote.town.focus();
		return false;
	}
	
	if(document.quote.postcode.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter postcode!</div></center>';
	    window.location.href = '#section1';
		document.quote.postcode.focus();
		return false;
	}
	
	if(document.quote.email.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter email!</div></center>';
	    window.location.href = '#section1';
		document.quote.email.focus();
		return false;
	}

	if(emailValidator(document.quote.email)==false){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter valid email!</div></center>';
	    window.location.href = '#section1';
		document.quote.email.value="";
		document.quote.email.focus();
		return false;
	}
	
	if(document.quote.telephone.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter telephone!</div></center>';
	    window.location.href = '#section1';
		//document.quote.telephone.focus();
		return false;
	}
	
	if(document.quote.country.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter country!</div></center>';
	    window.location.href = '#section1';
		document.quote.country.focus();
		return false;
	}
	
	if(document.quote.numrequired.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter total number required!</div></center>';
	    window.location.href = '#section1';
		document.quote.numrequired.focus();
		return false;
	}
	
	if(document.quote.size_S.value == "" && document.quote.size_M.value == "" && document.quote.size_L.value == "" && document.quote.size_XL.value == "" && document.quote.size_XXL.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter size required!</div></center>';
	    window.location.href = '#section1';
		document.quote.size_S.focus();
		return false;
	}
	
	if(document.quote.itemcolour.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please enter item color!</div></center>';
	    window.location.href = '#section1';
		document.quote.itemcolour.focus();
		return false;
	}
	
	if(document.quote.method.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please select method!</div></center>';
	    window.location.href = '#section1';
		document.quote.method.focus();
		return false;
	}
	
	if(document.quote.daterequired.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please select date!</div></center>';
	    window.location.href = '#section1';
		document.quote.daterequired.focus();
		return false;
	}
	
	if(compareDate(document.quote.daterequired.value) == false){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please select a date greater than present date!</div></center>';
	    window.location.href = '#section1';
		document.quote.daterequired.value="";
		document.quote.daterequired.focus();
		return false;
	}
	
	if(document.quote.logo.value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please upload a logo!</div></center>';
	    window.location.href = '#section1';
		//document.quote.logo.focus();
		return false;
	}
	
	if(document.quote.logo.value != ""){
		var str = document.quote.logo.value;
		//alert(str);
		var length = str.length;
		//alert(length);
		var file_extn = str.substring(length,length-3);
		var file_extn = file_extn.toLowerCase();
		//alert(file_extn);
		if(file_extn=='gif' || file_extn=='jpg' || file_extn=='png' ){
			//alert('ok');
			return true;
		}
		else{
			//alert('not ok');
			$j('div#msg').slideUp('slow');
			$j('div#msg').slideDown('slow');
			document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Please upload only GIF, JPG or PNG file!</div></center>';
			window.location.href = '#section1';
			//document.quote.logo.focus();
			document.quote.logo.value="";
			return false;
		}
	}
	
	return true;
}
//-------------------------- end of quote validation -----------------------------------------------------------

//-------- check total ----------------------
function CheckTotal(field,value){
var total = eval(document.quote.numrequired.value);
var s = document.quote.size_S.value;
var m = document.quote.size_M.value;
var l = document.quote.size_L.value;
var xl = document.quote.size_XL.value;
var xxl = document.quote.size_XXL.value;

	if(value=='1'){
		var tot = eval(s);
	}
	
	if(value=='2'){
		var tot = eval(s)+eval(m);
	}
	
	if(value=='3'){
		var tot = eval(s)+eval(m)+eval(l);
	}
	
	if(value=='4'){
		var tot = eval(s)+eval(m)+eval(l)+eval(xl);
	}
	
	if(value=='5'){
		var tot = eval(s)+eval(m)+eval(l)+eval(xl)+eval(xxl);
	}

	if(tot>total){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
		document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:10px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:10px; margin-top:3px;">Size value should not greater than total value!</div></center>';
	    window.location.href = '#section1';
 		return false;
	}
	else{
		$j('div#msg').slideUp('slow');
		return true;
	}
}
//------- end of check total ------------------------




function show_other(){
$j('div#other').slideDown('slow');	
}

function close_other(){
$j('div#other').slideUp('slow');	
}



//------------ address validatio-------------
function validate_address(){
	//alert('hi');
	var ret_b = 0;

	var ret_b = validate_address_details('','billing');
	if(ret_b == 0)
		return false;

	ret_b = 0;

	if(!document.getElementById('same').checked){
		ret_b = validate_address_details('s_','shipping');
		if(ret_b == 0)
			return false;
		else
			return true;
	}
	else
		return true;

}

function validate_address_details(prefix,err_msg){
	
    var cnt = -1;
	var radio_button = document.deliveryForm.delivery_method; 
    for (var i=radio_button.length-1; i > -1; i--){
        if (radio_button[i].checked){
			cnt = i; 
			i = -1;
		}
    }
	
    if (cnt == -1){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    window.location.href = '#section1';		
		document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please select a delivery method!</div></center>';
		return '0';
	}

	if(document.getElementById(prefix+'fname').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter first name for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'fname').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'lname').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter last name for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'lname').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'add1').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter address1 for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'add1').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'city').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter city for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'city').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'postcode').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter post code for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'postcode').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'country').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter country for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'country').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'phone_val').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter phone for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'phone_val').focus();
		return '0';
	}
	
	if(document.getElementById(prefix+'email').value == ""){
		$j('div#msg').slideUp('slow');
	    $j('div#msg').slideDown('slow');
	    document.getElementById('msg').innerHTML = '<center><div style="float:left; margin-left:0px;"><img src="images/front/chkout_error.gif">&nbsp;</div><div style="float:left; margin-left:2px; margin-top:3px;">Please enter email for '+err_msg+' address!</div></center>';
	    window.location.href = '#section1';
		//document.getElementById(prefix+'email').focus();
		return '0';
	}
	
	return '1';
	
}
//------------ end of address validation ----


//--------------- download --------------------
function download(){
	
	document.getElementById('error_div').style.display = 'none';
	
	var no_of_download = document.getElementById('no_of_download').value;
	var check          = '0';
	
	for(l=1; l<=no_of_download; l++){
		var field_name = 'chk_'+l;
		if(document.getElementById(field_name).checked){
			check = '1';	
		}	
	}
	
	if(check == '0'){
		document.getElementById('error_div').style.display = 'block';
		document.getElementById('error_div').innerHTML = 'Please select a flie!<br />';
	    window.location.href = '#section1';
		return false;
	}
	
	if(document.getElementById('email').value==''){
		document.getElementById('error_div').style.display = 'block';
		document.getElementById('error_div').innerHTML = 'Please enter your email address!<br />';
	    window.location.href = '#section1';
		return false;
	}
	
	if(emailValidator(document.getElementById('email'))==false){
		document.getElementById('error_div').style.display = 'block';
		document.getElementById('error_div').innerHTML = 'Please enter a valid email address!';
	    window.location.href = '#section1';
		return false;
	}
	
	return true;
	
}
//---------------------------------------------

//---------------------------------------------
function ValidForget(){
		
	document.getElementById('msg').innerHTML = '';	
	
	if(document.getElementById('email').value==''){
		document.getElementById('msg').innerHTML = 'Please enter your Email ID.';
		return false;
	}
	
	if(emailValidator(document.getElementById('email'))==false){
		document.getElementById('msg').innerHTML = 'Please enter valid Email ID.';
		return false;
	}
	
	return true;
	
}

function ValidData(){
	
	document.getElementById('msg').innerHTML = '';	
	
	if(document.getElementById('User_name').value==''){
		document.getElementById('msg').innerHTML = 'Please write user name!';
		return false;
	}
	
	if(document.getElementById('password').value==''){
		document.getElementById('msg').innerHTML = 'Please write password!';
		return false;
	}
	
	return true;
	
}
//---------------------------------------------
