var HTTP_SERVER = 'http://www.europeanjewelryinc.com/'; var buff = 0; var count = 0; var sas_xh; try { //Firefox,Opera,Safari sas_xh = new XMLHttpRequest(); } catch (e) { //IE try { sas_xh = new ActiveXObject("Msxm12.XMLHTTP"); } catch (e) { try { sas_xh = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); } } } function search_diamonds() { count++; if(buff == 0 && count>8) { buff = 1; document.getElementById("searching").style.display = "block"; sas_xh.onreadystatechange = function() { if(sas_xh.readyState == 4) { //Get data from the servers response text = sas_xh.responseText; div = "c_m"; if(text != "") document.getElementById(div).innerHTML = text; buff = 0; document.getElementById("searching").style.display = "none"; } } var egl=document.search_form.egl.checked; var gia=document.search_form.gia.checked; var app=document.search_form.appraised.checked; if(egl==false){ egl='nont'; } if(gia==false){ gia='nont'; } if(app==false){ app='nont'; } var price_min = document.search_form.price_min.value; var price_max = document.search_form.price_max.value; var carat_min = document.search_form.carat_min.value; var carat_max = document.search_form.carat_max.value; var clarity_min = document.search_form.clarity_min.value; var clarity_max = document.search_form.clarity_max.value; var color_min = document.search_form.color_min.value; var color_max = document.search_form.color_max.value; var type = document.search_form.type.value; sas_xh.open("GET",HTTP_SERVER+"/tencho/response.php?action=search&price_min="+price_min+"&price_max="+price_max+"&carat_min="+carat_min+"&carat_max="+carat_max+"&color_min="+color_min+"&color_max="+color_max+"&clarity_min="+clarity_min+"&clarity_max="+clarity_max+"&type="+type+"&egl="+egl+"&gia="+gia+"&app="+app,true); sas_xh.setRequestHeader("Content-type","application/x-www-form-urlencoded"); sas_xh.setRequestHeader("Connection","close"); sas_xh.send(null); } } function indertdeldiamnods(indo) { count++; if(buff == 0) { buff = 1; sas_xh.onreadystatechange = function() { if(sas_xh.readyState == 4) { //Get data from the servers response text = sas_xh.responseText; if(text != "") buff = 0; //go function show compaire compair('0'); //alert(text); } } sas_xh.open("GET",HTTP_SERVER+"/tencho/insertdeldiam.php?action=insert&id="+indo,true); sas_xh.setRequestHeader("Content-type","application/x-www-form-urlencoded"); sas_xh.setRequestHeader("Connection","close"); sas_xh.send(null); } } function deldiamnods(indo) { count++; if(buff == 0) { buff = 1; sas_xh.onreadystatechange = function() { if(sas_xh.readyState == 4) { //Get data from the servers response text = sas_xh.responseText; if(text != "") buff = 0; //go function show compaire compair('0'); //alert(text); } } sas_xh.open("GET",HTTP_SERVER+"/tencho/insertdeldiam.php?action=delete&id="+indo,true); sas_xh.setRequestHeader("Content-type","application/x-www-form-urlencoded"); sas_xh.setRequestHeader("Connection","close"); sas_xh.send(null); } } function compair(im,ido){ // alert(im); count++; if(buff == 0) { buff = 1; if(document.getElementById("searching2")){ document.getElementById("searching2").style.display = "block"; } if(document.getElementById("show")){ document.getElementById("show").style.backgroundColor = '#D8E1E9'; } sas_xh.onreadystatechange = function() { if(sas_xh.readyState == 4) { //Get data from the servers response text = sas_xh.responseText; div = "c_m2"; // alert(text); if(text != "") document.getElementById(div).innerHTML = text; trick(ido,im); buff = 0; document.getElementById("searching2").style.display = "none"; document.getElementById("show").style.backgroundColor = 'none'; } } if(im=='0'){ sas_xh.open("GET",HTTP_SERVER+"/tencho/diam_response.php",true); sas_xh.setRequestHeader("Content-type","application/x-www-form-urlencoded"); sas_xh.setRequestHeader("Connection","close"); sas_xh.send(null) }else{ sas_xh.open("GET",HTTP_SERVER+"/tencho/diam_response.php?order="+im,true); sas_xh.setRequestHeader("Content-type","application/x-www-form-urlencoded"); sas_xh.setRequestHeader("Connection","close"); sas_xh.send(null); } } } function trick(id,what){ if(id){ if(document.getElementById(id)){ for(var i=1; i<14; i++){ if(id!=i){ document.getElementById(i).style.backgroundColor = 'none'; }else{ document.getElementById(i).style.backgroundColor = '#565f70'; document.getElementById(i).style.color = 'white'; } } } } }