//////////////////////////////EMAIL VALIDATION//////////////////////////////////////////////////////////
function the_mail(control_value)
{
		var emailStr = control_value;
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			alert("Email address seems incorrect ");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null)
		{
			alert("The Email address doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!");
					//eval("document."+form_name+"."+control_name).focus();
					return true;
				}
			}
				 
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
			alert("The address must end in a three-letter domain, or two letter country.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		if (len<2) 
		{
			alert("This address is missing a hostname!");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		return false;
	
}
///////////////////////////////////////////////////////////////////////////////////////////

function check_contact1(a){
	var regBlank = /[^\s]/;
	var regBlank1=/[^\s]/;
	


		if(!regBlank.test(document.contatcus1.name.value)){
	alert("Please Enter Your Name");
	document.contatcus1.name.focus();
	return false;
	}	
	if(!regBlank.test(document.contatcus1.email.value)){
	alert("Please Enter Your Email");
	document.contatcus1.email.focus();
	return false;
	}
	if(the_mail(document.contatcus1.email.value))
	{
	document.contatcus1.email.focus();
	return false;
	}
			if(!regBlank.test(document.contatcus1.street.value)){
	alert("Please Enter Your Street");
	document.contatcus1.street.focus();
	return false;
	}	
			if(!regBlank.test(document.contatcus1.city.value)){
	alert("Please Enter Your City");
	document.contatcus1.city.focus();
	return false;
	}	
			if(!regBlank.test(document.contatcus1.state.value)){
	alert("Please Enter Your State");
	document.contatcus1.state.focus();
	return false;
	}	
			if(!regBlank.test(document.contatcus1.country.value)){
	alert("Please Enter Your Country");
	document.contatcus1.country.focus();
	return false;
	}	
			if(!regBlank.test(document.contatcus1.zip.value)){
	alert("Please Enter Your Zip");
	document.contatcus1.zip.focus();
	return false;
	}	
			if(!regBlank.test(document.contatcus1.areacode.value)){
	alert("Please Enter Your Areacode");
	document.contatcus1.areacode.focus();
	return false;
	}	
		if(!regBlank.test(document.contatcus1.telno.value)){
	alert("Please Enter Your Phone Number");
	document.contatcus1.telno.focus();
	return false;
	}	
		if(!regBlank.test(document.contatcus1.comment.value)){
	alert("Please Enter Your Comment");
	document.contatcus1.comment.focus();
	return false;
	}	
	
if(document.contatcus1.latter.value=='')
		{
		alert('Please  enter the above text !! ');
		document.contatcus1.latter.focus();
		return false;
		}
	
		if(document.contatcus1.latter.value!=a)
		{
		alert('The text do not match !! ');
		document.contatcus1.latter.focus();
		return false;
		}

	
}


function check_checkout()
{

var regBlank = /[^\s]/;
var regBlank1=/[^\s]/;
	
	
if(document.checkprocess.cardtype.value==0){
alert("Please Select Card Type");
document.checkprocess.cardtype.focus();
return false;
}

if(!regBlank.test(document.checkprocess.cardnumber.value)){
		alert("Please insert cardnumber");
		document.checkprocess.cardnumber.focus();
		return false;
	}

if(document.checkprocess.expmonth.value==0){
alert("Please Select Exp Month");
document.checkprocess.expmonth.focus();
return false;
}
if(document.checkprocess.expyear.value==0){
alert("Please Select Exp Year");
document.checkprocess.expyear.focus();
return false;
}	
if(!regBlank.test(document.checkprocess.csv.value)){
		alert("Please insert CID");
		document.checkprocess.csv.focus();
		return false;
	}
	if(!regBlank.test(document.checkprocess.billingFname.value)){
		alert("Please insert First name");
		document.checkprocess.billingFname.focus();
		return false;
	}
	if(!regBlank.test(document.checkprocess.billingLname.value)){
		alert("Please insert last name");
		document.checkprocess.billingLname.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.billingemail.value)){
		alert("Please insert email ");
		document.checkprocess.billingemail.focus();
		return false;
	}
   if(the_mail(document.checkprocess.billingemail.value))
	{
	document.checkprocess.billingemail.focus();
	return false;
	}	
	
		if(!regBlank.test(document.checkprocess.billingaddress.value)){
		alert("Please insert address ");
		document.checkprocess.billingaddress.focus();
		return false;
	}

		if(!regBlank.test(document.checkprocess.billingCity.value)){
		alert("Please insert city");
		document.checkprocess.billingCity.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.billingState.value)){
		alert("Please insert state ");
		document.checkprocess.billingState.focus();
		return false;
	}	
	if(document.checkprocess.billingCountry.value==0){
alert("Please Select Country");
document.checkprocess.billingCountry.focus();
return false;
}

		if(!regBlank.test(document.checkprocess.billingzip.value)){
		alert("Please insert zip code");
		document.checkprocess.billingzip.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.billingPhone.value)){
		alert("Please insert Phone");
		document.checkprocess.billingPhone.focus();
		return false;
	}





if(!regBlank.test(document.checkprocess.shippingFname.value)){
		alert("Please insert First name");
		document.checkprocess.shippingFname.focus();
		return false;
	}
	if(!regBlank.test(document.checkprocess.shippingLname.value)){
		alert("Please insert last name");
		document.checkprocess.shippingLname.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.shippingemail.value)){
		alert("Please insert email ");
		document.checkprocess.shippingemail.focus();
		return false;
	}
   if(the_mail(document.checkprocess.shippingemail.value))
	{
	document.checkprocess.shippingemail.focus();
	return false;
	}	
	
		if(!regBlank.test(document.checkprocess.shippingaddress.value)){
		alert("Please insert address ");
		document.checkprocess.shippingaddress.focus();
		return false;
	}

		if(!regBlank.test(document.checkprocess.shippingCity.value)){
		alert("Please insert city");
		document.checkprocess.shippingCity.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.shippingState.value)){
		alert("Please insert state ");
		document.checkprocess.shippingState.focus();
		return false;
	}	
	if(document.checkprocess.shippingCountry.value==0){
alert("Please Select Country");
document.checkprocess.shippingCountry.focus();
return false;
}

		if(!regBlank.test(document.checkprocess.shippingzip.value)){
		alert("Please insert zip code");
		document.checkprocess.shippingzip.focus();
		return false;
	}
		if(!regBlank.test(document.checkprocess.shippingPhone.value)){
		alert("Please insert Phone");
		document.checkprocess.shippingPhone.focus();
		return false;
	}

}








	function createRequestObject() {
   var req;
   if(window.XMLHttpRequest){
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      alert('Problem creating the XMLHttpRequest object');
   }
   return req;
}
var http = createRequestObject();

/*add to cart start */
function addtocart(pid)
{
for (var i=0; i < document.cart.ringsize.length; i++)
   {
   if (document.cart.ringsize[i].checked)
      {
      var ringsize = document.cart.ringsize[i].value;
	}
  }
document.getElementById("addtocartdiv").innerHTML = "<div class='addingtocart'><br/><br/><img src='images/zoomloader.gif' border='0'> Adding to basket...</div>";
http.open('get','addindtocart.php?act=add2cart&&ringsize='+ringsize+'&&pid='+pid+'');
http.onreadystatechange = handleResponseconaddcart;
http.send(null);
disable();   
}
function handleResponseconaddcart() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	 	  document.getElementById("addtocartdiv").innerHTML = '';
         document.getElementById("addtocartdiv").innerHTML = response;
      }
   }
}
/*add to cart end  */

/*soli pro view start */

function detailsalsoview(diamond,snk,img) {
	
	//alert(act);
document.getElementById("showalsoview").innerHTML = "<div class='solishowalsoview' align='center'><div class='showallcomprodivdet01loading02' ><img src='images/zoomloader.gif' border='0'> loading...</div></div>";
http.open('get','solishowalsoviewajax.php?diamond='+diamond+'');
http.onreadystatechange = handleResponseconsoli;
http.send(null);
disable();
}


function handleResponseconsoli() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	  document.getElementById('viewallcombination').style.display='none';
		  document.getElementById("showalsoview").innerHTML = '';
         document.getElementById("showalsoview").innerHTML = response;
      }
   }
}

function soliallcombinationclose() {
  document.getElementById("searchproajaxdiv").innerHTML = ''; 
  document.getElementById("showallcomprodivdet01").innerHTML = ''; 
  document.getElementById("showalsoview").innerHTML = ''; 
  document.getElementById('viewallcombination').style.display='block';
}
/*soli pro view end*/

/*soli pro details view end*/

function showallcomprodivdet(id){

	//alert(act);
document.getElementById("showallcomprodivdet01").innerHTML = "<div class='showallcomprodivdet01loading'  ><div class='showallcomprodivdet01loading01' ><img src='images/zoomloader.gif' border='0'> loading...</div></div>";
http.open('get','showallcomprodivdetpage.php?id='+id+'');
http.onreadystatechange = handleResponsecondetpage;
http.send(null);
disable();
	}
	
function handleResponsecondetpage() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	     document.getElementById("showallcomprodivdet01").innerHTML = '';
         document.getElementById("showallcomprodivdet01").innerHTML = response;
      }
   }
}
/*soli pro details view end*/

/*normal product search start */

function searchproajax(sitename){

	//alert(act);
	var id=document.searchproduct.search_text.value;
	document.getElementById("searchproajaxdiv").innerHTML = "<div class='searchproajaxloading'  ><div class='searchproajaxloading01' ><img src='"+sitename+"/images/zoomloader.gif' border='0'> Searching...</div></div>";
http.open('get',''+sitename+'/searchproajaxpage.php?id='+id+'');
http.onreadystatechange = handleResponseconsearchpro;
http.send(null);
disable();
	}
	
function handleResponseconsearchpro() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	     document.getElementById("searchproajaxdiv").innerHTML = '';
         document.getElementById("searchproajaxdiv").innerHTML = response;
      }
   }
}
/*normal product search END */

/* solitaire compare start */
<!-- checkbox select result and get data start-->
function showHidesoli(checkid,pid)
{
//alert(checkid);
if(document.getElementById(checkid).checked)
{
	window.scrollTo(0,0);
	addselectionsoli(pid);
}
else
{
	window.scrollTo(0,0);
	delselectionsoli(pid);
}
}

function addselectionsoli(act) {

	//alert(act);
document.getElementById("addselectiondivsolicom").innerHTML = "<div class='addselectionsoliloading'><img src='images/zoomloader.gif' border='0'> Selecting for compare...</div>";
http.open('get','solicompareproajax.php?act=insert&&diamond='+act+'');
http.onreadystatechange = handleResponseconcomsolistart;
http.send(null);
disable();
}


function handleResponseconcomsolistart() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	 	  document.getElementById("addselectiondivsolicom").innerHTML = '';
         document.getElementById("addselectiondivsolicom").innerHTML = response;
      }
   }
}




function delselectionsoli(act) {
	
	//alert(act);
document.getElementById("addselectiondivsolicom").innerHTML = "<div class='addselectionsoliloading'><img src='images/zoomloader.gif' border='0'> Removine from list...</div>";
http.open('get','solicompareproajax.php?act=del&&diamond='+act+'');
http.onreadystatechange = handleResponsecondcomsoli;
http.send(null);
disable();
}


function handleResponsecondcomsoli() {
   if(http.readyState == 4 && http.status == 200){
      var response = http.responseText;
      if(response!="")
	  {
	 	  document.getElementById("addselectiondivsolicom").innerHTML = '';
         document.getElementById("addselectiondivsolicom").innerHTML = response;
      }
   }
}

/* solitaire compare END */

