﻿// JScript File
function customer()
{

var v=false;
var Ccompany_name=document.getElementById("txtCcompanyname");
var Cbrokeer=document.getElementById("txtCyourbroker");
var Cbusinesstype=document.getElementById("ddlCbusinesstype");
var Cname=document.getElementById("txtCname");
var Cdesignation=document.getElementById("txtCdesignation");
var Cadd=document.getElementById("txtCaddress");
var Ccity=document.getElementById("txtCcity");
var Cstate=document.getElementById("txtCstate");
var Ccountry=document.getElementById("ddlCcountry");
var Cpin=document.getElementById("txtCpin");
var Ccountrycode1=document.getElementById("txtCcountrycode1");
var Carea1=document.getElementById("txtCareacode1");
var Ctel1=document.getElementById("txtCtelephone1");
var Ccountrycode2=document.getElementById("txtCcountrycode2");
var Careacode2=document.getElementById("txtCareacode2");
var Ctelephone2=document.getElementById("txtCtelephone2");
var Cfaxcountrycode=document.getElementById("txtCfaxcountrycode");
var Cfaxarea=document.getElementById("txtCfaxareacode");
var Cfaxtelephone=document.getElementById("txtCfaxtelephone");
var Cgsm=document.getElementById("txtCgsm");
var Cemail=document.getElementById("txtCemail");
//General details
var member=document.getElementById("txtCmember");
var comments=document.getElementById("txtCcomments");
var cutfrom=document.getElementById("ddlcutfrom");
var cutto=document.getElementById("ddlcutto");
var colorfrom=document.getElementById("ddlcolorfrom");
var colorto=document.getElementById("ddlcolorto");
var clarityfrom=document.getElementById("ddlclarityfrom");
var clarityto=document.getElementById("ddlclarityto");
var caratfrom=document.getElementById("txtcaratfrom");
var caratto=document.getElementById("txtcaratto");
//Shipping Details
var Sname=document.getElementById("txtSname");
var Sdesignation=document.getElementById("txtSdesignation");
var Sadd=document.getElementById("txtSaddress");
var Scity=document.getElementById("txtScity");
var Sstate=document.getElementById("txtSstate");
var Scountry=document.getElementById("ddlScountry");
var Spin=document.getElementById("txtSpin");
var Scountrycode1=document.getElementById("txtScountrycode1");
var Sarea1=document.getElementById("txtSareacode1");
var Stel1=document.getElementById("txtStelephone1");
var Scountrycode2=document.getElementById("txtScountrycode2");
var Sarea2=document.getElementById("txtSareacode2");
var Stel2=document.getElementById("txtStelephone2");
var Sfaxcountry=document.getElementById("txtSfaxcountrycode");
var Sfaxarea=document.getElementById("txtSfaxareacode");
var Stelephone=document.getElementById("txtSfaxtelephone");
var Sgsm=document.getElementById("txtSgsm");
//Trade References
//References1
var RCompany1=document.getElementById("txtRcompanyname1");
var Rcontact1=document.getElementById("txtRcontact1");
var Rcountrycode1=document.getElementById("txtRcountrycode1");
var Rarea1=document.getElementById("txtRareacode1");
var Rtel1=document.getElementById("txtRtelephone1");
var Rgsm1=document.getElementById("txtRgsm1");
//References2
var RCompany2=document.getElementById("txtRcompanyname2");
var Rcontact2=document.getElementById("txtRcontact2");
var Rcountrycode2=document.getElementById("txtRcountrycode2");
var Rarea2=document.getElementById("txtRareacode2");
var Rtel2=document.getElementById("txtRtelephone2");
var Rgsm2=document.getElementById("txtRgsm2");
//Login details
var login=document.getElementById("txtloginname");
var password=document.getElementById("txtpassword");
var confirmpass=document.getElementById("txtconfirmpass");
if(Ccompany_name.value=="")
{
alert('Please enter the Company name');
Ccompany_name.focus();
}
else if(Cbusinesstype.value=="0")
{
alert('Please enter the Type of Business');
Cbusinesstype.focus();
}
else if(Cname.value=="")
{
alert('Please enter the Name');
Cname.focus();
}
else if(!(isNaN(Cname.value)))
{
alert('Please enter the only Character value in Name');
Cname.focus();
}
else if(Cdesignation.value=="")
{
alert('Please enter the Designation');
Cdesignation.focus();
}
else if(Cadd.value=="")
{
alert('Please enter the address');
Cadd.focus();
}
else if(Ccity.value=="")
{
alert('Please enter the City');
Ccity.focus();
}
else if(Cstate.value=="")
{
alert('Please enter the State');
Cstate.focus();
}
else if(Ccountry.value=="")
{
alert('Please select the Country');
Ccountry.focus();
}
else if(Cpin.value=="")
{
alert('Please enter the pin code no.');
Cpin.focus();
}
else if(isNaN(Cpin.value))
{
alert('Please enter the numeric value in pin code no.');
Cpin.focus();
}


else if(Ccountrycode1.value=="")//else if(isNaN(Ccountrycode1.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the country code');
  Ccountrycode1.focus();
}	
else if(isNaN(Ccountrycode1.value))//else if(isNaN(Ccountrycode1.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in country code ');
  Ccountrycode1.focus();
}	
else if(Carea1.value=="")//isNaN(this.split(",").join(""));}
{
  alert('Please enter the area code in telephone 1 ');
  Carea1.focus();
}	
else if(isNaN(Carea1.value))
{
alert('Please enter the numeric value in area code no.');
Carea1.focus();
}
else if(Ctel1.value=="")
{
  alert('Please enter the telephone no.');
  Ctel1.focus();
}	
else if(isNaN(Ctel1.value))
{
alert('Please enter the numeric value in telephone no.');
Ctel1.focus();
}
	

else if(Cgsm.value=="")
{
  alert('Please enter the GSM no.');
  Cgsm.focus();
}	
else if(isNaN(Cgsm.value))
{
  alert('Please enter the numeric value in GSM no.');
  Cgsm.focus();
}	
else if(Cemail.value=="")
{
  alert('Please enter the Email address.');
  Cemail.focus();
}	
else if(!isValidEmail(Cemail.value))
{
 alert('Please enter the proper Email address.');
  Cemail.focus();
}	
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//*********************//General details
else if(member.value=="")
{
alert('Please enter the member of association');
member.focus();
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//**************Shipping Details
	
else if(document.getElementById("ChkShipping").checked==false)

{
if(Sname.value=="")
{
alert('Please enter the Name');
Sname.focus();
//return false;
}
else if(!(isNaN(Sname.value)))
{
alert('Please enter the only Character value in Name');
Sname.focus();
}
else if(Sdesignation.value=="")
{
alert('Please enter the Designation');
Sdesignation.focus();
}
else if(Sadd.value=="")
{
alert('Please enter the address');
Sadd.focus();
}
else if(Scity.value=="")
{
alert('Please enter the City');
Scity.focus();
}
else if(Sstate.value=="")
{
alert('Please enter the State');
Sstate.focus();
}
else if(Scountry.value=="")
{
alert('Please select the Country');
Scountry.focus();
}
else if(Spin.value=="")
{
alert('Please enter the pin code no.');
Spin.focus();
}
else if(isNaN(Spin.value))
{
alert('Please enter the numeric value in pin code no.');
Spin.focus();
}



else if(Scountrycode1.value=="")//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the country code ');
  Scountrycode1.focus();
}
else if(isNaN(Scountrycode1.value))//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in country code ');
  Scountrycode1.focus();
}
else if(Sarea1.value=="")//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the area code ');
  Sarea1.focus();
}
else if(isNaN(Sarea1.value))//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in area code ');
  Sarea1.focus();
}
else if(Stel1.value=="")//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the Telephone no. ');
  Stel1.focus();
}
else if(isNaN(Stel1.value))//else if(isNaN(Scountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in Telephone no. ');
  Stel1.focus();
}



else if(Sfaxcountry.value=="")//(isNaN(Sfaxcountry.value.split(",").join("+")))//isNaN(this.split(",").join(""));}----------
{
  alert('Please enter the fax country code ');
  Sfaxcountry.focus();
}	
else if(isNaN(Sfaxcountry.value))
{
alert('Please enter the numeric value in faxcountry code');
Sfaxcountry.focus();
}	
else if(Sfaxarea.value=="")//isNaN(this.split(",").join(""));}
{
  alert('Please enter the fax area code  ');
  Sfaxarea.focus();
}	
else if(isNaN(Sfaxarea.value))
{
alert('Please enter the numeric value in faxarea code no.');
Sfaxarea.focus();
}
else if(Stelephone.value=="")//isNaN(this.split(",").join(""));}
{
  alert('Please enter the fax Telephone no.  ');
  Stelephone.focus();
}	
else if(isNaN(Stelephone.value))
{
alert('Please enter the numeric value in fax Telephone no.');
Stelephone.focus();
}


else if(Sgsm.value=="")
{
  alert('Please enter the GSM no.');
  Sgsm.focus();
}
else if(isNaN(Sgsm.value))
{
alert('Please enter the numeric value in GSM no.');
Sgsm.focus();
}
}	
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//*********************////Trade References
else if(RCompany1.value=="")
{
alert('Please enter the company name');
RCompany1.focus();
}
else if(Rcontact1.value=="")
{
alert('Please enter the contact person name');
Rcontact1.focus();
}
else if(Rcontact1.value=="")
{
alert('Please enter the contact person name');
Rcontact1.focus();
}



else if(Rcountrycode1.value=="")//(isNaN(Scountrycode1.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
alert('Please enter the country code ');
 
  Rcountrycode1.focus();
}
else if(isNaN(Rcountrycode1.value))//else if(isNaN(Ccountrycode1.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in country code ');
  Rcountrycode1.focus();
}
else if(Rarea1.value=="")//isNaN(this.split(",").join(""));}
{
  alert('Please enter the area code  ');
  Rarea1.focus();
}	
else if(isNaN(Rarea1.value))
{
alert('Please enter the numeric value in area code no.');
Rarea1.focus();
}
else if(Rtel1.value=="")
{
  alert('Please enter the telephone no.');
  Rtel1.focus();
}	
else if(isNaN(Rtel1.value))
{
alert('Please enter the numeric value in telephone no.');
Rtel1.focus();
}

else if(Rgsm1.value=="")
{
  alert('Please enter the  GSM  no.');
  Rgsm1.focus();
}	
else if(isNaN(Rgsm1.value))
{
alert('Please enter the numeric value GSM no.');
Rgsm1.focus();
}
else if(isNaN(Rcountrycode2.value.split(",").join("+")))//isNaN(this.split(",").join(""));}
{
  alert('Please enter the numeric value in telephone 2 ');
  Rcountrycode2.focus();
}	
//############################################
//Login Details
else if(login.value=="")
{
alert('Please enter the login Name');
login.focus();
}
else if(password.value=="")
{
alert('Please enter the password');
password.focus();
}
else if ((password.value.length)<6 || (password.value.length)>20)
 {
 alert('Password should be minimum 6 and maximum 20 alphanumeric.')
 password.focus();
 }
 else if(confirmpass.value=="")
				{
				alert('Please enter the confirm password');
				confirmpass.focus();
				}	
				else if(!(password.value==confirmpass.value))
				{
				alert('Your password do not match');
				confirmpass.focus();
				}					
else
{
v=true;
}
return v;
}


function isValidEmail(email){ 
    var RegExp = /^((([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+(\.([a-z]|[0-9]|!|#|$|%|&|'|\*|\+|\-|\/|=|\?|\^|_|`|\{|\||\}|~)+)*)@((((([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.))*([a-z]|[0-9])([a-z]|[0-9]|\-){0,61}([a-z]|[0-9])\.)[\w]{2,4}|(((([0-9]){1,3}\.){3}([0-9]){1,3}))|(\[((([0-9]){1,3}\.){3}([0-9]){1,3})\])))$/
    if(RegExp.test(email)){ 
        return true; 
    }else{ 
        return false; 
        }
    } 		
    
//function isalpha(d)
// {
// //alert('hi');
//   var v=false;
//   var s,s1,l1,l2;
//    s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 
//   l1=d.lengh;
//   for (i=0; i<l1; i++)
//   {
//   l2=d.charAt(i);
//   l=document.getElementById("txtCname").value;
//  
//   s1=s.length;
//   for (i1=0; i1<s1; i1++)
//   {
//      if (l2==s.charAt(i))
//    {
//         
//         v= true;
//    }
//    else
//    {
//         v= false;
//    }
//    return v;
//    }
//   }
//  } 
  
//For Shipping Details
function shipping()
{
var Cname=document.getElementById("txtCname");
var Cdesignation=document.getElementById("txtCdesignation");
var Cadd=document.getElementById("txtCaddress");
var Ccity=document.getElementById("txtCcity");
var Cstate=document.getElementById("txtCstate");
var Ccountry=document.getElementById("ddlCcountry");
var Cpin=document.getElementById("txtCpin");
var Ccountrycode1=document.getElementById("txtCcountrycode1");
var Carea1=document.getElementById("txtCareacode1");
var Ctel1=document.getElementById("txtCtelephone1");
var Ccountrycode2=document.getElementById("txtCcountrycode2");
var Careacode2=document.getElementById("txtCareacode2");
var Ctelephone2=document.getElementById("txtCtelephone2");
var Cfaxcountrycode=document.getElementById("txtCfaxcountrycode");
var Cfaxarea=document.getElementById("txtCfaxareacode");
var Cfaxtelephone=document.getElementById("txtCfaxtelephone");
var Cgsm=document.getElementById("txtCgsm");
//&&&&&&&&&&&&&&&For shipped

var Sname=document.getElementById("txtSname");
var Sdesignation=document.getElementById("txtSdesignation");
var Sadd=document.getElementById("txtSaddress");
var Scity=document.getElementById("txtScity");
var Sstate=document.getElementById("txtSstate");
var Scountry=document.getElementById("ddlScountry");
var Spin=document.getElementById("txtSpin");
var Scountrycode1=document.getElementById("txtScountrycode1");
var Sarea1=document.getElementById("txtSareacode1");
var Stel1=document.getElementById("txtStelephone1");
var Scountrycode2=document.getElementById("txtScountrycode2");
var Sarea2=document.getElementById("txtSareacode2");
var Stel2=document.getElementById("txtStelephone2");
var Sfaxcountry=document.getElementById("txtSfaxcountrycode");
var Sfaxarea=document.getElementById("txtSfaxareacode");
var Stelephone=document.getElementById("txtSfaxtelephone");
var Sgsm=document.getElementById("txtSgsm");
if(document.getElementById("ChkShipping").checked==true)
{
Sname.value=Cname.value;
Sdesignation.value=Cdesignation.value;
Sadd.value=Cadd.value;
Scity.value=Ccity.value;
Sstate.value=Cstate.value;
Scountry.value=Ccountry.value;
Spin.value=Cpin.value;
Scountrycode1.value=Ccountrycode1.value;
Sarea1.value=Carea1.value;
Stel1.value=Ctel1.value;
Scountrycode2.value=Ccountrycode2.value;
Sarea2.value=Careacode2.value;
Stel2.value=Ctelephone2.value;
Sfaxcountry.value=Cfaxcountrycode.value;
Sfaxarea.value=Cfaxarea.value;
Stelephone.value=Cfaxtelephone.value;
Sgsm.value=Cgsm.value;
}  
else
{
Sname.value="";
Sdesignation.value="";
Sadd.value="";
Scity.value="";
Sstate.value="";
Scountry.value="";
Spin.value="";
Scountrycode1.value="";
Sarea1.value="";
Stel1.value="";
Scountrycode2.value="";
Sarea2.value="";
Stel2.value="";
Sfaxcountry.value="";
Sfaxarea.value="";
Stelephone.value="";
Sgsm.value="";
}
}

//For AdminUser.aspx

function valid(t)
{
v=false;
if(t.txtname.value=="")
{
alert('Please Enter User Name.');
t.txtname.focus();
}
else if(t.txtpass.value=="")
{
alert('Please Enter Password.')
t.txtpass.focus();
}
else if ((t.txtpass.value.length)<6 || (t.txtpass.value.length)>20)
{
alert('Password should be min 6 and max 20 alphanumeric.')
t.txtpass.focus();
}
else if(!(t.txtpass.value==t.txtconpass.value))
{
alert('Incorrect Password,Please Enter Again.')
t.txtconpass.focus();
}
else
{
v=true;
}
return v;
}

//for showing the shipping

function show()
{
if(document.getElementById("ChkShipping").checked==true)
{
document.getElementById("ship").style.display="none";
}
else
{
document.getElementById("ship").style.display="inline";
}
}


//
//function ship()
//{
//v=false;
//if(document.getElementById("ChkShipping").checked==false)

//{
//alert('hkhk');
//}
//else
//{
//v=true;
//}
//return v;
//}


// Shipping for registration.aspx

// Shipping fro registration_ED.aspx
 

