function FocusDateField(id) { if (document.rf.elements[id].value=='ÄÄ.ÌÌ.ÃÃÃÃ') { document.rf.elements[id].value = ''; } document.getElementById(id+"Field").style.backgroundPosition = "0px -200px"; } function BlurDateField(id) { if (document.rf.elements[id].value=='') { document.rf.elements[id].value = 'ÄÄ.ÌÌ.ÃÃÃÃ'; } document.getElementById(id+"Field").style.backgroundPosition = "0px 0px"; RecalculateRate(); } function VehicleOver(obj,id) { obj.style.cursor = "pointer"; if (document.rf.VehicleID.value==id) { return; } document.getElementById("VEHICLECELL"+id).style.background = "#E0E0E0"; document.getElementById("VEHICLELINK"+id).style.color = "#000000"; } function VehicleOut(obj,id) { obj.style.cursor = ""; if (document.rf.VehicleID.value==id) { return; } document.getElementById("VEHICLECELL"+id).style.background = ""; document.getElementById("VEHICLELINK"+id).style.color = "#444444"; } function VehicleSelect(id) { var VehicleObj; if (document.rf.VehicleID.value.length>0 && document.rf.VehicleID.value!=id) { VehicleObj = document.getElementById("VEHICLECELL"+document.rf.VehicleID.value); VehicleObj.style.backgroundColor = ""; VehicleObj.style.backgroundImage = ""; VehicleObj.style.backgroundRepeat = ""; VehicleObj.style.fontWeight = ""; document.getElementById("VEHICLELINK"+document.rf.VehicleID.value).style.color = "#444444"; } document.rf.VehicleID.value = id; VehicleObj = document.getElementById("VEHICLECELL"+id); VehicleObj.style.backgroundColor = "#0074F4"; VehicleObj.style.backgroundImage = "url('/images/elements/back01.gif')"; VehicleObj.style.backgroundRepeat = "repeat-x"; VehicleObj.style.fontWeight = "bold"; document.getElementById("VEHICLELINK"+id).style.color = "#FFFFFF"; RecalculateRate(); } function RecalculateRate() { Lib_ClearElement(document.getElementById("DurationRow")); Lib_ClearElement(document.getElementById("TotalAmountRow")); $("#CalculationContainer").slideUp("fast"); if (document.rf.VehicleID.value.length==0) { return; } if (document.rf.PickUpDate.value.length==0) { return; } if (document.rf.ReturnDate.value.length==0) { return; } if (document.rf.PickUpDate.value=='ÄÄ.ÌÌ.ÃÃÃÃ') { return; } if (document.rf.ReturnDate.value=='ÄÄ.ÌÌ.ÃÃÃÃ') { return; } var xmlHttp; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; } } } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState==4) { if (xmlHttp.responseText=='ERROR') { } else if (xmlHttp.responseText=='NORESULTS') { } else { $("#CalculationContainer").slideDown("medium"); var XMLDoc = xmlHttp.responseXML; var DurationStr,RateTotalAmountStr; var Duration = XMLDoc.getElementsByTagName("Duration")[0].childNodes[0].nodeValue; var RateCurrency = XMLDoc.getElementsByTagName("RateCurrency")[0].childNodes[0].nodeValue; var RateTotalAmount = XMLDoc.getElementsByTagName("RateTotalAmount")[0].childNodes[0].nodeValue; if (Duration==1) { DurationStr = '1 äåí'; } else { DurationStr = Duration+' äíè'; } if (RateCurrency=='EUR') { RateTotalAmountStr = "ˆ" + parseFloat(RateTotalAmount).toFixed(2); } else if (RateCurrency=='BGN') { RateTotalAmountStr = parseFloat(RateTotalAmount).toFixed(2) + " ëâ."; } else if (RateCurrency=='USD') { RateTotalAmountStr = "$" + parseFloat(RateTotalAmount).toFixed(2); } var DurationTxt = document.createTextNode(DurationStr); var DurationDiv = document.createElement("div"); DurationDiv.appendChild(DurationTxt); var TotalAmountTxt = document.createTextNode(RateTotalAmountStr); var TotalAmountDiv = document.createElement("div"); TotalAmountDiv.appendChild(TotalAmountTxt); document.getElementById("DurationRow").appendChild(DurationDiv); document.getElementById("TotalAmountRow").appendChild(TotalAmountDiv); } } } xmlHttp.open("POST","/bg/_getrate.xml?VehicleID="+document.rf.VehicleID.value+"&PickUpDate="+document.rf.PickUpDate.value+"&ReturnDate="+document.rf.ReturnDate.value,true); xmlHttp.send(null); }