var errorTxt="Some of the fields below are required or the information given is not valid, for further information move your mouse over the highlighted boxes below.";var urlRegxp=/^((http|https):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i
var emailRegxp=/^([\w_-]+)(\.[\w_-]+)*@([\w_-]+)(\.[\w_-]*){0,1}(\.[a-zA-Z]{2,4}){1,2}$/;var pcodeRegxp=/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {0,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/i;var dateRegxp=/^([0-9]){1,2}[\/|:|-]{1}([0-9]){1,2}[\/|:|-]([0-9]){4}$/;var dateTimeRegxp=/^([0-9]){1,2}[\/|:|-]{1}([0-9]){1,2}[\/|:|-]([0-9]){4} [0-9]{2}:{1}[0-9]{2}$/;var carddateRegxp=/^([0-9]){1,2}[\/|:|-]{1}([0-9]){1,2}$/;var passwordRegxp=/^[a-zA-Z0-9]{6,20}$/;var timeRegxp=/^[0-9]{2}:{1}[0-9]{2}$/;var usernameReqxp=/[a-zA-Z0-9]{3,20}/;var currencyRegxp=/^\d+(\.\d{1,2})?$/;var telnoRegxp=/^(^[0-9\+ \-\)\(]+)$/
var numericRegxp=/^([0-9]+)$/;var notblankRegxp=/[a-zA-Z_0-9]+/;var ignoretagsRegxp=/fieldset/i;var validate={};function verifylist(formobj,chklist){var fail=0;var debug=0;var result_array=new Array();for(var i=0;i<formobj.length;i++){var e=formobj.elements[i];if(ignoretagsRegxp.test(e.tagName)==true||e.tagName=='')continue;var valobj={};var robj={};robj.debug='';var val=chklist[e.name];if(typeof val=='string'){valobj.type=val;}else{valobj=val;}
robj.debug+="Field: "+e.name;if(valobj){robj.element=e;robj.alt_tag='';robj.good=0;robj.type=valobj.type;robj.debug+=" ("+valobj.type+")";if((isdisplayed(e)&&e.type!='hidden')||valobj.hidden){robj.debug+=" Visible";validate_field_value(robj,valobj);}else{robj.debug+=" Invisible";robj.good=1;}
result_array.push(robj);}else{robj.debug+=" (NOT IN CHECKLIST)\n";}}
var debugTxt="";for(var x=0;x<result_array.length;x++){var robj=result_array[x];if(robj.type=='radio'){var nm=robj.element.name;for(var y=0;y<result_array.length;y++){var chk_robj=result_array[y];if(chk_robj.element.name==nm){if(robj.good==1||chk_robj.good==1){robj.good=1;chk_robj.good=1;}}}}
if(robj.good)robj.debug+=" - GOOD\n";else robj.debug+="\n  "+robj.alt_tag+" - ERROR\n";if(robj.good==0){hilite_error(robj);fail=1;}else if(robj.good==1){clear_error(robj);}
debugTxt+=robj.debug;}
if(debug)alert(debugTxt);display_error_dialogue(errorTxt,fail,1);return(fail)?false:true;}
function validate_single_field(e,chklist){if(!e)return 1;var valobj={};var val=chklist[e.name];if(typeof val=='string'){valobj.type=val;}else{valobj=val;}
var robj={};robj.element=e;robj.alt_tag='';robj.good=0;robj.type=valobj.type;if(valobj){if(isdisplayed(e)){validate_field_value(robj,valobj);}else{robj.good=1;}}
if(robj.good==0)hilite_error(robj);else if(robj.good==1)clear_error(robj);return robj.good;}
function validate_field_value(robj,valobj){var value='';if(valobj.type!="wordcount"&&valobj.type!="text"&&valobj.type!="postcode"&&valobj.type!="datetime"){value=robj.element.value.replace(/ /g,'');if(valobj.type=="currency"){value=value.replace(/[^0-9]*/g,'');}else if(valobj.type!="email"&&valobj.type!="numeric"&&valobj.type!="meters"){value=value.replace(/\./g,'');value=value.replace(/\,/g,'');}}else{value=robj.element.value;}
value=trim(value);if(valobj.type=="text"){if((valobj.optional==1)&&(value=='')||(value!="")&&(!isBlank(value))){robj.good=1;}else{robj.alt_tag="This is a required field";}}
else if(valobj.type=="payment_type"){if(value!=''){robj.good=1;}else{alert('Please select a payment method before clicking on checkout.');}}
else if(valobj.type=="username"){if(usernameReqxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Username must be between 3 - 20 characters long and contain only letters and numbers.";}}
else if(valobj.type=="password"){if(passwordRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Password must be between 6 - 20 characters long and contain only letters and numbers.";}}
else if(valobj.type=="checkbox"){robj.good=1;}
else if(valobj.type=="select-one"){if(robj.element.value!="-1"||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Please select a value from the pulldown menu";robj.good=0;}}
else if(valobj.type=="radio"){if(robj.element.checked||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Please select at least one of these options";}}
else if(valobj.type=="agree"){if(robj.element.checked){robj.good=1;}else{robj.alt_tag="Please tick to agree";}}
else if(valobj.type=="date"){if(dateRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Date format must be eg. dd/mm/yyyy";}}
else if(valobj.type=="datetime"){if(dateTimeRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Date time format must be eg. dd/mm/yyyy hh:mm";}}
else if(valobj.type=="card_date"){if(carddateRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Please make a selection from this drop down.";}}
else if(valobj.type=="time"){if(timeRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Time format must be in 24hr format eg. 16:00";}}
else if(valobj.type=="numeric"){if(numericRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Value entered should only contain digits eg. 1234";}}
else if(valobj.type=="csv"){if((numericRegxp.test(value)==true&&(value.length==3||value.length==4))||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Your security code should be either 3 or 4 digits.";}}
else if(valobj.type=="card_number"){if(numericRegxp.test(value)==true&&(value.length>=14&&value.length<=19)||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Please ensure you have entered your card number correctly.";}}
else if(valobj.type=="meters"){if(numericRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Fabrics can only be purchased in whole meters.";}}
else if(valobj.type=="currency"){if(currencyRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Must contain a positive currency value eg. 10.99";}}
else if(valobj.type=="postcode"){if(pcodeRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Ensure postcode is valid eg. BN27 2GH";}}
else if(valobj.type=="telephone"){value=value.replace(/ /g,'');if(telnoRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Ensure this is a valid phone number.";}}
else if(valobj.type=="http"){if(urlRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Please ensure you have entered a valid web address.";}}
else if(valobj.type=="email"){if(emailRegxp.test(value)==true||(valobj.optional==1&&value=='')){robj.good=1;}else{robj.alt_tag="Ensure this is a valid email address eg. somebody@domain.co.uk";}}
else if(valobj.type=="cm"||(valobj.optional==1&&value=='')){value=value.replace(/cm/,'');if(numericRegxp.test(value)==true){robj.good=1;}else{robj.alt_tag="This should be a value in cm eg. 100cm";}}
else{alert('Element ('+robj.element.name+') has unknown validation type! ('+valobj.type+')');robj.good=1;}
if(valobj.change_case){if(valobj.change_case=='upper'){value=value.toUpperCase();}else if(valobj.change_case=='lower'){value=value.toLowerCase();}else if(valobj.change_case=='capitalise'){value='Coming soon to a validate script near you';}}
if(valobj.minimum!=null){if(value>=valobj.minimum){robj.alt_tag="Entered value is below the minimum of "+valobj.minimum;robj.good=0;}}
if(valobj.maximum!=null){if(value<=valobj.maximum){robj.alt_tag="Entered value is above the maximum of "+valobj.maximum;robj.good=0;}}
if(valobj.round_up){value=parseInt((value*valobj.round_up)/valobj.round_up);}
if(valobj.round_down){value=(value/valobj.round_down)*valobj.round_down;}
if(valobj.expiry_date){var today=new Date();var mnth=$('dyn_expiry_month');var year=$('dyn_expiry_year');today.setDate(1);if(mnth.value!=-1&&year.value!=-1){var checkdate=new Date();checkdate.setFullYear(parseInt('20'+year.value),(mnth.value-1),2);if(checkdate>today){clear_error({'element':mnth,'alt_tag':''});clear_error({'element':year,'alt_tag':''});}else{var errstr="This card has expired please ensure you have entered the information correctly.";hilite_error({'element':mnth,'alt_tag':errstr});hilite_error({'element':year,'alt_tag':errstr});robj.good=0;}}}
if(valobj.start_date){var today=new Date();var mnth=$('dyn_start_month');var year=$('dyn_start_year');today.setDate(2);if(mnth.value!=-1&&year.value!=-1){var checkdate=new Date();checkdate.setFullYear(parseInt('20'+year.value),(mnth.value-1),1);if(checkdate<today){clear_error({'element':mnth,'alt_tag':''});clear_error({'element':year,'alt_tag':''});}else{var errstr="This card is not active yet please ensure you have entered the information correctly.";hilite_error({'element':mnth,'alt_tag':errstr});hilite_error({'element':year,'alt_tag':errstr});robj.good=0;}}}
if(valobj.conf_email){var errstr="Please ensure both email address fields match before continuing";var confObj=$(valobj.conf_email);if(confObj){var test=(value==confObj.value)?1:0;if(test){clear_error({'element':confObj,'alt_tag':''});}else{robj.alt_tag=(robj.good)?errstr:robj.alt_tag;hilite_error({'element':confObj,'alt_tag':errstr});robj.good=0;}}else{alert("No email confirmation email field with id: "+valobj.conf_email);}}
if(valobj.checkifblank){if(robj.good==0){var cobj={};cobj.element=$(valobj.checkifblank.name);cobj.alt_tag='';cobj.good=0;cobj.type=valobj.checkifblank.type;var cvalobj={}
cvalobj.type=valobj.checkifblank.type;if(cobj.element){validate_field_value(cobj,cvalobj);}else{cobj.good=0;}
robj.good=cobj.good;}}
if(valobj.onerrorhilite){var elements=valobj.onerrorhilite.split(',');for(var x=0;x<elements.length;x++){var obj=$(elements[x]);if(robj.good){clear_error({'element':obj,'alt_tag':''});}else{hilite_error({'element':obj,'alt_tag':robj.alt_tag});}}}
robj.element.value=value;}
function clear_error(robj){if(robj.type='radio'&&$(robj.element.name+"_div"))robj.element=$(robj.element.name+"_div");if(robj.element.style)robj.element.style.backgroundColor="";if(robj.element.style)robj.element.style.color="";robj.element.backgroundColor="";robj.element.color="";robj.element.title=(robj.alt_tag)?robj.alt_tag:"";robj.element.alt=(robj.alt_tag)?robj.alt_tag:"";}
function hilite_error(robj){if(robj.type='radio'&&$(robj.element.name+"_div"))robj.element=$(robj.element.name+"_div");if(robj.element.style)robj.element.style.backgroundColor="#AD3D36";if(robj.element.style)robj.element.style.color="#ffffff";robj.element.backgroundColor="#AD3D36";robj.element.color="#ffffff";robj.element.title=(robj.alt_tag)?robj.alt_tag:"";robj.element.alt=(robj.alt_tag)?robj.alt_tag:"";if(robj.element.attachEvent){robj.element.attachEvent('onchange',function(){clear_error({'element':this});});}
else{robj.element.addEventListener('change',function(){clear_error({'element':this});},false);}}
function display_error_dialogue(error,fail,scroll){var errorDivObj=$('message');if(errorDivObj){var display=(fail)?'block':'none';errorDivObj.style.display=display;errorDivObj.innerHTML=error;}
if(scroll)window.scrollTo(0,0);}
function trim(s){s=s.replace(/ $/g,'');s=s.replace(/^ /g,'');return s;}
function isBlank(s){if(s==''){return true}
return!notblankRegxp.test(s);}
function isdisplayed(node){var n=0;var fnd=0;while(fnd==0){if(n>1){node=node.parentNode;}
if(node){if(node.style){if(node.style.display){if(node.style.display=='block'){fnd=0;}
if(node.style.display=='none'){fnd=1;}}}}else{fnd=3;}
if(n>20){return true;}
n++;}
if(fnd==1){return false;}
if(fnd==0||fnd==3){return true;}}
if(typeof(_infx)=="undefined")var _infx={};_infx.popups=function(params){this.bgcolor='#aaaaaa';for(var p in params){this[p]=params[p];}
this.maskerobj=null;this.frame=null;this.dialogue=null;this.y_with_scroll=null;this.x_with_scroll=null;this.$=function(id){return document.getElementById(id);}
this.create_masker=function(){this.maskerobj=this.$('masker');if(!this.maskerobj){this.maskerobj=document.createElement("div");this.maskerobj.setAttribute("id","masker");this.maskerobj.style.backgroundColor=this.bgcolor;if(this.frame){this.frame.appendChild(this.maskerobj);}else{document.body.appendChild(this.maskerobj);}}}
this.create_popup=function(){this.frame=this.$('popup_frame');this.dialogue=this.$('popup_dialog');if(!this.frame){this.frame=document.createElement("div");this.frame.setAttribute("id","popup_frame");document.body.appendChild(this.frame);}
if(!this.dialogue){this.dialogue=document.createElement("span");this.dialogue.setAttribute("id","popup_dialog");this.frame.appendChild(this.dialogue);}}
this.switch_masker=function(onoff){if(this.maskerobj==null){this.create_masker();}
if(this.maskerobj){this.setOpacity(this.maskerobj,70);this.maskerobj.style.visibility=(onoff==1)?'visible':'hidden';this.getPageSizeWithScroll();if(document.all){this.maskerobj.style.height=this.y_with_scroll;this.maskerobj.style.width=this.x_with_scroll;}else{this.maskerobj.style.height=(this.y_with_scroll)+'px';this.maskerobj.style.width=(this.x_with_scroll-((this.y_max_scroll>0)?0:15))+'px';}}}
this.switch_popup=function(onoff,inner_html){if(this.frame==null||this.dialogue==null){this.create_popup();}
if(this.frame&&this.dialogue){this.frame.style.visibility=(onoff==1)?'visible':'hidden';this.dialogue.innerHTML=inner_html;this.popup_form=this.$('popup_form');if(inner_html!=''&&this.popup_form){if(document.all){this.page_offset=document.documentElement.scrollTop||(document.body.scrollTop||0);this.window_height=document.documentElement.clientHeight;this.window_width=document.documentElement.clientWidth;}else{this.page_offset=window.pageYOffset||(document.body.scrollTop||0);this.window_height=window.innerHeight;this.window_width=window.innerWidth;}
this.dialogue_height=this.popup_form.clientHeight;this.dialogue_width=this.popup_form.clientWidth;var top=parseInt((this.window_height/2)-(this.dialogue_height/2))+this.page_offset;var left=parseInt((this.window_width/2)-(this.dialogue_width/2));if(document.all){this.popup_form.style.pixelTop=top;this.popup_form.style.pixelLeft=left;}else{this.popup_form.style.top=top+'px';this.popup_form.style.left=left+'px';}}}}
this.getPageSizeWithScroll=function(){this.x_max_scroll=0;if(window.innerHeight){this.y_with_scroll=window.innerHeight+window.scrollMaxY;this.x_with_scroll=window.innerWidth+window.scrollMaxX;this.x_max_scroll=window.scrollMaxX;}else if(document.body.scrollHeight>document.body.offsetHeight){this.y_with_scroll=document.body.scrollHeight;this.x_with_scroll=document.body.scrollWidth;}else{this.y_with_scroll=document.body.offsetHeight;this.x_with_scroll=document.body.offsetWidth;}
}
this.setOpacity=function(obj,opacity){opacity=(opacity==100)?99.999:opacity;obj.style.filter="alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity=opacity/100;obj.style.MozOpacity=opacity/100;obj.style.opacity=opacity/100;}
this.fadeUp=function(obj_id,opacity,limit,fade_speed){if(!limit)limit=100;var obj=this.$(obj_id);if(obj){if(opacity<=limit){this.setOpacity(obj,opacity);opacity+=2.5;window.setTimeout("_infx.popup.fadeUp('"+obj_id+"',"+opacity+","+limit+","+fade_speed+");",fade_speed);}}}
this.fadeDown=function(obj_id,opacity,limit,fade_speed){var obj=this.$(obj_id);if(obj){this.setOpacity(obj,opacity);if(opacity>=limit){opacity-=2.5;window.setTimeout("_infx.popup.fadeDown('"+obj_id+"',"+opacity+","+limit+","+fade_speed+");",fade_speed);}}}
this.masker=function(onoff){this.switch_masker(onoff);}
this.layer=function(onoff,inner_html){this.switch_popup(onoff,inner_html);this.switch_masker(onoff);}
this.loading=function(onoff){this.switch_masker(onoff);this.maskerobj.innerHTML=(onoff)?"<div id='loading_frame' style=''><img src='/images/ajax-loader.gif' style='visibility:visible;'>&nbsp;</div>":"";}
this.mini_loading=function(id,onoff){var obj=this.$(id);if(obj)obj.style.display=(onoff==1)?'block':'none';if(this.$('basket_open'))this.$('basket_open').style.display=(onoff!=1)?'block':'none';}
this.add_to_basket_message=function(){_infx.popup.layer(1,"<div id='popup_form' style='width:460px;height:25px;padding-top:8px;'><div class='add_to_basket_message'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Item added to basket successfully!</div></div>");window.setTimeout("_infx.popup.layer(0,'');",1000);}
this.delivery_changed_message=function(){_infx.popup.layer(1,"<div id='popup_form' style='width:650px;height:25px;padding-top:8px;'><div class='information_message'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your changes may of affected the delivery charge please check before proceeding</div></div>");window.setTimeout("_infx.popup.layer(0,'');",2000);}}
_infx.popup=new _infx.popups();function ajax_request(site_url,callback){var http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('You are probably using the last version of Internet Explorer for the Mac which has been discontinued.');return false;}
http_request.onreadystatechange=function(){ajax_process_response(http_request,site_url,callback);};http_request.open('GET',site_url,true);http_request.send(null);}
function ajax_post_request(site_url,params,callback){var http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('You are probably using the last version of Internet Explorer for the Mac which has been discontinued.');return false;}
var parameters=make_url_params(params,0);http_request.onreadystatechange=function(){ajax_process_response(http_request,site_url,callback);};http_request.open('POST',site_url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function ajax_process_response(http_request,site_url,callback){if(http_request.readyState==4){if(http_request.status==200){if(http_request.responseText=='done'){window.location.href=unescape(window.location.pathname);}else{eval(callback);}}else{return false;}}}
function ajax_submit_form(json){var frmObj=$(json.frmname);if(frmObj){for(var n in json){var obj=frmObj[n];if(obj){obj.value=json[n];}}
var params={};var elements=frmObj.elements;for(var x=0;x<elements.length;x++){var el=elements[x];params[el.name]=el.value;}
if(json.val_list){if(verifylist(frmObj,json.val_list,json.error_panel)){ajax_post_request(json.script,params,json.callback);}}else{ajax_post_request(json.script,params,json.callback);}}else{alert("Can't find form with name "+json.frmname);}}
function ajax_fill_data(fill_id,returned){if(document.getElementById(fill_id)){document.getElementById(fill_id).innerHTML=returned;}else{}}
function ajax_populate_form(fill_id,form_id,returned){if(document.getElementById(fill_id)){document.getElementById(fill_id).innerHTML=returned;if(document.forms[form_id]){document.forms[form_id].submit();}}}
function ajax_request_form(fill_id,type){ajax_request("/cgi-bin/payment-control.pl?ac=ajax_form&type="+type,"ajax_populate_form('"+fill_id+"','dynamic_form',http_request.responseText);");}
function make_url_params(params_obj,first){var s='';for(p in params_obj){var sep=(first||first==null)?'?':'&';first=0;s+=sep+p+'='+encodeURI(params_obj[p]);};return s;}
var newsletter_signup='/cgi-bin/infxnewsletter/emailer.pl?ac=subscribe';var advert_widget='/cgi-bin/infxwidgets/widget-adverts.pl';var search_widget='/cgi-bin/infxwidgets/widget-site-search.pl';var send_info='/cgi-bin/send-info.pl';var search_timeout;function $(id){return document.getElementById(id);}
function submit_form(json){var frmObj=$(json.frmname);if(frmObj){for(var n in json){var obj=$(n);if(obj){obj.value=json[n];}else if(n!='frmname'&&n!='val_list'&&n!='error_panel'){alert("Can't Set "+n+" in "+json.frmname+" to "+json[n]);}}
if(json.val_list){if(verifylist(frmObj,json.val_list,json.error_panel)){frmObj.submit();}}else{frmObj.submit();}}else{alert("Can't find form with name "+json.frmname);}}
function signup_for_newsletter(type,message){if($('signup_name')){$('signup_name').value=($('signup_name').value=='Your Name')?"":$('signup_name').value;}
if($('signup_email')){$('signup_email').value=($('signup_email').value=='your@email.com')?"":$('signup_email').value;}
if(validate_single_field($('signup_email'),{'signup_email':'email'})){var name=($('signup_name'))?$('signup_email').value:"";ajax_request(newsletter_signup+'&name='+name+'&email='+$('signup_email').value+'&signup_type='+type+'&successtext='+escape(message),"ajax_fill_data('newsletter_signup',http_request.responseText);");}}
function send_page_to_a_friend(message){if(validate_single_field($('friend_email'),{'friend_email':'email'})){ajax_request(send_info+'?ac=send_to_a_friend&friends_email='+$('friend_email').value+'&recommended_page='+escape(location.href)+'&successtext='+escape(message),"ajax_fill_data('send_to_a_friend',http_request.responseText);");}}
function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);}
return[curleft,curtop];}
function keyCheck(e,checkcode){var keycode=(window.event)?event.keyCode:e.keyCode;return(keycode==checkcode)?true:false;}
function stop_propagation(event){if (!event) var event = window.event;event.cancelBubble = true;if (event.stopPropagation) event.stopPropagation();return false;} 
function BC_datachange(obj,lcb_fieldname){$('datachange').value=1;$(lcb_fieldname).value='';}
function toggle_panels(id_list,force){var id_array=id_list.split(',');for(var x=0;x<id_array.length;x++){toggle_panel(id_array[x],force);}}
function toggle_panel(id,force){var obj=$(id);if(obj)obj.style.display=(obj.style.display=='none'||force==1)?'block':'none';}
function toggle_panel_visibility(id,force){var obj=$(id);if(obj)obj.style.visibility=(obj.style.visibility=='hidden'||force==1)?'show':'hidden';}
function panel_control(id,display){var obj=$(id);if(obj)obj.style.display=display;}
function load_page(href){if(href!=location.href)location.href=href;}
function email(name,domain,suffix,text){var address=name+"\u0040"+domain+"."+suffix;var url="mailto:"+address;document.write("<a href=\""+url+"\">"+((!text)?address:text)+"</a>");}
function search_control(json){if($('search_spinner'))$('search_spinner').style.visibility=(json.searchtxt!='')?'visible':'hidden';if(json.searchtxt!=''){ajax_post_request(search_widget,json,"display_search_results('search_results',http_request.responseText);");}else{display_search_results('search_results','');}}
function display_search_results(fill_id,returned){if(document.getElementById(fill_id)){if($('search_spinner'))$('search_spinner').style.visibility='hidden';document.getElementById(fill_id).innerHTML=returned;}}
function delay_submit_search(value){if(search_timeout)clearTimeout(search_timeout);value=escape(value);search_timeout=setTimeout("search_control({'searchtxt':'"+value+"','ac':'search'});",500);}
function submit_search(value){var json={};json.ac='search';json.searchtxt=value;ajax_post_request(search_widget,json,"ajax_fill_data('search_results',http_request.responseText);");}
function switch_advert_category(type,amount,target,category,control_type){var json={};json.type=type;json.dir=(type=='smallads')?'/dyn/_smallads/':'/dyn/_mainads/';json.amount=amount;json.category=category;json.control_type=control_type;json.ajax=1;ajax_post_request(advert_widget,json,"advert_callback(http_request.responseText);");}
function advert_callback(target,jsonstr){var json;eval("json = "+jsonstr+";");ajax_fill_data(json.control_type,json.control_html);ajax_fill_data(target,json.content);}
function close_search(value){ajax_fill_data('search_results','');}
var useBSNns;if(useBSNns)
{if(typeof(bsn)=="undefined")
bsn={}
var _bsn=bsn;}
else
{var _bsn=this;}
_bsn.Crossfader=function(divs,fadetime,delay)
{this.nAct=-1;this.aDivs=divs;for(var i=0;i<divs.length;i++){document.getElementById(divs[i]).style.opacity=0;document.getElementById(divs[i]).style.position="absolute";document.getElementById(divs[i]).style.filter="alpha(opacity=0)";document.getElementById(divs[i]).style.visibility="hidden";}
this.nDur=fadetime;this.nDelay=delay;this.bPlay=1;this.queue=-1;this.nDelayCnt=0;var p=this;this.nID1=setInterval(function(){p._timer()},this.nDelay/100);this._newfade();}
_bsn.Crossfader.prototype._timer=function()
{if(this.bPlay)this.nDelayCnt++;if(this.nDelayCnt>100&&!this.fading){this._newfade();}}
_bsn.Crossfader.prototype._selectfade=function(idx)
{this.queue=idx;this.nDelayCnt=101;this.bPlay=0;}
_bsn.Crossfader.prototype._newfade=function()
{this.nDelayCnt=0;this.nOldAct=this.nAct;this.nAct++;if(this.queue>-1){this.nAct=this.queue;this.queue=-1;}
if(!this.aDivs[this.nAct])this.nAct=0;if(this.nAct==this.nOldAct)
return false;document.getElementById(this.aDivs[this.nAct]).style.visibility="visible";this.nInt=50;this.nTime=0;var p=this;this.fading=1;this.nID2=setInterval(function(){p._fade()},this.nInt);}
_bsn.Crossfader.prototype._play=function()
{this.bPlay=1;this.nDelayCnt=100;}
_bsn.Crossfader.prototype._fade=function()
{this.nTime+=this.nInt;var ieop=Math.round(this._easeInOut(this.nTime,0,1,this.nDur)*100);var op=ieop/100;document.getElementById(this.aDivs[this.nAct]).style.opacity=op;document.getElementById(this.aDivs[this.nAct]).style.filter="alpha(opacity="+ieop+")";if(this.nOldAct>-1)
{document.getElementById(this.aDivs[this.nOldAct]).style.opacity=1-op;document.getElementById(this.aDivs[this.nOldAct]).style.filter="alpha(opacity="+(100-ieop)+")";}
if(this.nTime==this.nDur)
{clearInterval(this.nID2);this.fading=0;if(this.nOldAct>-1)
document.getElementById(this.aDivs[this.nOldAct]).style.visibility="hidden";if(this.queue>-1){this._selectfade(this.queue);this.queue=-1;}
var p=this;this.nDelayCnt=0;}}
_bsn.Crossfader.prototype._easeInOut=function(t,b,c,d)
{return c/2*(1-Math.cos(Math.PI*t/d))+b;}