var tabPos = new Array(); var divTop = 0; function fixTabPos(){ for(key in tabPos){ if(tabPos[key]) { tabPos[key].parentNode.firstChild.style.top = findPosY(tabPos[key]) + 'px'; //alert(tabPos[key].parentNode.firstChild.style.top + ' --> ' + findPosY(tabPos[key])); } } } function findPosX(obj) { var curleft = 0; if(obj) { if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) { curleft += obj.x; } return curleft; } } function findPosY(obj) { var curtop = 0; if(obj) { if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.x) { curtop += obj.x; } return curtop; } } function fillDiv(key, divid,idArr, chkDivHt) { if(divid == "infoDiv1"){ var idArr = new Array(); idArr[0] = "pagelabel-mylunchbox"; idArr[1] = "pagelabel-leftovers"; idArr[2] = "pagelabel-healthyhabits"; idArr[3] = "pagelabel-Not logged in brighton"; idArr[4] = "pagelabel-foodguides"; }else if(divid == "infoDiv2"){ var idArr = new Array(); idArr[0] = "pagelabel-recipes"; }else if(divid == "infoDiv3"){ var idArr = new Array(); idArr[0] = "pagelabel-banner"; }else if(divid == "infoDiv4"){ var idArr = new Array(); idArr[0] = "pagelabel-mycupboard"; idArr[1] = "pagelabel-littlechef"; } // alert(idArr.length); if(idArr.length > 0){ var k; for(k=0;k 20){ // if((tabName.length > 20) || (tabName.indexOf("
") >= 0)){ document.getElementById(idArr[k] + '_topDiv').className = 'tableftact theight'; document.getElementById(idArr[k] + '_midDiv').className = 'tabtext txtbgact'; document.getElementById(idArr[k] + '_botDiv').className = 'tabrightact theight'; }else{ document.getElementById(idArr[k] + '_topDiv').className = 'tableftact sheight'; document.getElementById(idArr[k] + '_midDiv').className = 'tabtext txtbgact'; document.getElementById(idArr[k] + '_botDiv').className = 'tabrightact sheight'; } } } } var divObj = document.getElementById(divid); var tabObj = document.getElementById(key + '_btn'); var tabTopObj = document.getElementById(key + '_topDiv'); var tabMidObj = document.getElementById(key + '_midDiv'); var tabBotObj = document.getElementById(key + '_botDiv'); var selectedTab = tabMidObj.innerHTML; if(selectedTab.length > 20){ // if((selectedTab.length > 20) || (selectedTab.indexOf("
") >= 0)){ tabTopObj.className = 'tableft theight'; tabMidObj.className = 'tabtext txtbgnorm'; tabBotObj.className = 'tabright theight'; }else{ tabTopObj.className = 'tableft sheight'; tabMidObj.className = 'tabtext txtbgnorm'; tabBotObj.className = 'tabright sheight'; } for(var i=0; i 1) { thisObj.removeChild(thisObj.firstChild); } } } if(tabInfoObj.innerHTML == '' || tabInfoObj.innerHTML == 'Searching for the latest local information...' || tabInfoObj.innerHTML.indexOf('Error:') >= 0) { tabInfoObj.innerHTML = '  Searching for the latest local information...'; switch(key) { case "map": break; // case "journeyplanner": // var ajaxVar = new ajaxVars(); // ajaxVar.vars['sql_type'] = "select"; // ajaxVar.vars['sql_what'] = "name, intro, bodytext"; // ajaxVar.vars['sql_from'] = "pages"; // ajaxVar.vars['sql_where'] = "id=23"; // ajaxVar.vars['action'] = "mysql_fetch_array"; // ajaxVar.fnVars['divId'] = key; // ajaxVar.gotoFunction = "showData"; // ajaxVar.AjaxPostSQL(); // break; default: // alert(key); var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "tabData"; ajaxVar.vars['args'] = key + ',' + randPostcode; ajaxVar.fnVars['divId'] = key; ajaxVar.fnVars['divArr'] = chkDivHt; ajaxVar.gotoFunction = 'putData'; ajaxVar.AjaxPostSQL(); break; } } if(tabInfoObj.id == 'weather'){ tabInfoObj.innerHTML = ""; } var infoHeight = tabInfoObj.offsetHeight + 10; if(key != "homeroads" && key != "weather" && key != "food"){ var infoHeight = (infoHeight < 185) ? 185 : infoHeight; tabInfoObj.parentNode.style.height = infoHeight + 'px'; } if(key == 'pagelabel-banner' || key == 'pagelabel-mycupboard' || key == 'pagelabel-littlechef' || key == 'pagelabel-recipes'){ var infoHeight = (infoHeight < 650) ? 650 : infoHeight; tabInfoObj.parentNode.style.height = infoHeight + 'px'; } if(key == 'account_detail' || key == 'briefcase'){ fixFooter(infoHeight); } // if(key!='pagelabel-mycupboard' || key!='pagelabel-leftovers' || key!='pagelabel-healthyhabits' || key!='pagelabel-library' || key!='pagelabel-Not logged in brighton' || key!='pagelabel-foodguides' || key!='pagelabel-banner' || key!='pagelabel-recipes' || key!='pagelabel-mylunchbox' || key!='pagelabel-littlechef'){ // fixFooter(infoHeight); // } } function showData(data, fnVars) { var divObj = document.getElementById(fnVars['divId']); divObj.className = 'bodyclass leftpadding'; if(isArray(data)) { divObj.innerHTML = data['intro'][0]; divObj.innerHTML += data['bodytext'][0]; }else{ divObj.innerHTML =data; } var infoHeight = divObj.offsetHeight + 10; infoHeight = (infoHeight < 185) ? 185 : infoHeight; divObj.parentNode.style.height = infoHeight + 'px'; // fixFooter(infoHeight); fixTabPos(); } function putData(data, fnVars) { var divObj = document.getElementById(fnVars['divId']); divObj.innerHTML = data; var infoHeight = divObj.offsetHeight + 10; infoHeight = (infoHeight < 185) ? 185 : infoHeight; divObj.parentNode.style.height = infoHeight + 'px'; // hack for good food widget since the widget doesn't give correct height on load if(fnVars['divId'] == 'pagelabel-recipes') { divObj.parentNode.style.width = "320px"; if(infoHeight<=185){ divObj.parentNode.style.height = "339px"; } } if(fnVars['divId'] == 'pagelabel-banner' || fnVars['divId'] == 'pagelabel-mycupboard' || fnVars['divId'] == 'pagelabel-littlechef' || fnVars['divId'] == 'pagelabel-recipes'){ var infoHeight = (infoHeight < 650) ? 650 : infoHeight; divObj.parentNode.style.height = infoHeight + 'px'; } if (fnVars['divArr']) { var tmpArr = fnVars['divArr'].split("++"); infoHeight = 0; for (var xI=0; xI0 && divHt<800) { mainObj.style.height = '925px'; }else if (parseInt(mainObj.offsetHeight)<920 && divHt<920) { mainObj.style.height = '925px'; }else if (divHt>920) { mainObj.style.height = (parseInt(divHt) + 280) + 'px'; } } } function isArray(obj) { if (obj.constructor.toString().indexOf('Array') == -1) return false; else return true; } function validate_checkoutuser(){ var Obj1 = document.getElementById('emailid'); var Obj2 = document.getElementById('password'); if(Obj1.value == "" || Obj2.value == ""){ msg = "Following fields are empty:\n"; if (Obj1.value == "") msg += " Email\n"; if (Obj2.value == "") msg += " Password"; alert(msg); return false; }else{ return true; } } function moveTop(){ filmObj = document.getElementById('film'); var filmContObj = document.getElementById('filmcontainer'); var contTop = findPosY(filmContObj); divTop = parseInt(divTop-25); filmObj.style.top = divTop + "px"; var childBottom = findPosY(filmObj.firstChild) + filmObj.firstChild.offsetHeight; // alert(findPosY(filmObj.firstChild) + "===" + filmObj.firstChild.offsetHeight); if(childBottom < findPosY(filmContObj)) { var childH = filmObj.firstChild.offsetHeight; filmObj.appendChild(filmObj.firstChild); filmObj.style.top = '0px'; divTop = 0; } } function showmailResponse(data){ var newData = data; var divObj = document.getElementById('mainConDiv'); while(newData.indexOf('##EQUAL##') > 0){ newData = decodeStr(newData); } divObj.innerHTML = newData; } function sendmail(){ var frmObj = document.form_forgotPass; var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "EmailUser"; ajaxVar.vars['from'] = "Locale "; ajaxVar.vars['to'] = frmObj.email.value; // ajaxVar.vars['to'] = "swati@lizard.sapna"; ajaxVar.gotoFunction = 'showmailResponse'; ajaxVar.AjaxPostSQL(); } function validate_changepassword(){ var frmObj = document.form_forgotPass; var errmsg = ""; if(frmObj.email.value==""){ errmsg += "Email\n"; }else if (!checkEmail(frmObj.email.value)){ errmsg += "Invalid Email Address\n"; } if(errmsg){ msg = "Following fields are empty or not entered correctly:"; alert(msg + '\n\n' + errmsg); }else{ sendmail(); } return false; } function postionOptionsDrop(optDiv, refDiv){ //optDiv---This is the list of the options DIV //refDiv---This is used as reference for positioning var optDivObj = document.getElementById(optDiv); var refDivObj = document.getElementById(refDiv); optDivObj.style.visibility = 'visible'; optDivObj.style.display = 'block'; var posX = findPosX(refDivObj); var posY = findPosY(refDivObj); optDivObj.style.left = parseInt(posX + 0) + 'px'; optDivObj.style.top = parseInt(posY + 18) + 'px'; } function showHideDropDownDivs(mainID,userVal,selVal){ var mainIDObj = document.getElementById(mainID); if(userVal==selVal){ mainIDObj.style.visibility = 'visible'; mainIDObj.style.display = 'block'; }else{ mainIDObj.firstChild.value = ""; mainIDObj.style.visibility = 'hidden'; mainIDObj.style.display = 'none'; } } function setOptionsValue(dropListOpt,selectOptDiv,radioButton,radioVal,dropList,callUserFunc){ var selectOptDivObj = document.getElementById(selectOptDiv); var radioButtonObj = document.getElementById(radioButton); var dropListObj = document.getElementById(dropList); selectOptDivObj.value = dropListOpt; radioButtonObj.value = radioVal; if(callUserFunc!=0){ eval(callUserFunc.replace(/##USERVAL##/g,radioVal)+";"); } } function hidingDropDowns(dropID){ if(document.getElementById(dropID).hideNow) { document.getElementById(dropID).style.visibility='hidden'; } } function setDropFocus(listID,event){ var listObj = document.getElementById(listID); var totLen = listObj.childNodes.length; var searchKey = String.fromCharCode(event.keyCode); if(!listObj.prevKey){ listObj.prevKey=""; } if(!listObj.useKey){ listObj.useKey=0; } //alert(listObj.childNodes[0].firstChild); switch(event.keyCode){ case 40: if(listObj.useKey < totLen){ listObj.childNodes[listObj.useKey].firstChild.focus(); listObj.childNodes[listObj.useKey].firstChild.className = 'dropSelectOver'; for(var i=0;i=0){ if(listObj.useKey > 0){ listObj.useKey--; } listObj.childNodes[listObj.useKey].firstChild.focus(); listObj.childNodes[listObj.useKey].firstChild.className = 'dropSelectOver'; for(var i=0;i= 65 && event.keyCode <=90){ if(listObj.prevKey!=searchKey){ listObj.firstKey=-1; } for(var i=0;i 59) { minutes = minutes % 60; // increment the hour hour++; if(hour > 23) { // increment the day day++; // set the hour to midnight hour = 0; } } var month = currentDate.getMonth(); var day = currentDate.getDate(); var year = currentDate.getFullYear(); var monthList = new Array(12); monthList[0]="Jan"; monthList[1]="Feb"; monthList[2]="Mar"; monthList[3]="Apr"; monthList[4]="May"; monthList[5]="Jun"; monthList[6]="Jul"; monthList[7]="Aug"; monthList[8]="Sep"; monthList[9]="Oct"; monthList[10]="Nov"; monthList[11]="Dec"; var displayMonthsText = new Array(3); var displayMonthsNumber = new Array(3); var followingYear = year+1; switch(month) { case 10: displayMonthsText[0] = monthList[month]+" "+year; displayMonthsText[1] = monthList[month+1]+" "+year; displayMonthsText[2] = monthList[0]+" "+followingYear; var month2 = month+1; var month3 = month+2; displayMonthsNumber[0] = month2+""+year; displayMonthsNumber[1] = month3+""+year; displayMonthsNumber[2] = "01"+followingYear; break; case 11: displayMonthsText[0] = monthList[month]+" "+year; displayMonthsText[1] = monthList[0]+" "+followingYear; displayMonthsText[2] = monthList[1]+" "+followingYear; var currentMonth = month+1; displayMonthsNumber[0] = currentMonth+""+year; displayMonthsNumber[1] = "01"+followingYear; displayMonthsNumber[2] = "02"+followingYear; break; default: var month2 = month+1; var month3 = month+2; var month4 = month+3; displayMonthsText[0] = monthList[month]+" "+year; displayMonthsText[1] = monthList[month2]+" "+year; displayMonthsText[2] = monthList[month3]+" "+year; displayMonthsNumber[0] = ""+month2+year; displayMonthsNumber[1] = ""+month3+year; displayMonthsNumber[2] = ""+month4+year; break; } // Get a reference to the drop-down var hourDropDownList = document.getElementById("timeHours"); var minutesDropDownList = document.getElementById("timeMinutes"); var daysDropDownList = document.getElementById("dateTimeDay"); var monthsDropDownList = document.getElementById("dateTimeMonth"); // Loop through hours for (i = 0; i< hourDropDownList.options.length; i++) { if (hourDropDownList.options[i].value == hour) { hourDropDownList.options[i].selected = true; break; } } // Loop through minutes for (k = 0; k< minutesDropDownList.options.length; k++) { if (minutesDropDownList.options[k].value == minutes) { minutesDropDownList.options[k].selected = true; break; } } // Loop through days for (m = 0; m< daysDropDownList.options.length; m++) { if (daysDropDownList.options[m].value == day) { daysDropDownList.options[m].selected = true; break; } } // Loop through months for (n = 0; n< displayMonthsText.length; n++) { //name, value e.g. ("May 2006", "052006") monthsDropDownList.options[n]=new Option(displayMonthsText[n], displayMonthsNumber[n]); } // set current month (the first item in the array) as the selected item monthsDropDownList.selectedIndex = 0; } function AssembleParameters() { var inputText = document.getElementById("txtOrigin").value; var outputText = document.getElementById("txtDestination").value; //set the date and time document.getElementById("departureDate").value = GetDate("dateTimeDay","dateTimeMonth"); document.getElementById("departureTime").value = GetTime("timeHours","timeMinutes"); if(document.getElementById("returnDate")){ document.getElementById("returnDate").value = GetDate("RdateTimeDay","RdateTimeMonth"); document.getElementById("returnTime").value = GetTime("RtimeHours","RtimeMinutes"); } // destination is the entered postcode document.getElementById("destinationData").value = outputText; document.getElementById("destinationName").value = outputText; document.getElementById("destinationType").value = "p"; // origin is the entered postcode document.getElementById("originData").value = inputText; document.getElementById("originType").value = "p"; document.getElementById("originName").value = inputText; } function GetTime(hr,mn) { var hour = document.getElementById(hr).options[document.getElementById(hr).selectedIndex].value; var min = document.getElementById(mn).options[document.getElementById(mn).selectedIndex].value; return hour+""+min; } function GetDate(dy,mt) { var day = document.getElementById(dy).options[document.getElementById(dy).selectedIndex].value; var monthYear = document.getElementById(mt).options[document.getElementById(mt).selectedIndex].value; return day+""+monthYear; } function changeTabOut(did){ var tabTopObj = document.getElementById(did + '_topDiv'); var tabMidObj = document.getElementById(did + '_midDiv'); var tabBotObj = document.getElementById(did + '_botDiv'); var tabName = tabMidObj.innerHTML; if(tabMidObj.className != "tabtext txtbgnorm"){ if(tabName.length > 20){ // if((tabName.length > 20) || (tabName.indexOf("
") >= 0)){ tabTopObj.className = 'tableftact theight'; tabMidObj.className = 'tabtext txtbgact'; tabBotObj.className = 'tabrightact theight'; }else{ tabTopObj.className = 'tableftact sheight'; tabMidObj.className = 'tabtext txtbgact'; tabBotObj.className = 'tabrightact sheight'; } } } function changeTabOver(did){ var tabTopObj = document.getElementById(did + '_topDiv'); var tabMidObj = document.getElementById(did + '_midDiv'); var tabBotObj = document.getElementById(did + '_botDiv'); var tabName = tabMidObj.innerHTML; if(tabMidObj.className != "tabtext txtbgnorm"){ if(tabName.length > 20){ // if((tabName.length > 20) || (tabName.indexOf("
") >= 0)){ tabTopObj.className = 'tablefthov theight'; tabMidObj.className = 'tabtext txtbghov'; tabBotObj.className = 'tabrighthov theight'; }else{ tabTopObj.className = 'tablefthov sheight'; tabMidObj.className = 'tabtext txtbghov'; tabBotObj.className = 'tabrighthov sheight'; } } } function bookmarksite(title,url){ if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ""); else if(window.opera && window.print){ // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all)// ie window.external.AddFavorite(url, title); } function showHideCaretaker(id, chekforFm){ var divObj = document.getElementById(id); if(divObj){ if((chekforFm == 1 || chekforFm == 2) && document.getElementById('fm_user').checked == true){ divObj.style.visibility = "visible"; divObj.style.display = "block"; }else{ divObj.style.visibility = "hidden"; divObj.style.display = "none"; } } } function submitSearch(){ document.listing_frm.submit(); } function populatePark(formName, field, hideGlobal){ var frmObj = eval('document.' + formName); var RegionId = eval('frmObj.' + field + '.value'); var ParkId = eval('frmObj.' + 'park_id'); var ParkIdVal = eval('frmObj.park_id.value'); var parkData = new Array(); parkData['global'] = new Array(); parkData['global']['id'] = new Array(); parkData['global']['name'] = new Array(); parkData['global']['id'][0] = 'global'; parkData['global']['name'][0] = 'Global'; for(var i = 0; i