// JavaScript Document
<!-- Validates the form
	
	//-->

<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

//validation for more_sample starts 

function moresample()
  {
  	var color_flag=0;
  	var items = new Array();
  	var label = new Array();
  	var merror;
   	premail = document.frmmoresample.txtemail.value;
  	
  		
  	merror = "<span style='padding-left:50px'> Your information is incomplete or incorrect.\n</span>";
  	merror = merror.concat("<br>");
  	merror += "<span style='padding-left:50px'>Please correct the fields below and try again.\n\n</span>";
  	merror = merror.concat("<br><br>");
  	items[0] = "txtname";
  	items[1] = "txtlast";
  	items[2] = "txtemail";
   	items[3] = "txtcompany";
  	
  	
  	label[0]="samplefn";
  	label[1]="sampleln";
   	label[2]="sampleem";
	label[3]="samplecmp";
	
	
	
  	for (i=0; i<items.length; i++)
  	{
   	if(document.getElementById(items[i]).value != "")
  	 {
  	 document.getElementById(label[i]).style.color = "black";
  	 }	
  	 else
  	 {
     var str = document.getElementById(label[i]).innerHTML;
     var newStr = str.substring(0, str.length-1);
     merror = merror + "<span style='padding-left:50px'>";  
     merror = merror+newStr;
  	 merror = merror.concat("<br>");
  	 document.getElementById(label[i]).style.color = "red";
  	 color_flag = 1;
   	 }
   	}
   	
   	if((document.frmmoresample.txtemail.value) !=""){
		if(echecknew(premail,'frmmoresample')==false) {
			merror = merror.concat("<br><span style='padding-left:50px'>");
			merror += "Invalid email address";
			document.getElementById('sampleem').style.color = "red";
			color_flag = 1;
		}  else {
			document.getElementById('sampleem').style.color = "black";
		}
	}
	if ((document.frmmoresample.txtphone.value) != "")
	{
	 if (isAlphabet(document.frmmoresample.txtphone.value) == true) {
	 	 merror = merror.concat("<br><span style='padding-left:50px'>");
     	 merror = merror + "Telephone should be numeric";
    	 document.getElementById('sampleph').style.color = "red";
		 color_flag = 1;
	 }  else {
			document.getElementById('sampleph').style.color = "black";
	 }
	}
  
	
   	
	if (color_flag != 0)  {
  		document.getElementById("sampleerror").style.display="block";
		document.getElementById("sampleerror").innerHTML=merror;
		return false;
	   }
	    else
	   {
	    return true;
		document.frmmoresample.submit();
		
	 }
  	
   	
  }
  
 //validation for more_sample ends 
 function creditcard()
  {
  	var color_flag=0;
  	var items = new Array();
  	var label = new Array();
  	var cerror;
   	premail = document.frmcreditcard.txtpremail.value;
  	secmail = document.frmcreditcard.txtsecmail.value;
  	
  	cerror = "<span style='padding-left:50px;'> Your information is incomplete or incorrect.\n</span>";
  	cerror = cerror.concat("<br>");
  	cerror += "<span style='padding-left:50px;'>Please correct the fields below and try again.\n\n</span>";
  	cerror = cerror.concat("<br><br>");
  	items[0] = "txtname";
  	items[1] = "txtlast";
  	items[2] = "txtdesignation";
  	items[3] = "txtpremail";
  	items[4] = "txtphone";
  	items[5] = "txtcompany";
  	items[6] = "txtcountry";
  	items[7] = "txtaddress";
  	
  	label[0]="creditfn";
  	label[1]="creditln";
  	label[2]="creditdn";
  	label[3]="creditem";
	label[4]="creditph";
	label[5]="creditcmp";
	label[6]="creditcou";
	label[7]="creditad";
	
	
  	for (i=0; i<items.length; i++)
  	{
   	if(document.getElementById(items[i]).value != "")
  	 {
  	 document.getElementById(label[i]).style.color = "black";
  	 }	
  	 else
  	 {
     var str = document.getElementById(label[i]).innerHTML;
     var newStr = str.substring(0, str.length-1);
     cerror = cerror + "<span style='padding-left:50px'>";  
     cerror = cerror+newStr;
  	 cerror = cerror.concat("<br>");
  	 document.getElementById(label[i]).style.color = "red";
  	 color_flag = 1;
   	 }
   	}
   	
   	if((document.frmcreditcard.txtpremail.value) !=""){
		if(echecknew(premail,'frmcreditcard')==false) {
		cerror = cerror.concat("<br><span style='padding-left:50px'>");
		cerror += "Invalid primary email address";
		document.getElementById('creditem').style.color = "red";
		color_flag = 1
	}  else {
		document.getElementById('creditem').style.color = "black";
		}
	}
	
	
	if((document.frmcreditcard.txtsecmail.value) !=""){
		if(echecknew(secmail,'frmcreditcard')==false) {
		cerror = cerror.concat("<br><span style='padding-left:50px'>");
		cerror += "Invalid secondary email address";
		document.getElementById('creditsem').style.color = "red";
		color_flag = 1
	}  else {
		document.getElementById('creditsem').style.color = "black";
	}
	}
   	if ((document.frmcreditcard.txtphone.value) != "")
	{
	 if (isAlphabet(document.frmcreditcard.txtphone.value) == true) {
	 	 cerror = cerror.concat("<br><span style='padding-left:50px'>");
     	 cerror = cerror + "Telephone should be numeric";
    	 document.getElementById('creditph').style.color = "red";
		 color_flag = 1
	 }  else {
			document.getElementById('creditph').style.color = "black";
	 }
	}
  
	
  	if (color_flag != 0)  {
  		 
  		 if (document.frmcreditcard.checkbox.checked == true) 
	    		document.getElementById("creditterms").style.color = "black";
  		   		document.getElementById("crediterror").style.display="block";
		        document.getElementById("crediterror").innerHTML=cerror;
		        return false;
	 	       
	   }
	    else
	   {
	  
	    if (document.frmcreditcard.checkbox.checked == true) {
	      document.getElementById("creditterms").style.color = "black";
		  return true;
		  document.frmcreditcard.submit();
		} else 	{
		
		cerror = "<span style='padding-left:50px'>Please read the terms and conditions and check the box";
		cerror=cerror.concat("<br><br><br>");
		document.getElementById("crediterror").style.display="block";
		document.getElementById("crediterror").innerHTML=cerror;
		document.getElementById("creditterms").style.color = "red";
		
		return false;
		}
	 }
  }
 //validation for form_creditcard ends
 
 
 //validation for form_banktransfer starts
 function banktransfer()
  {
  	
  	var color_flag=0,rdflag = 0;
  	var items = new Array();
  	var label = new Array();
  	var error;
  	len = document.frmbanktransfer.radio.length;
  	premail = document.frmbanktransfer.txtpremail.value;
  	secmail = document.frmbanktransfer.txtsecmail.value;
  	
  	error = "<span style='padding-left:50px'> Your information is incomplete or incorrect.\n</span>";
  	error = error.concat("<br>");
  	error += "<span style='padding-left:50px'>Please correct the fields below and try again.\n\n</span>";
  	error = error.concat("<br><br>");
  	items[0] = "txtname";
  	items[1] = "txtlastname";
  	items[2] = "txtdesignation";
  	items[3] = "txtpremail";
  	items[4] = "txtphone";
  	items[5] = "txtcompany";
  	items[6] = "txtcountry";
  	items[7] = "txtaddress";
  	
  	label[0]="bankfn";
  	label[1]="bankln";
  	label[2]="bankdn";
  	label[3]="bankem";
	label[4]="bankph";
	label[5]="bankcmp";
	label[6]="bankcou";
	label[7]="bankad";
	
	
  	for (i=0; i<items.length; i++)
  	{
   	if(document.getElementById(items[i]).value != "")
  	 {
  	 document.getElementById(label[i]).style.color = "black";
  	 }	
  	 else
  	 {
     var str = document.getElementById(label[i]).innerHTML;
     var newStr = str.substring(0, str.length-1);
     error = error + "<span style='padding-left:50px'>";  
     error = error+newStr;
  	 error = error.concat("<br>");
  	 document.getElementById(label[i]).style.color = "red";
  	 color_flag = 1;
   	 }
   	}
  
   	//for checkbox
  	for (l = 0;l < len ;l++) {
   		if (document.frmbanktransfer.radio[l].checked == false) {
	 		rdflag = 1;
	 	} else {
	  		rdflag = 0;
	  		break;
	  	}
	 }
	 if (rdflag == 1) {
	 	error = error + "<span style='padding-left:50px'>"; 
		error +=  "Currency";
		document.getElementById('bankcur').style.color = "red";
	} else {
		document.getElementById('bankcur').style.color = "black";
	}
	
	
	//for email
	if((document.frmbanktransfer.txtpremail.value) !=""){
		if(echecknew(premail,'frmbanktransfer')==false) {
		error = error.concat("<br><span style='padding-left:50px'>");
		error += "Invalid primary email address";
		document.getElementById('bankem').style.color = "red";
		color_flag = 1
	}  else {
		document.getElementById('bankem').style.color = "black";
	}
	}
	
	
	if((document.frmbanktransfer.txtsecmail.value) !=""){
		if(echecknew(secmail,'frmbanktransfer')==false) {
		error = error.concat("<br><span style='padding-left:50px'>");
		error += "Invalid secondary email address";
		document.getElementById('banksem').style.color = "red";
		color_flag = 1
	}  else {
		document.getElementById('banksem').style.color = "black";
	}
	}
	
	if ((document.frmbanktransfer.txtphone.value) != "")
	{
	 if (isAlphabet(document.frmbanktransfer.txtphone.value) == true) {
	 	 error = error.concat("<br><span style='padding-left:50px'>");
     	 error = error + "Telephone should be numeric";
    	 document.getElementById('bankph').style.color = "red";
		 color_flag = 1
	 }  else {
			document.getElementById('bankph').style.color = "black";
	 }
	}
	
  	if ((color_flag != 0) || (rdflag == 1) ) {
  		document.getElementById("bankerror").style.display="block";
  			if (document.frmbanktransfer.checkbox.checked == true) 
	    		document.getElementById("bankterms").style.color = "black";
  			    document.getElementById("bankerror").innerHTML=error;
		        return false;
	   }
	    else
	   {
	    if (document.frmbanktransfer.checkbox.checked == true) {
	    	document.getElementById("bankterms").style.color = "black";
		return true;
		document.frmbanktransfer.submit();
		} else 	{
		error = "<span style='padding-left:50px'>Please read the terms and conditions and check the box";
		error=error.concat("<br><br><br>");
		document.getElementById("bankerror").style.display="block";
		document.getElementById("bankerror").innerHTML=error;
		document.getElementById("bankterms").style.color = "red";
		
		return false;
		}
	}
  	  
 }
 //validation for form_banktransfer ends
 
 
<!-- Form validation for Kovent_contact.php Ends -->
// *** Email validation display in textbox ***
	function echecknew(str,frm) {
		dml=document.forms[frm];
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid email address")
		   //dml.txtdisplay.value="Invalid email address..";
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || 
str.indexOf(at)==lstr){
		  // alert("Invalid email address")
		   //dml.txtdisplay.value="Invalid email address..";
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || 
str.indexOf(dot)==lstr){
		   //alert("Invalid email address")
		    //dml.txtdisplay.value="Invalid email address..";
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   // alert("Invalid email address")
		   //dml.txtdisplay.value="Invalid email address..";
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || 
str.substring(lat+1,lat+2)==dot){
		  //alert("Invalid email address")
		    //dml.txtdisplay.value="Invalid email address..";
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   // alert("Invalid email address")
		   //dml.txtdisplay.value="Invalid email address..";
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		  //  alert("Invalid email address")
		   //dml.txtdisplay.value="Invalid email address..";
		    return false
		 }

 		 return true					
	}
//*****************email validation end

//trim blankspace validation
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
//trim blankspace validation ends

// Numeric check for price details 
function isNumericKey(e)
{
var k = document.all ? e.keyCode : e.which;
return ((k > 47 && k < 58) || k == 8 || k == 0);
}
function isNumeric(n){
	if (isNaN(n) == true)
	return false;
	else
	return true;
}

/*changes made by vally starts here */

 
function about_us()
  {
  	var color_flag=0;
  	var items = new Array();
  	var label = new Array();
  	var merror;
   	
  		
  	merror = "<span style='padding-left:50px'> Your information is incomplete or incorrect.\n</span>";
  	merror = merror.concat("<br>");
  	merror += "<span style='padding-left:50px'>Please correct the fields below and try again.\n\n</span>";
  	merror = merror.concat("<br><br>");
  	items[0] = "txtname";
  	items[1] = "txtlast";
  	items[2] = "txtdesig";
  	items[3] = "txtemail";
  	items[4] = "txtphone";
   	items[5] = "txtcompany";
   	items[6] = "txtcountry";
    	
  	label[0]="aboutfn";
  	label[1]="aboutln";
  	label[2]="aboutdn"
   	label[3]="aboutem";
	label[4]="aboutph";
	label[5]="aboutcmp";
	label[6]="aboutcou";
		
  	for (i=0; i<items.length; i++)
  	{
   	if(document.getElementById(items[i]).value != "")
  	 {
  	 document.getElementById(label[i]).style.color = "black";
  	 }	
  	 else
  	 {
     var str = document.getElementById(label[i]).innerHTML;
     var newStr = str.substring(0, str.length-1);
     merror = merror + "<span style='padding-left:50px'>";  
     merror = merror+newStr;
  	 merror = merror.concat("<br>");
  	 document.getElementById(label[i]).style.color = "red";
  	 color_flag = 1;
   	 }
   	}
   	if((document.aboutus.txtemail.value) !=""){
		if(echecknew(document.aboutus.txtemail.value,'aboutus')==false) {
			merror = merror.concat("<span style='padding-left:50px'>");
			merror += "Invalid email address";
			document.getElementById('aboutem').style.color = "red";
			color_flag = 1
		}  else {
			document.getElementById('aboutem').style.color = "black";
		}
	}
	
	if ((document.aboutus.txtphone.value) != "")
	{
	 if (isAlphabet(document.aboutus.txtphone.value) == true) {
	 	merror = merror.concat("<br><span style='padding-left:50px'>");
     	 merror = merror + "Telephone should be numeric";
    	 document.getElementById('aboutph').style.color = "red";
		 color_flag = 1
	 }  else {
			document.getElementById('aboutph').style.color = "black";
	 }
	}
   	if (color_flag != 0)  {
  		document.getElementById("aboutuserror").style.display="block";
		document.getElementById("aboutuserror").innerHTML=merror;
		return false;
	   }
	    else
	   {
	    return true;
		document.aboutus.submit();
		
	
	}
  	
} //function about_us ends here
    
   
  

function isAlphabet(strString)
  {
  	
   var strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   var strChar;
   var phoneflag =0;
   for (i = 0; i < strString.length && phoneflag==0; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) != -1)
         {
           phoneflag = 1;
           break;
        }
     }
    
      if (phoneflag == 1) {
       	return true;
      
      }
      else {
         return false;
      }
 }


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
