
var
hidArrows=false,docprint;
function el(id){return document.getElementById(id);}
function esn(n){return document.getElementsByName(n);}
function estn(t){return document.getElementsByTagName(t);}
function setting(code){
if(window.settings!=undefined&&window.settings[code]!=undefined)return window.settings[code];
else return'';
}
function translation(code){
if(window.translations!=undefined&&window.translations[code]!=undefined)return window.translations[code];
else return code;
}
function formatCurrency(val){
var decimalSep=',',thousandSep='.';
if(loc=='UK'){
decimalSep='.';
thousandSep=',';
}
x=(val.toFixed(2)).split('.');
x1=x[0];
x2=x.length>1?decimalSep+x[1]:'';
var rgx=/(\d+)(\d{3})/;
while(rgx.test(x1)){
x1=x1.replace(rgx,'$1'+thousandSep+'$2');
}
return x1+x2;
}
function checkForm(){
var result=true;
var msg='';
var reg=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
el('emailaddress').style.backgroundColor='#FFFFFF';
el('firstname').style.backgroundColor='#FFFFFF';
el('lastname').style.backgroundColor='#FFFFFF';
el('about').style.backgroundColor='#FFFFFF';
if(el('emailaddress').value==''){
result=false;
bg('emailaddress');
}
else if(reg.test(el('emailaddress').value)==false){
result=false;
bg('emailaddress');
el('lbl_email_invalid').style.visibility='visible';
el('lbl_email_invalid').style.display='block';
}
else{
el('lbl_email_invalid').style.visibility='hidden';
el('lbl_email_invalid').style.display='none';
}
if(el('firstname').value==''){
result=false;
bg('firstname');
}
if(el('lastname').value==''){
result=false;
bg('lastname');
}
if(el('about').value==''){
result=false;
bg('about');
}
if(result){
el('lbl_error').style.visibility='hidden';
el('lbl_error').style.display='none';
el('contactform').submit();
}
else{
el('lbl_error').style.visibility='visible';
el('lbl_error').style.display='block';
}
return result;
}
function bg(id){
el(id).style.backgroundColor='#ad2120';
$('#'+id+'').css('color','#fff');
};
var prevTab={},currentMenu,currentMenu2,recProdW,resetMenu;
function setTab(i,btn,ctr,init){
var p=ctr.replace('-','').replace('.','class_').replace('#','id_');
if(!prevTab||prevTab[p]==null){
prevTab[p]=init;}
$(ctr+prevTab[p]).hide();
$(btn+prevTab[p]).removeClass("standard-button-grey");
$(btn+prevTab[p]).addClass("standard-button-gradient");
$(ctr+i).show();
$(btn+i).addClass("standard-button-grey");
$(btn+i).removeClass("standard-button-gradient");
prevTab[p]=i;
}
function error(title,msg){
Boxy.alert(msg,null,{title:title});
}
function message(msg,title){
if(title){
Boxy.alert(msg,null,{title:title});
}
else{
Boxy.alert(msg,null,{title:'Message'});
}
}
function setProdTTs(){
}
function sameHeight(sel){
var mh=0;
$(sel).each(function(i){
mh=Math.max($(this).height(),mh);
});
if(mh>0){
$(sel).height(mh);
}
return mh;
}
function sameWidth(sel,p){
var mw=0;
$(sel).each(function(i){
mw=Math.max($(this).width(),mw);
});
if(p){
mw+=p;
}
if(mw>0){
$(sel).width(mw);
}
return mw;
}
$().ready(function(){
var title='';
hidArrows=setting('hide_scrollarrows_onend')=='1';
if(document.title==''){
$('.inner-center h1').each(function(i){
title+=$(this).text()+' | ';
});
document.title=title+setting('web_platform_name');
}
$('.reset-form').click(function(){
$('#contactform')[0].reset();
});
$('#submit-contact').click(function(e){
e.preventDefault();e.stopPropagation();
if(checkForm()){
$('#contactform').submit();
}
});
if(window.location.href.indexOf('show_itemsleft_message=1')>0&&window.location.href.indexOf('community')==0){
message('<strong>'+translation('dlg_txt_basket_itemsleft')+'</strong>',translation('dlg_tit_basket_itemsleft'));
}
$('#search-website').submit(function(){
return($(this).find('.search-field').val()!=$(this).find('.search-field').attr('alt')&&$(this).find('.search-field').val()!='');
});
setProdTTs();
$('#important-delivery-message').click(function(){
var h=$(window).height()-110;
Boxy.alert('<div class="datahtml-container" style="overflow-y:scroll; width:800px; height:'+h+'px;"></div>',null,{
title:'Latest carrier advice on deliveries',
width:600,
afterShow:function(){
var ajax_load='<img src="images/weather-conditions.jpg"/>',loadUrl='<img src="images/weather-conditions.jpg"/>';
$.ajaxSetup({
cache:false
});
$('.datahtml-container').html(ajax_load).load(loadUrl);
}
});
return false;
});
sameHeight('.product-detail');
sameHeight('.product-detail .model');
$('.langnavtitle').hover(function(){
$('.langul').slideDown('fast');
},function(){
$('.langul').slideUp('fast');
});
$('a').each(function(){
if($(this).attr('href')!=''&&$(this).attr('href')!=null&&$(this).attr('href')!='#'&&$(this).attr('rel')=='external'){
$(this).attr('target','_blank');
}
});
$('.next-link').each(function(i){
$(this).fakeClick(function(){
$(this).parent().find('.sub-list').first().scrollTo({top:'+=42px',left:'-=0px'},200);
$(this).parent().find('.horizontal-ul').first().scrollTo({left:'+=42px',top:'-=0px'},200);
});
});
$('.prev-link').each(function(i){
$(this).fakeClick(function(){
$(this).parent().find('.sub-list').first().scrollTo({top:'-=42px',left:'-=0px'},200);
$(this).parent().find('.horizontal-ul').first().scrollTo({left:'-=42px',top:'-=0px'},200);
});
});
$('#center .footer-data-link').click(function(){
var h=$(window).height()-110,u=$(this).attr('href').toLowerCase(),ret=false;
if(u.indexOf('index.cfm')>-1&&u.indexOf('fuseaction')>-1){
ret=true;
}
else{
Boxy.alert('<div class="datahtml-container" style="overflow-y:scroll; width:600px; height:'+h+'px;"></div>',null,{
title:$(this).html(),
width:600,
afterShow:function(){
var urlPrefix='http://'+host_url+root;
var ajax_load='<div class="loader"><img src="'+urlPrefix+'images/loading.gif" width="32" height="32" alt="" border="0"/><br/><span>'+translation('loading')+'</span></div>',loadUrl=urlPrefix+u+'?lang=3&CFID='+cfid+'&CFTOKEN='+cftoken;
$.ajaxSetup({
cache:false
});
$('.datahtml-container').html(ajax_load).load(loadUrl);
}
});
}
return ret;
});
recProdW=174+10+2;
$('.relative-box .products-detail-ul').each(function(){
if($(this).find('li').length>0){
$(this).parent().height($(this).find('.product-detail').height()+50);
}
$(this).css({
position:'absolute',
width:$(this).find('li').length*recProdW
});
});
$('.relative-box').each(function(){
var li=$(this).find('li').length;
if(li>5){
$(this).find('.next-arrow').show().attr('src','images/next_arrow2.png');
}
else{
$(this).find('.next-arrow').hideIf(hidArrows).attr('src','images/next_arrow.png');
}
$(this).find('.prev-arrow').hideIf(hidArrows).attr('src','images/prev_arrow.png');
});
$('.relative-box .next-arrow').each(function(i){
$(this).parent().fakeClick(function(){
var box=$(this).parent().find('.products-detail-ul');
var li=$(box).find('li').length;
var l=$(box).position().left,w=$(box).width();
if((l*-1)<w-(recProdW*5)){
$(box).animate({left:'-='+recProdW},200);
$(this).parent().find('.prev-arrow').show().attr('src','images/prev_arrow2.png');
if((l*-1)==(recProdW*(li-6))){
$(this).find('.next-arrow').hideIf(hidArrows).attr('src','images/next_arrow.png');
}
}
});
});
$('.relative-box .prev-arrow').each(function(i){
$(this).parent().fakeClick(function(){
var box=$(this).parent().find('.products-detail-ul');
var li=$(box).find('li').length;
var l=$(box).position().left;
if(l<0){
$(box).animate({left:'+='+recProdW},200);
$(this).parent().find('.next-arrow').show().attr('src','images/next_arrow2.png');
if((l*-1)>recProdW){
$(this).find('.prev-arrow').show().attr('src','images/prev_arrow2.png');
}
else{
$(this).find('.prev-arrow').hideIf(hidArrows).attr('src','images/prev_arrow.png');
}
}
else{
$(box).animate({left:'0'},200);
}
});
});
$('.basket-menu').hover(function(){
$('.overlay-right').css('z-index','0');
},function(){
$('.overlay-right').css('z-index','20000');
});
Cufon.replace('.main-title-box h1');
$('input[alt]').placeholder();
$('.menu-item').removeClass('nojs').hoverIntent({sensitivity:7,interval:50,timeout:700,
over:function(){
$(this).addClass('menu-item-hovered');
var box=$(this).find('> .drop-down-box'),box_ajax=box.find('> .drop-down-ajax');
if(box.length>0){
var hu=window.location.host;
var urlPrefix=(("https:"==window.location.protocol)?'https://':'http://')+(hu.indexOf('/community.')>-1||hu.indexOf('/community2.')>-1?hu:host_url+root);var ajax_load='<div class="loader"><img src="http://'+host_url+root+'images/loading.gif" width="32" height="32" alt="" border="0"/><br/><span>'+translation('loading')+'</span></div>',
loadUrl=urlPrefix+"act_get_menu_sub.cfm?lang="+lang+"&id="+box.attr('id').replace('group','')+'&CFID='+cfid+'&CFTOKEN='+cftoken;
if(box_ajax.is(':empty')||box_ajax.html().indexOf('images/loading.gif')>-1){
$.ajaxSetup({cache:false});
box_ajax.html(ajax_load).load(loadUrl);
}
var l=$(this).position().left;box.css('left',-l);
box.show();
}
$('.menu-item').removeClass('menu-item-selected');
},
out:function(){
$(this).removeClass('menu-item-hovered');
var box=$(this).find('> .drop-down-box');
if(box.length>0){box.hide();}
resetMenu=true;
$('.menu-item').each(function(i){
if($(this).hasClass('menu-item-hovered')){
resetMenu=false;
}
});
setTimeout('restoreMenu()',300);
}
});
if(loc=='BE'){
$('.header-promos .first').css('left',55);
}
var time=parseInt($('.header-promos .first').attr('time'));
setTimeout('CycleHeaderImages()',time);
});
function restoreMenu(){
if(resetMenu){
$('.menu-item').each(function(i){
if($(this).hasClass('restore')){
$(this).addClass('menu-item-selected');
}
});
}
resetMenu=false;
}
function changeCanvasState(anchor,state,value){
$('#'+anchor).trigger(state,[value]);
}
function loadCanvasState(canvas,configID,stateID,value){
var box_ajax=$('#'+canvas);
var urlPrefix=(window.location.href.indexOf('https')>-1?'https://':'http://')+host_url+root;
var ajax_load='<div style="text-align:center;padding:20px;padding-top:0px;height:'+$(box_ajax).height()+'px;"><img src="'+urlPrefix+'images/loading.gif" width="32" height="32" alt="" border="0"/><br/><span style="color:#000;">'+translation('loading')+'</span></div>';
var loadUrl=urlPrefix+"act_get_page_block_state_canvas_sub.cfm?config="+configID+"&state="+stateID+"&value="+value+'&CFID='+cfid+'&CFTOKEN='+cftoken;
$.ajaxSetup({cache:false});
box_ajax.load(loadUrl,function(){
setTimeout('initScrollButtons()',1000);
});
}
function selectPromoareaBottomItems(value,id){
var box_ajax=$('#pbItems');
var urlPrefix=(window.location.href.indexOf('https')>-1?'https://':'http://')+host_url+root;
var ajax_load='<div style="text-align:center;padding:20px;padding-top:0px;height:'+$(box_ajax).height()+'px;"><img src="'+urlPrefix+'images/loading.gif" width="32" height="32" alt="" border="0"/><br/><span style="color:#000;">'+translation('loading')+'</span></div>';
var loadUrl=urlPrefix+"act_get_page_block_state_canvas_sub.cfm?id="+id+'&CFID='+cfid+'&CFTOKEN='+cftoken+'&lang="'+lang+'"';
$.ajaxSetup({cache:false});
box_ajax.load(loadUrl,function(){
setTimeout('initScrollButtons()',1000);
});
}
function report_page(){
var s=Math.min($(window).height(),$(window).width());
var b=Boxy.alert(
'<div class="close">'+
'<iframe src="index.cfm/fuseaction/main.report_page" width="1000" height="400"></iframe>'+
'</div>',
null,{title:"",width:800}
);
}
function print_content(){
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
docprint=window.open("","printcontent",disp_setting);
setTimeout('print_content_fill()',500);
}
function print_content_fill(){
var content_value=$('#content_left').html();
var logo=$('.logo').html();
var breadcrumb=$('.bread-crumb').html();
var head=$('head').html();
var cnt='<html><head>'+head+
'</head><body onLoad="self.print()" style="background-image: none !important; padding: 10px;">'+
logo+'<br />'+
'<ul>'+breadcrumb+'</ul><br />'+
content_value+
'</body></html>';
docprint.document.open("text/html","replace");
docprint.document.write(cnt);
docprint.document.close();
docprint.focus();
}
function CycleHeaderImages(){
var nr=$('.header-promos .header-promo-image').length;
var c=-1;$('.header-promos .header-promo-image').each(function(i){
if($(this).hasClass('visible')){
$(this).removeClass('visible').fadeOut(200);
if(c==-1){
c=i;
}
return;
}
});
if(c+1==nr){
c=-1;
}
$('.header-promos .header-promo-image').each(function(i){
if(i==c+1){
$(this).fadeIn(200).addClass('visible');
if(loc=='BE'){
$(this).css('left',($('.header-promos').width()-$(this).width())/2);
}
return;
}
});
var timeout=$('.header-promos .visible').attr('time');
setTimeout('CycleHeaderImages()',timeout);
}
