function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
var calculatorReq=GetXmlHttpObject();var calculatorResponse='';function calculateAjaxForm(calculatorForm){var cod=calculatorForm.cod.value;var cantitate=calculatorForm.cantitate.value;var cate_culori=calculatorForm.cate_culori.value;var locul=getCheckedValue(calculatorForm.locul);var calcul=calculatorForm.calcul.value;var termen_exec=calculatorForm.termen_exec.value;var cod_promotie=calculatorForm.cod_promotie.value;calculateAjax(cod,cantitate,cate_culori,locul,calcul,termen_exec,cod_promotie);}
function calculateAjax(cod,cantitate,cate_culori,locul,calcul,termen_exec,cod_promotie){if(calculatorReq.readyState==4||calculatorReq.readyState==0){toogleModalWindow('visible');loadModalContent();calculatorReq.open("GET",'/calculator_pret.php?cod='+cod+'&cantitate='+cantitate+'&cate_culori='+cate_culori+'&locul='+locul+'&calcul='+calcul+'&termen_exec='+termen_exec+'&cod_promotie='+cod_promotie+'',true);calculatorReq.onreadystatechange=handleCalculate;calculatorReq.send(null);}}
function handleCalculate(){if(calculatorReq.readyState==4){var cab=document.getElementById('modalContent')
cab.innerHTML='';calculatorResponse=calculatorReq.responseText;cab.innerHTML='<div align="right" ><a href="#calculator" onclick="CloseCalculator()"><b>Inchide [X]</b></a></div>';cab.innerHTML+=calculatorResponse;}}
function getCheckedValue(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
function CloseCalculator(){var cb=document.getElementById('calculator');cb.innerHTML=calculatorResponse;toogleModalWindow('hidden');}
function toogleModalWindow(type){toogleOverlay(type);toogleModalContent(type);}
function loadModalContent(){var ModalContent=document.getElementById('modalContent');ModalContent.innerHTML=document.getElementById('calculatorAjaxLoading').innerHTML;}
function toogleModalContent(type){var ModalContent=document.getElementById('modalContent');if(type=='visible'){ModalContent.style.visibility='visible';ModalContent.style.display='block';}else{ModalContent.style.visibility='hidden';ModalContent.style.display='none';}}
function toogleOverlay(type){var divOverlay=document.getElementById('AjaxOverlay');if(type=='visible'){divOverlay.style.visibility='visible';divOverlay.style.display='block';}else{divOverlay.style.visibility='hidden';divOverlay.style.display='none';}}
