var mnuIcon = new Image(); var SpacerIcon = new Image(); mnuIcon.src = "/proimages/mnuIcon.gif"; SpacerIcon.src = "/proimages/spacer.gif"; var CheckMenu = 0; function onChangeLoadColor(id) { alert(document.getElementById('menutd_' + id)) } function isArray(obj) { if (obj.constructor.toString().indexOf('Array') == -1) return false; else return true; } function onChangeLoadImg(id) { document.getElementById('mnuIcon_' + id).src = mnuIcon.src; } function onChangeLoadOutImg(id) { document.getElementById('mnuIcon_' + id).src = SpacerIcon.src; } function ChangeImage(id) { document.getElementById('mnuIcon_' + id).src = mnuIcon.src; } function showHideDiv(id,status){ var divObj = document.getElementById(id); if(divObj) { if (status){ if (status == '1'){ divObj.className = 'visible'; }else if (status == '0'){ divObj.className = 'hidden'; } }else{ if (divObj.className.indexOf('visible') > -1){ divObj.className = 'hidden'; }else{ divObj.className = 'visible'; } } } } function checkNum(Obj){ if(isNaN(Obj.value)) { Obj.value = 20; } } function order(field, url){ url += "?"; url += "&order=" + field; location.href = url; } function changeOrder(idObj, move){ id = idObj.id.replace('a_', ''); var vals = id.split('_'); switch(move) { case "down": var nextOrder = parseInt(vals[vals.length - 1], 10); nextOrder++; var upperDivId = 'div_' + vals[0] + '_' + vals[1]; var lowerDivId = 'div_' + vals[0] + '_' + nextOrder; break; case "up": var prevOrder = parseInt(vals[vals.length - 1], 10); prevOrder--; var upperDivId = 'div_' + vals[0] + '_' + prevOrder; var lowerDivId = 'div_' + vals[0] + '_' + vals[1]; break; } var upperdivObj = document.getElementById(upperDivId); var lowerdivObj = document.getElementById(lowerDivId); if(upperdivObj) { var upperHTML = lowerdivObj.innerHTML;} if(lowerdivObj) { var lowerHTML = upperdivObj.innerHTML; } if(upperdivObj) { upperdivObj.innerHTML = upperHTML; } if(lowerdivObj) { lowerdivObj.innerHTML = lowerHTML; } } function openBrowse(check, divId) { divObj = document.getElementById('tbl_' + divId); fileObj = document.getElementById('imagefile_' + divId); if(check.checked) { divObj.style.visibility = "visible"; }else{ divObj.style.visibility = "hidden"; fileObj.value = ''; } } function changeOpac(opacity, obj) { obj.style.opacity = (opacity / 100); obj.style.MozOpacity = (opacity / 100); obj.style.KhtmlOpacity = (opacity / 100); obj.style.filter = "alpha(opacity=" + opacity + ")"; } function update_preview(obj, img_no, img_width, img_height) { // Delete off earlier cropping parameters. This is incase cropping values are saved // and then another image is uploaded store_coords(img_no, 1); div_obj = document.getElementById('previewimg_' + img_no); // Remove the old preview image if any if(div_obj.childNodes.length > 0) { div_obj.removeChild(div_obj.firstChild); } preview_img = new Image(); preview_img.src = obj.value; preview_img.name = "preview_image"; if (browser.isNS) preview_img.src = "file:///" + escape(preview_img.src.replace(/\\/g, "/")); org_width = preview_img.width; org_height = preview_img.height; // Check if image is smaller than prescribed width or height if(preview_img.width < img_width || preview_img.height < img_height) { return; } // find the ratio to understand we need to resize on width or height var previewratio = preview_img.width/preview_img.height; var imgratio = img_width/img_height; if (previewratio < imgratio) { // this means width is less derived_height = (img_width/preview_img.width)*preview_img.height; derived_height = parseInt(derived_height, 10); preview_img.height = derived_height; preview_img.style.height = derived_height; preview_img.width = img_width; preview_img.style.width = img_width; } else { // Get the derived width derived_width = (img_height/preview_img.height)*preview_img.width; derived_width = parseInt(derived_width, 10); preview_img.width = derived_width; preview_img.style.width = derived_width; preview_img.height = img_height; preview_img.style.height = img_height; } document.getElementById('previewtext_' + img_no).style.width = preview_img.width; // Set the scale factors vis-a-vis original and preview image. This is to scale the x and y positions before form submission document.getElementById('scalex_' + img_no).value = org_width/preview_img.width; document.getElementById('scaley_' + img_no).value = org_height/preview_img.height; // Make preview image visible document.getElementById('preview_' + img_no).style.visibility = "visible"; document.getElementById('preview_' + img_no).style.display = "block"; document.getElementById('previewimg_' + img_no).style.visibility = "visible"; document.getElementById('previewimg_' + img_no).style.display = "block"; div_obj.appendChild(preview_img); //div_obj.insertBefore(preview_img,div_obj.firstChild); // Make cropper tool visible. Put same image in cropper tool also div_obj = document.getElementById('cropbox_' + img_no); div_obj.style.visibility = "visible"; div_obj.style.display = "block"; div_obj.style.overflow = "hidden"; div_obj.innerHTML = ""; div_obj.style.left = findPosX(document.getElementById('previewimg_' + img_no)); div_obj.style.top = findPosY(document.getElementById('previewimg_' + img_no)); changeOpac(40, preview_img); } var browser = new Browser(); var dragObj = new Object(); var DivWidth = 380; var dragFlag = false; var dragStartFlag = false; function Browser() { var ua, s, i; this.isIE = false; this.isNS = false; this.version = null; ua = navigator.userAgent; s = "MSIE"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); return; } s = "Netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return; } s = "Gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = 6.1; return; } } function crop_dragStart(event, id) { current_image_crop_id = "previewimg" + id.substring(7,(id.length)); current_id = id.substring(7,(id.length)); if((dragStartFlag == false) && (dragFlag == false)) { dragStartFlag = true; var el; var x, y; if (id) { dragObj.elNode = document.getElementById(id); }else { if (browser.isIE) dragObj.elNode = window.event.srcElement; if (browser.isNS) dragObj.elNode = event.target; if (dragObj.elNode.nodeType == 3) dragObj.elNode = dragObj.elNode.parentNode; } if (browser.isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } if (browser.isNS) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY; } dragObj.cursorStartX = x; dragObj.cursorStartY = y; dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10); dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10); if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0; if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 0; dragObj.elNode.style.zIndex = ++dragObj.zIndex; if (browser.isIE) { document.attachEvent("onmousemove", crop_dragGo); document.attachEvent("onmouseup", crop_dragStop); window.event.cancelBubble = true; window.event.returnValue = false; } if (browser.isNS) { document.addEventListener("mousemove", crop_dragGo, true); document.addEventListener("mouseup", crop_dragStop, true); event.preventDefault(); } } } function crop_dragGo(event) { var x, y; if (browser.isIE) { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } if (browser.isNS) { x = event.clientX + window.scrollX; y = event.clientY + window.scrollY; } var current_drag_point_x = (dragObj.elStartLeft + x - dragObj.cursorStartX); var current_preview_image_x = findPosX(document.getElementById(current_image_crop_id)); var current_drag_point_y = (dragObj.elStartTop + y - dragObj.cursorStartY); var current_preview_image_y = findPosY(document.getElementById(current_image_crop_id)); var current_preview_image_width = preview_img.width; //document.getElementById('updatemsg').innerHTML = (current_drag_point_x + ", " + current_preview_image_x + "," + current_preview_image_width); if ( current_drag_point_x < current_preview_image_x) { dragObj.elNode.style.left = current_preview_image_x + "px"; } else if (current_drag_point_x >= (current_preview_image_x + current_preview_image_width - dragObj.elNode.offsetWidth)) { dragObj.elNode.style.left = current_preview_image_x + current_preview_image_width - dragObj.elNode.offsetWidth; } else { dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px"; } if ((dragObj.elStartTop + y - dragObj.cursorStartY) <= findPosY(document.getElementById(current_image_crop_id))) { dragObj.elNode.style.top = findPosY(document.getElementById(current_image_crop_id)) + "px"; } else if ((dragObj.elStartTop + y - dragObj.cursorStartY) >= (findPosY(document.getElementById(current_image_crop_id)) + document.getElementById(current_image_crop_id).offsetHeight) - dragObj.elNode.offsetHeight) { dragObj.elNode.style.top = (findPosY(document.getElementById(current_image_crop_id)) + document.getElementById(current_image_crop_id).offsetHeight - dragObj.elNode.offsetHeight); } else { dragObj.elNode.style.top = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px"; } img_obj = document.getElementById('crop_img'); cur_left = dragObj.elNode.style.left.replace("px", ""); cur_left = parseInt(cur_left, 10); cur_left = parseInt(current_preview_image_x) - cur_left; cur_top = dragObj.elNode.style.top.replace("px", ""); cur_top = parseInt(cur_top, 10); cur_top = parseInt(current_preview_image_y) - cur_top; img_obj.style.marginLeft = cur_left + "px"; img_obj.style.marginTop = cur_top + "px"; if (browser.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; } if (browser.isNS) event.preventDefault(); } function crop_dragStop(event) { dragStartFlag = false; if (browser.isIE) { document.detachEvent("onmousemove", crop_dragGo); document.detachEvent("onmouseup", crop_dragStop); } if (browser.isNS) { document.removeEventListener("mousemove", crop_dragGo, true); document.removeEventListener("mouseup", crop_dragStop, true); } } function store_coords(ref_no, reset) { if(reset == 1) { document.getElementById('x_' + ref_no).value = ''; document.getElementById('y_' + ref_no).value = ''; return; } cropObj = document.getElementById('cropbox_' + ref_no); preObj = document.getElementById('previewimg_' + ref_no); x_position = (findPosX(cropObj) - findPosX(preObj))*document.getElementById('scalex_' + ref_no).value; y_position = (findPosY(cropObj) - findPosY(preObj) - 0)*document.getElementById('scaley_' + ref_no).value; document.getElementById('x_' + ref_no).value = parseInt(x_position, 10); document.getElementById('y_' + ref_no).value = parseInt(y_position, 10); hide_preview(ref_no); } function hide_preview(ref_no) { cropObj = document.getElementById('cropbox_' + ref_no); preObj = document.getElementById('preview_' + ref_no); // Close the preview window cropObj.style.visibility = "hidden"; cropObj.style.display = "none"; preObj.style.visibility = "hidden"; preObj.style.display = "none"; // reset the x and y co-ordinates to '' so that it does not crop } function unset_coords(ref_no) { document.getElementById('x_' + ref_no).value = ''; document.getElementById('y_' + ref_no).value = ''; hide_preview(ref_no); } function findPosX(obj) { var curleft = 0; 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.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) { curtop += obj.y; } return curtop; } function changeBgOver(tid){ tid.className = "naviBgOver"; } function changeBgOut(tid){ tid.className = "naviBgOut"; } function showPostCodeSearch(drpObj){ if (drpObj){ var ctry_id = drpObj.options[drpObj.selectedIndex].value; var searchBox = document.getElementById('postCodeDiv'); var retDivObj = document.getElementById('retailerDiv'); var frameObj = document.getElementById("newsFrame"); if (document.getElementById('lnavi_maindiv').offsetHeight >= 400){ frameObj.style.height = (document.getElementById('lnavi_maindiv').offsetHeight - 190) + "px"; } if (ctry_id == 0){ // 0- none // hide the ratailer div retDivObj.className = 'hidden'; searchBox.className = 'hidden'; }else if (ctry_id == 1){ // 1 - german searchBox.className = 'leftClass visible'; // hide the ratailer div retDivObj.className = 'hidden'; }else{ searchBox.className = 'hidden'; getCountryRetailers(1); } } } function getCountryRetailers(ps){ var retDivObj = document.getElementById('retailerDiv'); retDivObj.className = 'visible leftClass plainText'; retDivObj.innerHTML = "Loading... please wait."; var pcInputObj = document.getElementById('postcode'); var conObj = document.getElementById('cid'); var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "getretailers"; ajaxVar.vars['con_id'] = conObj.options[conObj.selectedIndex].value; if ((pcInputObj.value) && (ps != 1)){ ajaxVar.vars['postc'] = pcInputObj.value + ' '; } ajaxVar.vars['nosplit'] = 1; ajaxVar.gotoFunction = 'displayRetailers'; ajaxVar.AjaxPostSQL(); } function displayRetailers(data){ var retDivObj = document.getElementById('retailerDiv'); retDivObj.innerHTML = data; retDivObj.innerHTML = replaceSpecialChars(retDivObj.innerHTML); var frameObj = document.getElementById("newsFrame"); if (document.getElementById('retailerOuterDiv').offsetHeight >= 400){ frameObj.style.height = (document.getElementById('retailerOuterDiv').offsetHeight - 170) + "px"; }else { var leftHeight = document.getElementById('lnavi_maindiv').offsetHeight; var video_div = document.getElementById('video_div'); if ((video_div) && (video_div.className == 'visible')){ if ( (frameObj.offsetHeight > leftHeight) || (frameObj.offsetHeight < leftHeight)) { frameObj.style.height = (leftHeight - 170) + "px"; } }else{ if (frameObj.offsetHeight > leftHeight){ frameObj.style.height = (leftHeight -20) + "px"; } } } } function newsFrameHeight(){ var frameObj = document.getElementById("newsFrame"); var bodyDivObj = document.getElementById('outerBodyDiv'); if ( (bodyDivObj) && (frameObj)){ frameObj.style.height = (bodyDivObj.offsetHeight - 40 ) + "px"; } } function validate_contact(type){ var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "getMandArr"; ajaxVar.vars['type'] = type; ajaxVar.vars['nosplit'] = 1; ajaxVar.gotoFunction = 'validate_form'; ajaxVar.AjaxPostSQL(); } fieldNames = new Array(); fieldTypes = new Array(); fieldMand = new Array(); function validate_form(data){ if (data){ fields = data.split('#FEND#'); if (fields.length > 0){ for (i=0; i < (fields.length - 1); i++){ fieldSplit1 = fields[i].split('#T#'); for(j=0; j< fieldSplit1.length; j++){ fieldSplit2 = fieldSplit1[j].split('#M#'); //alert(fieldSplit2[0] + "==" + fieldSplit2[1]); } fieldNames[i] = fieldSplit1[0]; fieldTypes[i] = fieldSplit2[0]; fieldMand[i] = fieldSplit2[1]; } } } if(fieldNames.length > 0){ var objVar = new getObjVars(); for(i in fieldNames){ if(fieldMand[i] != ""){ objVar.fieldN[i] = fieldNames[i]; objVar.fieldV[i] = fieldMand[i]; objVar.fieldT[i] = "text"; objVar.fieldI[i] = fieldNames[i]; } } if (validateForm('contact_us',objVar)){ document.contact_us.submit(); } } } // functions to be used on the sitemap page function linkHover(imgId,imgName){ var imgObj = document.getElementById('img_' + imgId ); if (imgObj){ imgObj.src = imgName; } if (document.getElementById('link_' + imgId )){ document.getElementById('link_' + imgId ).style.color = '#ee7f01'; document.getElementById('link_' + imgId ).style.textDecoration = 'none'; document.getElementById('link_' + imgId ).style.fontFamily = 'Arial,Trebuchet MS'; } } function linkOut(imgId,imgName,colorFlag){ var imgObj = document.getElementById('img_' + imgId ); if (imgObj){ imgObj.src = imgName; } if (document.getElementById('link_' + imgId )){ document.getElementById('link_' + imgId ).style.color = (colorFlag == 1) ? '#000000' : '#000000'; document.getElementById('link_' + imgId ).style.textDecoration = 'none'; document.getElementById('link_' + imgId ).style.fontFamily = ''; } } function replaceSpecialChars(str){ str = str.replace(/ZZZ/g, "ž"); str = str.replace(/SSS/g, "š"); return str; } function showGlossary(keyVal,onSearch){ var charKey = keyVal = (trim(keyVal)=="")?"A":keyVal; keyVal = keyVal.replace(/Ä/i, "Ä"); keyVal = keyVal.replace(/Ü/i, "Ü"); keyVal = keyVal.replace(/Ö/i, "Ö"); keyVal = keyVal.replace(/ä/i, "ä"); keyVal = keyVal.replace(/ü/i, "ü"); keyVal = keyVal.replace(/ö/i, "ö"); charKey = charKey.replace(/Ä/i, "Ae"); charKey = charKey.replace(/Ü/i, "Ue;"); charKey = charKey.replace(/Ö/i, "Oe;"); charKey = charKey.replace(/ä/i, "Ae;"); charKey = charKey.replace(/ü/i, "Ue"); charKey = charKey.replace(/ö/i, "Oe"); var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = "showGlossary"; ajaxVar.vars['keyVal'] = keyVal; ajaxVar.fnVars['keyVal'] = charKey; ajaxVar.vars['nosplit'] = 1; if(onSearch){ ajaxVar.fnVars['onSearch'] = onSearch; } ajaxVar.vars['ajaxCharset'] = 'iso-8859-1'; ajaxVar.gotoFunction = 'listGlossary'; ajaxVar.AjaxPostSQL(); } function listGlossary(dataArr,fnVars){ if(fnVars['onSearch']){ var keyVal = fnVars['keyVal'].toUpperCase(); ; var charKey = keyVal.charCodeAt(0); changeColor(charKey); } var dt = new Date(); var grpDesc = dt.getTime() + dt.getSeconds(); document.getElementById('contentDiv').innerHTML = dataArr; var divIdsTxtArr = document.getElementsByName('divIdsTxt[]'); var cnt = divIdsTxtArr.length; for(var i=0;i