function openVideosTab() { if (productInfoTabs) { return productInfoTabs.changeTab(productInfoTabs.tabsArr[2]); } if (document.readyState === "complete" || document.readyState === "interactive") { return false; } setTimeout(openVideosTab, 1000); } function subscribeModal() { thisBumbleBox = new bumbleBox('/?page_type=form&form=mailinglist', 'Subscribe to our mailing list', '500px', 'auto', 'ajax'); thisBumbleBox.show(); } function addToWishlist() { document.getElementById('shop_wishlist_toggle').value='1'; document.getElementById('product_form').submit(); return false; } function productOptionPop(pid, title) { thisBumbleBox = new bumbleBox('/?page_type=shop_option_details&pid=' + pid, title, '500px', 'auto', 'ajax'); thisBumbleBox.show(); } function checkExtrasFinance() { const optionsSelect = $('select[name=xtra_val_1]'); if (optionsSelect.length > 0) { $('input[name=xtra_val_1]').val(optionsSelect.val()); return true; } else { if ($('#has_extras').val() == '1') { var pid = $("[id^=shop_product_additem_]").val(); thisBumbleBox = new bumbleBox('/?page_type=shop_option_alert_modal_new&finance=1&pid=' + pid, 'Like to add any optional extras?', '600px', 'auto', 'ajax'); thisBumbleBox.show(); return false; } } return true; } function extrasImage(anchor) { const img = anchor.href; const width = anchor.getAttribute('data-width'); const height = anchor.getAttribute('data-height'); const title = anchor.getAttribute('data-title'); const maxWidth = window.innerWidth - 100; const maxHeight = window.innerHeight - 100; let displayWidth = width > maxWidth ? maxWidth : width; let displayHeight = parseInt((height / width) * displayWidth); if (displayHeight > maxHeight) { displayHeight = maxHeight; displayWidth = parseInt((width / height) * displayHeight); } displayHeight += 70; const bbox = new bumbleBox(img, title, displayWidth + 'px', displayHeight + 'px', 'image'); bbox.show(); } function checkExtrasNew() { const optionsSelect = $('select[name=xtra_val_1]'); if (optionsSelect.length > 0) { $('input[name=xtra_val_1]').val(optionsSelect.val()); return true; } else { var extraChecked = $('#extra_in_cart').val() == '1' ? true : false; if (!extraChecked && $('#has_extras').val() == '1') { var pid = $("[id^=shop_product_additem_]").val(); thisBumbleBox = new bumbleBox('/?page_type=shop_option_alert_modal_new&pid=' + pid, 'Like to add any optional extras?', '600px', 'auto', 'ajax'); thisBumbleBox.show(); return false; } } return true; } function addExtrasFromPopup() { let extrasDelim = ''; const extrasInput = $('[id^=shop_product_addextras_]'); $("[id^=product_popup_options_check_]").each(function() { if(this.checked) { extrasDelim += this.value + ','; } }); extrasInput.val(extrasDelim); setTimeout(function() { $('#product_form').submit(); }, 100); } function extrasTotal() { const totalEl = $('#total_inc_extras'); let total = parseFloat(totalEl.attr('data-total')); let label = $('.finance_description')[0].getAttribute('data-label'); $('.product_popup_options_option:checked').each(function() { total += parseFloat($(this).attr('data-value')); label += ' + ' + $(this).attr('data-label'); }); console.log('total = ' + total); totalEl.text(total.toFixed(2)); $('#finance_price').text(total.toFixed(2)); $('.finance_total_price').val(total.toFixed(2)); $('.finance_description').val(label); updateFinanceCalc(); } function checkBasketForParent() { if ($('#parent_in_cart').val() != 1) { const warning = $('.shop_option_add_warning'); warning.addClass('active'); setTimeout(function() { warning.removeClass('active'); }, 2000); return false; } return true; } $(document).ready(function() { setTimeout(function() { $('.product_added').removeClass('active'); }, 2000); }); function updateFinanceDeposit() { var aprSelect = document.getElementById('finance_select_month').value; var aprSelectParts = aprSelect.split('_'); var months = parseFloat(aprSelectParts[0]); if (months == 18) var changeDeposit = 10; else var changeDeposit = 10; document.getElementById('finance_deposit_percent').value = changeDeposit; document.getElementById('finance_deposit_range').setAttribute('min', aprSelectParts[2]); document.getElementById('finance_deposit_range').value=changeDeposit; updateFinanceCalc(); } function updateFinanceCalc() { var aprSelect = document.getElementById('finance_select_month').value; var aprSelectParts = aprSelect.split('_'); var months = parseFloat(aprSelectParts[0]); var apr = parseFloat(aprSelectParts[1]); var depositPercent = parseFloat(document.getElementById('finance_deposit_percent').value); var amount = parseFloat(document.getElementById('finance_price').innerHTML); var deposit = parseFloat((amount/100) * depositPercent); var amountMinusDeposit = amount - deposit; var interestRate = ((apr / 100) / 12); if (interestRate > 0) var monthlyPayment = parseFloat(amountMinusDeposit * interestRate * Math.pow(1+interestRate,months)) / (Math.pow(1+interestRate,months) -1); else var monthlyPayment = parseFloat(amountMinusDeposit / months); var totalPayable = (monthlyPayment * months) + deposit; document.getElementById('finance_deposit').innerHTML = deposit.toFixed(2); //document.getElementById('finance_months').innerHTML = months; document.getElementById('finance_months2').innerHTML = months; //document.getElementById('finance_apr').innerHTML = apr; document.getElementById('finance_deposit_percent').value = depositPercent; monthlyPayment = isNaN(monthlyPayment) ? 0 : monthlyPayment; document.getElementById('finance_payments').innerHTML = monthlyPayment.toFixed(2); document.getElementById('finance_payments2').innerHTML = monthlyPayment.toFixed(2); document.getElementById('finance_credit').innerHTML = amountMinusDeposit.toFixed(2); document.getElementById('finance_total_payable').innerHTML = totalPayable.toFixed(2); document.getElementById('finance_page_id').value = 'finance-application-' + months + '-months'; document.getElementById('finance_deposit_1').value = '£' + deposit.toFixed(2); document.getElementById('finance_deposit_2').value = '£' + deposit.toFixed(2); document.getElementById('finance_deposit_3').value = '£' + deposit.toFixed(2); document.getElementById('finance_deposit_4').value = '£' + deposit.toFixed(2); document.getElementById('finance_deposit_5').value = '£' + deposit.toFixed(2); } // DHTML Menus /*=======Ver: 6.6.60802========*/ /*DHTMLMenu, (c) 2006, SourceTec Software Co.,LTD - www.sothink.com*/ if(typeof st_js=="undefined") { STM_FILTER=1; STM_SCROLL=1; STM_SLIP=1; STM_RTL=0; STM_AHCM=0; STM_SMSC=1; STM_BIMG=1; STM_ILOC=0; STM_ILINK=0; stHAL=["left","center","right"]; stVAL=["top","middle","bottom"]; stREP=["no-repeat","repeat-x","repeat-y","repeat"]; stBDS=["none","solid","double","dotted","dashed","groove","ridge","inset","outset"]; stENTS=["onmouseover","onmouseout","onclick","onmousedown","onmouseup","onfocus","onblur","onkeydown","onkeyup"]; st_ld=[]; st_lded=0; st_ck=[]; st_ms=[]; st_imgs=[]; st_funs=0; st_path=stgfd(location.href); st_nav=stnav(); st_cm=st_cp=st_ci= st_tid=0; if(!Array.prototype.push)Array.prototype.push=function(){var l=this.length;for(var i=0;i3?arguments[3]:0,ht=arguments.length>4?arguments[4]:0;stm_ai(l,(a.length?a.concat(i.args.slice(a.length)):i.args),wd,ht)} function stm_ep(){var m=st_cm,p=st_cp;st_ci=p.parI;if(st_ci) st_cp=st_ci.parP;else st_cp=0; if(!p.is.length){var i=p.parI;if(m.rtl){i.ico=["",""];i.icoW=0;i.icoH=0;i.icoB=0;}else{i.arr=["",""];i.arrW=0;i.arrH=0;i.arrB=0;} i.subP=0;m.ps.pop();} } function stm_sc(n,a){if(!STM_SCROLL)return; var m=st_cm,e;for(var j=1;j=4){if(v<5||p=="mac")STM_SCROLL=0;t=0;}else if(n=="opera"&&v>=7||n=="safari"&&v>=1){if(n!="opera"||v<9)STM_SCROLL=0;STM_FILTER=0;t=1;}else if(n=="konqueror"&&v>=3){STM_FILTER=0;STM_SLIP=0;STM_SCROLL=0;t=1;}else if(n=="gecko"){STM_FILTER=0;t=1;}else t=4;return {os:p,nam:n,ver:v,typ:t}} function stckpg(){if(!st_ck.length) return;for(var j=0;j"} function stCreate(){var m=st_cm,d=document;if(m.eslip)steslip();if(m.ieff)stflt();var f=(st_funs&2)||(st_funs&4);switch(st_nav.typ){case 0:if(!(st_funs&2)){d.write(stgJs(m.jsP+"stie.js"));st_funs|=2;}break;case 1:if(!(st_funs&4)){d.write(stgJs(m.jsP+"stdom.js"));st_funs|=4;}}if((st_funs&512)&&f) stshow();else {d.write(stgJs(m.jsP+"stinit.js")); st_funs|=512;}} function stDtB(a){var b=0;for(var j=0;j/g;s=s.replace(re,">");re=/\r\n/g;s=s.replace(re,"
");re=/\"/g;s=s.replace(re,""");return s;} function stabs(s){var t=s.toLowerCase();return t=="@"||!t||!t.indexOf("#")||!t.indexOf("?")||t.indexOf(":")==1&&t.charCodeAt()>="a"&&t.charCodeAt()<="z"||!t.indexOf("http:")||!t.indexOf("https:")||!t.indexOf("file:")||!t.indexOf("ftp:")||!t.indexOf("/")||!t.indexOf("javascript:")||!t.indexOf("mailto:")||!t.indexOf("about:")||!t.indexOf("gopher:")||!t.indexOf("news:")||!t.indexOf("telnet:")||!t.indexOf("wais:")||!t.indexOf("rtsp:")||!t.indexOf("mms:");} function stbuf(s){if(s&&STM_BIMG){for(var j=0;j=0;j--)s+=n[j]+".";if(m.sfrn) s+=m.sfrn+".";else s+="parent.";m.sfrp=s;return s;} function sthl(){if(typeof(stisL)=="undefined") return;for(var k=0;k=0;l--){ i=is[l]; if(!i.ishl||mck){ex=i.pid?stckL(i,w):stckL(i);if(m.lits&0x01000000){ if(ex){i._anchor.href="#";i._anchor.target="_self";i._layer.style.cursor=!m.cur[0].indexOf("url(")&&!st_nav.typ&&st_nav.ver<6||m.cur[0]=="hand"&&st_nav.typ==1&&st_nav.nam!="opera"?"":m.cur[0];} i.blnk=i.lnk;i.lnk="@";} f=1;}else{do{if(typeof ii[i.pid]=="undefined")ii[i.pid]=[];ii[i.pid][i.id]=1;i=i.parP.parI; }while(i&&(m.lits&0x04000000));continue;}pp=[];t=0;do{ if(m.lits&0x08000000)pp.push(i.parP);if(!t||m.lits&0x04000000){ if(ex&&!i.isOv){var los=i.lock;i.lock=0;stcIt(i,li);i.lock=los;}i.stat=i.oust=li;i.ishl=1; if(typeof ii[i.pid]=="undefined")ii[i.pid]=[];ii[i.pid][i.id]=1;}t=1;i=i.parP.parI; if(!i)break;ex=i.pid?stckL(i,w):stckL(i);}while(m.lits&0x04000000||m.lits&0x08000000);if(m.lits&0x10000000)sn=Math.max(pp.length-m.litl,0);for(var q=pp.length-1;q>=sn;q--){ clearTimeout(pp[q].tid);if(!pp[q].isSh){var los=pp[q].lock;pp[q].lock=0;stshP(pp[q]);pp[q].lock=los;}ip[pp[q].id]=1;}}}}if(f)for(var j=0;j0?rc[0]+p.scxs:rc[0]-p.scxs,y=dy>0?rc[1]+p.scys:rc[1]-p.scys;stmvto([x,y],p)}}} function stgsp(sp,d){var i=0,s=5;if(d0)s=s.replace("/./","/");while((t=s.indexOf("/../"))>0){var p1,p2;p1=s.substr(0,t);p2=s.substr(t).replace("/../","");p1=p1.substr(0,p1.lastIndexOf("/")+1);s=p1+p2;}return s;} function stStyle(){var s="";} function stgCss(t,f,c){var s="";if(!f){if(stCSS[t]) s=" class='stc"+t+"'";if(c) s+=" style=\""+c+"\"";}else{if(!c&&stCSS[t])s=" style='"+stCSS[t]+"'";else if(stCSS[t]){s=" style=\"";var a=ststo(c),b=ststo(stCSS[t]);for(var i in b) if(typeof a[i]=="undefined") a[i]=b[i];s+=stots(a);s+="\"";}}return s;} function ststo(s){var o={},a,re=/\s*([\w\-_]+)\s*:\s*([:\w#%\- .\"\',\(\)\-\/\\=\|]+)\s*(;|$)/,ra;a=s.split(";"); for(var i=0;i=5)&&i<24&&i>=0?"revealTrans(Transition="+i+",Duration="+((110-s)/100)+")":"":f;} ///////////////////////////////////////////////////////////////////////////////////// // ibox, modal popups (http://www.ibegin.com/blog/p_ibox.html) iboxCompleteAction=''; var indicator_img_path="https://www.allegromusic.co.uk/library/templates/default/resources/indicator.gif"; var indicator_img_html = "\"Loading...\""; var opacity_level = 30; var ibAttr="rel"; var imgPreloader=new Image(); function init_ibox(){ var elem_wrapper="ibox"; createIbox(document.getElementsByTagName("body")[0]); var docRoot=document.getElementsByTagName("a"); var e; for(var i=0;i"; strHTML+="
"; strHTML+=indicator_img_html; strHTML+="
"; strHTML+="
"; strHTML+="
"; strHTML+="
"; strHTML+=""; strHTML+="
"; var docBody=document.getElementsByTagName("body")[0]; var ibox=document.createElement("div"); ibox.setAttribute("id","ibox"); ibox.style.display=''; ibox.innerHTML=strHTML; elem.appendChild(ibox); } var ibox_w_height=0; var iboxTimeout = ''; showIbox = function(url,title,params,callBack){ clearTimeout(iboxTimeout); var contentContainer = document.getElementById('ibox_content'); if (contentContainer == null || typeof contentContainer == 'undefined') { setTimeout(function() { showIbox(url,title,params,callBack); }, 500); } else { contentContainer.style.display = 'block'; console.log('boo'); opacity('ibox_content', 0, 100, 1); document.getElementById('ibox_wrapper').style.display='none'; doSomethingWithClasses('control_flash_container', 'visibility', 'hidden'); var ibox=getElem('ibox_wrapper'); var ibox_type=0; //var ibox_footer=getElem('ibox_footer'); if(title!=""){ //ibox_footer.innerHTML=title; } else{ //ibox_footer.innerHTML=" "; } var urlString=/\.jpg|\.jpeg|\.png|\.gif|\.html|\.htm|\.php|\.cfm|\.asp|\.aspx|\.jsp|\.jst|\.rb|\.rhtml|\.txt/g; var urlType=url.match(urlString); if(urlType=='.jpg'||urlType=='.jpeg'||urlType=='.png'||urlType=='.gif'){ibox_type=1;} else if(url.indexOf("#")!=-1){ibox_type=2;} else if( (!params['type'] || params['type'] === undefined) && (urlType=='.htm'||urlType=='.html'||urlType=='.php'||urlType=='.asp'||urlType=='.aspx'||urlType=='.jsp'||urlType=='.jst'||urlType=='.rb'||urlType=='.txt'||urlType=='.rhtml'||urlType=='.cfm')){ibox_type=3;} else{ if(params['type']){ibox_type=parseInt(params['type']);} else{hideIbox();return false;} } ibox_type = parseInt(ibox_type); var thisCallBack = ''; if (callBack && callBack != undefined) thisCallBack = callBack; switch(ibox_type){ case 1: showIndicator(); imgPreloader=new Image(); imgPreloader.onload=function(){ imgPreloader=resizeImageToScreen(imgPreloader); hideIndicator(); var strHTML=""; if(loadCancelled==false){ ibox.style.height=imgPreloader.height+'px'; ibox.style.width=imgPreloader.width+'px'; ibox.style.display=""; ibox.style.opacity=0; ibox.style.filter='alpha(opacity=0)'; ibox.style.visibility="hidden"; posToCenter(ibox); ibox.style.visibility="visible"; setIBoxContent(strHTML, thisCallBack); window.setTimeout('opacity(\'ibox_wrapper\',0,100,300);', 500); } } loadCancelled=false; imgPreloader.src=url; break; case 2: var strHTML=""; if(params['height']){ ibox.style.height=params['height']+'px'; } else{ibox.style.height='280px';} if(params['width']){ibox.style.width=params['width']+'px';} else{ibox.style.width='450px';} ibox.style.display=""; posToCenter(ibox); ibox.style.visibility="visible"; getElem('ibox_content').style.overflow="auto"; var elemSrcId=url.substr(url.indexOf("#")+1,1000); var elemSrc=getElem(elemSrcId); if(elemSrc){strHTML=elemSrc.innerHTML;} setIBoxContent(strHTML); window.setTimeout('opacity(\'ibox_wrapper\',0,100,300);', 500); break; case 3: showIndicator(); http.open('get',url,true); http.onreadystatechange=function(){ if(http.readyState==4){ window.setTimeout('hideIndicator()', 500); if(params['height']){ibox.style.height=params['height']+'px';} else{ibox.style.height='280px';} if(params['width']){ibox.style.width=params['width']+'px';} else{ibox.style.width='450px';} ibox.style.display=""; ibox.style.opacity=0; ibox.style.filter='alpha(opacity=0)'; posToCenter(ibox); getElem('ibox_content').style.overflow="auto"; var response=http.responseText; setIBoxContent(response, thisCallBack); window.setTimeout('opacity(\'ibox_wrapper\',0,100,300);', 500); http.abort(); http.onreadystatechange=function(){} } } http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); http.send(null); break; default: } // //var ibox_op_level=10; //setIboxOpacity=setOpacity; if(1==1||ibox_type==2||ibox_type==3){ ibox.onclick=null; getElem("ibox_close_a").onclick=function(){hideIbox();} } else{ ibox.onclick=hideIbox; getElem("ibox_close_a").onclick=null; } } return true; } setOpacity = function(elemid,value) { var e=getElem(elemid); e.style.opacity = value/10; e.style.filter = 'alpha(opacity='+value*10+')'; } resizeImageToScreen = function(objImg){ var pagesize = new getPageSize(); var x = pagesize.width - 100; var y = pagesize.height - 100; if (objImg.width > x) { objImg.height = objImg.height * (x/objImg.width); objImg.width = x; if(objImg.height>y){ objImg.width = objImg.width * (y/objImg.height); objImg.height=y; } } else if (objImg.height > y) { objImg.width = objImg.width * (y/objImg.height); objImg.height = y; if(objImg.width > x) { objImg.height = objImg.height * (x/objImg.width); objImg.width=x; } } return objImg; } maintPos = function() { var ibox=getElem('ibox_wrapper'); var box_w=getElem('ibox_w'); var pagesize=new getPageSize(); var scrollPos=new getScrollPos(); var ua=navigator.userAgent; if(ua.indexOf("MSIE ")!=-1) { box_w.style.width=pagesize.width+'px'; } if(ua.indexOf("Opera/9")!=-1){ box_w.style.height=document.body.scrollHeight+'px'; } else { box_w.style.height = pagesize.height+scrollPos.scrollY+'px'; } posToCenter(ibox); } hideIbox=function(){ containerDiv = document.getElementById('ibox_content'); extraDiv = document.getElementById('ibox_extra_content'); containerDiv.style.display = 'block'; extraDiv.style.display = 'none'; doSomethingWithClasses('control_flash_container', 'visibility', 'visible'); hideBG(); var ibox=getElem('ibox_wrapper'); ibox.style.display="none"; clearIboxContent(); window.onscroll=null; } posToCenter=function(elem){ var scrollPos=new getScrollPos(); var pageSize=new getPageSize(); var emSize=new getElementSize(elem); var x=Math.round(pageSize.width/2)-(emSize.width/2)+scrollPos.scrollX; var y=Math.round(pageSize.height/2)-(emSize.height/2)+scrollPos.scrollY; if (y < 0) y = 0; elem.style.left=x+'px'; elem.style.top=y+'px'; } getScrollPos=function(){ var docElem = document.documentElement; this.scrollX = self.pageXOffset || (docElem&&docElem.scrollLeft) || document.body.scrollLeft; this.scrollY = self.pageYOffset || (docElem&&docElem.scrollTop) || document.body.scrollTop; } getPageSize=function(){var docElem=document.documentElement this.width=self.innerWidth||(docElem&&docElem.clientWidth)||document.body.clientWidth;this.height=self.innerHeight||(docElem&&docElem.clientHeight)||document.body.clientHeight;} getElementSize=function(elem){this.width=elem.offsetWidth||elem.style.pixelWidth;this.height=elem.offsetHeight||elem.style.pixelHeight;} setIBoxContent=function(str, callBack){ clearIboxContent(); var e=getElem('ibox_content'); e.style.overflow="auto"; e.innerHTML=str; if (callBack && callBack != undefined) { callBack = addslashes(callBack); window.setTimeout('eval(\'' + callBack + '\')', 50); } else if (iboxCompleteAction!='') window.setTimeout('eval(iboxCompleteAction)', 50); } clearIboxContent=function(){var e=getElem('ibox_content');e.innerHTML="";} getElem=function(elemId){return document.getElementById(elemId);} parseQuery=function(query){var Params=new Object();if(!query)return Params;var Pairs=query.split(/[;&]/);for(var i=0;i opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } } //change the opacity for different browsers function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; } ///////////////////////////////////////////////////////////////////////////////////// // DIY 'getElementsByClass' and do something function //Create an array var allPageTags = new Array(); allPageTags=document.getElementsByTagName("*"); function doSomethingWithClasses(theClass, theStyle, theValue) { //Cycle through the tags using a for loop for (i=0; i= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = createRequestObject(); function updateDiv(div,scriptURL,queryVars,type,notifyBool) { if (connectComplete == 1){ if (notifyBool == 1) { document.getElementById(div).innerHTML = '
 
'; } connectComplete = 0; divName = div; handleType = type; http.open("GET", scriptURL + "?" + queryVars, true); http.send(null); http.onreadystatechange = handleHttpResponse; } } function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}} addEvent(window,'load',init_ibox); ////////////////////////////////////////////////////////////////////////////////////// // Comments function commentLike(cId) { updateDiv('comments_comment_like_' + cId, 'start.php', 'page_type=comment_like&cid=' + cId,'html',0); document.getElementById('comments_comment_like_' + cId).blur(); } function commentReport(cId) { updateDiv('comments_comment_report_' + cId, 'start.php', 'page_type=comment_report&cid=' + cId,'html',0); document.getElementById('comments_comment_report_' + cId).blur(); document.getElementById('comments_comment_report_' + cId).onClick = 'return false;'; } function commentQuote(cId) { var commentMsg = document.getElementById('comments_comment_body_' + cId).innerHTML; commentMsg = stripTags(commentMsg); var commentBox = document.getElementById('comments_comment'); var newMsg = '[quote]' + commentMsg + '[/quote]\r\n'; commentBox.value = newMsg; commentBox.focus(); } ///////////////////////////////////////////////////////////////////////////////////// // Calendar function calendarPop(triggerObj, inputBoxId, calType) { var inputBox = document.getElementById(inputBoxId); var triggerX = findPosX(triggerObj) + 0; var triggerY = findPosY(triggerObj) + 20; var calendarObj = document.createElement('div'); var calendarId = 'calendar_pop_' + inputBoxId; if (calType == 'monthyear') calendarObj.className = 'calendar_pop_container calendar_pop_monthyear'; else calendarObj.className = 'calendar_pop_container'; if (!document.getElementById(calendarId)) { calendarObj.setAttribute('id', calendarId); calendarObj.setAttribute('style','left:' + triggerX + 'px;top:' + triggerY + 'px;'); inputBox.parentNode.appendChild(calendarObj); updateDiv(calendarId, 'start.php', 'page_type=calendar_modal&cal_type=' + calType + '&type=modal&input_box=' + inputBoxId, 'html', 0); } } function calendarPopDestroy(objId) { if (typeof(document.getElementById(objId)) != 'undefined') { var obj = document.getElementById(objId); obj.parentNode.removeChild(obj); } } function calenderPopSelect(inputBoxId, day, month, year) { var inputBox = document.getElementById(inputBoxId); var calendarId = 'calendar_pop_' + inputBoxId; var calendarObj = document.getElementById(calendarId); inputBox.value = day + '/' + month + '/' + year; inputBox.focus(); window.setTimeout('calendarPopDestroy(\'' + calendarId + '\')', 100); } function calendarPopUpdate(calId, action, calType) { if (action == 'next') var m = parseInt(document.getElementById('calendar_pop_month').value) + 1; else if (action == 'prev') var m = parseInt(document.getElementById('calendar_pop_month').value) - 1; else m = document.getElementById('calendar_pop_month').value; var y = document.getElementById('calendar_pop_year').value; if (m > 12) { m = 1; y ++; } else if (m < 1) { m = 12; y --; } var inputBoxId = calId.replace('calendar_pop_', ''); var qs = '&m=' + m + '&y=' + y; updateDiv(calId, 'start.php', 'page_type=calendar_modal&cal_type=' + calType + '&type=modal&input_box=' + inputBoxId + qs, 'html', 0); } function calendarPopSubmitMY(inputBoxId) { var allMonths = new Array(' ', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var thisMonth = document.getElementById('calendar_pop_month').value; var inputBox = document.getElementById(inputBoxId); inputBox.value = allMonths[parseInt(thisMonth)] + ' ' + document.getElementById('calendar_pop_year').value; calendarPopDestroy('calendar_pop_' + inputBoxId); } function calendar_show_time_slots(timestamp,type) { location.href='#calendar_days'; updateDiv('calendar_times_container', 'start.php', 'page_type=calendar_times&action=book×tamp=' + timestamp + '&type=' + type, 'html', 1); } function update_calendar(action,type) { if (action == 'next') m = parseInt(document.getElementById('calendar_list_months').value) + 1; else if (action == 'prev') m = parseInt(document.getElementById('calendar_list_months').value) - 1; else m = document.getElementById('calendar_list_months').value; y = document.getElementById('calendar_list_years').value; if (m > 12) { m = 1; y ++; } else if (m < 1) { m = 12; y --; } var qs = '&m=' + m + '&y=' + y; updateDiv('calendar_container', 'start.php', 'page_type=calendar&action=book&' + 'type=' + type + qs, 'html', 1); } function calendar_book(timestamp,type) { var chosen_date = new Date(); chosen_date.setTime(timestamp + '000'); chosen_hour = chosen_date.getHours(); if (chosen_hour > 12) chosen_hour -= 12; else if (chosen_hour == 0) chosen_hour = 12; if (chosen_hour > 11) chosen_suffix = 'AM'; else chosen_suffix = 'PM'; chosen_mins = chosen_date.getMinutes(); if (chosen_mins < 10) chosen_mins = '0' + chosen_mins; var chosen_date_formatted = chosen_date.getDate() + '/' + (chosen_date.getMonth() + 1) + '/' + chosen_date.getFullYear() + ' at ' + chosen_hour + ":" + chosen_mins + ' ' + chosen_suffix; if (confirm("You have requested a booking for " + chosen_date_formatted +".\n\nAre you sure you wish to proceed?\n\n ")) { updateDiv('calendar_container', 'start.php', 'page_type=calendar&type=' + type + '&action=bookslot&slottime=' + timestamp, 'html', 1); } } ///////////////////////////////////////////////////////////////////////////////////// // Product review submission function shopRatingChange(rating, e) { if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; var imgStarOff = targ.src.replace('rate_star.gif', 'rate_star_off.gif'); var imgStarOn = targ.src.replace('rate_star_off.gif', 'rate_star.gif'); var idParts = targ.id.split('-'); var thisStar = ''; for (var r=1; r <= 5; r++) { thisStar = document.getElementById(idParts[0] + '-' + idParts[1] + '-' + r); if (r <= rating) thisStar.src = imgStarOn; else thisStar.src = imgStarOff; } } function submitRating(e) { if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; var idParts = targ.id.split('-'); var rating = idParts[2]; var pid = idParts[1]; window.location.href = '/start.php?page=_product_review&pid=' + pid + '&action=new&rating=' + rating; } function submitReview(pid) { if (document.getElementById('new_name') != null) var name = parseQS(document.getElementById('new_name').value); if (document.getElementById('new_location') != null) var location = parseQS(document.getElementById('new_location').value); var rating = parseQS(document.getElementById('new_rating').value); var review = parseQS(document.getElementById('new_review').value); updateDiv('review_form', '/start.php', 'page_type=product_review&pid=' + pid + '&action=new&name=' + name + '&location=' + location + '&rating=' + rating + '&review=' + review, 'html', 1) } // swap product details with additional extra function shopSwapProductDetails(mainPid, extraId) { var shortDescription = document.getElementById('shop_product_short_description_' + mainPid); var longDescription = document.getElementById('shop_product_long_description_' + mainPid); var image = document.getElementById('shop_product_image_' + mainPid); var price = document.getElementById('shop_product_price_' + mainPid); var addItem = document.getElementById('shop_product_additem_' + mainPid); shortDescription.innerHTML = shopProductExtras[extraId]['short_description']; longDescription.innerHTML = shopProductExtras[extraId]['long_description']; image.src = '/start.php?page_type=show_image&w=' + image.width + '&h=' + image.height + '&img=' + shopProductExtras[extraId]['image']; price.innerHTML = '£' + shopProductExtras[extraId]['price']; addItem.value = extraId; } ///////////////////////////////////////////////////////////////////////////////////// // Validate forms function checkform(formname) { /* Tool methods */ function cf_adderr(o) { // create image, add to and colourise the error fields var errorIndicator=document.createElement('img'); errorIndicator.alt=errorAlt; errorIndicator.src=errorImg; errorIndicator.title=errorTitle; o.className=errorClass; o.parentNode.insertBefore(errorIndicator,o); // Check if there is no error message if(!document.getElementById(errorID)) { // create errormessage and insert before submit button var em = document.createElement('div'); em.style.textAlign='left'; em.id = errorID; var newp = document.createElement('p'); newp.innerHTML = errorMsg; // clone and insert the error image newp.appendChild(errorIndicator.cloneNode(true)); em.appendChild(newp); // find the submit button for(var i=0; i < formname.getElementsByTagName('input').length; i++){ if(/submit/i.test(formname.getElementsByTagName('input')[i].type)) { var sb = formname.getElementsByTagName('input')[i]; break; } } if(sb) { sb.parentNode.insertBefore(em,sb); } } } function cf_isEmailAddr(str) { return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/); } if(!document.getElementById || !document.createTextNode || !formname.required) { return; } else { var errorID='error_alert'; var errorClass='input_error' var errorMsg='Some fields are missing or invalid.
Please enter or change the fields marked with a '; var errorImg='library/templates/default/resources/form_alert.gif'; var errorAlt='Error'; var errorTitle='Please complete this field'; var reqfields=formname.required.value.split('||'); // Cleanup old mess // if there is an old errormessage field, delete it if(document.getElementById(errorID)){ var em=document.getElementById(errorID); em.parentNode.removeChild(em); } // remove old images and classes from the required fields for(var i=0; i < reqfields.length; i++) { var f=document.getElementById(reqfields[i]); if(!f) continue; if(f.previousSibling && /img/i.test(f.previousSibling.nodeName)) { f.parentNode.removeChild(f.previousSibling); } f.className='inputbox'; } // loop over required fields for(var i=0; i < reqfields.length; i++) { // check if required field is there var f=document.getElementById(reqfields[i]); if(!f) continue; // test if the required field has an error, // according to its type else switch(f.type.toLowerCase()) { case 'text': if(f.value=='' && f.id!='email' && (f.attributes.alt.value) != 'Email') cf_adderr(f); if((f.id=='email' || ((f.attributes.alt.value) == 'Email')) && !cf_isEmailAddr(f.value)) cf_adderr(f); break; case 'hidden': // if hidden, then we're looking for a radio selection etc instead, using name instead of ID if (f.value.substr(0,14) == 'multicheckbox=') { // multi checkbox var thisNumBoxes = parseInt(f.value.substr(14)); var thisChecked = 0; for(var c = 1; c <= thisNumBoxes; c++) { if (document.getElementById(f.id + '_' + c).checked) { thisChecked = 1; break; } } if (thisChecked == 0) cf_adderr(f); } else { // radio selection var formnameName = formname.name; var radioObject = eval('document.' + formnameName + '.' + f.id + ';'); var radioObjectNum = (radioObject.length == 'undefined') ? 1 : radioObject.length; var radioChecked = 0; for(var r = 0; r < radioObjectNum; r++) { if(radioObject[r].checked) { radioChecked = 1; break; } } if (radioChecked == 0) cf_adderr(f); } break; case 'textarea': if(f.value=='') cf_adderr(f); break; case 'checkbox': if(!f.checked) cf_adderr(f); break; case 'select-one': if(!f.selectedIndex && f.selectedIndex==0) cf_adderr(f); break; } } return !document.getElementById(errorID); } } function validateField(field, valType, compareField) { var fieldId = field.id; if (typeof valInProgress != 'undefined' && typeof valInProgress[fieldId] != 'undefined') window.clearTimeout(valInProgress[fieldId]); else if (typeof valInProgress == 'undefined') valInProgress = new Array(); validationMessage(fieldId, 'wait'); valInProgress[fieldId] = window.setTimeout("actualValidate('" + fieldId + "', '" + valType + "', '" + compareField + "')", 500); } function actualValidate(fieldId, valType, compareField) { var field = document.getElementById(fieldId); var fieldValue = field.value; var validated = false; if (document.getElementById(compareField)) var compareVal = document.getElementById(compareField).value; switch (valType) { case "password": if (fieldValue.length < 6) var valMsg = 'Password must be 6 or more characters long'; else validated = true; break; case "confirm": if (fieldValue.length < 6) var valMsg = 'Password must be 6 or more characters long'; else if (fieldValue != compareVal) var valMsg = 'This must be the same as the password'; else validated = true; break; case "email": if (!fieldValue.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/)) var valMsg = 'This doesn\'t appear to be a proper email address'; else validated = true; break; case "postcode": field.value = formatPostcode(fieldValue); fieldValue = field.value; if(!isValidPostcode(fieldValue)) var valMsg = 'This doesn\'t appear to be a valid postcode'; else validated = true; break; case "none": validated = true; break; default: // check if empty or not if (fieldValue != '') validated = true; else var valMsg = 'This field cannot be empty.'; break; } validationMessage(fieldId, validated, valMsg); } function validationMessage(fieldId, validated, valMsg) { var field = document.getElementById(fieldId); var valIcon = document.getElementById('valid_icon_' + fieldId); var iconOK = '/library/templates/default/resources/validate_ok.gif'; var iconFailed = '/library/templates/default/resources/validate_failed.gif'; var iconWait = '/library/templates/default/resources/validate_wait.gif'; if (valIcon == null) { var posX = findPosX(field) + field.offsetWidth + 25; var posY = findPosY(field) + field.offsetHeight - 21; var newValIcon = document.createElement('div'); var bodyElement = document.getElementsByTagName('body'); newValIcon.setAttribute('id', 'valid_icon_' + fieldId); field.parentNode.appendChild(newValIcon); //bodyElement[0].firstChild.parentNode.insertBefore(newValIcon, bodyElement[0].firstChild); valIcon = document.getElementById('valid_icon_' + fieldId); valIcon.style.display = 'inline'; valIcon.style.position = 'absolute'; valIcon.style.marginTop = '-2px'; valIcon.style.marginLeft = '10px'; //valIcon.style.top = posY + 'px'; //valIcon.style.left = posX + 'px'; valIcon.style.padding = '2px 2px 2px 30px'; valIcon.style.height = '19px'; valIcon.style.backgroundPosition = '2px 2px'; valIcon.style.backgroundRepeat = 'no-repeat'; } if (validated == 'wait') { valIcon.style.backgroundColor = 'Transparent'; valIcon.style.backgroundImage = 'url(' + iconWait + ')'; valIcon.innerHTML = ' '; } else if (validated == true) { valIcon.style.backgroundColor = 'Transparent'; valIcon.style.backgroundImage = 'url(' + iconOK + ')'; valIcon.innerHTML = ' '; } else { valIcon.style.backgroundColor = '#fff'; valIcon.style.backgroundImage = 'url(' + iconFailed + ')'; valIcon.innerHTML = valMsg; } } function isValidPostcode(p) { var postcodeRegEx = /[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}/i; return postcodeRegEx.test(p); } /* formats a VALID postcode nicely: AB120XY -> AB1 0XY */ function formatPostcode(p) { if (isValidPostcode(p)) { var postcodeRegEx = /(^[A-Z]{1,2}[0-9]{1,2})([0-9][A-Z]{2}$)/i; p = p.toUpperCase(); return p.replace(postcodeRegEx,"$1 $2"); } else { return p; } } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } // For shop - when using additional products, check if any are ticked function checkTickedProducts(thisFormId) { thisForm = document.getElementById(thisFormId); numExtra = thisForm.num_extra.value; if(thisForm.xtra_val_1) { noneTicked=1; for (x=1; x<=numExtra; x++) { thisElement=eval("thisForm.xtra_bool_"+x); if(thisElement.checked) { noneTicked=0; } } if (noneTicked==1) { alert('Please tick the items you require before adding to cart'); return false; } } else { return true; } } // Cart accessories function shopCartShowAccessories(catId) { var accContainer = document.getElementById('shop_cart_accessories_products'); var accArr = eval('accessories_' + catId); accContainer.innerHTML = ''; for (var i=0; i < accArr.length; i++) { var lineHTML = '
'; lineHTML += '' + accArr[i]['short_description'] + ''; lineHTML += 'Add to basket'; lineHTML += '£' + accArr[i]['price'] + ' ' + accArr[i]['unit'] + ''; lineHTML += '

' + accArr[i]['short_description'] + '

'; lineHTML += '
' + accArr[i]['long_description'] + '
'; lineHTML += '
'; accContainer.innerHTML += lineHTML; } accContainer.style.display = 'block'; window.location.hash = "accessories"; } // tidy strings before passing via query string function parseQS(str) { str = str.replace(/\%/g, '[percent]'); str = encodeURIComponent(str); str = str.replace(/\%5Bpercent\%5D/g, '%25'); return str; } // Strip HTML tags function stripTags(strMod){ if (arguments.length<3) strMod=strMod.replace(/<\/?(?!\!)[^>]*>/gi, ''); else{ var IsAllowed=arguments[1]; var Specified=eval("["+arguments[2]+"]"); if(IsAllowed){ var strRegExp=']*>'; strMod=strMod.replace(new RegExp(strRegExp, 'gi'), ''); }else{ var strRegExp=']*>'; strMod=strMod.replace(new RegExp(strRegExp, 'gi'), ''); } } return strMod; } // Confirmations function confirmAction(msg) { if (!msg) var msg = 'Are you sure you wish to delete this item?'; return confirm(msg); } // Popup windows var newwin; function launchwin(winurl,winname,winfeatures) { if(newwin) { newwin.close(); } newwin = window.open(winurl,winname,winfeatures); newwin.focus(); } function placeFocus() { if (document.forms.length > 0) { var field = document.forms[0]; for (i = 0; i < field.length; i++) { if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) { document.forms[0].elements[i].focus(); break; } } } } function showModalInfo(e, itemType, itemId) { var modalBox = document.getElementById('modal_info_container'); if (!e) var e = window.event; var currentPosX = e.pageX - 50; var currentPosY = e.pageY - 100; modalBox.style.left = currentPosX + 'px'; modalBox.style.top = currentPosY + 'px'; modalBox.style.display = 'block'; updateDiv('modal_info_content', '/start.php', 'page_type=modal_content&type=' + itemType + '&id=' + itemId, 'html', 1); } function hideModalInfo() { var modalBox = document.getElementById('modal_info_container'); var modalContent = document.getElementById('modal_info_content'); modalContent.innerHTML = ''; modalBox.style.display = 'none'; } // Return characters pressed, in input boxes etc, and filter (e.g. numbers only) function getkey(e) { if (window.event) return window.event.keyCode; else if (e) return e.which; else return null; } function swapimage(imageid, imagefile) { document.getElementById(imageid).src = 'library/images/' + imagefile; } function goodchars(e, goods) { var key, keychar; key = getkey(e); if (key == null) return true; // get character keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); goods = goods.toLowerCase(); // check goodkeys if (goods.indexOf(keychar) != -1) return true; // control keys if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 ) return true; // else return false return false; } function changeqty(dir, id) { currentqty = parseInt(document.getElementById(id).value); if (dir=='up') document.getElementById(id).value = currentqty+1; else if (dir=='down' && currentqty > 1) document.getElementById(id).value = currentqty-1; else if (dir=='down' && currentqty < 2) document.getElementById(id).value = 1; } function checksearch(searchform,searchbox) { if (document.forms[searchform].elements[searchbox].value == "") { alert( "Please enter your criteria in the search box." ); document.forms[searchform].elements[searchbox].focus(); return false; } else if (document.forms[searchform].elements[searchbox].value.length < 3) { alert( "Search term should be more than 2 characters" ); document.forms[searchform].elements[searchbox].focus(); return false; } else return true; } function showFormComment(fieldId) { document.getElementById('form_comment_' + fieldId).style.display = 'block'; } function checkAndShowCommentBox(fieldId, formName) { var specialConcat = document.getElementById('_special_' + fieldId).value; var specialIndexes = specialConcat.split(','); var formField = document.getElementById('_form_' + fieldId); if (formField.type == 'hidden') { // if hidden, then we're looking for a radio selection instead, using name instead of ID var radioObject = eval('document.' + formName + '.' + '_form_' + fieldId + ';'); var radioObjectNum = (radioObject.length == 'undefined') ? 1 : radioObject.length; var radioChecked = 0; for(var r = 0; r < radioObjectNum; r++) { if(radioObject[r].checked) { var fieldSelected = r - 1; break; } } } else { var fieldSelected = formField.selectedIndex - 1; } var key = ''; for (key in specialIndexes) { if (specialIndexes[key] == fieldSelected) { showFormComment(fieldId); var comments = 1; } } if (comments != 1) { document.getElementById('form_comment_' + fieldId).style.display = 'none'; } } function formsDisabledWarning(inputObj) { alert('Please view the attachment before answering this question.'); inputObj.blur(); } function formsEnableField(fieldId) { fieldObj = document.getElementById('_form_' + fieldId); fieldObj.onfocus = ''; } function commentsEditComment(commentId) { var commentDiv = document.getElementById('comments_comment_body_' + commentId); var parentDiv = commentDiv.parentNode; var commentText = commentDiv.innerHTML; commentText = commentText.replace(/
/gi, ''); commentText = commentText.replace(/
/gi, ''); var boxWidth = parentDiv.offsetWidth - 100; var thisURL = window.location.pathname + '#comments' + commentId; var newHTML = '
'; newHTML += ''; newHTML += ''; newHTML += ''; newHTML += ''; newHTML += '
'; commentDiv.innerHTML = newHTML; } function show_ee() { // } function shopSlideShow(imagesDelim, width, height,offSet) { width = window.innerWidth || document.documentElement.clientWidth; height = window.innerHeight || document.documentElement.clientHeight; width = width - 100; height = height - 100; width = width > 900 ? 900 : width; height = height > 700 ? 700 : height; var imagesArr = imagesDelim.split(','); var firstImg = '/start.php?page_type=show_image&img=' + imagesArr[0] + '&w=' + width + '&h=' + height + '&canvas=frame&bgcolour=ffffff&q=90'; var callBack = 'shopSlideShowGenerate(\'' + addslashes(imagesDelim) + '\', ' + width + ', ' + height + ', \'' + offSet + '\')'; manualiBox(firstImg, 'type=1&width=' + (width) + '&height=' + (height), callBack); shopSlideShowGenerate(addslashes(imagesDelim), width, height, offSet); } var shopSlideTimeout = ''; function shopSlideShowGenerate(imagesDelim, width, height, offSet) { clearTimeout(shopSlideTimeout); var contentDiv = document.getElementById('ibox_content'); if (contentDiv == null || typeof contentDiv == 'undefined') { setTimeout(function() { shopSlideShowGenerate(imagesDelim, width, height, offSet); }, 500); } else { var imagesArr = imagesDelim.split(','); var len = imagesArr.length; var randNum = Math.floor((Math.random()*100000)+1); var thisContainer = 'gallery_slider_' + randNum; var htmlStr = ''; contentDiv.innerHTML = htmlStr; var thisSlider = new bumbleSlider(thisContainer, width, height, 2000, 2000, offSet, 1, 'slide', 1); } } function addslashes(str='') { str=str.replace(/\\/g,'\\\\'); str=str.replace(/\'/g,'\\\''); str=str.replace(/\"/g,'\\"'); str=str.replace(/\0/g,'\\0'); return str; } function stripslashes(str='') { str=str.replace(/\\'/g,'\''); str=str.replace(/\\"/g,'"'); str=str.replace(/\\0/g,'\0'); str=str.replace(/\\\\/g,'\\'); return str; } function findPosX(obj) { var curleft = 0; if(obj.offsetParent) while(1) { curleft += obj.offsetLeft; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } function getStats() { var screenres; var screencolor; var flashvn; var browser; var browservn; var os; if (screen.width) screenres=screen.width+" x "+screen.height; else screenres="Unknown"; if (screen.colorDepth) screencolor=screen.colorDepth; else screencolor="Unknown"; browser=''; browservn=''; alert("Screen res: "+screenres+", "+screencolor+" bit\nBrowser: "+browser+" "+browservn); } // CHAP for site login var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } function md5_vm_test() { return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; } function core_md5(x, len) { /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; } function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; } function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } return str; } function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; } function doCHAP() { var password=document.getElementById('site_login_psw').value; document.getElementById('response').value=hex_md5(hex_md5(password)+''); document.getElementById('site_login_psw').value=''; return true; } // Embed Flash content if(typeof deconcept=="undefined"){var deconcept=new Object();} if(typeof deconcept.util=="undefined"){deconcept.util=new Object();} if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();} deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){ if(!document.getElementById){return;} this.DETECT_KEY=_b?_b:"detectflash"; this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY); this.params=new Object(); this.variables=new Object(); this.attributes=new Array(); if(_1){this.setAttribute("swf",_1);} if(id){this.setAttribute("id",id);} if(w){this.setAttribute("width",w);} if(h){this.setAttribute("height",h);} if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));} this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(); if(c){this.addParam("bgcolor",c);} var q=_8?_8:"high"; this.addParam("quality",q); this.setAttribute("useExpressInstall",_7); this.setAttribute("doExpressInstall",false); var _d=(_9)?_9:window.location; this.setAttribute("xiRedirectUrl",_d); this.setAttribute("redirectUrl",""); if(_a){this.setAttribute("redirectUrl",_a);}}; deconcept.SWFObject.prototype={setAttribute:function(_e,_f){ this.attributes[_e]=_f; },getAttribute:function(_10){ return this.attributes[_10]; },addParam:function(_11,_12){ this.params[_11]=_12; },getParams:function(){ return this.params; },addVariable:function(_13,_14){ this.variables[_13]=_14; },getVariable:function(_15){ return this.variables[_15]; },getVariables:function(){ return this.variables; },getVariablePairs:function(){ var _16=new Array(); var key; var _18=this.getVariables(); for(key in _18){_16.push(key+"="+_18[key]);} return _16; },getSWFHTML:function(){ var _19=""; if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){ if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");} _19="0){_19+="flashvars=\""+_1c+"\"";} _19+="/>"; }else{if(this.getAttribute("doExpressInstall")){ this.addVariable("MMplayerType","ActiveX");} _19=""; _19+=""; var _1d=this.getParams(); for(var key in _1d){_19+="";} var _1f=this.getVariablePairs().join("&"); if(_1f.length>0){_19+="";} _19+="";} return _19; },write:function(_20){ if(this.getAttribute("useExpressInstall")){ var _21=new deconcept.PlayerVersion([6,0,65]); if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){ this.setAttribute("doExpressInstall",true); this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl"))); document.title=document.title.slice(0,47)+" - Flash Player Installation"; this.addVariable("MMdoctitle",document.title);}} if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){ var n=(typeof _20=="string")?document.getElementById(_20):_20; n.innerHTML=this.getSWFHTML(); return true; }else{ if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}} return false;}}; deconcept.SWFObjectUtil.getPlayerVersion=function(){ var _23=new deconcept.PlayerVersion([0,0,0]); if(navigator.plugins&&navigator.mimeTypes.length){ var x=navigator.plugins["Shockwave Flash"]; if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));} }else{ try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");} catch(e){try{ var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); _23=new deconcept.PlayerVersion([6,0,21]); axo.AllowScriptAccess="always";} catch(e){ if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");} catch(e){}} if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}} return _23;}; deconcept.PlayerVersion=function(_27){ this.major=_27[0]!=null?parseInt(_27[0]):0; this.minor=_27[1]!=null?parseInt(_27[1]):0; this.rev=_27[2]!=null?parseInt(_27[2]):0; }; deconcept.PlayerVersion.prototype.versionIsValid=function(fv){ if(this.majorfv.major){return true;} if(this.minorfv.minor){return true;} if(this.rev