var tabPos = new Array(); function fixTabPos(){ for(key in tabPos){ if(tabPos[key]) { tabPos[key].parentNode.firstChild.style.top = findPosY(tabPos[key]) + 'px'; } } } 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, prodID,numDiv, preView,langID) { var divObj = document.getElementById(divid); var tabObj = document.getElementById(key + '_btn'); for(var i=0; i 1) { thisObj.removeChild(thisObj.firstChild); thisObj.firstChild.className = "tabText"; } } } if(tabInfoObj.innerHTML == '' || tabInfoObj.innerHTML == 'Searching for the latest local information...' || tabInfoObj.innerHTML.indexOf('Error:') >= 0) { tabInfoObj.innerHTML = 'Displaying data kindly wait...'; switch(key) { case "map": break; default: var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "fetch_catdata"; ajaxVar.gotoFunction = 'indexData'; ajaxVar.fnVars['divId'] = key; ajaxVar.vars['scase'] = key; ajaxVar.vars['pid'] = prodID; ajaxVar.vars['preview'] = preView; ajaxVar.vars['lang_id'] = langID; ajaxVar.phpFile = "../includes/ajax.files.php"; ajaxVar.AjaxPostSQL(); break; } } fixTabPos(); var infoHeight = tabInfoObj.offsetHeight + 10; if(tabInfoObj.id == 'map') { infoHeight = 200; } infoHeight = (infoHeight < 150) ? 150 : infoHeight; tabInfoObj.parentNode.style.height = infoHeight + 'px'; } function fillDivTest(key, divid, prodID,numDiv, preView,langID) { var divObj = document.getElementById(divid); var tabObj = document.getElementById(key + '_btn'); for(var i=0; i 1) { thisObj.removeChild(thisObj.firstChild); thisObj.firstChild.className = "tabText"; } } } if(tabInfoObj.innerHTML == '' || tabInfoObj.innerHTML == 'Searching for the latest local information...' || tabInfoObj.innerHTML.indexOf('Error:') >= 0) { tabInfoObj.innerHTML = 'Displaying data kindly wait...'; switch(key) { case "map": break; default: var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "fetch_catdata"; ajaxVar.gotoFunction = 'indexData'; ajaxVar.fnVars['divId'] = key; ajaxVar.vars['scase'] = key; ajaxVar.vars['pid'] = prodID; ajaxVar.vars['preview'] = preView; ajaxVar.vars['lang_id'] = langID; ajaxVar.phpFile = "../includes/ajax.files.php"; ajaxVar.AjaxPostSQL(); break; } } fixTabPos(); var infoHeight = tabInfoObj.offsetHeight + 10; if(tabInfoObj.id == 'map') { infoHeight = 200; } infoHeight = (infoHeight < 150) ? 150 : infoHeight; tabInfoObj.parentNode.style.height = infoHeight + 'px'; } function indexData(data, fnVars) { var divObj = document.getElementById(fnVars['divId']); var tempData = data; while(tempData.indexOf('##EQUAL##') > 0){ tempData = tempData.replace(/##EQUAL##/gi,"="); } while(tempData.indexOf('##AMP##') > -1){ tempData = tempData.replace(/##AMP##/gi,"&"); } divObj.innerHTML = tempData; var infoHeight = divObj.offsetHeight + 10; infoHeight = (infoHeight < 150) ? 150 : infoHeight; divObj.parentNode.style.height = infoHeight + 'px'; fixTabPos(); } function gen_formURL(){ var obj = document.getElementById('conselect').options[document.getElementById('conselect').selectedIndex].value; location.href = obj; } function gotowtb_page1(chkpostcode,langId){ var conObj = document.getElementById("con_id"); var conID = conObj.options[document.getElementById("con_id").selectedIndex].value; var postcodeObj = document.getElementById("postcode"); var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "wtbDefault"; ajaxVar.vars['func'] = 'wtb_' + chkpostcode; ajaxVar.vars['con_id'] = conID; ajaxVar.vars['lang_id'] = langId; if ( (chkpostcode == 1) && (postcodeObj) && (postcodeObj.value != 'Postcode' )){ ajaxVar.vars['postcode'] = postcodeObj.value; } ajaxVar.gotoFunction = 'wtb'; ajaxVar.phpFile = "/index/goto_wtb_view.php"; } function gotowtb_page(chkpostcode,langId){ var ajaxVar = new ajaxVars(); var conObj = document.getElementById("con_id"); var conID = conObj.options[document.getElementById("con_id").selectedIndex].value; var postcodeObj = document.getElementById("postcode"); //alert(chkpostcode + "==" + postcodeObj + "==" + postcodeObj.value); if ( (chkpostcode == 1) && (postcodeObj) && (postcodeObj.value != 'Postcode' )){ ajaxVar.vars['postcode'] = postcodeObj.value; } if (chkpostcode == 2){ if ( (postcodeObj) && (postcodeObj.value != 'Postcode' )) { ajaxVar.vars['postcode'] = postcodeObj.value; } var prodObj = document.getElementById("prod_drp"); //var prodID = prodObj.options[prodObj.selectedIndex].value; ajaxVar.vars['wtbpid'] = prodObj.value; } if (chkpostcode == 0){ var prodObj = document.getElementById("prod_drp"); if (prodObj){ ajaxVar.vars['wtbpid'] = prodObj.value; } } rangeVal = ""; var selstoresObj = document.getElementById("only_selectedstores"); if (selstoresObj){ if(selstoresObj.checked){ ajaxVar.vars['selstores'] = 1; }else{ ajaxVar.vars['selstores'] = 0; } } ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "wtb_p"; ajaxVar.gotoFunction = 'wtb'; ajaxVar.vars['con_id'] = conID; ajaxVar.vars['lang_id'] = langId; ajaxVar.vars['range'] = rangeVal; ajaxVar.vars['checkcase'] = 'wtb_' + chkpostcode; ajaxVar.phpFile = "../includes/ajax.files.php"; ajaxVar.AjaxPostSQL(); } function wtb(data,fnVars){ data = data.replace(/##AND##/gi,"&"); data = data.replace(/##EQUAL##/gi,"="); data = data.replace(/##QUESTION##/gi,"?"); data = data.replace(/##PERCENT##/gi,"%"); location.href = data; } function showCatData(date,lang_id){ var ajaxVar = new ajaxVars(); var divObj = document.getElementById('catdata'); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "fetch_catdata"; ajaxVar.gotoFunction = 'returnCatData'; ajaxVar.phpFile = "../includes/ajax.files.php"; divObj.innerHTML = "
Loading data please wait.."; ajaxVar.AjaxPostSQL(); } function returnCatData(data){ var newData = data; var divObj = document.getElementById('catdata'); while(newData.indexOf('##EQUAL##') > 0){ newData = newData.replace(/##EQUAL##/gi,"="); } divObj.innerHTML = newData; } function initialLoad(key, divid, prodID,numDiv, preView,langID){ var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "indexDefault"; ajaxVar.vars['func'] = key; ajaxVar.vars['pid'] = prodID; ajaxVar.vars['preview'] = preView; ajaxVar.vars['lang_id'] = langID; ajaxVar.fnVars['divId'] = divid; ajaxVar.gotoFunction = 'indexDataInital'; ajaxVar.phpFile = '/index/indexDiv.php'; ajaxVar.AjaxPostSQL(); } function indexDataInital(data, fnVars) { var divObj = document.getElementById(fnVars['divId']); var tempData = data; while(tempData.indexOf('##EQUAL##') > 0){ tempData = tempData.replace(/##EQUAL##/gi,"="); } while(tempData.indexOf('##AMP##') > -1){ tempData = tempData.replace(/##AMP##/gi,"&"); } divObj.innerHTML = tempData; var infoHeight = divObj.offsetHeight + 10; infoHeight = (infoHeight < 150) ? 150 : infoHeight; divObj.parentNode.style.height = infoHeight + 'px'; fixTabPos(); } function fillTabDiv(key, divid, prodID,numDiv, preView,langID) { var divObj = document.getElementById(divid); var tabObj = document.getElementById(key + '_btne'); for(var i=0; i 0){ tempData = tempData.replace(/##EQUAL##/gi,"="); } while(tempData.indexOf('##AMP##') > -1){ tempData = tempData.replace(/##AMP##/gi,"&"); } divObj.innerHTML = tempData; } function gotowtb_page_demo(chkpostcode,langId){ var ajaxVar = new ajaxVars(); var conObj = document.getElementById("con_id"); var conID = conObj.options[document.getElementById("con_id").selectedIndex].value; var postcodeObj = document.getElementById("postcode"); //alert(chkpostcode + "==" + postcodeObj + "==" + postcodeObj.value); if ( (chkpostcode == 1) && (postcodeObj) && (postcodeObj.value != 'Postcode' )){ ajaxVar.vars['postcode'] = postcodeObj.value; } if (chkpostcode == 2){ if ( (postcodeObj) && (postcodeObj.value != 'Postcode' )) { ajaxVar.vars['postcode'] = postcodeObj.value; } var prodObj = document.getElementById("prod_drp"); //var prodID = prodObj.options[prodObj.selectedIndex].value; ajaxVar.vars['wtbpid'] = prodObj.value; } if (chkpostcode == 0){ var prodObj = document.getElementById("prod_drp"); if (prodObj){ ajaxVar.vars['wtbpid'] = prodObj.value; } } ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "wtb_p_demo"; ajaxVar.gotoFunction = 'wtb'; ajaxVar.vars['con_id'] = conID; ajaxVar.vars['lang_id'] = langId; ajaxVar.vars['checkcase'] = 'wtb_' + chkpostcode; ajaxVar.phpFile = "../includes/ajax.files.php"; ajaxVar.AjaxPostSQL(); } function getHelpData(imgId, divId){ imgObj = document.getElementById(imgId); var posX = findPosX(imgObj); var posY = findPosY(imgObj); var divToolTipObj = document.getElementById(divId); divToolTipObj.style.left = (posX - 302)+ 'px' divToolTipObj.style.top = (posY + 4) + 'px' divToolTipObj.style.visibility = 'visible'; divToolTipObj.style.display = 'block'; } function HideHelp(divId){ var divToolTipObj = document.getElementById(divId); divToolTipObj.style.visibility = 'hidden'; divToolTipObj.style.display = 'none'; } function deleteVariant(cat_id,dropdown_no,option_no,btnObj,langId){ var bstatus = 0; if ( (btnObj) && (btnObj.src.indexOf('inactive') > 0)) { bstatus = 1; } if ( (cat_id > 0) && (dropdown_no > 0) && (option_no > 0)) { var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "del_variant"; ajaxVar.gotoFunction = 'afterDeleteVariant'; ajaxVar.vars['catId'] = cat_id; ajaxVar.vars['status'] = bstatus; ajaxVar.vars['dropdownNo'] = dropdown_no; ajaxVar.vars['optionNo'] = option_no; if (langId){ ajaxVar.vars['langId'] = langId; } ajaxVar.fnVars['var_btnObj'] = btnObj; ajaxVar.fnVars['status'] = bstatus; ajaxVar.phpFile = "../inc/ajax.files.php"; ajaxVar.AjaxPostSQL(); } } function afterDeleteVariant(data,fnVars){ if (fnVars['var_btnObj']){ if (fnVars['status'] == 1){ fnVars['var_btnObj'].src = '../images/active.gif'; }else{ fnVars['var_btnObj'].src = '../images/inactive.gif'; } } }