/* Javascript written by Paula Molinero, */ /* based on sevaral code samples and */ /* other online resources. */ /* _______________________________________ */ var siteName = 'Crownland Ltd'; var webPath = '/home/clients/projects/crownlanddev/html/;'; var separator = ' / '; var browser = navigator.appName; // ___ Crownland functions ______________________________________________________________________ // function fereastra(fis) { window.open(fis,'mywin','left=0,top=0,width=510,height=700,toolbar=0,resizable=0'); } function populateAmounts (plotPrice) { if (plotPrice) { var splitPlot = plotPrice.split(";"); if (splitPlot[1]) { printInnerText ('totalAmount',splitPlot[1]); printInnerText ('reservationFee',(splitPlot[1]/10)); printInnerText ('errPlotCode',' '); } } } function selectPlotFromComboBox (i) { document.forms['reserve'].PlotCode.selectedIndex = i; } //___ Base functions ___________________________________________________________________________ // function topOfThePage () { window.scrollTo(0,0) } function Escape (text) { if (!arguments.callee.sRE) { var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); } return text.replace(arguments.callee.sRE, '\\$1'); } function printInnerText (ID,Str) { //alert ('ID: ' + ID + ' - Str: ' + Str); if (ID != 'redirect') { if (myEl = document.getElementById(ID)) { myEl.innerHTML = Str; } } } function redir (thisURL) { if (thisURL) { location.href = thisURL; } } function switchClass(id, newClass) { if (myElement=document.getElementById(id)) { myElement.className = newClass; } } function validateForm (str) { return str; } //___ Visibility functions _____________________________________________________________________ // function vis1(objID) { if(myElement = document.getElementById (objID)) { if(myElement.style.display == 'block') { myElement.style.display = 'none'; } else { myElement.style.display = 'block'; } } } function vis2(objID,total) { if(objID > 0) { for(i = 1; i <= total; i++) { var id = 'sub' + i; myElement = document.getElementById(id); if(i == objID) { myElement.style.display = 'block'; } else { myElement.style.display = 'none'; } } } } function vis3(objID,strID,strOn,strOff,cooName) { if(myElement = document.getElementById(objID)) { if(myElement.style.display == 'block') { myElement.style.display = 'none'; printInnerText (strID,strOff); var cooVal = 'n'; } else { myElement.style.display = 'block'; printInnerText (strID,strOn); var cooVal = 'y'; } if (cooName) { createCookie (cooName, cooVal); } } } function vis4(objID,imgID,imgShow,imgHide) { if(myElement = document.getElementById(objID)) { myImg = document.getElementById(imgID); if(myElement.style.display == 'block') { myElement.style.display = 'none'; myImg.src = imgShow; } else { myElement.style.display = 'block'; myImg.src = imgHide; } //if (cooName) { createCookie (cooName,objID); } } } //___ Confirmation boxes _______________________________________________________________________ // function confirmBox(msg,fwd,rwd) { var where_to = confirm(msg); if (where_to == true) { window.location = fwd; } else { window.location = rwd; } } function confirmBox2(msg) { var where_to= confirm(msg); if (where_to == false) { history.go(-1); } else { return true; } } //___ cookie functions by quirksmode.org _______________________________________________________ // function createCookie(name,value,mins) { if (mins) { var date = new Date(); date.setTime (date.getTime()+(mins*60)); var expires = ";expires="+date.toGMTString(); } else { var expires = ""; } document.cookie = name+"="+value+expires+";path="+webPath; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); }