function doVerifyCode(frmID,elementID,Values,ContactVerificationCodeDisplay)	{
	if($(elementID).value==''){
		$(elementID).className='txtred';
		$(Values).innerHTML='<font color="#ffffff">verification code required </font>';
	}else{
		$(Values).innerHTML='<span><img src="imgs/loading.gif" border="0" /></span>';
		var success = function(t){ VerifycodeSucess(t, Values,elementID,ContactVerificationCodeDisplay);}
		var failure = function(t){ editFailed(t, Values,Display);}
		var pars = 'ajaxaction=CheckVerifyCode&VerifyCode='+document.getElementById(elementID).value;
		var url     =  'ajax/quoteajax.php';
		var myAjax  = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}
}
function VerifycodeSucess(t, Values,elementID,ContactVerificationCodeDisplay){
	var checkresult = t.responseText;
	//alert(t.responseText);
	document.getElementById(ContactVerificationCodeDisplay).value= t.responseText;
	if(checkresult==0){
		document.getElementById(elementID).className='txtred';
		document.getElementById(Values).innerHTML = '<font color="#ffffff">verification code mismatch </font>';
	}else
		document.getElementById(Values).innerHTML = '<font color="#ffffff">Correct</font>';
}
function doValidateContactUs(obj){
	var NoError = true;
	if(!doCheckwhiteFormField(document.getElementById('contactus_clienttname'),"TextBox",'Text','Yes','name'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('contactus_clienttemail'),"TextBox",'Email','Yes','email'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('contactus_description'),"TextBox",'Text','Yes','description'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('contactus_verificationcode'),"TextBox",'','Yes','verificationcode'))NoError = false;
	if(document.getElementById('contactus_verificationcodehiddenvalue').value == 0){
	 	if(document.getElementById('contactus_verificationcode').value !=""){
		 	$('contactus_verificationcode_imgError').innerHTML='<font color="#ffffff" style="font-weight:bold; font-size:10px">'+" verification code mismatch."+'<font>';
			NoError = false;}
	}
	if(NoError)
		document.contactus.submit();
}
function doValidateLogin(obj){
	var NoError = true;
	if(!doCheckwhiteFormField(document.getElementById('login_emailaddress'),"TextBox",'Email','Yes','Email Address'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('login_password'),"TextBox",'Text','Yes','Password'))NoError = false;
	if(NoError)
		document.login.submit();
}
function doValidateForgetPassword(obj){
	var NoError = true;
	if(!doCheckwhiteFormField(document.getElementById('forget_password_emailaddress'),"TextBox",'Email','Yes','Email Address'))NoError = false;
	if(NoError)
		document.forget_password.submit();
}


function checkpassword(passWord1,passWord2) {
	var NoError = true;
	if(passWord1!=''){
		if(passWord1.length < 6){
			$('changepassword_newpassword_imgError').innerHTML='<font color="#ffffff">Password length must be atleast 6 characters</font>';
			$('changepassword_newpassword').className='txtred';
			NoError = false;
		}else{
			if(passWord1 == passWord2){
				$('changepassword_retypepassword_imgError').innerHTML='<font color="#ffffff">correct </font>';
				NoError = true;
			}else{ 
				$('changepassword_retypepassword_imgError').innerHTML='<font color="#ffffff">password mismatch </font>';
				$('changepassword_retypepassword').className='txtred';
				//$('changepassword_newpassword').className='txtred';
				NoError = false;
			 }
			 return NoError;
		}
	}
}
function doValidatePassword(){
	var NoError = true;
	if(!doCheckwhiteFormField(document.getElementById('changepassword_oldpassword'),"TextBox",'Text','Yes','old password'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('changepassword_newpassword'),"TextBox",'Text','Yes','new password'))NoError = false;
	if(!doCheckwhiteFormField(document.getElementById('changepassword_retypepassword'),"TextBox",'Text','Yes','retype password'))NoError = false;
	NoError = checkpassword(document.getElementById('changepassword_newpassword').value,document.getElementById('changepassword_retypepassword').value);
	if(NoError)
		document.changepassword.submit();
}


function KeyEnter_DoAction(fldName,evt,formname) {
		evt = (evt) ? evt : window.event;
		if (evt.keyCode == 13 ) {
			if(formname=="form_login") { 
				doValidateLogin('login');
			}
			return false;
		} else {
			return true;
		}
	}
function SearchAction()	{
	if($('searchvalue').value!=''){
			var form_name	=	document.searchfrm;
			var textvalue	=	$('searchvalue').value;
			var textvalues	=	textvalue.split(' ');
			var strvalue	=	"";
			for(i=0;i<textvalues.length;i++)	{
				if(strvalue=="")
					strvalue	=	textvalues[0];
				else
					strvalue	=	strvalue+'+'+textvalues[i];
			}
		/*	if(ModRewrite=='Yes')
				form_name.action	=	SiteGlobalPath+"search/"+strvalue;
			else*/
				form_name.action	=	SiteGlobalPath+"search&query="+strvalue;
			form_name.submit();
	}else{
		alert("Enter Search Value");
		$('searchvalue').focus();
		return false;
	}
}

function doValidateForCheckout(obj){
	if(document.getElementById('payment_credit').checked == true){
		var NoError = true;
		if(!doCheckFormField(document.getElementById('payment_firstname'),"TextBox",'Text','Yes','First Name'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_lastname'),"TextBox",'Text','Yes','Last Name'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_address'),"TextBox",'Text','Yes','Address'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_city'),"TextBox",'Text','Yes','City'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_state'),"TextBox",'Text','Yes','State'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_zipcode'),"TextBox",'Numeric','Yes','Zipcode'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_country'),"TextBox",'Text','Yes','Country'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_emailaddress'),"TextBox",'Email','Yes','Email Address'))NoError = false;
		
		if(!doCheckFormField(document.getElementById('payment_creditcardusername'),"TextBox",'Text','Yes','Name on credit card'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_creditcardnumber'),"TextBox",'Text','Yes','Credit card number'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_cardtype'),"TextBox",'Select','Yes','Credit card type'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_expiremonth'),"TextBox",'Select','Yes','Expire month'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_expireyear'),"TextBox",'Select','Yes','Expire year'))NoError = false;
		if(!doCheckFormField(document.getElementById('payment_cvvcode'),"TextBox",'Numeric','Yes','CVV code'))NoError = false;
		if(NoError){
			document.choosepayment.action ="payment.php";
			document.choosepayment.submit();
		}
	}else{
		alert("Please choose the payment type");
		document.getElementById('payment_credit').focus();
		return false;
	}
}

