
var is_IE=0;var is_firefox=0;var loaded=0;nav=navigator.userAgent;var global_url="http://www.lan.co.uk/";var s_global_url='https://www.lan.co.uk/';re=/MSIE/gi;if(nav.match(re)){is_IE=1;}else{re=/Firefox/gi;if(nav.match(re)){is_firefox=1;}}
var load_side_only=0;var logon_form=null;var page_y=100;var option_y=100;var menu_y=100;var speed=10;var inc=10;var inc_x=40;var inc_y=10;var flash_frame_h=0;var show_laymans=false;var site_fixed_height=0;var site_float=0;var site_width=1000;var flash_disabled=0;var last_menu_obj=null;var menu_in_obj=null;var menu_out_obj=null;var menus_loaded=Array();var page_type="";var page_id="";var products=Array();var qa_arr=Array();var menu_width=200;var left_menu_width=200;var right_menu_width=200;var header_img_repeat=0;var main_overflow_x=0;var main_overflow_y=1;var left_overflow_x=0;var left_overflow_y=1;var right_overflow_x=0;var right_overflow_y=1;var site_float_y=0;var flash_color_1="#ffffff";var flash_color_2="#ffffff";var flash_highlight_color="#ff0000";var flash_main_color_1="#ffffff";var flash_main_color_2="#ffffff";var flash_bg_color="#ffffff";var flash_back_width=450;var default_postage=4.95;var non_default_postage=10.95;var default_postage_text="Postage & Insurance";var non_default_postage_text="International Postage";var top_bar_font_color='#999999';var dropdown_menu_left_offset=1;var mem_allow_logon=1;var gallery_show_img_name=0;var gallery_img_name_color='#ff0000';var header_height=100;var header_type=1;var can_get_basket=1;var footer_bar_height=130;var print_header="";var gallery_background_random=0;var page_back_img_below_header=2;var basket_empty_txt="";var main_menu_btn_spacing=1;var dropdown_min_height=25;var form_error_color="#ff0000";var ARTICLES_TITLE="Articles";var USE_HTACCESS_REWRITE=1;var DEFAULT_NAME="Lantec";function flashAction(action){closeAllMenus();switch(action){}}
function checkEnterPressed(e){if(!e){if(window.event){e=window.event;}else{return false;}}
if(typeof(e.which)=='number'){e=e.which;if(e=='13')return true;}else if(typeof(e.keyCode)=='number'){e=e.keyCode;if(e=='13')return true;}else if(typeof(e.charCode)=='number'){e=e.charCode;if(e=='13')return true;}else{return false;;}}
function bookmark(){title=document.title;url=document.location;if(window.external){try{window.external.AddFavorite(url,title);}catch(e){}}
if(window.sidebar){try{window.sidebar.addPanel(title,url,'');}catch(e){}}}
function updateDivHTML(id,txt,is_encoded){if(document.getElementById(id)){document.getElementById(id).innerHTML=(is_encoded==1)?decode64(txt):txt;}}
function checkemail(email){var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(filter.test(email))
return true;else{return false;}}
function printPrep(html){re=/(<[^>]*)\bname[\s]*=[\s]*(['"]?)[^\2\s>]+/gi;if(html.match(re)){html=html.replace(re,"$1");}
re=/(<[^>]*)\bid[\s]*=[\s]*(['"]?)[^\2\s>]+/gi;if(html.match(re)){html=html.replace(re,"$1");}
re=/<script>.*?<\/script>/gi;if(html.match(re)){html=html.replace(re,"");}
re=/overflow: hidden;/gi;if(html.match(re)){html=html.replace(re,"");}
return html;}
function printDiv(div){if(div&&document.getElementById('print_div')){document.getElementById('print_div').innerHTML=print_header;document.getElementById('print_div').innerHTML+=printPrep(div.innerHTML);window.print();}}
function updatePrintDiv(){if((document.getElementById('main_content'))&&(document.getElementById('print_div'))){document.getElementById('print_div').innerHTML=print_header;document.getElementById('print_div').innerHTML+=printPrep(document.getElementById('main_content').innerHTML);}}
function createControls(){document.write("<iframe name=\"main_frame\" id=\"main_frame\"></iframe>\r\n");document.write("<iframe name=\"process_frame\" id=\"process_frame\"></iframe>\r\n");document.write("<iframe name=\"process_frame2\" id=\"process_frame2\"></iframe>\r\n");document.write("<iframe name=\"logon_frame\" id=\"logon_frame\"></iframe>\r\n");}
function formatQAItem(str){re=/<AND>/gi
str=str.replace(re,"&");re=/<DBLQUOTE>/gi
str=str.replace(re,'"');re=/<SGLQUOTE>/gi
str=str.replace(re,"'");return str;}
function loadQA(id){try{if(qa_arr[id]){arr=qa_arr[id];last_cat1="";last_cat2="";current_list=null;for(i=0;i<arr.length;i++){cat1=arr[i]["category1"];cat2=arr[i]["category2"];if(last_cat1!=cat1){last_cat1=cat1;last_cat2=cat2;newItem=document.createElement('option');newItem.value=cat2;newItem.text=(cat2!="")?"-- "+formatQAItem(cat2):"-- "+formatQAItem(cat1);re=/\W/gi;cat_str=cat1.replace(re,"").toLowerCase();list=document.getElementById(cat_str+"_cat2_"+id);if(list){current_list=list;try{list.add(newItem,null);}catch(ie_err){list.add(newItem);}}else{current_list=null;}}
if((last_cat2!=cat2)&&(current_list)){last_cat2=cat2;newItem=document.createElement('option');newItem.value=cat2;newItem.text="-- "+cat2;try{list.add(newItem,null);}catch(ie_err){list.add(newItem);}}}}}catch(qa_err){}}
function clearList(list){if((list)&&(list.length>0)){for(l=(list.length-1);l>=0;l--){list.remove(l);}
list.length=0;}}
function showQABlank(cat_str,cat,id){blank_div=document.getElementById(cat_str+"_blank_"+id);if((blank_div)&&(qa_arr[id])){arr=qa_arr[id];for(a=0;a<arr.length;a++){if(arr[a]["category1"]==cat){div=document.getElementById("txt_div_"+a+"_"+id);if(div){div.style.display="none";}}}
blank_div.style.display="block";}}
function loadQuestions(list,index,cat,id){if(index>-1){val=list[index].value;re=/\W/gi;cat_str=cat.replace(re,"").toLowerCase();list=document.getElementById(cat_str+"_qs_"+id);if(list){clearList(list);showQABlank(cat_str,cat,id);if(val=="resetlist"){if(document.getElementById('qs_div_'+id)){document.getElementById('qs_div_'+id).innerHTML="&nbsp;";}}else{if(document.getElementById('qs_div_'+id)){document.getElementById('qs_div_'+id).innerHTML="Now choose your question";}
newItem=document.createElement('option');newItem.value="reset";newItem.text="Select your question here";newItem.style.color="#666666";try{list.add(newItem,null);}catch(ie_err){list.add(newItem);}
arr=qa_arr[id];for(a=0;a<arr.length;a++){if((arr[a]["category1"]==cat)&&(arr[a]["category2"]==val)){newItem=document.createElement('option');newItem.value=a;newItem.text="-- "+formatQAItem(arr[a]["question"]);try{list.add(newItem,null);}catch(ie_err){list.add(newItem);}}}}}else{}}}
function loadAnswer(list,index,cat,id){if(index>-1){val=list[index].value;Math.abs(val);re=/\W/gi;cat_str=cat.replace(re,"").toLowerCase();if(qa_arr[id]){found=0;arr=qa_arr[id];for(a=0;a<arr.length;a++){if(arr[a]["category1"]==cat){div=document.getElementById("txt_div_"+a+"_"+id);if(div){div.style.display=(a==val)?"block":"none";if(a==val){found=1;}}}}
blank_div=document.getElementById(cat_str+"_blank_"+id);if(blank_div){blank_div.style.display=(found==1)?"none":"block";}}}}
function stopScrollDiv(id){if(window[id]){clearTimeout(window[id]);}}
function startScrollDiv(id){if(window[id]){clearTimeout(window[id]);}
window[id]=setInterval("scrollDiv('"+id+"')",60);}
function scrollDiv(id){if((document.getElementById("d_"+id))&&(document.getElementById("s_"+id))){try{frame_h=parseInt(parent.document.getElementById("d_"+id).style.height);div_h=document.getElementById("s_"+id).clientHeight;t=parseInt(document.getElementById("s_"+id).style.top);if(t>(0-div_h)){document.getElementById("s_"+id).style.top=(t-1)+"px";}else{document.getElementById("s_"+id).style.top=frame_h+"px";}}catch(e){}}}
function toggleShowSearch(div,search_box_tag){if(search_box_tag){search_box_tag="_"+search_box_tag;}else{search_box_tag="";}
img=div+"_img";re1=/_down/gi;re2=/_up/gi;if(document.getElementById(img)){shown=(document.getElementById(img).src.match(re1))?1:0
document.getElementById(img).src=(shown==1)?document.getElementById(img).src.replace(re1,"_up"):document.getElementById(img).src.replace(re2,"_down");if(document.getElementById(div)){document.getElementById(div).style.display=(shown==1)?"block":"none";resizePage();}
show_search_box=(shown==1)?1:0;expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+6);parent.document.cookie="show_search_box"+search_box_tag+"="+show_search_box+";expires="+expireDate.toGMTString()+";path=/";}}
function toggleMainMenu(bool){if(document.getElementById('header_menu')){document.getElementById('header_menu').style.display=(bool)?"block":"none";}}
function toggleHeader(bool){check_h=(bool)?"block":"none";if(document.getElementById('header').style.display!=check_h){document.getElementById('header').style.height=(bool)?header_height+"px":"0px";document.getElementById('header').style.display=(bool)?"block":"none";}
if((document.getElementById('custom_header'))&&(document.getElementById('custom_header').style.display!=check_h)){document.getElementById('custom_header').style.display=(bool)?"block":"none";}}
function toggleFooter(bool){check_h=(bool)?"block":"none";if((document.getElementById('footer_menu'))&&(document.getElementById('footer_menu').style.display!=check_h)){document.getElementById('footer_menu').style.display=(bool)?"block":"none";}}
function updateHeader(html){if(document.getElementById('custom_header')){if(document.getElementById('custom_header').innerHTML!=decode64(html)){document.getElementById('custom_header').innerHTML=decode64(html);}}}
function removeLastSearchOption(rewrite_flag){search_options="";theCookie=""+parent.document.cookie;cookieName="search_options"+DEFAULT_NAME.toLowerCase();ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){basket="";}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val=unescape(theCookie.substring(ind+cookieName.length+1,ind1));search_options=val;}
if(search_options!=""){search_opt_arr=search_options.split("|");new_search_options="";for(i=0;i<search_opt_arr.length-1;i++){new_search_options+=(new_search_options!="")?"|":"";new_search_options+=search_opt_arr[i];}
expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+2);document.cookie="search_options"+DEFAULT_NAME.toLowerCase()+"="+new_search_options+";expires="+expireDate.toGMTString()+";path=/";if(rewrite_flag){var loc=window.location+"";re=/page\d+$/g
loc=loc.replace(re,"");window.location=loc;}else if(current_page!=""){p_url=global_url+current_page.substr(1);q_arr=p_url.split("?");q_arr2=q_arr[1].split("&");new_q_str="";for(i=0;i<q_arr2.length;i++){if((q_arr2[i].split("=")[0]!="rs")&&(q_arr2[i].split("=")[0]!="cp")){new_q_str+=(new_q_str=="")?q_arr2[i]:"&"+q_arr2[i];}}
p_url=q_arr[0]+"?"+new_q_str;loadPage(p_url);}}}
function getCalenderPosition(coord,myevent){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;val=getCurrentMousePosition(coord,myevent);if(coord=="x"){w+=document.documentElement.scrollLeft;cal_center_w=Math.ceil(parseInt(document.getElementById('calender').clientWidth)/2);if((val+cal_center_w)>w){x=w-(cal_center_w*2)}else{x=val-cal_center_w}
return x;}
if(coord=="y"){h+=document.documentElement.scrollTop;cal_center_h=Math.ceil(parseInt(document.getElementById('calender').clientHeight)/2);if((val+cal_center_h)>h){y=h-(cal_center_h*2)}else{y=val-cal_center_h}
return y;}
return 0;}
function getCurrentMousePosition(coord,myevent){try{start_move=0;if(mouse_move_started==0){start_move=1;startMouseMove();}
getMouseXY(myevent);if(start_move==1){mouse_move_started=0;document.onmousemove=null;}
if(coord=="x"){return tempX;}
if(coord=="y"){return tempY;}}catch(er){}
return 0;}
function clearSearchOptions(reload_p,rewrite_flag){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()-2);document.cookie="search_options"+DEFAULT_NAME.toLowerCase()+"=;expires="+expireDate.toGMTString()+";path=/";if(USE_HTACCESS_REWRITE==0){document.cookie="search_article_options=;expires="+expireDate.toGMTString()+";path=/";document.cookie="show_search_box_article=;expires="+expireDate.toGMTString()+";path=/";}
document.cookie="show_search_box=;expires="+expireDate.toGMTString()+";path=/";if(reload_p){if(rewrite_flag){var loc=window.location+"";re=/page\d+$/g
loc=loc.replace(re,"");window.location=loc;}else if(current_page!=""){p_url=global_url+current_page.substr(1)+"&clear";q_arr=p_url.split("?");q_arr2=q_arr[1].split("&");new_q_str="";for(i=0;i<q_arr2.length;i++){if((q_arr2[i].split("=")[0]!="rs")&&(q_arr2[i].split("=")[0]!="cp")&&(q_arr2[i].split("=")[0]!="show_all")){new_q_str+=(new_q_str=="")?q_arr2[i]:"&"+q_arr2[i];}}
p_url=q_arr[0]+"?"+new_q_str;loadPage(p_url);}}}
function updateSearchArticles(keyword,category,date_from,date_to){str=encode64(keyword+"")+"|"+encode64(category+"")+"|"+encode64(date_from+"")+"|"+encode64(date_to+"");expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+2);document.cookie="search_article_options="+str+";expires="+expireDate.toGMTString()+";path=/";if(current_page!=""){p_url=global_url+current_page.substr(1)+"&1";q_arr=p_url.split("?");q_arr2=q_arr[1].split("&");var load_cat_tag="";new_q_str="";for(i=0;i<q_arr2.length;i++){if(q_arr2[i].split("=")[0]=="load_article"){load_cat_tag=q_arr2[i].split("=")[1];}
if((q_arr2[i].split("=")[0]!="rs")&&(q_arr2[i].split("=")[0]!="cp")){new_q_str+=(new_q_str=="")?q_arr2[i]:"&"+q_arr2[i];}}
p_url=q_arr[0]+"?"+new_q_str;loadPage(p_url);}else if(USE_HTACCESS_REWRITE==1){var loc=window.location+"";re=/page\d+$/g
loc=loc.replace(re,"");window.location=loc;}}
function updateSearchOption(opt,type,rewrite_flag){if(opt!=""){search_options="";theCookie=""+parent.document.cookie;cookieName="search_options"+DEFAULT_NAME.toLowerCase();ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){basket="";}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val=unescape(theCookie.substring(ind+cookieName.length+1,ind1));search_options=val;if(search_options==";"){search_options="";}}
if(search_options!=""){search_opt_arr=search_options.split("|");}else{search_opt_arr=Array();}
if(type=="add"){found=0;for(i=0;i<search_opt_arr.length;i++){if(search_opt_arr[i]==opt){found=1;break;}}
if(found==0){search_opt_arr.push(opt);}}else if(type=="remove"){found=0;for(i=0;i<search_opt_arr.length;i++){if(search_opt_arr[i]==opt){search_opt_arr.splice(i,1);break;}}}
new_search_options="";for(i=0;i<search_opt_arr.length;i++){new_search_options+=(new_search_options!="")?"|":"";new_search_options+=search_opt_arr[i];}
expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+2);document.cookie="search_options"+DEFAULT_NAME.toLowerCase()+"="+new_search_options+";expires="+expireDate.toGMTString()+";path=/";if(search_options!=new_search_options){if(rewrite_flag){var loc=window.location+"";re=/page\d+$/g
loc=loc.replace(re,"");window.location=loc;}else if(new_search_options==""){loc=window.location;window.location=loc;}else if(current_page!=""){p_url=global_url+current_page.substr(1)+"&1";q_arr=p_url.split("?");q_arr2=q_arr[1].split("&");new_q_str="";for(i=0;i<q_arr2.length;i++){if((q_arr2[i].split("=")[0]!="rs")&&(q_arr2[i].split("=")[0]!="cp")){new_q_str+=(new_q_str=="")?q_arr2[i]:"&"+q_arr2[i];}}
p_url=q_arr[0]+"?"+new_q_str;loadPage(p_url);}}}}
function showLoading(){document.getElementById('main_content').innerHTML="<div style=\"padding:20px;\"><div style=\"display:inline;padding:2px;background-color:#ffffff;\">loading please wait...</div></div>";}
function updateMainContent(){frame=window.frames['main_frame'];document.getElementById('main_frame').style.display="block";if(frame.document.getElementById('page_details')){document.getElementById('main_content').innerHTML=frame.document.getElementById('page_details').innerHTML;updatePrintDiv();try{if(frame.document.getElementById('left_menu_details')){if(frame.document.getElementById('left_menu_details').innerHTML!="LEAVE"){document.getElementById('left_content').innerHTML=frame.document.getElementById('left_menu_details').innerHTML;}}else{if(document.getElementById('left_content')){document.getElementById('left_content').innerHTML="";}
menu_y=100;}
if(frame.document.getElementById('right_menu_details')){document.getElementById('right_content').style.display="block";if(frame.document.getElementById('right_menu_details').innerHTML!="LEAVE"){document.getElementById('right_content').innerHTML=frame.document.getElementById('right_menu_details').innerHTML;}}else{if(document.getElementById('right_content')){document.getElementById('right_content').innerHTML="";}
option_y=100;}
try{closeAllMenus();}catch(e){}}catch(e1){}
try{frame.onPageComplete();}catch(e){}}
window.frames['main_frame'].src="";resizePage();document.getElementById('main_frame').style.display="none";}
function loadFlashPage(type,p){if(type!=""){loadPage(global_url+"scripts/pages.php?page_type="+type+"&p="+p);}else{loadPageNum(p);}}
var auto_load_cat="";function rtnHome(){var str=decode64("aHR0cDovLw==");var re=new RegExp("https://");window.location.href=global_url.replace(re,str);}
function loadMenu(type,id,page_type){frame=(type==1)?"side_menu_frame":"features_frame";str=type+"|"+id+"|"+page_type;str=encode64(str);document.getElementById(frame).src=global_url+"scripts/options.php?"+str;}
var gallery_style=0;var gallery_downloads=0;var flash_load_str="";var load_flash_on_complete=0;var side_menu_moving=0;var right_menu_moving=0;function loadFlash(str){if(!str){str="";}
if(str!=""){temp=str.split(":");flash=temp[0].toLowerCase();re1=/\s{1,}/gi;flash=flash.replace(re1,"_");size=temp[1];if(!temp[2]){xtra="";}else{xtra=temp[2];}
var w=Math.abs(temp[4]);if(side_menu_moving==0){if((flash_in==0)||(flash_frame_h!=size)){load_flash_on_complete=1;flash_load_str=str;document.getElementById('flash_frame').innerHTML="";if(flash_frame_h<size){flash_frame_h=size;flashIn();}else{flash_frame_h=size;flash_out_h=size;flashOut();}}else{load_flash_on_complete=0;flash_load_str="";re=/gallery carousel/gi;if(str.match(re)){f_file=loadSWF(flash,flash+".swf?global_url="+global_url+"&gallery="+temp[2]+"&page="+temp[3]+"&style="+gallery_style+"&downloads="+gallery_downloads+"&high_c="+flash_highlight_color+"&show_name="+gallery_show_img_name+"&name_c="+gallery_img_name_color+"&bg_color="+flash_bg_color+"&w="+w);}else{f_file=loadSWF(flash,flash+".swf?global_url="+global_url+"&c1="+flash_color_1+"&c2="+flash_color_2+"&high_c="+flash_highlight_color+"&main_c1="+flash_main_color_1+"&main_c2="+flash_main_color_2+"&bw="+flash_back_width+"&xtra="+xtra+"&w="+w);}
document.getElementById('flash_frame').innerHTML=f_file;}}else{load_flash_on_complete=1;flash_load_str=str;}}else if(flash_in==1){load_flash_on_complete=0;flash_out_h=0;flash_load_str="";document.getElementById('flash_frame').innerHTML="";flashOut();}}
function loadFlashDiv(str,divname){div=document.getElementById(divname);if(div){if(str==""){div.innerHTML="";}else{temp=str.split(":");flash=temp[0].toLowerCase();re1=/\s{1,}/gi;flash=flash.replace(re1,"_");size=temp[1];if(!temp[2]){xtra="";}else{xtra=temp[2];}
var w=Math.abs(temp[4]);re=/gallery carousel/gi;if(str.match(re)){f_file=loadSWF(flash,flash+".swf?global_url="+global_url+"&gallery="+temp[2]+"&page="+temp[3]+"&style="+gallery_style+"&downloads="+gallery_downloads+"&high_c="+flash_highlight_color+"&show_name="+gallery_show_img_name+"&name_c="+gallery_img_name_color+"&bg_color="+flash_bg_color+"&w="+w);}else{f_file=loadSWF(flash,flash+".swf?global_url="+global_url+"&c1="+flash_color_1+"&c2="+flash_color_2+"&high_c="+flash_highlight_color+"&main_c1="+flash_main_color_1+"&main_c2="+flash_main_color_2+"&bw="+flash_back_width+"&xtra="+xtra+"&w="+w);}
div.innerHTML=f_file;}}}
function loadSWF(f,fs,width,height,path,scale,salign){if((!path)||(path=="")){path=global_url+'flash/';}
if(!width){width="100%";}
if(!height){height="100%";}
if(!scale){scale="noscale";}
if(!salign){salign="";}
f_file='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" id="'+f+'" align="middle"><param name="salign" value="'+salign+'" /><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+path+fs+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="'+scale+'" /><param name="wmode" value="transparent" /><embed src="'+path+fs+'" loop="false" menu="false" quality="high"  scale="'+scale+'" wmode="transparent"  width="'+width+'" height="'+height+'" salign="'+salign+'" name="'+f+'"  align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';return f_file;}
function drawFlash(f,fs,w,h,path,scale){document.write(loadSWF(f,fs,w,h,path,scale));}
function loadSWFBackground(swf_back_file,swf_scale_type,swf_alignment){document.write(loadSWF("swf_back",swf_back_file,"100%","100%",global_url+"flash/",swf_scale_type,swf_alignment));}
function openWindow(id,url,w,h){resizeable="no";if(!w){w="800";resizeable="yes";}
if(!h){h="600";resizeable="yes";}
params='width='+w+', height='+h+', resizable='+resizeable+', scrollbars=no, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no';var fwin=window.open(url,id,params);if(fwin&&window.focus)fwin.focus();}
var last_cat_src="";function loadCatalogue(product_id,cat1,cat2,brand,tag,auto){moveCalender(-2000,-2000);str=str1=product_id+","+cat1+","+cat2+","+brand+","+tag;str=encode64(str);showLoading();document.getElementById('main_frame').src=last_cat_src=global_url+"scripts/pages.php?load_catalogue="+str;}
function loadArticle(article_id,list_type,category,no_of_records,date_from,date_to){moveCalender(-2000,-2000);str=str1=article_id+","+list_type+","+category+","+no_of_records+","+date_from+","+date_to;str=encode64(str);showLoading();document.getElementById('main_frame').src=last_cat_src=global_url+"scripts/pages.php?load_article="+str;}
function cancelStyle(){}
function loadPageStyle(img,flag,background_image,background_repeat){re_img=/.jpg/gi;flag=Math.abs(flag);try{folder_path=(img=="header_default.jpg")?"images/":"uploads/image/";header_img=((img!="")&&(flag=='1'))?"url("+global_url+folder_path+img+")":"none";if(document.getElementById('header_img_div').style.backgroundImage!=header_img){document.getElementById('header_img_div').style.backgroundImage=header_img;document.getElementById('header_img_div').style.backgroundRepeat=(header_img_repeat==1)?"repeat-x":"no-repeat";document.getElementById('header_img_div').style.backgroundPosition="50% 0px";}}catch(e1){document.getElementById('header').style.backgroundImage="none";}
try{if((background_image)&&(background_image!="")&&(background_image.substr(0,8)!="gallery:")){if(document.getElementById('main_page_back').style.backgroundImage!="url("+global_url+"uploads/image/"+background_image+")"){document.getElementById('main_page_back').style.backgroundImage="url("+global_url+"uploads/image/"+background_image+")";}
document.getElementById('main_page_back').style.backgroundRepeat=(background_repeat!="")?background_repeat:"repeat";}else if(background_image.substr(0,8)!="gallery:"){document.getElementById('main_page_back').style.backgroundImage='none';}}catch(e1){}}
function drawFlashHeader(rtn){obj='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%" id="flash_header" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+global_url+'flash/flash_header.swf?global_url='+global_url+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="salign" value="t" /><param name="wmode" value="transparent" /><embed src="'+global_url+'flash/flash_header.swf?global_url='+global_url+'" loop="false" menu="false" quality="high" scale="noscale" wmode="transparent" salign="t" width="100%" height="100%" name="flash_header" swLiveConnect=true align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';if((is_IE==0)&&(is_firefox==0)){ver=GetSwfVer();if(ver<"10.0.22"){obj='<div style=\"padding:50px;\" align=\"right\">Please download the latest <a href=\"http://get.adobe.com/flashplayer/\" target=\"_blank\" style=\"color:#000000;\"><u>flash player</u></a></div>';}}
if(!rtn){document.write(obj);}else{return obj;}}
function drawFlashHeaderMC(){site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+site_f_width+'" height="100%" id="flash_header_mc" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+global_url+'flash/flash_header_mc.swf?global_url='+global_url+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><embed src="'+global_url+'flash/flash_header_mc.swf?global_url='+global_url+'" loop="false" menu="false" quality="high" scale="noscale" wmode="transparent" width="'+site_f_width+'" height="100%" name="flash_header_mc" swLiveConnect=true align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');}
var lastbg_color="transparent";var lastf_color=top_bar_font_color;function toggleBackStyle(field,tog){try{if(tog==1){lastbg_color=(field.style.backgroundColor)?field.style.backgroundColor:lastbg_color;lastf_color=(field.style.color)?field.style.color:lastf_color;}
field.style.backgroundColor=(tog==1)?"#ffffff":lastbg_color;field.style.color=(tog==1)?"#000000":lastf_color;}catch(transErr){}}
function forgotPassword(secure_flag){var str=(secure_flag==1)?"s_forgot_password":"forgot_password";document.getElementById('main_frame').src=last_cat_src=global_url+"scripts/pages.php?"+str;}
function flashSearch(txt){var re=/[^a-zA-Z0-9\s_£&\?\.\-\:\/]/gi
txt=txt.replace(re,'');var re=/\s+/gi
txt=txt.replace(re,' ');var re=/\s/gi
test=txt.replace(re,"");if(test!=""){if(USE_HTACCESS_REWRITE==1){var dir_str="";var search_arr=txt.split(' ');for(i in search_arr){search_arr[i]=trim(search_arr[i]);if(search_arr[i]!=""){dir_str+=(dir_str=="")?"":"/";dir_str+=urlencode(search_arr[i]);}}
var str=decode64("aHR0cDovLw==");var re=new RegExp("https://");top.window.document.location=global_url.replace(re,str)+"search/"+dir_str;}else{txt=encode64(txt);loadPage(global_url+"scripts/search.php?"+txt);}}else{rtnHome();}}
var default_search_txt="enter keyword";function checkClearSearch(){if(document.search_form.search_txt.value==default_search_txt){document.search_form.search_txt.value='';}}
function checkSearch(){closeAllMenus();fm=document.search_form;if((fm.search_txt.value=="")||(fm.search_txt.value==default_search_txt)||(fm.search_txt.value=="searching...")){fm.search_txt.value=default_search_txt;fm.search_txt.focus();fm.search_txt.select();}else{flashSearch(fm.search_txt.value);toggleBackStyle(fm.search_txt,0);}}
function reloadPage(){if(current_page!=""){document.getElementById('main_frame').src=global_url+current_page;}}
function openDocument(doc){window.open(global_url+"scripts/document.php?"+doc);setTimeout("reloadPage()",5000);}
function askQuestion(){document.getElementById('main_frame').src=global_url+"scripts/ask_question.php?edit=new";}
function formatPassword(field){val=field.value;re=/\W/gi
if(val.match(re)){val=val.replace(re,'');if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="Your password can only contain letters, numbers or the underscore(_)";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="block";}
resizePage();}else{alert("Your password can only contain letters, numbers or the underscore(_)")}
field.focus();field.value=val;}else{if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="&nbsp;";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="none";}
resizePage();}}}
function checkPasswordLength(field){if((field.value.length<6)&&(field.value.length>0)){if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="Your password must be at least 6 characters in length";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="block";}
resizePage();}else{alert("Your password must be at least 6 characters in length");}
field.value="";field.focus();}else{if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="&nbsp;";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="none";}
resizePage();}}}
function checkPasswordMatch(field,original,rtn){if((original)&&(field.value!="")&&(original.value!="")){if(rtn){return(original.value==field.value)?true:false;}else{if(original.value!=field.value){if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="Please re-confirm your password";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="block";}
resizePage();}else{alert("Please re-confirm your password")}
field.value="";field.focus();}else{if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="&nbsp;";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="none";}
resizePage();}}}}else{if(document.getElementById('error_txt')){document.getElementById('error_txt').innerHTML="&nbsp;";if(document.getElementById('error_box')){document.getElementById('error_box').style.display="none";}
resizePage();}}
return true;}
function closeSearch(clear){fm=document.search_form;fm.search_txt.value=(clear)?"":last_search;fm.search_txt.disabled=false;fm.search_btn.value="product code"
fm.search_btn.disabled=false;}
var last_search="";function searchProduct(keyword){last_search=keyword;fm=document.search_form;fm.search_txt.value="searching..."
fm.search_txt.disabled=true;fm.search_btn.value="..."
fm.search_btn.disabled=true;str=str1="search_products|"+keyword+"|";str=encode64(str);document.getElementById('main_frame').src=global_url+"scripts/pages.php?load_catalogue="+str;}
function showSearchResults(clear){fm=document.search_form;fm.search_txt.value=(clear)?"":last_search;fm.search_txt.disabled=false;fm.search_btn.value="product code"
fm.search_btn.disabled=false;}
var flash_in=0;function flashIn(){if(flash_disabled==0){h=flash_frame_h;document.getElementById('flash_frame').style.height=h+"px";document.getElementById('main_content').style.top=document.getElementById('right_content').style.top=h+"px";document.getElementById('main_content').style.borderTop=document.getElementById('right_content').style.borderTop="1px solid #cccccc";resizePage();flash_in=1;loadFlash(flash_load_str);}}
var flash_out_h=0;function flashOut(){h=flash_out_h;document.getElementById('flash_frame').style.height=h+"px";document.getElementById('main_content').style.top=document.getElementById('right_content').style.top=h+"px";if(flash_out_h>0){flash_in=1;loadFlash(flash_load_str);}else{flash_in=0;flash_load_str="";loadFlash(flash_load_str);document.getElementById('main_content').style.borderTop=document.getElementById('right_content').style.borderTop="0px solid #cccccc";}
flash_frame_h=flash_out_h;resizePage();}
function featuresIn(){site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;w=right_menu_width;document.getElementById('right_content').style.width=w+"px";side_w=parseInt(document.getElementById('left_content').style.width);document.getElementById('right_content').style.left=(site_f_width+1-w)+"px";document.getElementById('main_content').style.width=(site_f_width-side_w-w)+"px";}
function featuresOut(){site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;option_y=100;w=0;document.getElementById('right_content').style.width=w+"px";side_w=parseInt(document.getElementById('left_content').style.width);document.getElementById('right_content').style.left=(site_f_width+1-w)+"px";document.getElementById('main_content').style.width=(site_f_width-side_w-w)+"px";}
function sideMenuIn(){site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;w=left_menu_width;document.getElementById('left_content').style.width=w+"px";document.getElementById('main_content').style.left=(w+1)+"px";document.getElementById('flash_frame').style.width=(site_f_width-left_menu_width)+"px";document.getElementById('flash_frame').style.left=left_menu_width+"px";features_w=parseInt(document.getElementById('right_content').style.width);if(right_menu_moving==1){features_w-=20;}
document.getElementById('main_content').style.width=(site_f_width-features_w-w)+"px";}
function sideMenuOut(){site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;menu_y=100;w=0;document.getElementById('left_content').style.width=w+"px";document.getElementById('main_content').style.left=(w+1)+"px";document.getElementById('flash_frame').style.left="0px";document.getElementById('flash_frame').style.width=site_f_width+"px";features_w=parseInt(document.getElementById('right_content').style.width);document.getElementById('main_content').style.width=(site_f_width-features_w)+"px";}
var resize_running=0;function resizePage(){if(resize_running==0){resize_running=1;h=parseInt(document.documentElement.clientHeight);w=parseInt(document.documentElement.clientWidth);w_start=w;if((document.getElementById('header'))&&(document.getElementById('header').innerHTML=="")){}
if((document.getElementById('background_header_div'))&&(document.getElementById('background_header_div').style.display=='none')){document.getElementById('background_header_div').style.display='block';}
if((document.getElementById('background_footer_div'))&&(document.getElementById('background_footer_div').style.display=='none')){document.getElementById('background_footer_div').style.display='block';}
if((document.getElementById('footer_menu'))&&(parseInt(document.getElementById('footer_menu').style.top=-1000))){document.getElementById('footer_menu').style.top="0px";}
if(is_IE==1){if(document.getElementById('custom_header')){document.getElementById('custom_header').style.width=(w)+"px";}
if(document.getElementById('main_div')){document.getElementById('main_div').style.width=(w)+"px";}}
try{if((site_fixed_height>0)&&(site_float_y==1)){t=(Math.floor((h-site_fixed_height)/2)>0)?Math.floor((h-site_fixed_height)/2):0;if(document.getElementById('main_div')){document.getElementById('main_div').style.top=(t)+"px";}
if(document.getElementById('background_header_div')){document.getElementById('background_header_div').style.top=(t)+"px";}}}catch(e){}
try{if(site_width==0){if(document.getElementById('main_page')){document.getElementById('main_page').style.width=(w)+"px";}
if(document.getElementById('main_page_back')){document.getElementById('main_page_back').style.width=(w)+"px";}
if(document.getElementById('background_header_div')){document.getElementById('background_header_div').style.width=(w)+"px";}
if(document.getElementById('background_footer_div')){document.getElementById('background_footer_div').style.width=(w)+"px";}
if(document.getElementById('flash_background')){document.getElementById('flash_background').style.width=(w)+"px";}
if(document.getElementById('header_img_div')){document.getElementById('header_img_div').style.width=(w)+"px";}
if(document.getElementById('header')){document.getElementById('header').style.width=(w)+"px";}
if(document.getElementById('header_menu')){document.getElementById('header_menu').style.width=(w)+"px";}
if(document.getElementById('footer_menu')){document.getElementById('footer_menu').style.width=(w)+"px";}
if(document.getElementById('main_menu')){document.getElementById('main_menu').style.width=(w)+"px";}
if(document.getElementById('dropdown_menus')){document.getElementById('dropdown_menus').style.left=0+"px";}
left_w=0;right_w=0;if(document.getElementById('left_content')){auto=0;if(document.getElementById('left_content').style.overflowY=="auto"){document.getElementById('left_content').style.overflowY="hidden";auto=1;}
left_w=parseInt(document.getElementById('left_content').clientWidth);if(auto==1){document.getElementById('left_content').style.overflowY="auto";}}
if(document.getElementById('right_content')){auto=0;if(document.getElementById('right_content').style.overflowY=="auto"){document.getElementById('right_content').style.overflowY="hidden";auto=1;}
right_w=parseInt(document.getElementById('right_content').clientWidth);if(auto==1){document.getElementById('right_content').style.overflowY="auto";}}
m_w=0;if(document.getElementById('main_content')){m_w=((w-left_w-right_w)>100)?(w-left_w-right_w):100;document.getElementById('main_content').style.width=(m_w)+"px";}
if(document.getElementById('right_content')){document.getElementById('right_content').style.left=(m_w+left_w+2)+"px";}
m_w=0;if(document.getElementById('flash_frame')){m_w=((w-left_w)>10)?(w-left_w):10;document.getElementById('flash_frame').style.width=(m_w)+"px";}}else{if(document.getElementById('dropdown_menus')){drop_left=Math.round((w-(site_width+2))/2);if(drop_left<0){drop_left=0;}
document.getElementById('dropdown_menus').style.left=drop_left+"px";}}}catch(e){}
try{header_h=((document.getElementById('header'))&&(document.getElementById('header').style.display=="block"))?parseInt(document.getElementById('header').clientHeight):0;flash_h=(document.getElementById('flash_frame'))?parseInt(document.getElementById('flash_frame').style.height):0;flash_h+=(document.getElementById('flash_frame'))?parseInt(document.getElementById('flash_frame').style.top):0;header_menu_h=((document.getElementById('header_menu'))&&(document.getElementById('header_menu').style.display=="block"))?parseInt(document.getElementById('header_menu').style.height):0;if(document.getElementById('main_content')){document.getElementById('main_content').style.display="block";page_y=parseInt(document.getElementById('main_content').clientHeight)+20;}
if((document.getElementById('main_page_back'))&&(document.getElementById('main_page_back').style.display=="none")){document.getElementById('main_page_back').style.display="block";}
if(document.getElementById('left_content')){menu_y=parseInt(document.getElementById('left_content').clientHeight)+20;}
if(document.getElementById('right_content')){option_y=parseInt(document.getElementById('right_content').clientHeight)+20;}
footer_h=0;if(document.getElementById('footer_menu')){footer_h=parseInt(document.getElementById('footer_menu').clientHeight);}
if(document.getElementById('main_content')){document.getElementById('main_content').style.overflowX=(main_overflow_x==1)?"auto":"hidden";}
if(document.getElementById('right_content')){document.getElementById('right_content').style.overflowX=(right_overflow_x==1)?"auto":"hidden";}
if(document.getElementById('left_content')){document.getElementById('left_content').style.overflowX=(left_overflow_x==1)?"auto":"hidden";}
if(site_fixed_height==0){this_page_y=page_y+flash_h;this_option_y=option_y+flash_h;t_y=(menu_y>this_page_y)?menu_y:this_page_y;t_y=(this_option_y>t_y)?this_option_y:t_y;if((t_y)>(h-header_h-header_menu_h-footer_h)){h1=(t_y-flash_h-footer_h);h2=(t_y);h3=(t_y-1);if(document.getElementById('main_page')){document.getElementById('main_page').style.height=(t_y)+"px";}
if(document.getElementById('dropdown_menus')){document.getElementById('dropdown_menus').style.top=(header_h+header_menu_h)+"px";}
if(document.getElementById('main_page_back')){main_page_back_h=t_y+header_h+header_menu_h+footer_h+4;main_page_back_t=0;if(page_back_img_below_header>0){main_page_back_h-=header_h;main_page_back_t+=header_h;}
if((page_back_img_below_header==2)&&(document.getElementById('main_menu'))){main_page_back_h-=header_menu_h;main_page_back_t+=header_menu_h;}
document.getElementById('main_page_back').style.height=main_page_back_h+"px";document.getElementById('main_page_back').style.top=main_page_back_t+"px";}
if(document.getElementById('background_shadow_left')){document.getElementById('background_shadow_left').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";}
if(document.getElementById('background_shadow_right')){document.getElementById('background_shadow_right').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";document.getElementById('background_shadow_left').style.display=document.getElementById('background_shadow_right').style.display=((w>=(site_width+22))&&(site_width>0))?"block":"none";}
if(document.getElementById('flash_background')){document.getElementById('flash_background').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";}
if(document.getElementById('header_img_div')){document.getElementById('header_img_div').style.height=((t_y+header_h+header_menu_h+footer_h+4)-parseInt(document.getElementById('header_img_div').style.top))+"px";}
if(document.getElementById('background_header_div')){document.getElementById('background_header_div').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";}
if(document.getElementById('background_footer_div')){document.getElementById('background_footer_div').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";document.getElementById('background_footer_div').style.top=(0)+"px";}
if(document.getElementById('disable_page')){document.getElementById('disable_page').style.height=(t_y+header_h+header_menu_h+footer_h+4)+"px";}}else{h1=(h-header_h-footer_h-header_menu_h-flash_h);if(h1<10){h1=10;};h2=(h-header_h-header_menu_h-footer_h);if(h2<10){h2=10;};h3=(h-header_h-header_menu_h-101-footer_h-flash_h);if(h3<10){h3=10;};if(document.getElementById('main_page')){document.getElementById('main_page').style.height=(h2-4)+"px";}
if(document.getElementById('dropdown_menus')){document.getElementById('dropdown_menus').style.top=(header_h+header_menu_h)+"px";}
if(document.getElementById('main_page_back')){main_page_back_h=h;main_page_back_t=0;if(page_back_img_below_header>0){main_page_back_h-=header_h;main_page_back_t+=header_h;}
if((page_back_img_below_header==2)&&(document.getElementById('main_menu'))){main_page_back_h-=header_menu_h;main_page_back_t+=header_menu_h;}
document.getElementById('main_page_back').style.height=main_page_back_h+"px";document.getElementById('main_page_back').style.top=main_page_back_t+"px";}
if(document.getElementById('background_shadow_left')){document.getElementById('background_shadow_left').style.height=(h)+"px";}
if(document.getElementById('background_shadow_right')){document.getElementById('background_shadow_right').style.height=(h)+"px";document.getElementById('background_shadow_left').style.display=document.getElementById('background_shadow_right').style.display=((w>=(site_width+22))&&(site_width>0))?"block":"none";}
if(document.getElementById('header_img_div')){document.getElementById('header_img_div').style.height=((h)-parseInt(document.getElementById('header_img_div').style.top))+"px";}
if(document.getElementById('background_header_div')){document.getElementById('background_header_div').style.height="100%";}
if(document.getElementById('background_footer_div')){document.getElementById('background_footer_div').style.height="100%";}
if(document.getElementById('flash_background')){document.getElementById('flash_background').style.height="100%"}
if(document.getElementById('disable_page')){document.getElementById('disable_page').style.height=(h)+"px";}}}else{body_h=h;h=site_fixed_height;min_size=h-flash_h-footer_h-50;if(min_size<50){if(flash_h>0){flash_disabled=1;flash_out_h=0;if(window['flash_out']){clearTimeout(window['flash_out']);}
if(window['flash_in']){clearTimeout(window['flash_in']);}
flashOut();flash_h=0;min_size=h-header_h-flash_h-header_menu_h-footer_h-50;if(min_size<50){site_fixed_height=h+Math.abs(min_size)+50;}}}
if(site_float==1){h_top=Math.round((body_h-h)/2);if(h_top<0){h_top=0;}}else{h_top=0;}
if(site_float==2){var page_border=(document.getElementById('main_page_back'))?parseInt(document.getElementById('main_page_back').style.borderTopWidth):0;if(document.getElementById('main_content')){document.getElementById('main_content').style.top=(flash_h>0)?flash_h+"px":page_border+"px";document.getElementById('main_content').style.height=(h-header_menu_h-flash_h)+"px";}
if(document.getElementById('right_content')){document.getElementById('right_content').style.top=(flash_h>0)?flash_h+"px":page_border+"px";document.getElementById('right_content').style.height=(h-header_menu_h-flash_h)+"px";}
if(document.getElementById('left_content')){document.getElementById('left_content').style.top=page_border+"px";document.getElementById('left_content').style.height=(h-header_menu_h)+"px";}
if(document.getElementById('main_page')){document.getElementById('main_page').style.height=(h-header_menu_h-2)+"px";document.getElementById('main_page').style.top=0+"px";}
if(document.getElementById('dropdown_menus')){document.getElementById('dropdown_menus').style.top=(header_h+header_menu_h)+"px";}
if(document.getElementById('main_page_back')){document.getElementById('main_page_back').style.top=header_h+"px";document.getElementById('main_page_back').style.height=(h)+"px";}}else{if(document.getElementById('main_content')){document.getElementById('main_content').style.top=(flash_h>0)?flash_h+"px":page_border+"px";document.getElementById('main_content').style.height=(h-header_h-header_menu_h-flash_h)+"px";}
if(document.getElementById('right_content')){document.getElementById('right_content').style.top=(flash_h>0)?flash_h+"px":page_border+"px";document.getElementById('right_content').style.height=(h-header_h-header_menu_h-flash_h)+"px";}
if(document.getElementById('left_content')){document.getElementById('left_content').style.top=page_border+"px";document.getElementById('left_content').style.height=(h-header_h-header_menu_h)+"px";}
if(document.getElementById('main_page')){document.getElementById('main_page').style.height=(h-header_h-header_menu_h-2)+"px";document.getElementById('main_page').style.top=0+"px";}
if(document.getElementById('dropdown_menus')){document.getElementById('dropdown_menus').style.top=(0-(h-header_h-2))+"px";}
if(document.getElementById('main_page_back')){document.getElementById('main_page_back').style.top=h_top+"px";document.getElementById('main_page_back').style.height=(h)+"px";}}
if(document.getElementById('flash_background')){document.getElementById('flash_background').style.height=(h)+"px";}
if(document.getElementById('disable_page')){h2=(parseInt(document.documentElement.clientHeight)>h)?parseInt(document.documentElement.clientHeight):h;document.getElementById('disable_page').style.height=(h2)+"px";}
if(document.getElementById('header_img_div')){document.getElementById('header_img_div').style.top=h_top+"px";document.getElementById('header_img_div').style.height=(h+header_h)+"px";}
if(document.getElementById('background_shadow_left')){document.getElementById('background_shadow_left').style.top=h_top+"px";document.getElementById('background_shadow_left').style.height=(h)+"px";}
if(document.getElementById('background_shadow_right')){document.getElementById('background_shadow_right').style.top=h_top+"px";document.getElementById('background_shadow_right').style.height=(h)+"px";document.getElementById('background_shadow_left').style.display=document.getElementById('background_shadow_right').style.display=((w>=(site_width+22))&&(site_width>0))?"block":"none";}
h+=header_h+footer_h;back_h=(body_h>h)?body_h:h;if(document.getElementById('background_header_div')){document.getElementById('background_header_div').style.height=(back_h)+"px";document.getElementById('background_header_div').style.top=(0)+"px";}
if(document.getElementById('background_footer_div')){document.getElementById('background_footer_div').style.height=(back_h)+"px";document.getElementById('background_footer_div').style.top=(0)+"px";}}}catch(e){}
try{if(document.getElementById('page_logo')&&(document.getElementById('page_logo').style.display!="block")){document.getElementById('page_logo').style.display="block";}}catch(e){}
resize_running=0;w=parseInt(document.documentElement.clientWidth);if(w!=w_start){resizePage();}}}
var submenu_left=menu_width;var submenu_width=menu_width;var menu_image_height=200;var submenu_height=menu_image_height;var submenu_top=0;var item_menu_left=menu_width*2;var item_menu_width=400;var item_menu_height=menu_image_height;var disable_item_out=0;var disable_sub_out=0;var last_goto=0;function shopCheckOut(){window.location.href=s_global_url+"checkout";}
function viewBasket(){window.location.href=s_global_url+"basket";}
function getBasket(){document.getElementById('process_frame').src=global_url+"scripts/catalogue.php?getBasket";}
function memberLogin(type,details,reload_page,is_member,is_logged_in){try{closeLightBox();}catch(lb_err){}
if(mem_allow_logon==1){if(type==0){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()-6);expires=expireDate.toGMTString();document.cookie="m_details=;expires="+expires+";path=/";document.cookie="is_logged_in=;expires="+expires+";path=/";document.cookie="is_member=;expires="+expires+";path=/";if(Math.abs(reload_page)==1){rtnHome();}else{memberStatus(0,0,'');}}
if(type==1){current_page="/scripts/members.php";document.getElementById('main_frame').src=global_url+"scripts/members.php?1";}
if(type==2){d=decode64(details);d_arr=d.split("|");if(d_arr.length>=5){member_name=decode64(d_arr[0]);expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+3);expires=expireDate.toGMTString();document.cookie="m_details="+details+";expires="+expires+";path=/";document.cookie="is_member=1;expires="+expires+";path=/";expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()+120);expires=expireDate.toGMTString();document.cookie="is_logged_in=1;expires="+expires+";path=/";memberStatus(1,1,member_name);if(Math.abs(reload_page)==1){if(current_page!=""){src=global_url+current_page.substr(1);top.window.location.href=src;}else{var loc=top.window.document.location+"";top.window.location.href=loc;}}}else{memberStatus(0,0,'');if(Math.abs(reload_page)==1){if(current_page!=""){src=global_url+current_page.substr(1);top.window.location.href=src;}else{var loc=top.window.document.location+"";top.window.location.href=loc;}}}}
if(type==3){d=decode64(details);d_arr=d.split("|");if(d_arr.length>=5){member_name=decode64(d_arr[0]);expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+3);expires=expireDate.toGMTString();document.cookie="m_details="+details+";expires="+expires+";path=/";document.cookie="is_member="+is_member+";expires="+expires+";path=/";expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()+120);expires=expireDate.toGMTString();document.cookie="is_logged_in="+is_logged_in+";expires="+expires+";path=/";memberStatus(is_member,is_logged_in,member_name);}else{memberStatus(0,0,'');}}
if(type==4){current_page="/scripts/members.php";document.getElementById('main_frame').src=global_url+"scripts/members.php?2";}}}
var mem_logon_text="Customer Area";var mem_logon_text_dir="Customer Area";function memberStatus(is_member,is_logged_in,member_name){if(mem_allow_logon==1){div=document.getElementById('main_frame');txt="";if(is_member==1){txt="Welcome "+member_name;}
if((is_logged_in==0)&&(div)){txt+="<a href=\""+s_global_url+mem_logon_text_dir.toLowerCase()+"\">";txt+=(is_member==1)?"&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;"+mem_logon_text:mem_logon_text;txt+="</a>";}else if(is_member==1){if(div){txt+="&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\""+s_global_url+mem_logon_text_dir.toLowerCase()+"\">"+mem_logon_text+"</a>";}
if(is_logged_in==1){txt+="&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"javascript:memberLogin(0,'',1);\">Sign&nbsp;Out</a>";}else if(!div){txt+="&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;You are not signed in.";}}
updateLogOnTxt(txt);}}
var log_txt="";function updateLogOnTxt(txt){if(document.getElementById('logon_status_txt')){try{document.getElementById('logon_status_txt').innerHTML=txt;}catch(e){}}}
function start(){if(is_IE==1){document.body.scroll="yes";}
updatePrintDiv();try{onPageComplete();}catch(e){}
resizePage();setThemeDefaults();if(mem_allow_logon==1){document.getElementById('logon_frame').src=global_url+"scripts/members.php?checklogon";}
if(can_get_basket==1){document.getElementById('process_frame').src=global_url+"scripts/catalogue.php?getBasket";}
if(page_images.length>0){loadOtherImages();}}
var default_bg_top_img="";var default_bg_bottom_img="";var default_pg_border_color="";var default_menu_border_color="";var default_menu_font_color="";var current_menu_font_color="";function setThemeDefaults(){if(document.getElementById('background_header_div')){default_bg_top_img=document.getElementById('background_header_div').style.backgroundImage;}
if(document.getElementById('background_footer_div')){default_bg_bottom_img=document.getElementById('background_footer_div').style.backgroundImage;}
if(document.getElementById('main_page_back')){if(document.getElementById('main_page_back').style.borderColor){default_pg_border_color=document.getElementById('main_page_back').style.borderColor;}else if(document.getElementById('main_page_back').style.borderTopColor){default_pg_border_color=document.getElementById('main_page_back').style.borderTopColor;}else if(document.getElementById('main_page_back').style.borderBottomColor){default_pg_border_color=document.getElementById('main_page_back').style.borderBottomColor;}else if(document.getElementById('main_page_back').style.borderLeftColor){default_pg_border_color=document.getElementById('main_page_back').style.borderLeftColor;}else if(document.getElementById('main_page_back').style.borderRightColor){default_pg_border_color=document.getElementById('main_page_back').style.borderRightColor;}}
if(document.getElementById('header_menu')){if(document.getElementById('header_menu').style.borderColor){default_menu_border_color=document.getElementById('header_menu').style.borderColor;}else if(document.getElementById('header_menu').style.borderTopColor){default_menu_border_color=document.getElementById('header_menu').style.borderTopColor;}else if(document.getElementById('header_menu').style.borderBottomColor){default_menu_border_color=document.getElementById('header_menu').style.borderBottomColor;}else if(document.getElementById('header_menu').style.borderLeftColor){default_menu_border_color=document.getElementById('header_menu').style.borderLeftColor;}else if(document.getElementById('header_menu').style.borderRightColor){default_menu_border_color=document.getElementById('header_menu').style.borderRightColor;}}
if(total_btns>0){for(i=1;i<(total_btns+1);i++){if(document.getElementById('main_btn_'+i)){default_menu_font_color=current_menu_font_color=document.getElementById('main_btn_'+i).style.color;break;}}}}
function updateTheme(bg_top_img,bg_bottom_img,pg_border_color,menu_border_color,menu_font_color){current_menu_font_color=(menu_font_color!="")?menu_font_color:default_menu_font_color;if(document.getElementById('background_header_div')){if(bg_top_img=="none"){document.getElementById('background_header_div').style.backgroundImage="none";}else{document.getElementById('background_header_div').style.backgroundImage=(bg_top_img!="")?"url("+bg_top_img+")":default_bg_top_img;}}
if(document.getElementById('background_footer_div')){if(bg_bottom_img=="none"){document.getElementById('background_footer_div').style.backgroundImage="none";}else{document.getElementById('background_footer_div').style.backgroundImage=(bg_bottom_img!="")?"url("+bg_bottom_img+")":default_bg_bottom_img;}}
if(document.getElementById('main_page_back')){obj=document.getElementById('main_page_back').style;obj.borderColor=obj.borderTopColor=obj.borderBottomColor=obj.borderLeftColor=obj.borderRightColor=(pg_border_color!="")?pg_border_color:default_pg_border_color;}
if(document.getElementById('header_menu')){obj=document.getElementById('header_menu').style;obj.borderColor=obj.borderTopColor=obj.borderBottomColor=obj.borderLeftColor=obj.borderRightColor=(menu_border_color!="")?menu_border_color:default_menu_border_color;}
if(total_btns>0){for(i=1;i<(total_btns+1);i++){if(document.getElementById('main_btn_'+i)){document.getElementById('main_btn_'+i).style.color=(menu_font_color!="")?menu_font_color:default_menu_font_color;}}}}
var menu_dif=0;var menu_z=0;function loadTopPage(p){top.location.href=p;}
function loadPage(p){closeAllMenus();moveCalender(-2000,-2000);showLoading();document.getElementById('main_frame').src=p;try{document.getElementById('main_frame').focus();}catch(e){}}
function loadPageJS(p){closeAllMenus();moveCalender(-2000,-2000);showLoading();document.getElementById('main_frame').src=p;try{document.getElementById('main_frame').focus();}catch(e){}}
function loadPageNum(p){closeAllMenus();moveCalender(-2000,-2000);showLoading();document.getElementById('main_frame').src=global_url+"scripts/pages.php?p="+p;try{document.getElementById('main_frame').focus();}catch(e){}}
function loadMemberPageNum(p){closeAllMenus();moveCalender(-2000,-2000);showLoading();document.getElementById('main_frame').src=global_url+"scripts/members.php?p="+p;try{document.getElementById('main_frame').focus();}catch(e){}}
function checkMenuOut(m){if(window[m+'out']){clearTimeout(window[m+'out']);}
window[m+'out']=setTimeout("menuOut('"+m+"')",250);}
function clearMenuOut(m){if(window[m+'out']){clearTimeout(window[m+'out']);}}
function reloadMenu(mod){if(mod!=current_module){current_module=mod;menu_height_array=Array();document.getElementById('dropdown_menus').innerHTML="";document.getElementById('main_menu').innerHTML="<div style=\"font-size:5px;\">&nbsp</div><div style=\"width:100%;text-align:center;\" id=\"menu_loading_txt\">loading menu...</div>";document.getElementById('process_frame').src=global_url+"scripts/menu.php?main|"+encode64(mod)+"|"+encode64(current_menu_font_color+"");}}
function createMenu(menu_table_enc,menu_enc,main_menu_back_width,main_menu_width,main_menu_left,t_btns,btn_width){total_btns=total_menus=t_btns;menu_width=btn_width;document.getElementById('main_menu').style.left=main_menu_left+"px";document.getElementById('main_menu').innerHTML=decode64(menu_table_enc);document.getElementById('dropdown_menus').innerHTML=decode64(menu_enc);}
var menu_max_height=550;var menu_height_array=Array();var menu_width_array=Array();function menuIn(m){abort=0
if(document.getElementById('main_btn_'+m)){num=Math.abs(m);site_f_width=(site_width==0)?parseInt(document.documentElement.clientWidth):site_width;checkMainBtnOver(m);closeAllMenus(m);try{if(document.getElementById('menu_'+m)){if(!menu_height_array[num]){this_l=document.getElementById('menu_'+m).style.left;document.getElementById('menu_'+m).style.left="-2000px";document.getElementById('menu_'+m).style.top="-6000px";document.getElementById('menu_'+m).style.display="block";this_div=document.getElementById('menu_content_'+num);if(this_div){d_w=parseInt(this_div.clientWidth);d_h=parseInt(this_div.clientHeight);menu_height_array[num]=d_h;menu_width_array[num]=d_w;if(document.getElementById("menu_shadow_"+num)){document.getElementById("menu_shadow_"+num).style.width=d_w+"px";}
document.getElementById('menu_'+m).style.display="none";document.getElementById('menu_'+m).style.left=((parseInt(this_l)+d_w)<(menu_width*total_menus))?this_l:parseInt(this_l)+num+((menu_width*total_menus)-(parseInt(this_l)+d_w))+"px";document.getElementById('menu_'+m).style.top="0px";}else{abort=1;}}
if(abort==0){menu_z++;document.getElementById('menu_'+m).style.zIndex=menu_z;height=menu_height_array[num];var html="OK";try{var elements=document.getElementsByName('dd_menu_links');html=elements[(num-1)].innerHTML;}catch(html_err){}
if((height>dropdown_min_height)&&(html!="")){h=height;l=parseInt(document.getElementById('main_menu').style.left)+dropdown_menu_left_offset;if(m>1){l+=1;}
for(b=1;b<(num);b++){this_w=parseInt(document.getElementById("main_btn_"+b).clientWidth)
l+=this_w;if(b>1){l+=main_menu_btn_spacing;}}
w=menu_width_array[num];avail=site_f_width-l;if(avail<w){document.getElementById('menu_'+m).style.left=(l-(w-avail)-1)+"px";}else{document.getElementById('menu_'+m).style.left=(l)+"px";}
if(document.getElementById("menu_shadow_"+num)){document.getElementById("menu_shadow_"+num).style.height=(h+4)+"px";}
document.getElementById('menu_'+m).style.display="block";process_menu=null;process_height=0;}}else{process_menu=null;process_height=0;}}else{}}catch(err){alert(err);}}}
var closeAll=0;var current_menu=0;function closeAllMenus(menu){for(i=1;i<=total_menus;i++){this_m="menu_"+(i);if(document.getElementById(this_m)){if((menu)&&(menu==i)){}else if(current_menu==(i)){}else{menuOut(i);}}}}
function menuOut(m,debug){if(debug){}
if(window[m+'out']){clearTimeout(window[m+'out']);}
checkMainBtnOut(m);if(document.getElementById('menu_'+m)){document.getElementById('menu_'+m).style.display="none";process_menu=null;process_height=0;}}
function checkMainBtnOver(id){for(i=1;i<=total_btns;i++){if(i!=id){checkMainBtnOut(i);}}
try{if(document.getElementById('main_btn_'+id)&&(document.getElementById('main_btn_'+id).className!="main_menu_selected")){w=parseInt(document.getElementById('main_btn_'+id).clientWidth);x=0-200-Math.floor((200-w)/2);document.getElementById('main_btn_'+id).style.backgroundPosition=x+"px 0px ";}}catch(btn_e){}}
function checkMainBtnOut(id){try{if(document.getElementById('main_btn_'+id)&&(document.getElementById('main_btn_'+id).className!="main_menu_selected")){var w=parseInt(document.getElementById('main_btn_'+id).clientWidth);var x=0-Math.floor((200-w)/2);document.getElementById('main_btn_'+id).style.backgroundPosition=x+"px 0px";}}catch(btn_e){}}
var current_date_div=null;var calender_left=-2000;var calender_top=-2000;function showCalender(field,left,top,dateMin,dateMax,startdate,div){value=field.value;current_date_div=(div)?div:null;current_date_field=field;if((value=="")&&(startdate)){value=startdate;}
calender_left=left;calender_top=top;document.getElementById('calender_frame').src=global_url+"admin/calendar_popup.php?field="+field+"&value="+value+"&date_min="+dateMin+"&date_max="+dateMax;}
function moveCalender(left,top){document.getElementById('calender').style.left=left+"px";document.getElementById('calender').style.top=top+"px";}
function formatDate(div,date){if(div){date_arr=date.split("-");div.innerHTML=((date=="")||(date=="0000-00-00"))?"&nbsp":date_arr[2]+" "+date_arr[1]+" "+date_arr[0];}}
function updateDiv(date){if(current_date_div){formatDate(current_date_div,date);}}
function checkOver(btn){btn.className=btn.className+"_over";btn.style.cursor='pointer';}
function checkOut(btn){re=/_over/gi;if(btn.className.match(re)){newClass=btn.className.replace(re,"");btn.className=newClass;}
btn.style.cursor='default';}
function getCookieValue(cookieName){theCookie=""+document.cookie;ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){val="";}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val=unescape(theCookie.substring(ind+cookieName.length+1,ind1));}
if(val==";"){val="";}
return val;}
function trim(str,chars){return ltrim(rtrim(str,chars),chars);}
function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");}
function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");}
function urlencode(str){var hexStr=function(dec){return'%'+dec.toString(16).toUpperCase();};var ret='',unreserved=/[\w.-]/;str=(str+'').toString();for(var i=0,dl=str.length;i<dl;i++){var ch=str.charAt(i);if(unreserved.test(ch)){ret+=ch;}
else{var code=str.charCodeAt(i);if(code===32){ret+='%20';}
else if(code<128){ret+=hexStr(code);}
else if(code>=128&&code<2048){ret+=hexStr((code>>6)|0xC0);ret+=hexStr((code&0x3F)|0x80);}
else if(code>=2048&&code<65536){ret+=hexStr((code>>12)|0xE0);ret+=hexStr(((code>>6)&0x3F)|0x80);ret+=hexStr((code&0x3F)|0x80);}
else if(code>=65536){ret+=hexStr((code>>18)|0xF0);ret+=hexStr(((code>>12)&0x3F)|0x80);ret+=hexStr(((code>>6)&0x3F)|0x80);ret+=hexStr((code&0x3F)|0x80);}}}
return ret;}
var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function encode64(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);return output;}
function decode64(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return output;}
var cache_page_images=new Array();var current_image=0;var current_image_url=global_url+"images/trans.gif";var image_change_delay=(is_IE)?14*1000:10*1000;var inital_image_change_delay=5*1000;var divid="main_page_back";var imageid="main_page_back_img";function loadOtherImages(){if(page_images.length>1){var d=new Date();var before;var after;var j=0;var start_swap_img=0;for(var i in page_images)
{d=new Date();before=d.getTime();if(j==0){changeOpac(0,imageid);if(document.getElementById(imageid).src!=global_url+"images/"+page_images[i]){document.getElementById(imageid).src=current_image_url;blendimage(divid,imageid,global_url+"images/"+page_images[i],2500);}else{document.getElementById(imageid).src=global_url+"images/"+page_images[i];start_swap_img=1;current_image_url=global_url+"images/"+page_images[i];}}
cache_page_images[j]=new Image();cache_page_images[j].src=global_url+"images/"+page_images[i];d=new Date();after=d.getTime();if((after-before)>5000)break;j++;}
if(start_swap_img==1){if(window['image_changer']){clearTimeout(window['image_changer']);}
window['image_changer']=setTimeout("swapImage()",inital_image_change_delay);}}else{document.getElementById(imageid).src=global_url+"images/"+page_images[0];current_image_url=global_url+"images/"+page_images[0];}}
function clearSwapImages(){if(window['image_changer']){clearTimeout(window['image_changer']);}
for(i=0;i<=100;i++){if(window['opt_'+i]){clearTimeout(window['opt_'+i]);}}
if((imageid)&&(document.getElementById(imageid))){changeOpac(0,imageid);document.getElementById(imageid).src=current_image_url;document.getElementById(divid).style.backgroundImage="url("+document.getElementById(imageid).src+")";}
image_changer=null;page_images=new Array();cache_page_images=new Array();current_image=0;}
var next_img=0;function swapImage()
{if(window['image_changer']){clearTimeout(window['image_changer']);}
for(i=0;i<=100;i++){if(window['opt_'+i]){clearTimeout(window['opt_'+i]);}}
var n=cache_page_images.length;if(gallery_background_random==1){do
{i=Math.floor(Math.random()*n);}
while(!cache_page_images[i]||(i==current_image&&n>1));}else{i=Math.abs(next_img)+1;if(i==n){i=0;}
next_img=i;}
if(cache_page_images[i]){blendimage(divid,imageid,cache_page_images[i].src,2500)
current_image=i;}}
function opacity(id,opacStart,opacEnd,millisec){var speed=Math.round(millisec/100);var timer=0;if(opacStart>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++;}}}
function changeOpac(opacity,id){if((id)&&(document.getElementById(id))){var object=document.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";}}
function shiftOpacity(id,millisec){if(document.getElementById(id).style.opacity==0){opacity(id,0,100,millisec);}else{opacity(id,100,0,millisec);}}
function blendimage(divid,imageid,imagefile,millisec){if(document.getElementById(divid)){var speed=Math.round(millisec/100);var timer=100;document.getElementById(divid).style.backgroundImage="url("+document.getElementById(imageid).src+")";current_image_url=imagefile;changeOpac(0,imageid);if(document.getElementById('debug_txt')){document.getElementById('debug_txt').innerHTML=current_image_url+"<br>";}
document.getElementById(imageid).src=imagefile;document.getElementById(imageid).display="block";for(i=0;i<=100;i++){window['opt_'+i]=setTimeout("changeOpac("+i+",'"+imageid+"')",(timer*speed));timer++;}
window['image_changer']=setTimeout("swapImage()",image_change_delay);}}
function checkNumber(field,type){switch(type){case"full":thisNum=parseInt(field.value);break;case"decimal":t1=field.value;t2=round_decimals(t1,2);t3=pad_with_zeros(t2,2);thisNum=t3;break;}
thisNum1=""+thisNum;if(thisNum1.substr(0,3)=="NaN"){field.value=(type=="full")?"0":"0.00";}else{field.value=thisNum}}
function formatNumber(num,type){switch(type){case"full":thisNum=parseInt(num);break;case"decimal":t1=num
t2=round_decimals(t1,2);t3=pad_with_zeros(t2,2);thisNum=t3;break;}
thisNum1=""+thisNum;if(thisNum1.substr(0,3)=="NaN"){return(type=="full")?"0":"0.00";}else{return thisNum;}}
function round_decimals(original_number,decimals){var result1=original_number*Math.pow(10,decimals)
var result2=Math.round(result1)
var result3=result2/Math.pow(10,decimals)
return pad_with_zeros(result3,decimals)}
function pad_with_zeros(rounded_value,decimal_places){var value_string=rounded_value.toString()
var decimal_location=value_string.indexOf(".")
if(decimal_location==-1){decimal_part_length=0
value_string+=decimal_places>0?".":""}
else{decimal_part_length=value_string.length-decimal_location-1}
var pad_total=decimal_places-decimal_part_length
if(pad_total>0){for(var counter=1;counter<=pad_total;counter++)
value_string+="0"}
return value_string}
function disablePage(bool){if(document.getElementById("disable_page")){document.getElementById("disable_page").style.display=(bool)?"block":"none";}}
function toggleObj(id1,id2,id3,id4){if(document.getElementById(id1)){dis=document.getElementById(id1).style.display;document.getElementById(id1).style.display=(dis=="none")?"block":"none";if(document.getElementById(id3)){document.getElementById(id3).style.display=(dis=="none")?"block":"none";}
if(document.getElementById(id2)){document.getElementById(id2).style.display=(dis=="none")?"none":"block";}
if(document.getElementById(id4)){document.getElementById(id4).style.display=(dis=="none")?"none":"block";}}
try{resizePage();}catch(e){}}
var gallery_scroll_bar_offset_x=0;var gallery_containers=Array();var current_scroll_timer=null;var current_scroll_timer2=null;var gallery_start_l=0;var gallery_sb_start_l=0;var gallery_start_l=0;var gallery_img_inc=1;var auto_scroll_speed=10;var gallery_img_inc_speed=auto_scroll_speed;var gallery_global_inc_speed=100;var gallery_can_scroll_img=0;var gallery_scroll=0;var gallery_sb_direction="right";var auto_scroll_g_x=0;var auto_scroll_inc=1;var gallery_firstload=1;function toggleGalleryHTML(img,id){if(document.getElementById(id)){dis=document.getElementById(id).style.display;document.getElementById(id).style.display=(dis=="block")?"none":"block";img.alt=(dis=="block")?"click here to show more information":"click here to hide more information";}}
function positionScrollBar(div1,div_container1,div2,div_container2,scroll_div,id,offset,scale,total_h){if((document.getElementById(div1))&&(document.getElementById(div_container1))&&(document.getElementById(div2))&&(document.getElementById(div_container2))&&(document.getElementById(scroll_div))){if(offset){gallery_scroll_bar_offset_x=offset;}
main_w=parseInt(document.getElementById(div_container1).clientWidth);main_h=parseInt(document.getElementById(div_container1).clientHeight);main_img_w=parseInt(document.getElementById(div1).clientWidth);main_img_l=parseInt(document.getElementById(div1).style.left);scroll_bar=document.getElementById(scroll_div);var scrollbar_border=(scroll_bar.style.borderWidth)?parseInt(scroll_bar.style.borderWidth):0;scrollbar_h=parseInt(scroll_bar.style.height)-(scrollbar_border*2);ratio=main_w/main_h;scrollbar_w=Math.round((scrollbar_h)*ratio*scale);if((id)&&(!gallery_containers[id])){temp_arr=Array();temp_arr[0]=document.getElementById(div1);temp_arr[1]=document.getElementById(div_container1);temp_arr[2]=document.getElementById(div2);temp_arr[3]=document.getElementById(div_container2);temp_arr[4]=scroll_bar;temp_arr[5]=0;gallery_containers[id]=temp_arr;}
preview_w=parseInt(document.getElementById(div_container2).clientWidth);preview_h=parseInt(document.getElementById(div_container2).style.height);preview_img_w=parseInt(document.getElementById(div2).clientWidth);preview_img_l=parseInt(document.getElementById(div2).style.left);scroll_div_l=parseInt(scroll_bar.style.left);d=new Date();if(main_img_w<main_w){scroll_bar.style.display="none";document.getElementById(div1).style.left="0px";document.getElementById(div2).style.left="0px";}else{scale=main_img_w/preview_img_w;if(preview_img_l<0){if((preview_img_w-Math.abs(preview_img_l))<preview_w){new_l=preview_w-preview_img_w;document.getElementById(div2).style.left=new_l+"px";gallery_containers[id][5]=Math.round(new_l*scale);document.getElementById(div1).style.left=(0-Math.round(scroll_div_l*scale)+Math.round(new_l*scale))+"px";}}else if(preview_img_l>0){new_l=0;document.getElementById(div2).style.left=new_l+"px";gallery_containers[id][5]=Math.round(new_l*scale);document.getElementById(div1).style.left=(0-Math.round(scroll_div_l*scale)+Math.round(new_l*scale))+"px";}
if(scroll_div_l>0){max_x=(preview_img_w<preview_w)?preview_img_w:preview_w
if(is_IE==0){max_x-=2;}
scroll_w=scroll_div_l+scrollbar_w;if(scroll_w>max_x){l=max_x-scrollbar_w;scroll_bar.style.left=l;document.getElementById(div1).style.left=(0-Math.round(l*scale)+gallery_containers[id][5])+"px";}}
if(scroll_div_l<0){l=0;scroll_bar.style.left=l;document.getElementById(div1).style.left=(0-Math.round(l*scale)+gallery_containers[id][5])+"px";}
if(gallery_firstload==1){sb_top_max=(main_h+preview_h+10);var sb_h=parseInt(scroll_bar.style.height);var dif=total_h-main_h-sb_h;if(dif<0){sb_top=main_h+10;scroll_bar.style.height=(scrollbar_h+dif)+"px";}else{sb_top=main_h+dif;var border_w=(scroll_bar.style.borderWidth)?parseInt(scroll_bar.style.borderWidth):0;scroll_bar.style.height=(total_h-main_h-dif-(border_w*2))+"px";}
scroll_bar.style.top=sb_top+"px";gallery_firstload=0;}
scroll_bar.style.width=scrollbar_w+"px";scroll_bar.style.display="block";startMouseMove();}}}
function clearScrollDivBar(id,not_t1,not_t2){gallery_can_scroll_img=0;gallery_scroll=0;document.documentElement.style.cursor='default';if((current_scroll_timer)&&(!not_t1)){clearInterval(current_scroll_timer);}
if((current_scroll_timer2)&&(!not_t2)){clearInterval(current_scroll_timer2);}}
function checkGalleryScroll(id){if(gallery_scroll==1){disablePage(true);}else{disablePage(false);}}
function scrollDivImg(id,scale){this_direction=(gallery_img_inc<0)?"right":"left";if((gallery_can_scroll_img==1)&&(this_direction==gallery_sb_direction)){div1=gallery_containers[id][0];div2=gallery_containers[id][2];div_container2=gallery_containers[id][3];this_l=parseInt(div2.style.left)+gallery_img_inc;preview_w=parseInt(div_container2.clientWidth);preview_img_w=parseInt(div2.clientWidth);if(gallery_img_inc<0){if(this_l<(preview_w-preview_img_w)){this_l=(preview_w-preview_img_w);gallery_can_scroll_img=0;gallery_img_inc=0;stopGalleryAutoScroll(id)}}
if(gallery_img_inc>0){if(this_l>0){this_l=0;gallery_can_scroll_img=0;gallery_img_inc=0;stopGalleryAutoScroll(id)}}
div2.style.left=this_l+"px";gallery_containers[id][5]=parseInt(gallery_containers[id][5])+Math.round(gallery_img_inc*scale);}else{if(current_scroll_timer2){clearInterval(current_scroll_timer2);}
stopGalleryAutoScroll(id);}}
function stopGalleryAutoScroll(id){if(window["auto_scroll_g_"+id]){clearInterval(window["auto_scroll_g_"+id]);}
gallery_img_inc_speed=gallery_global_inc_speed;}
function startGalleryAutoScroll(id){if(gallery_containers[id]){auto_scroll_g_x+=auto_scroll_inc;x=auto_scroll_g_x
scrollDivBar(id,null,x);clearScrollDivBar(id);window["auto_scroll_g_"+id]=setTimeout("startGalleryAutoScroll('"+id+"')",gallery_img_inc_speed);}}
function galleryJumpTo(id){if(gallery_containers[id]){x=tempX-gallery_scroll_bar_offset_x;scrollDivBar(id);clearScrollDivBar(id);}}
function scrollDivBar(id,firstdown,x){gallery_scroll=1;document.documentElement.style.cursor='move';if(!x){x=tempX-gallery_scroll_bar_offset_x;}
if(document.getElementById('x_pos_'+id)){document.getElementById('x_pos_'+id).innerHTML=x;}
y=tempY;if(gallery_containers[id]){div1=gallery_containers[id][0];div_container1=gallery_containers[id][1];div2=gallery_containers[id][2];div_container2=gallery_containers[id][3];scroll_div=gallery_containers[id][4];l=parseInt(scroll_div.style.left);last_l=l;if(firstdown){gallery_start_l=x;gallery_sb_start_l=l;}
main_w=parseInt(div_container1.clientWidth);main_h=parseInt(div_container1.style.height);main_img_w=parseInt(div1.style.width);main_img_l=parseInt(div1.style.left);preview_w=parseInt(div_container2.clientWidth);preview_h=parseInt(div_container2.style.height);preview_img_w=parseInt(div2.style.width);preview_img_l=parseInt(div2.style.left);scroll_div_w=parseInt(scroll_div.style.width);if(scroll_div.style.border){scroll_div_w+=(is_IE==1)?parseInt(scroll_div.style.borderRightWidth)*2:parseInt(scroll_div.style.borderRightWidth);}else if(is_IE!=1){scroll_div_w-=2;}
min_x=0;max_x=(preview_img_w<preview_w)?preview_img_w:preview_w;if(is_IE==0){max_x-=2;}
l=gallery_sb_start_l+(x-gallery_start_l);scale=main_img_w/preview_img_w;gallery_sb_direction=(l<last_l)?"left":"right";if(l<min_x){l=min_x;if(preview_img_w>preview_w){gallery_can_scroll_img=1;gallery_img_inc=10;scrollDivImg(id,scale);}}
if((l+scroll_div_w)>max_x){l=max_x-scroll_div_w;if(preview_img_w>preview_w){gallery_can_scroll_img=1;gallery_img_inc=-10;scrollDivImg(id,scale);}}
scroll_div.style.left=l+"px";div1_offset=parseInt(gallery_containers[id][5]);div1_l=(0-Math.round((l+2)*scale)+div1_offset);div1_l_max=(0-main_img_w+main_w);debug(div1_l+","+div1_l_max,1);div1.style.left=(div1_l<div1_l_max)?div1_l_max+"px":div1_l+"px";debug("<br>"+div1.style.left);if((l==0)&&(parseInt(div2.style.left)==0)){div1.style.left="0px";}
if((div1)&&(div_container1)&&(div2)&&(div_container2)&&(scroll_div)){current_scroll_timer=setTimeout("scrollDivBar('"+id+"')",1);}}}
var thumbnail_popups=Array();var popup=null;var thumbnail_popup_on=0;function setupThumbnailGallery(html,id,popup_on,border_color){thumbnail_popup_on=popup_on;if((document.getElementById('popup'))&&(popup===null)){popup=document.getElementById('popup');if(html){popup.innerHTML=decode64(html);}}
var j=0;for(var i in thumbnail_popups[id])
{img=document.getElementById('img_'+j+'_'+id);if(img){img.className='alpha_100';var popup_html=thumbnail_popups[id][i]['popup'];if(popup_html!=""){img.onmouseover=function(){this.style.cursor='pointer';this.className='alpha_40';};img.onmouseout=function(){this.className='alpha_100';}}}
j++;}}
function loadPopUpHtml(id,n){var div=document.getElementById('popup_html');if((popup)&&(div)){var popup_html=thumbnail_popups[id][n]['popup'];if(popup_html!=""){popup_html=decode64(popup_html);div.innerHTML=popup_html;}
var bool=(popup_html!="")?true:false;showHTMLPopUp(bool)}}
function closeHTMLPopUp(){showHTMLPopUp(false);}
function showHTMLPopUp(bool){if((popup)){popup.style.display=(bool)?"block":"none";if(bool){centerPopUp();}}}
function centerPopUp(){if(popup){var mcw=parseInt(document.getElementById('main_page').clientWidth);var mch=parseInt(document.getElementById('main_div').clientHeight);if((parseInt(document.documentElement.clientHeight)<mch)){mch=parseInt(document.documentElement.clientHeight)+document.documentElement.scrollTop;}
var lw=parseInt(popup.clientWidth);var lh=parseInt(popup.clientHeight);popup.style.left=(Math.round((mcw-lw+parseInt(document.getElementById('left_content').clientWidth))/2)+"px")
popup.style.top=Math.round((mch-lh)/2)-parseInt(document.getElementById('header').clientHeight)+"px";}}
var lightbox=null;var lightbox_image=null;var lightbox_back=null;var lightbox_zoom_back=null;var lightbox_zoom=null;var lightbox_zoom_tool=null;var lightbox_w=0;var lightbox_h=0;var lightbox_inc_x=0;var lightbox_inc_y=0;var lightbox_mtw=0;var lightbox_mth=0;var lightbox_speed=100;var lightbox_millisec=1000;var lightbox_moving=0;var lightbox_images=Array();var lightbox_img_cache=Array();var lightbox_mov_int=null;var lightbox_y_offset=0;var lightbox_x_offset=0;var lightbox_zoom_scale=1;var lightbox_type=1;var lightbox_border=0;function setupLightBox(html,id,type,border_color){lightbox_type=type;if((document.getElementById('lightbox'))&&(lightbox===null)){lightbox=document.getElementById('lightbox');if(html){lightbox.innerHTML=decode64(html);}
if(document.getElementById('lightbox_image')){lightbox_image=document.getElementById('lightbox_image');if(border_color!=""){lightbox_image.style.border="1px solid "+border_color;lightbox_border=1;}}
if(document.getElementById('lightbox_back')){lightbox_back=document.getElementById('lightbox_back');}
if((document.getElementById('lightbox_zoom_'+id))&&(document.getElementById('lightbox_zoom_tool'))){lightbox_zoom=document.getElementById('lightbox_zoom_'+id);lightbox_zoom_tool=document.getElementById('lightbox_zoom_tool');}else{lightbox_zoom=null;}
if(document.getElementById('lightbox_zoom_back_'+id)){lightbox_zoom_back=document.getElementById('lightbox_zoom_back_'+id);}else{lightbox_zoom_back=null;}
loadLightBoxImages(id);}}
function loadLightBoxImages(id){var j=0;for(var i in lightbox_images[id])
{d=new Date();before=d.getTime();light_img=decode64(lightbox_images[id][i]['light']);if(lightbox_type<3){image_img=decode64(lightbox_images[id][i]['image']);}
w=Math.abs(lightbox_images[id][i]['w']);h=Math.abs(lightbox_images[id][i]['h']);w2=Math.abs(lightbox_images[id][i]['w2']);h2=Math.abs(lightbox_images[id][i]['h2']);n=Math.abs(lightbox_images[id][i]['n']);lightbox_img_cache[id][j]={light:null,image:null,w:w,h:h,w2:w2,h2:h2};lightbox_img_cache[id][j]['light']=new Image();lightbox_img_cache[id][j]['light'].src=light_img;lightbox_img_cache[id][j]['image']=new Image();if(lightbox_type<3){lightbox_img_cache[id][j]['image'].src=image_img;}
img=document.getElementById('img_'+j+'_'+id);if(img){img.className='alpha_100';img.onmouseover=function(){this.style.cursor='pointer';this.className='alpha_40';};img.onmouseout=function(){this.className='alpha_100';}}
j++;}}
function loadLightBoxImage(id,n){clearMoveLightBox();clearLightBoxFade();if(lightbox_img_cache[id][n]){img1=lightbox_img_cache[id][n]['light'];img2=lightbox_img_cache[id][n]['image'];w=Math.abs(lightbox_img_cache[id][n]['w']);h=Math.abs(lightbox_img_cache[id][n]['h']);w2=Math.abs(lightbox_img_cache[id][n]['w2']);h2=Math.abs(lightbox_img_cache[id][n]['h2']);lightbox_zoom_scale=w2/w;if(lightbox){if((lightbox_zoom_tool)&&(lightbox_zoom)){if(lightbox_type==2){lightbox_zoom.style.height=(h)+"px";lightbox_zoom.style.top="11px";}
lightbox_zoom_tool.style.width=Math.round(parseInt(lightbox_zoom.style.width)/lightbox_zoom_scale)+"px";lightbox_zoom_tool.style.height=Math.round(parseInt(lightbox_zoom.style.height)/lightbox_zoom_scale)+"px";}
showLightBoxImage(img1,w,h,img2,w2,h2,id,n);showLightBox(true);startMouseMove();lightbox_mov_int=setInterval("moveLightBoxZoom()",1);}}}
function closeLightBox(){debug("<br>stopLightBoxZoom()<br>");stopLightBoxZoom();debug("<br>clearLightBoxFade()<br>");clearLightBoxFade();debug("<br>clearMoveLightBox()<br>");clearMoveLightBox();debug("<br>showLightBox(false)<br>");showLightBox(false);}
function showLightBoxImage(img,w,h,img2,w2,h2,id,n){if(lightbox_image){var plus=(lightbox_type==2)?300:0;var l_style=(lightbox_border==1)?"style='top:11px;'":"";lightbox_image.innerHTML="<img id='lightbox_current_img' src='"+img.src+"' width='"+w+"' height='"+h+"' "+l_style+" onmouseover='javascript:startLightBoxZoom();'>";if(lightbox_type==2){lightbox_image.innerHTML+="<div id=\"lightbox_txt\" style=\"top:"+(Math.round((h-60)/2))+"px;\">Move your mouse over the image to view in more detail.</div>";}
if(lightbox_type==3){var popup_html=lightbox_images[id][n]['popup'];if(popup_html!=""){lightbox_image.innerHTML+="<div id=\"lightbox_popup_txt\" style=\"height:"+(h-40)+"px;\">"+decode64(popup_html)+"</div>";plus=300;}}
changeOpac(0,'lightbox_current_img');if(lightbox_zoom){lightbox_zoom.innerHTML="<img id='lightbox_zoom_img' src='"+img2.src+"' width='"+w2+"' height='"+h2+"'>";}
lightbox_w=w+plus;lightbox_h=h;clearMoveLightBox();resizeLightBox(w+plus,h);}}
function clearMoveLightBoxZoom(){if(lightbox_mov_int){clearInterval(lightbox_mov_int);lightbox_mov_int=null;}}
function moveLightBoxZoom(){if(lightbox_type<3){lightbox_y_offset=parseInt(lightbox.style.top);x=tempX-lightbox_x_offset-Math.round((parseInt(document.documentElement.clientWidth)-parseInt(document.getElementById('main_page').clientWidth))/2);y=tempY-lightbox_y_offset-parseInt(document.getElementById('header').clientHeight);var lightbox_zoom_tool_width=(lightbox_zoom_tool)?parseInt(lightbox_zoom_tool.style.width):0;var lightbox_zoom_tool_height=(lightbox_zoom_tool)?parseInt(lightbox_zoom_tool.style.height):0;l=x-Math.round(lightbox_zoom_tool_width/2);t=y-Math.round(lightbox_zoom_tool_width/2);debug("tempY:"+tempY+"<br>y:"+y+"<br>lightbox_y_offset:"+lightbox_y_offset+"<br>top:"+t+"<br>"+document.documentElement.scrollTop,1);min_x=10;max_x=(lightbox_type==2)?parseInt(lightbox_image.style.width)-300-lightbox_zoom_tool_width+8:parseInt(lightbox_image.style.width)-lightbox_zoom_tool_width+8;if(l<min_x){l=min_x;}
if(l>max_x){l=max_x;}
min_y=10;max_y=parseInt(lightbox_image.style.height)-lightbox_zoom_tool_height+9;if(t<min_y){t=min_y;}
if(t>max_y){t=max_y;}
zoom_l=(10*lightbox_zoom_scale)-(l*lightbox_zoom_scale);zoom_t=(10*lightbox_zoom_scale)-(t*lightbox_zoom_scale);lightbox_zoom_tool.style.left=l+"px";lightbox_zoom_tool.style.top=t+"px";if(document.getElementById('lightbox_zoom_img')){document.getElementById('lightbox_zoom_img').style.left=zoom_l+"px";document.getElementById('lightbox_zoom_img').style.top=zoom_t+"px";}
var lb_max_x=(lightbox_type==2)?(parseInt(lightbox_image.style.width))+10-300:(parseInt(lightbox_image.style.width))+10
if((x<10)||(x>lb_max_x)||(y<10)||(y>(parseInt(lightbox_image.style.height))+10)){stopLightBoxZoom()}}}
function startLightBoxZoom(){if((lightbox_zoom)&&(lightbox_zoom_tool)){showLightBoxZoom(true);}}
function stopLightBoxZoom(){if((lightbox_zoom)&&(lightbox_zoom_tool)){showLightBoxZoom(false);}}
function showLightBoxZoom(bool){if(lightbox_zoom){lightbox_zoom.style.display=(bool)?"block":"none";}
if(lightbox_zoom_tool){lightbox_zoom_tool.style.display=(bool)?"block":"none";}
if(lightbox_zoom_back){lightbox_zoom_back.style.display=(bool)?"block":"none";}}
function showLightBox(bool){if(lightbox){if(bool){centerLightBox();}
lightbox.style.display=(bool)?"block":"none";}}
function moveLightBox(){w=lightbox_w;h=lightbox_h;mcw=(lightbox_type==1)?parseInt(document.getElementById('main_content').clientWidth):parseInt(document.getElementById('main_page').clientWidth);mch=(lightbox_type==1)?parseInt(document.getElementById('main_content').clientHeight):parseInt(document.getElementById('main_div').clientHeight);if((lightbox_type==2)&&(parseInt(document.documentElement.clientHeight)<mch)){mch=parseInt(document.documentElement.clientHeight)+(document.documentElement.scrollTop*2);}
if((cw==lightbox_mtw)&&(ch==lightbox_mth)){clearMoveLightBox();return false;}
if((lightbox_inc_x!=0)&&(cw!=lightbox_mtw)){w=(cw+lightbox_inc_x);if(((lightbox_inc_x>0)&&(w>lightbox_mtw))||((lightbox_inc_x<0)&&(w<lightbox_mtw))){w=Math.abs(lightbox_mtw);}
lightbox_image.style.width=w+"px";lightbox_back.style.width=(w+20)+"px";lightbox.style.left=(lightbox_type==1)?(Math.round((mcw-(w+20))/2)+parseInt(document.getElementById('left_content').clientWidth)+"px"):(Math.round((mcw-(w+20))/2)+"px");lightbox_x_offset=parseInt(lightbox.style.left);}
if((lightbox_inc_y!=0)&&(ch!=lightbox_mth)){h=(ch+lightbox_inc_y);if(((lightbox_inc_y>0)&&(h>lightbox_mth))||((lightbox_inc_y<0)&&(h<lightbox_mth))){h=Math.abs(lightbox_mth);}
lightbox_image.style.height=h+"px";lightbox_back.style.height=(h+20)+"px";lightbox.style.top=Math.round((mch-(h+20))/2)+"px";}}
function clearLightBoxFade(){for(i=0;i<=100;i++){if(window['opt_lb_'+i]){clearTimeout(window['opt_lb_'+i]);}}}
function clearMoveLightBox(){for(i=0;i<=lightbox_speed;i++){if(window['move_lb_'+i]){clearTimeout(window['move_lb_'+i]);}}
lightbox_moving=0;}
function resizeLightBox(w,h){if((lightbox_back)&&(lightbox_image)){lightbox_mtw=w;lightbox_mth=h;var speed=Math.round(lightbox_millisec/lightbox_speed);var timer=0;cw=parseInt(lightbox_image.style.width);ch=parseInt(lightbox_image.style.height);lightbox_inc_x=((lightbox_mtw-cw));lightbox_inc_y=((lightbox_mth-ch));if(lightbox_inc_x>0){lightbox_inc_x+=1;}else if(lightbox_inc_x<0){lightbox_inc_x-=1;}
if(lightbox_inc_y>0){lightbox_inc_y+=1;}else if(lightbox_inc_y<0){lightbox_inc_y-=1;}
lightbox_inc_x=Math.round(lightbox_inc_x);lightbox_inc_y=Math.round(lightbox_inc_y);lightbox_moving=1;moveLightBox();debug("START<br>",1);changeOpac(100,'lightbox_current_img');}}
function centerLightBox(){if((lightbox)){mcw=parseInt(document.getElementById('main_page').clientWidth);mch=parseInt(document.getElementById('main_content').clientHeight);if((lightbox_type==2)&&(parseInt(document.documentElement.clientHeight)<mch)){mch=parseInt(document.documentElement.clientHeight)+(document.documentElement.scrollTop*2);}
var lw=lightbox_w+20;var lh=lightbox_h+20;lightbox.style.left=(Math.round((mcw-lw)/2))+"px";lightbox.style.top=Math.round((mch-lh)/2)+"px";}}
var rotator_box_items=Array();function rotateBox(key,delay){div=document.getElementById('pr_'+key);if((rotator_box_items[key])&&(div));{no_items=Math.abs(rotator_box_items[key]['no_items']);current_item=Math.abs(rotator_box_items[key]['current_item']);h=Math.abs(rotator_box_items[key]['h']);if(current_item>=no_items){current_item=0;}
rotator_box_items[key]['current_item']=current_item+1;try{div.style.top=(0-(current_item*h))+"px";setTimeout("rotateBox('"+key+"',"+delay+")",delay);}catch(e){}}}
var selected_current_back_color="";var selected_current_font_color="";function changeTrans(field,bool){if(bool){selected_current_back_color=field.style.backgroundColor;selected_current_font_color=field.style.color;}
field.style.backgroundColor=(bool)?"#ffffff":selected_current_back_color;field.style.color=(bool)?"#333333":selected_current_font_color;}
function depth(obj){var level=1;while(obj.parentNode.className!=listClass){if(obj.tagName=="UL")level++;obj=obj.parentNode;};return level;};var expandTo=1;var listClass="bloglinks";function toggleList(li){var elements=li.getElementsByTagName("ul");}
function debug(str,replace_all){div=document.getElementById('debug')
if(div){div.innerHTML=(replace_all)?str:div.innerHTML+str;}}
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion()
{var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}catch(e){version=-1;}}
return version;}
function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];var versionRevision=descArray[3];if(versionRevision==""){versionRevision=descArray[4];}
if(versionRevision[0]=="d"){versionRevision=versionRevision.substring(1);}else if(versionRevision[0]=="r"){versionRevision=versionRevision.substring(1);if(versionRevision.indexOf("d")>0){versionRevision=versionRevision.substring(0,versionRevision.indexOf("d"));}}
var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera){flashVer=ControlVersion();}
return flashVer;}
function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision)
{versionStr=GetSwfVer();if(versionStr==-1){return false;}else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(".");}
var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVer))
return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=parseFloat(reqRevision))
return true;}}
return false;}}
function AC_AddExtension(src,ext)
{if(src.indexOf('?')!=-1)
return src.replace(/\?/,ext+'?');else
return src+ext;}
function AC_Generateobj(objAttrs,params,embedAttrs)
{var str='';if(isIE&&isWin&&!isOpera)
{str+='<object ';for(var i in objAttrs)
str+=i+'="'+objAttrs[i]+'" ';for(var i in params)
str+='><param name="'+i+'" value="'+params[i]+'" /> ';str+='></object>';}else{str+='<embed ';for(var i in embedAttrs)
str+=i+'="'+embedAttrs[i]+'" ';str+='> </embed>';}
document.write(str);}
function AC_FL_RunContent(){var ret=AC_GetArgs
(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);}
function AC_GetArgs(args,ext,srcParamName,classid,mimeType){var ret=new Object();ret.embedAttrs=new Object();ret.params=new Object();ret.objAttrs=new Object();for(var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch(currArg){case"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;case"src":case"movie":args[i+1]=AC_AddExtension(args[i+1],ext);ret.embedAttrs["src"]=args[i+1];ret.params[srcParamName]=args[i+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":ret.objAttrs[args[i]]=args[i+1];break;case"id":case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];}}
ret.objAttrs["classid"]=classid;if(mimeType)ret.embedAttrs["type"]=mimeType;return ret;}
var password_pass=0;var processing=0;function sendCustomerDetails(res,success){fm=document.theForm;if(res){document.getElementById('status_txt').innerHTML=res;if(success==0){document.getElementById('btn_row').style.display="block";fm.customer_email.disabled=false;}}else if(processing==0){email=fm.customer_email.value;document.getElementById('email_fail_row').style.display="none";document.getElementById('process_row').style.display="none";document.getElementById('btn_row').style.display="block";if(!checkemail(email)){document.getElementById('email_fail_row').style.display="block";fm.customer_email.focus();fm.customer_email.select();return false;}
fm.customer_email.disabled=true;document.getElementById('status_txt').innerHTML="processing details please wait....";document.getElementById('process_row').style.display="block";document.getElementById('btn_row').style.display="none";email=encode64(email);document.getElementById('process_frame').src=global_url+"scripts/forgot_password.php?"+email;}}
function updateRememberMe(box){if(box.checked==true){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+12);}else{expireDate=new Date;expireDate.setMonth(expireDate.getMonth()-12);}
document.cookie="remember_me="+document.theForm.customer_email.value+";expires="+expireDate.toGMTString()+";path=/";}
function memberContinue(){fm=document.theForm;email=fm.customer_email.value;document.getElementById('password_fail_row').style.display="none";document.getElementById('email_fail_row').style.display="none";document.getElementById('username_fail_row').style.display="none";document.getElementById('process_row').style.display="none";document.getElementById('btn_row').style.display="block";if(parseInt(document.theForm.MEM_LOGON_TYPE.value)==0){if(!checkemail(email)){document.getElementById('email_fail_row').style.display="block";fm.customer_email.focus();fm.customer_email.select();resizePage();return false;}}else{if(email==""){document.getElementById('username_fail_row').style.display="block";fm.customer_email.focus();fm.customer_email.select();resizePage();return false;}}
if(fm.remember_me.checked==true){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+12);}else{expireDate=new Date;expireDate.setMonth(expireDate.getMonth()-12);}
document.cookie="remember_me="+email+";expires="+expireDate.toGMTString()+";path=/";password=fm.customer_password.value;customer_type=1;if(password==""){document.getElementById('password_fail_row').style.display="block";fm.customer_password.focus();return false;}else if(password_pass==0){fm.customer_email.disabled=true;fm.customer_password.disabled=true;document.getElementById('status_txt').innerHTML="checking details please wait....";document.getElementById('process_row').style.display="block";document.getElementById('btn_row').style.display="none";email=parent.encode64(email);password=parent.encode64(password);str=email+"|"+password+"|1";str=parent.encode64(str);document.getElementById('process_frame').src=global_url+"scripts/check_details.php?"+str;return false;}
memberProcess();}
function memberProcess(res){fm=document.theForm;if(res){fm.customer_email.disabled=false;fm.customer_password.disabled=false;document.getElementById('status_txt').innerHTML=res;document.getElementById('btn_row').style.display="block";}}
function toggleForm(id,num){btn=(Math.abs(num)>0)?document.getElementById("toggle_btn"+num+"_"+id):document.getElementById("toggle_btn_"+id);div=(Math.abs(num)>0)?document.getElementById("form_row"+num+"_"+id):document.getElementById("form_row_"+id);if((btn)&&(div)){img=btn.src.split("/").pop();reg=new RegExp(img);new_img=(img=="arrow_up.png")?"arrow_down.png":"arrow_up.png";btn.src=btn.src.replace(reg,new_img);div.style.display=(new_img=="arrow_up.png")?"block":"none";resizePage();}}
function updateFlags(id){form=null;if(document.forms["form_"+id]){form=document.forms["form_"+id];}
if((form!=null)&&(form['flags'])){flags="";for(var i=0;i<form.length;i++){if((form[i].name=='flag')&&(form[i].type=="checkbox")){if(form[i].checked==true){flags+=(flags=="")?"":"^";flags+=form[i].value;}}}
form['flags'].value=flags;}}
function emailRegistered(id,email_field_name){div=document.getElementById('form_div_'+id);form=document.forms["form_"+id];if((div)&&(form)){disableBtns(form,1);div.style.display="block";if(form[email_field_name]){form[email_field_name].value="";form[email_field_name].focus();}
resizePage();}}
function showForm(id){form=document.getElementById('form_hidden_row_'+id);if(form){form.style.display="block";resizePage();}}
function resetForm(id){form=null;if(document.forms["form_"+id]){form=document.forms["form_"+id];form.reset();disableBtns(form,1);form.action="javascript:";form.todo.value="";document.getElementById('form_result_txt_'+id).innerHTML="";document.getElementById('form_result_div_'+id).style.display="none";document.getElementById('form_div_'+id).style.display="block";resizePage();}}
function replaceForm(id,str){try{document.getElementById('form_div_'+id).innerHTML=decode64(str);document.getElementById('form_result_txt_'+id).innerHTML="";document.getElementById('form_result_div_'+id).style.display="none";document.getElementById('form_div_'+id).style.display="block";}catch(form_err){}}
function updateEncodedResultTxt(id,str){res=document.getElementById('form_result_txt_'+id);if(res){res.innerHTML=decode64(str);}}
function updateHiddenFormValue(field,type,hidden_field_name,separator,form_id){form=null;if(document.forms["form_"+form_id]){form=document.forms["form_"+form_id];}
if((form!=null)&&(form[field.name])&&(form[hidden_field_name])){rtn_value="";if(type=="select"){for(f=0;f<field.length;f++){if(field[f].selected==true){rtn_value+=(rtn_value=="")?"":separator;rtn_value+=field[f].value;}}}
form[hidden_field_name].value=rtn_value;}}
function formCheckEmail(field,ignore_blank){email=field.value;var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(filter.test(email)){return true;}else if((email=="")&&(ignore_blank==1)){return true;}else{field.value="";alert("Please enter a valid email address");try{field.focus();}catch(e){}
return false;}}
function checkUploadFile(file){allowed_arr=Array("doc","rtf","txt","htm","docx");file_arr=file.split(".");last=file_arr.length-1;ext=file_arr[last].toLowerCase();file_ok=false;for(a=0;a<allowed_arr.length;a++){if(ext==allowed_arr[a]){file_ok=true;break;}}
return file_ok;}
function disableBtns(form,enable){for(b=0;b<form.length;b++){if(form[b].type=="button"){form[b].disabled=(!enable)?true:false;}}}
function removeLastKeyword(id){fm=document.forms['form_'+id];if((fm)&&(fm.keyword)&&(fm.keyword.value!="")){key_arr=fm.keyword.value.split("|");new_key="";for(i=0;i<(key_arr.length-1);i++){new_key+=(new_key=="")?key_arr[i]:"|"+key_arr[i];}
fm.keyword.value=new_key;fm.keyword_search.value="";checkNewsSearchForm(id);}}
function clearAllKeywords(id){fm=document.forms['form_'+id];if((fm)&&(fm.keyword)&&(fm.keyword.value!="")){fm.keyword.value="";fm.keyword_search.value="";checkNewsSearchForm(id)}}
function removeSearchKeyword(id,val){fm=document.forms['form_'+id];if((fm)&&(fm.keyword)&&(fm.keyword.value!="")){key_arr=fm.keyword.value.split("|");new_key="";for(i=0;i<key_arr.length;i++){if(key_arr[i]!=val){new_key+=(new_key=="")?key_arr[i]:"|"+key_arr[i];}}
fm.keyword.value=new_key;fm.keyword_search.value="";checkNewsSearchForm(id);}}
function addToSearchKeyword(id,val){fm=document.forms['form_'+id];if((fm)&&(fm.keyword)&&(val!="")){fm.keyword.value+=(fm.keyword.value=="")?encode64(val):"|"+encode64(val);}}
function checkNewsSearchForm(id){fm=document.forms['form_'+id];if(fm){keyword="";category="";date_from="";date_to="";for(i=0;i<fm.length;i++){if(fm[i].type!="button"){if(fm[i].name=="date_from"){date_from=fm[i].value;}
if(fm[i].name=="date_to"){date_to=fm[i].value;}
if(fm[i].name=="keyword_search"){addToSearchKeyword(id,fm[i].value);}
if(fm[i].name=="keyword"){keyword=fm[i].value;}
if((fm[i].name.substr(0,4)=="cat_")&&(fm[i].checked==true)){category+=(category=="")?fm[i].value:"|"+fm[i].value;}}}
if((date_from>date_to)&&(date_from!="")&&(date_to!="")){fm.date_from.value=date_to
formatDate(document.getElementById('date_from_div_'+id),date_to);fm.date_to.value=date_from
formatDate(document.getElementById('date_to_div_'+id),date_from);date_to=fm.date_to.value;date_from=fm.date_from.value}
updateSearchArticles(keyword,category,date_from,date_to)}}
function clearNewsSearchForm(id){clearSearchOptions(1);}
function checkForm(type,action,id){form=null;for(i=0;i<document.forms.length;i++){if(document.forms[i].name=="form_"+id){form=document.forms[i];break;}}
if(form!=null){faillist="";invalidlist="";to_focus=null;check_arr=Array();todo=type;if((type=="enquiry")||(type=="member")){check_arr.push({field:"firstname",txt:"first name",type:"text"});check_arr.push({field:"surname",txt:"last name",type:"text"});check_arr.push({field:"email",txt:"email address",type:"valid_text"});check_arr.push({field:"telephone1",txt:"a primary contact number",type:"text"});check_arr.push({field:"postcode",txt:"your postcode",type:"valid_text"});check_arr.push({field:"enquiry",txt:"enquiry details",type:"text"});check_arr.push({field:"over_18",txt:"you are over the age of 18",type:"checkbox"});}
if(type=="faq ask"){check_arr.push({field:"your_name",txt:"your name",type:"text"});check_arr.push({field:"your_email",txt:"your email address",type:"valid_text"});check_arr.push({field:"your_question",txt:"your question",type:"text"});}
if(type=="logon"){check_arr.push({field:"customer_uname",txt:"your username",type:"text"});check_arr.push({field:"customer_pword",txt:"your password",type:"text"});}
if(type=="logon_blog"){check_arr.push({field:"customer_uname",txt:"your email address",type:"valid_text"});check_arr.push({field:"customer_pword",txt:"your password",type:"text"});todo="logon";}
if(type=="register"){check_arr.push({field:"register_firstname",txt:"your first name",type:"text"});check_arr.push({field:"register_surname",txt:"your surname",type:"text"});check_arr.push({field:"register_email",txt:"your email address",type:"valid_text"});}
if(type=="member_full_details"){check_arr.push({field:"up_title",txt:"your title",type:"text"});check_arr.push({field:"up_firstname",txt:"your first name",type:"text"});check_arr.push({field:"up_surname",txt:"your surname",type:"text"});check_arr.push({field:"up_address1",txt:"the first line of your address",type:"text"});check_arr.push({field:"up_postcode",txt:"your postcode",type:"text"});check_arr.push({field:"up_country",txt:"your country",type:"text"});check_arr.push({field:"up_email1",txt:"your email address",type:"valid_text"});check_arr.push({field:"up_telephone1",txt:"your primary contact number",type:"text"});}
if(type=="member_password"){check_arr.push({field:"current_password",txt:"your current password",type:"text"});check_arr.push({field:"new_password",txt:"your new password",type:"text"});check_arr.push({field:"confirm_password",txt:"confirm your new password",type:"text"});}
if(type=="post_comment"){var ok=confirm("Are you sure you want to post this commment?");if(ok==false){return false;}
check_arr.push({field:"blog_comment",txt:"your comment",type:"text"});}
for(i=0;i<check_arr.length;i++){txt=check_arr[i]['txt'];field=check_arr[i]['field'];type=check_arr[i]['type'];if(type.substr(0,6)=='valid_'){type=type.substr(6);if((valid_format_error[field])&&(valid_format_error[field]==1)){invalidlist+=(invalidlist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="text"){if((form[field])&&(form[field].value=="")){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="text2"){field_val_ok=0;field_arr=field.split("|");for(f=0;f<field_arr.length;f++){if((form[field_arr[f]])&&(form[field_arr[f]].value!="")){field_val_ok=1;break;}}
if(field_val_ok==0){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field_arr[0]]:to_focus;}}
if(type=="checkbox"){if((form[field])&&(form[field].checked==false)){faillist+=(faillist=="")?txt:", "+txt;}}
if(type=="radio"){if((form[field])){radio_selected=0;for(r=0;r<form[field].length;r++){if(form[field][r].checked==true){radio_selected=1;break;}}
if(radio_selected==0){faillist+=(faillist=="")?txt:", "+txt;}}}
if(type=="file"){if((form[field])&&(form[field].value=="")){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}else if((form[field])&&(!checkUploadFile(form[field].value))){txt+=" - in a valid word document format or plain text";faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="file2"){if((form[field])&&(form[field].value!="")){if(!checkUploadFile(form[field].value)){txt+="the document in a valid word document format or plain text";faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}}}
if((invalidlist!="")||(faillist!="")){tmp="";tmp+=(invalidlist!="")?"The following details were not recognised:- \r\n"+invalidlist+"\r\n\r\n":"";tmp+=(faillist!="")?"Please complete the following:- \r\n"+faillist+"\r\n":"";alert(tmp);try{to_focus.focus();to_focus.select();}catch(e){}}else{if(todo=="member_password"){if(!checkPasswordMatch(form['confirm_password'],form['new_password'],1)){checkPasswordMatch(form['confirm_password'],form['new_password']);return false;}}
form.action=action;form.todo.value=todo;disableBtns(form);form.submit();document.getElementById('form_result_txt_'+id).innerHTML="processing please wait....";document.getElementById('form_result_div_'+id).style.display="block";document.getElementById('form_div_'+id).style.display="none";resizePage();}}}
var IE=document.all?true:false;var tempX=0
var tempY=0
var max_x=null;var max_y=null;var mouse_move_started=0;function startMouseMove(){if(mouse_move_started==0){mouse_move_started=1;if(window.Event&&document.captureEvents)document.captureEvents(Event.MOUSEMOVE);document.onmousemove=getMouseXY;}}
function getMouseXY(e){if(IE){tempX=event.clientX+document.documentElement.scrollLeft
tempY=event.clientY+document.documentElement.scrollTop}else{tempX=e.pageX
tempY=e.pageY}
if(tempX<0){tempX=0}
if(tempY<0){tempY=0}
return true}
function showTag(id,text,show){if(window['pres_alpha']){clearTimeout(window['pres_alpha']);}
if(text!=""){if(document.getElementById(id)){h=document.documentElement.clientHeight;header_h=parseInt(document.getElementById('header').style.height)
if((tempY-20+200)>h){h1=(h-200)}else{h1=(tempY-20);}
w1=tempX+10;re1=/alpha_/gi;this_class=document.getElementById(id).className;alpha=this_class.replace(re1,"");alpha=Math.abs(alpha);if(show==1){document.getElementById(id).style.left=(show==1)?(w1)+"px":"-1000px";document.getElementById(id).style.top=(show==1)?h1+"px":"-1000px";}
document.getElementById(id).style.height="180px";text=decode64(text);re=/\n/gi;text=text.replace(re,"<br>");document.getElementById(id).innerHTML=text;if(show==1){if(alpha<100){text=encode64(text);document.getElementById(id).className="alpha_"+(alpha+10);window['pres_alpha']=setTimeout("showTag('"+id+"','"+text+"',"+show+")",10);}else{document.getElementById(id).className="alpha_100";}}else{if(alpha>0){text=encode64(text);document.getElementById(id).className="alpha_"+(alpha-10);window['pres_alpha']=setTimeout("showTag('"+id+"','"+text+"',"+show+")",10);}else{document.getElementById(id).className="alpha_0";document.getElementById(id).style.left="-1000px";document.getElementById(id).style.top="-1000px";}}}}}
function fn_valid_format(str,type,result_format,args){function luhn_check(number,validators){if(!validators){validators='05';}
var number=number.replace(/\D/g,'');var number_length=number.length;var parity=number_length%2;var total=0;for(i=0;i<number_length;i++){var digit=number.charAt(i);if(i%2==parity){digit=digit*2;if(digit>9){digit=digit-9;}}
total+=parseInt(digit);}
var validator=(total%10);return((validators.indexOf(validator)!=-1)?true:false);}
function change_case(str,result_format,args){if(!result_format){result_format='';}
if((result_format.indexOf('0')==-1)&&(result_format.indexOf('1')==-1)&&(result_format.indexOf('2')==-1)){result_format+='0';}
var pat_words=/\s*[\S]*/g;var fstr=str+'';var parts=Array();var matches=Array();var temp=Array();var result='';if(fstr.match(pat_words)){matches=fstr.match(pat_words);var prev_c=' ';var prev_2c='';var prev_3c='';var c='';var prev_non_spc='.';for(j=0;j<matches.length;j++){m=matches[j];if(((result_format.indexOf('4')!=-1)||(args.indexOf('C')!=-1))){m=m.replace(/ {2,}/,' ')}
for(i=0;i<(m.length);i++){c=m.substr(i,1);fc=c;if((result_format.indexOf('0')!=-1)&&((".:").indexOf(prev_non_spc)!=-1)){fc=c.toUpperCase()}
else if((result_format.indexOf('1')!=-1)&&((".: (").indexOf(prev_c)!=-1)){fc=c.toUpperCase()}
else if((result_format.indexOf('2')!=-1)&&((".: ('-\n").indexOf(prev_c)!=-1)){fc=c.toUpperCase()}
else if(((result_format.indexOf('3')!=-1)||(args.indexOf('S')!=-1))&&(m.match(/[aeiou]/i))&&(!m.match(/[0-9]/i))){fc=c.toLowerCase()}
if((result_format.indexOf('2')!=-1)&&(prev_2c=='Mc')){fc=c.toUpperCase();}
if((result_format.indexOf('2')!=-1)&&(prev_3c=='Mac')){fc=c.toUpperCase();}
result+=fc;prev_3c=prev_2c+fc;prev_2c=prev_c+fc;prev_c=fc;tmp=" ";if(fc.match(/\S/)){prev_non_spc=fc;}}}}
return result;}
function in_array(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}
return false;}
function trim(str){return str.replace(/^\s+/,'').replace(/\s+$/,'');}
if((!type)||(type=="")){type='guess';}
if((!args)||(args=="")){args="";}
var args_arr=(args)?args.split(""):Array();var title_arr=Array('mr','master','sir','mrs','ms','miss','madam','dame','dr','doctor');var qual_arr=Array('b.a','b.sc','b.eng','b.ed','m.a','m.sc','ph.d','g.p');var pat_qual='';for(i in qual_arr){pat_qual+=(i==0)?qual_arr[i].replace('.','(?:\\.)?'):'|'+qual_arr[i].replace('.','(?:\\.)?');}
var pat_title='';for(i in title_arr){pat_title+=(i==0)?title_arr[i]:'|'+title_arr[i];}
var pat_pc1=/^(([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW]))( *)([0-9][ABD-HJLNP-UW-Z]{2}))$/i;var pat_pc2=/^(([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])))$/i;var pat_pc3=/^(([A-PR-UWYZ]|[A-HK-Y][A-PR-UWYZ]))$/i;var pat_pc4=/^((\d{5}-\d{4})|(\d{5})|([ABCEGHJKLMNPRSTVXY]\d[A-Z]\s?\d[A-Z]\d))$/i;var pat_email1=/^(([0-9a-z]([\-.\w_\&\']*[0-9a-z_\-\&\'])*)@(([0-9a-z][\-\w]*[0-9a-z]\.)+([a-z]{2,9})))$/i;var pat_tel1=/^(\+\d{3}[\s-]?|\+\d{1,2}[\s-])?\s*((0|\(\d+\))?([\d\s-]+))((x|ex|ext|extn|extension)?[\s-]*(\d*))$/;var pat_name1=new RegExp('^(('+pat_title+')[\\s\\.]+)?([\\w\\s\'-\\.]+?)([\\s\\.]+(\\(.+\\)|'+pat_qual+'))?[\\s\\.]*$','i');var pat_words=/\s*[\S]*/g;var pat_cc_amex15=/^(3[47]\d{2})(?:[:\-\s])?(\d{6})(?:[:\-\s])?(\d{5})$/;var pat_cc_dine14=/^(3[68]\d{2}|30[05]\d)(?:[:\-\s])?(\d{6})(?:[:\-\s])?(\d{4})$/;var pat_cc_disc16a=/^(6011)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_disc16b=/^(622[1-9])(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_disc16c=/^(64[4-9]\d|65\d{2})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_jcb16=/^(35[2-8]\d)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_laser=/^(6304|6706|6771|6709)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4,7})$/;var pat_cc_maest=/^(5018|5020|5038|6304|6759|6761|6763)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{0,7})$/;var pat_cc_mast16=/^(5[1-5]\d{2})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_solo=/^(6334|6767)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4}|\d{6}|\d{7})$/;var pat_cc_switcha=/^(4903|4905|4911|4936|6333|6759)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4}|\d{6}|\d{7})$/;var pat_cc_switchb=/^(5641)(?:[:\-\s])?(82\d{2})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4}|\d{6}|\d{7})$/;var pat_cc_switchc=/^(6331)(?:[:\-\s])?(10\d{2})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4}|\d{6}|\d{7})$/;var pat_cc_viselec=/^(4175|4917|4913|4508|4844)(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_cc_visa=/^(4\d{3})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d|\d{4})$/;var pat_cc_unk=/^(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})(?:[:\-\s])?(\d{4})$/;var pat_date_1=/^(\d{1,2})(?:[^\d\w]+)(\d{1,2})(?:[^\d\w]+)(\d{2}|\d{4})$|^(\d{1,2})(?:\[^\d\w]+)(\d{1,2})$|^(\d{1,2})(?:[^\d\w]+)(\d{2}|\d{4})$/;var pat_date_1g=/^(\d{1,2})(?:[^\d\w]+)(\d{1,2})(?:[^\d\w]+)(\d{2}|\d{4})$/;var pat_date_2=/^(\d{1,2})(?:st|nd|rd|th)?(?:[\.:\-\s]+)(\w+)(?:[\.:\-\s]+)(\d{2}|\d{4})$/i;if((type=='')||(trim((type+'').toLowerCase())=='guess')){var matches=Array();var days_in_month=Array(0,31,29,31,30,31,30,31,31,30,31,30,31);if(trim((str+'').toUpperCase()).match(pat_pc1)){return('postcode');}
else if((in_array('F',args_arr))&&(trim((str+'').toUpperCase()).match(pat_pc4))){return('postcode US/Can');}
else if(trim((str+'').toLowerCase()).match(pat_email1)){return('email');}
else if((trim(str+'').match(pat_cc_unk))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_amex15))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_dine14))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_disc16a))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_disc16b))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_disc16c))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_jcb16))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_laser))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_maest))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_mast16))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_solo))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_switcha))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_switchb))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_switchc))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_viselec))&&(luhn_check(str))){return('card');}
else if((trim(str+'').match(pat_cc_visa))&&(luhn_check(str))){return('card');}
else if(trim(str+'').match(pat_date_1g)){matches=trim(str+'').match(pat_date_1g);if((parseInt(matches[1])>=1)&&(parseInt(matches[1])<=days_in_month[parseInt(matches[2])])&&(parseInt(matches[2])>=1)&&(parseInt(matches[2])<=12)){return('date');}}
else if(trim(str+'').match(pat_date_2)){return('date');}
else if(trim((str+'').toLowerCase()).match(pat_tel1)){return('phone');}
else{return(false);}}
var valid=false;var validate=(in_array('V',args_arr))?true:false;var return_arr=(in_array('A',args_arr))?true:false;switch(trim(type+'').toLowerCase()){case'name':case'user':case'username':if((!result_format)||(result_format=="")){result_format='1 3';}
var fstr=trim((str+''));var parts=Array();var matches=Array();var temp=Array();if(fstr.match(pat_name1)){matches=fstr.match(pat_name1);parts[0]=matches[2];var temp1=matches[3];parts[5]=matches[5];parts[7]=matches[0];temp=temp1.split(/[\s\.]+/);var temp2='';parts[2]='';switch(''+temp.length){case'0':break;case'1':if((!parts[0])||(parts[0]=='')){parts[1]=temp[0];}
else{parts[3]=temp[0];}
break;case'2':parts[1]=temp[0];parts[3]=temp[1];parts[4]=temp[0].substr(0,1)
break;default:parts[1]=temp[0];parts[4]=temp[0].substr(0,1);for(i=1;i<(temp.length-1);i++){parts[2]+=(i==1)?temp[i]:' '+temp[i];parts[4]+=temp[i].substr(0,1);}
parts[3]=temp[temp.length-1];break;}
switch(parts[0].toLowerCase()){case'mr':case'master':case'sir':parts[6]='M';break;case'mrs':case'ms':case'miss':case'madam':case'dame':parts[6]='F';break;default:parts[6]='';break;}
if((('x'+result_format).indexOf('0')!=-1)&&(parts[0]=='')){return false;}
if((('x'+result_format).indexOf('1')!=-1)&&(parts[1]=='')){return false;}
if((('x'+result_format).indexOf('3')!=-1)&&(parts[3]=='')){return false;}
if((('x'+result_format).indexOf('4')!=-1)&&(parts[4]=='')){return false;}
if((('x'+result_format).indexOf('3')==-1)&&(('x'+result_format).indexOf('4')!=-1)){parts[4]+=parts[3].substr(0,1);}
if(parts[0]){parts[0]=change_case(parts[0],'2');}
if(parts[1]){parts[1]=change_case(parts[1],'2');}
if(parts[2]){parts[2]=change_case(parts[2],'2');}
if(parts[3]){parts[3]=change_case(parts[3],'2');}
if(parts[4]){parts[4]=parts[4].toUpperCase();}
if(parts[7]){parts[7]=change_case(parts[7],'2');}
valid=true;}else{return false;}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=result_format.substr(i,1);switch(j){case'0':case'1':case'2':case'3':case'4':case'5':case'6':case'7':if(parts[j]){result+=parts[j];}
break;default:result+=j+'';break;}}
result=(trim(result)).replace(/\s{2,}/,' ');return(validate)?valid:result;}
break;case'postcode':case'pcode':case'pc':var check_foreign=(in_array('F',args_arr))?true:false;if((!result_format)||(result_format=="")){result_format='1 2';}
var fstr=trim((str+'').toUpperCase());var parts=Array();var matches=Array();var temp=Array();if(fstr.match(pat_pc1)){matches=fstr.match(pat_pc1);parts[1]=matches[2];parts[2]=matches[7];temp=matches[2].match(/^[\D]*/);parts[0]=temp[0];valid=true;}else if(fstr.match(/^GIR *0AA$/i)){parts[1]='GIR';parts[2]='0AA';parts[0]='GIR';valid=true;}else if(fstr.match(pat_pc2)){matches=fstr.match(pat_pc2);parts[1]=matches[2];temp=matches[2].match(/^[\D]*/);parts[0]=temp[0];if(('x'+result_format).indexOf('2')!=-1){return false;}
valid=true;}else if(fstr.match(pat_pc3)){matches=fstr.match(pat_pc3);parts[0]=matches[0];if(('x'+result_format).indexOf('2')!=-1){return false;}
if(('x'+result_format).indexOf('1')!=-1){return false;}
valid=true;}else if((check_foreign)&&(fstr.match(pat_pc4))){valid=true;return(validate)?valid:result;}else{return false;}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=result_format.substr(i,1);switch(j){case'0':case'1':case'2':result+=parts[j];break;default:result+=j+'';break;}}
return(validate)?valid:result;}
break;case'tel':case'telephone':case'phone':var is_mobile=false;var check_mobile=(in_array('M',args_arr))?true:false;var check_strict=(in_array('S',args_arr))?true:false;var use_ext=(in_array('E',args_arr))?true:false;var allow_5dig=(in_array('5',args_arr))?true:false;if((!result_format)||(result_format=="")){result_format='0 1 2 3';use_ext=true;}
var fstr=trim((str+'').toLowerCase());var parts=Array();var matches=Array();if(fstr.match(pat_tel1)){matches=fstr.match(pat_tel1);parts[0]=trim(matches[1]+'');var temp1=trim(matches[3]);var temp2=trim(matches[4]);temp2=temp2.replace(/[\s-]/g,'');exception_arr=Array('121','131','141','151','161','191');var len1=(in_array(temp2.substr(0,3),exception_arr))?3:4;if(((temp2.length==5)&&(allow_5dig))||(temp2.length==6)){if((parts[0]!='')||(temp1!='')){return false;}
if((('x'+result_format).indexOf('0')!=-1)&&(check_strict==true)){return false;}
if((('x'+result_format).indexOf('1')!=-1)&&(check_strict==true)){return false;}
parts[2]=temp2;parts[3]=trim(matches[7]);}else if((temp2.length==9)||(temp2.length==10)){if((parts[0]=='')&&(('x'+result_format).indexOf('0')!=-1)&&(check_strict==true)){return false;}
parts[1]=temp2.substr(0,len1);parts[2]=temp2.substr(len1);parts[3]=trim(matches[7]);if(parts[1].substr(0,1)=='7'){is_mobile=true;}}else{return false;}
if((temp2.length==5)&&(is_mobile)){return false;}
if(('x'+result_format).indexOf('0')==-1){temp1=temp1.replace(/[\(\)]/g,'');}
if(temp1==''){temp1='0';}
if(((('x'+result_format).indexOf('0')==-1)||(parts[0]==''))&&(parts[1])){parts[1]=temp1+parts[1];}
if((parts[1]=='')&&(('x'+result_format).indexOf('1')!=-1)&&(check_strict==true)){return false;}
valid=true;}else{return false;}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=result_format.substr(i,1);switch(j){case'0':case'1':case'2':result+=(parts[j])?parts[j]:'';break;case'3':result+=(parts[j])?((use_ext==true)?'ext'+parts[j]:parts[j]):'';break;default:result+=j+'';break;}}
result=(trim(result)).replace(/\s{2,}/,' ');if((check_mobile)&&(!is_mobile)){valid=false;result=false;}
return(validate)?valid:result;break;}
break;case'email':case'mail':if((!result_format)||(result_format=="")){result_format='0@1';}
var fstr=trim((str+'').toLowerCase());var parts=Array();var matches=Array();var temp=Array();if(fstr.match(pat_email1)){matches=fstr.match(pat_email1);parts[0]=matches[2];parts[1]=matches[4];parts[2]=matches[6];valid=true;}else{return false;}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=(result_format+'').substr(i,1);switch(j){case'0':case'1':case'2':result+=parts[j]+'';break;default:result+=j+'';break}}
return(validate)?valid:result;}
break;case'case':case'title':result=change_case(str,result_format,args);return(validate)?true:result;break;case'card':case'cc':var parts=Array();var matches=Array();var temp=Array();fstr=str.replace(/\D/g,'');if(fstr.match(pat_cc_amex15)){parts[0]='AmEx';if((!result_format)||(result_format=="")){result_format='1 2 3';}
matches=fstr.match(pat_cc_amex15);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];valid=true;}else if(fstr.match(pat_cc_dine14)){parts[0]='Diners Club';if((!result_format)||(result_format=="")){result_format='1 2 3';}
matches=fstr.match(pat_cc_dine14);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];valid=true;}else if(fstr.match(pat_cc_disc16a)){parts[0]='Discover';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_disc16a);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_disc16b)){parts[0]='Discover';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_disc16b);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_disc16c)){parts[0]='Discover';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_disc16c);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_jcb16)){parts[0]='JCB';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_jcb16);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_laser)){parts[0]='Laser';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_laser);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_maest)){parts[0]='Maestro';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_maest);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_mast16)){parts[0]='Mastercard';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_mast16);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_solo)){parts[0]='Solo';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_solo);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_switcha)){parts[0]='Switch';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_switcha);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_switchb)){parts[0]='Switch';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_switchb);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_switchc)){parts[0]='Switch';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_switchc);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_viselec)){parts[0]='Visa Electron';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_viselec);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_visa)){parts[0]='Visa';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_visa);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else if(fstr.match(pat_cc_unk)){parts[0]='UNKNOWN';if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
matches=fstr.match(pat_cc_unk);if(!luhn_check(fstr)){return false;}
parts[1]=matches[1];parts[2]=matches[2];parts[3]=matches[3];parts[4]=matches[4];valid=true;}else{return false;}
if((!result_format)||(result_format=="")){result_format='1 2 3 4';}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=result_format.substr(i,1);switch(j){case'0':case'1':case'2':case'3':case'4':result+=(parts[j])?parts[j]:'';break;default:result+=j+'';break;}}
if(!valid){result=false;}
return(validate)?valid:result;break;}
break;case'date':case'dat':if((!result_format)||(result_format=="")){result_format='4/5/3';}
var fstr=trim((str+'').toLowerCase());var parts=Array();var matches=Array();var this_year=(new Date().getFullYear())+'';var this_yy=this_year.substr(2);var this_cc=this_year.substr(0,2);var this_yy_num=Math.abs(this_yy);var years_ahead=20;var days_in_month=Array(0,31,29,31,30,31,30,31,31,30,31,30,31);var month_short=Array('','jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');var month_long=Array('','january','february','march','april','may','june','july','august','september','october','november','december');var dflag=false;if(fstr.match(pat_date_1)){matches=fstr.match(pat_date_1);if(matches[1]){if((matches[1]<1)||(matches[1]>days_in_month[parseInt(matches[2])])){return false;}
if((matches[2]<1)||(matches[2]>12)){return false;}
var tmp_d=matches[1];parts[0]=((tmp_d=='1')||(tmp_d=='21')||(tmp_d=='31'))?'st':((tmp_d=='2')||(tmp_d=='22'))?'nd':((tmp_d=='3')||(tmp_d=='23'))?'rd':'th';parts[1]=(matches[1]<10)?matches[1].substr(matches[1].length-1):matches[1];parts[4]=(matches[1]<10)?('0'+matches[1]).substr(('0'+matches[1]).length-2):matches[1];parts[2]=(matches[2]<10)?matches[2].substr(matches[2].length-1):matches[2];parts[5]=(matches[2]<10)?('0'+matches[2]).substr(('0'+matches[2]).length-2):matches[2];parts[3]=matches[3].substr(matches[3].length-2);parts[6]=(Math.abs(matches[3])<this_yy_num+years_ahead)?(this_cc+matches[3]).substr((this_cc+matches[3]).length-4):((parseInt(this_cc)-1)+matches[3]).substr(((parseInt(this_cc)-1)+matches[3]).length-4);parts[7]=month_short[Math.abs(matches[2])].substr(0,1).toUpperCase()+month_short[Math.abs(matches[2])].substr(1);parts[8]=month_long[Math.abs(matches[2])].substr(0,1).toUpperCase()+month_long[Math.abs(matches[2])].substr(1);}else if(matches[6]){if((matches[6]<1)||(matches[6]>12)){return false;}
parts[2]=(matches[6]<10)?matches[6].substr(matches[6].length-1):matches[6];parts[5]=(matches[6]<10)?('0'+matches[6]).substr(('0'+matches[6]).length-2):matches[6];parts[3]=matches[7].substr(matches[7].length-2);parts[6]=matches[7];parts[7]=month_short[Math.abs(matches[6])].substr(0,1).toUpperCase()+month_short[Math.abs(matches[6])].substr(1);parts[8]=month_long[Math.abs(matches[6])].substr(0,1).toUpperCase()+month_long[Math.abs(matches[6])].substr(1);}else{if(matches[4]>12){dflag=true;}
else if(matches[5]>12){dflag=false;}
else{if((result_format.indexOf('1')!=-1)||(result_format.indexOf('4')!=-1)){dflag=true;}
else{dflag=false;}}
if(dflag){if((matches[4]<1)||(matches[4]>days_in_month[matches[5]+0])){return false;}
if((matches[5]<1)||(matches[5]>12)){return false;}
parts[1]=(matches[4]<10)?matches[4].substr(matches[4].length-1):matches[4];parts[4]=(matches[4]<10)?('0'+matches[4]).substr(('0'+matches[4]).length-2):matches[4];parts[2]=(matches[5]<10)?matches[5].substr(matches[5].length-1):matches[5];parts[5]=(matches[5]<10)?('0'+matches[5]).substr(('0'+matches[5]).length-2):matches[5];parts[7]=month_short[Math.abs(matches[5])].substr(0,1).toUpperCase()+month_short[Math.abs(matches[5])].substr(1);parts[8]=month_long[Math.abs(matches[5])].substr(0,1).toUpperCase()+month_long[Math.abs(matches[5])].substr(1);}else{if((matches[4]<1)||(matches[4]>12)){return false;}
parts[2]=(matches[4]<10)?matches[4].substr(matches[4].length-1):matches[4];parts[5]=(matches[4]<10)?('0'+matches[4]).substr(('0'+matches[4]).length-2):matches[4];parts[3]=matches[5].substr(matches[5].length-2);parts[6]=(Math.abs(matches[5])<this_yy_num+years_ahead)?(this_cc+matches[5]).substr((this_cc+matches[5]).length-4):((parseInt(this_cc)-1)+matches[5]).substr(((parseInt(this_cc)-1)+matches[5]).length-4);parts[7]=month_short[Math.abs(matches[4])].substr(0,1).toUpperCase()+month_short[Math.abs(matches[4])].substr(1);parts[8]=month_long[Math.abs(matches[4])].substr(0,1).toUpperCase()+month_long[Math.abs(matches[4])].substr(1);}}
valid=true;}else if(fstr.match(pat_date_2)){matches=fstr.match(pat_date_2);var tmp_mon=matches[2].toLowerCase().substr(0,3);if(!in_array(tmp_mon,month_short)){return false;}
var tmp_mon_idx=0;for(i=1;i<13;i++){if(tmp_mon==month_short[i]){tmp_mon_idx=i;}}
if((matches[1]<1)||(matches[1]>days_in_month[tmp_mon_idx])){return false;}
var tmp_d=matches[1];parts[0]=((tmp_d=='1')||(tmp_d=='21')||(tmp_d=='31'))?'st':((tmp_d=='2')||(tmp_d=='22'))?'nd':((tmp_d=='3')||(tmp_d=='23'))?'rd':'th';parts[1]=(matches[1]<10)?matches[1].substr(matches[1].length-1):matches[1];parts[4]=(matches[1]<10)?('0'+matches[1]).substr(('0'+matches[1]).length-2):matches[1];parts[2]=tmp_mon_idx+'';parts[5]=('0'+tmp_mon_idx).substr(('0'+tmp_mon_idx).length-2);parts[3]=matches[3].substr(matches[3].length-2);parts[6]=(Math.abs(matches[3])<this_yy_num+years_ahead)?(this_cc+matches[3]).substr((this_cc+matches[3]).length-4):((parseInt(this_cc)-1)+matches[3]).substr(((parseInt(this_cc)-1)+matches[3]).length-4);parts[7]=month_short[tmp_mon_idx].substr(0,1).toUpperCase()+month_short[tmp_mon_idx].substr(1);parts[8]=month_long[tmp_mon_idx].substr(0,1).toUpperCase()+month_long[tmp_mon_idx].substr(1);valid=true;}else{return false;}
if(return_arr){return(parts);}
else{result='';for(i=0;i<(result_format+'').length;i++){j=result_format.substr(i,1);switch(j){case'0':case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':result+=(parts[j])?parts[j]:'';break;default:result+=j+'';break;}}
if(!valid){result=false;}
return(validate)?valid:result;break;}
break;case'address':case'addr':result=change_case(str,'234');var tmp_result=result;var addr_arr=result.split(/[,\n]/g);var replace_me='';var postcode='';var guess='';for(k=0;k<(addr_arr.length);k++){guess=fn_valid_format(addr_arr[k],'guess');if(fn_valid_format(addr_arr[k],'guess')=='postcode'){replace_me=addr_arr[k].replace(/^\s*/,'');postcode=fn_valid_format(addr_arr[k],'postcode','1 2');}
result=tmp_result.replace(replace_me,postcode);}
return(validate)?true:result;break;}}
var valid_format_styles=Array();var valid_format_error=Array();function valid_format(obj,str,type,result_format,args){if(!valid_format_styles[obj.name]){valid_format_styles[obj.name]=(obj.style.color)?obj.style.color:'NOCOLOR';}
var fstr=fn_valid_format(str,type,result_format,args);if(str==''){fstr='';}
if(fstr===false){obj.style.color=form_error_color;valid_format_error[obj.name]='1';obj.value=str;return(str);}else{if(valid_format_styles[obj.name]=='NOCOLOR'){obj.style.removeAttribute('color');}
else if(valid_format_styles[obj.name]){obj.style.color=valid_format_styles[obj.name];}
valid_format_error[obj.name]='0';obj.value=fstr;return(fstr);}}
var listArr=Array();var startList=Array();var product_images=Array();var linked_options=Array();var brandList=Array();var product_info_options=Array();var catalogue_exclude_options=Array();var item_options_arr=Array();var required_item_options_arr=Array();var footer_html_arr=Array();var current_home_image=1;var max_home_images=3;var current_home_image_index=Array();current_home_image_index[1]=0;current_home_image_index[2]=0;current_home_image_index[3]=0;function clearCatOrder(){expireDate=new Date;expireDate.setHours(expireDate.getHours()-4);parent.document.cookie="search_catalogue_order=;expires="+expireDate.toGMTString()+";path=/";}
function changeCatOrder(order,enc_str,rewrite_flag){expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()+20);parent.document.cookie="search_catalogue_order="+order+";expires="+expireDate.toGMTString()+";path=/";if(rewrite_flag){var loc=window.location+"";re=/page\d+$/g
loc=loc.replace(re,"");window.location=loc;}else if(enc_str!=""){parent.loadPageJS(parent.decode64(enc_str));}}
var current_home_image_list=Array();function rollHomeImages(){current_home_image++;if(current_home_image>max_home_images){current_home_image=1;}
if(document.getElementById('home_img_'+current_home_image)){this_arr=current_home_image_list[current_home_image];try{index=current_home_image_index[current_home_image];index++;if(index>=this_arr.length){index=0;}
current_home_image_index[current_home_image]=index;this_img=this_arr[index];document.getElementById('home_img_'+current_home_image).src=global_url+"uploads/image/"+this_img;}catch(e){}}}
function updateBasketTxt(basket){if(basket==""){txt=basket_empty_txt;}else{total_items=basket.split("|").length;txt=(total_items==1)?"You have 1 item in your basket&nbsp;&nbsp;":"You have "+total_items+" items in your basket&nbsp;&nbsp;";txt+="|&nbsp;&nbsp;<a href=\"#basket\" onclick=\"javascript:viewBasket();\">View Basket</a>";txt+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href=\"#checkout\" onclick=\"javascript:checkBasketItemStock(0);\">Checkout</a>";}
if(parent.document.getElementById('basket_txt')){parent.document.getElementById('basket_txt').innerHTML=txt;}}
function updateBasket(index,type,refresh_flag,qty){basket="";theCookie=""+document.cookie;cookieName="basket=";ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){basket="";}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val=unescape(theCookie.substring(ind+cookieName.length,ind1));basket=val;}
basket_arr=basket.split("|");basket="";if(type==1){var ok=confirm("Are you sure you want to remove this item from your basket?");if(ok==false){return false;}
for(i=0;i<basket_arr.length;i++){this_item=basket_arr[i];if((i!=index)&&(this_item!="")&&(this_item!="AAAA")){basket+=(basket=="")?basket_arr[i]:"|"+basket_arr[i];}}}
if(type==2){for(i=0;i<basket_arr.length;i++){this_item=decode64(basket_arr[i]);if((i!=index)&&(this_item!="")&&(this_item!="AAAA")){basket+=(basket=="")?basket_arr[i]:"|"+basket_arr[i];}else if((this_item!="")&&(this_item!="AAAA")){this_id=this_item.split(":")[0];this_item_code=this_item.split(":")[1];this_item_cost=this_item.split(":")[2];this_info=this_item.split(":")[3];this_qty=this_item.split(":")[4];this_total=this_item.split(":")[5];this_bespoke=this_item.split(":")[6];this_vat_flag=this_item.split(":")[7];this_vat_rate=this_item.split(":")[8];this_uk_flag=this_item.split(":")[9];this_eu_flag=this_item.split(":")[10];this_rw_flag=this_item.split(":")[11];this_weight=this_item.split(":")[12];this_str=this_id+":"+this_item_code+":"+this_item_cost+":"+this_info+":"+qty+":"+this_total+":"+this_bespoke+":"+this_vat_flag+":"+this_vat_rate+":"+this_uk_flag+":"+this_eu_flag+":"+this_rw_flag+":"+this_weight;basket+=(basket=="")?encode64(this_str):"|"+encode64(this_str);}}}
if(basket==""){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()-2);}else{expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+2);}
parent.document.cookie="basket="+basket+";expires="+expireDate.toGMTString()+";path=/";if(refresh_flag==1){viewBasket();}
updateBasketTxt(basket);}
function addToBasket(){if(!checkRequiredOptions()){return false;}
fm=document.theForm;id=fm.product_id.value;item_code=fm.linked_option.value;x_arr=decode64(fm.x.value).split("|");item_cost=decode64(x_arr[0]);total=decode64(x_arr[1]);vat_flag=decode64(x_arr[2]);vat_rate=decode64(x_arr[3]);uk_flag=decode64(x_arr[4]);eu_flag=decode64(x_arr[5]);rw_flag=decode64(x_arr[6]);weight=decode64(x_arr[7]);info_str=fm.info_str.value;info_str=encode64(info_str);qty=1;bespoke="";try{bespoke=checkBespoke();if(bespoke=="fail"){return false;}}catch(e){}
basket="";theCookie=""+parent.document.cookie;cookieName="basket=";ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){basket="";}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val=unescape(theCookie.substring(ind+cookieName.length,ind1));basket=val;}
already_in_basket=0;if(basket!=""){basket_arr=basket.split("|");basket="";for(i=0;i<basket_arr.length;i++){this_item=basket_arr[i];if((this_item!="")&&(this_item!="AAAA")){this_item=decode64(basket_arr[i]);this_id=this_item.split(":")[0];this_item_code=this_item.split(":")[1];this_item_cost=this_item.split(":")[2];this_info=this_item.split(":")[3];this_qty=this_item.split(":")[4];this_total=this_item.split(":")[5];this_bespoke=this_item.split(":")[6];if((this_id==id)&&(this_item_code==item_code)&&(this_item_cost==item_cost)&&(this_info==info_str)&&(this_total==total)&&(this_bespoke==bespoke)){this_str=id+":"+item_code+":"+item_cost+":"+info_str+":"+(qty+Math.abs(this_qty))+":"+total+":"+bespoke+":"+vat_flag+":"+vat_rate+":"+uk_flag+":"+eu_flag+":"+rw_flag+":"+weight;basket+=(basket=="")?encode64(this_str):"|"+encode64(this_str);already_in_basket=1;}else{basket+=(basket=="")?encode64(this_item):"|"+encode64(this_item);}}}}
if(already_in_basket==0){this_str=id+":"+item_code+":"+item_cost+":"+info_str+":"+qty+":"+total+":"+bespoke+":"+vat_flag+":"+vat_rate+":"+uk_flag+":"+eu_flag+":"+rw_flag+":"+weight;basket+=(basket=="")?encode64(this_str):"|"+encode64(this_str);}
expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+2);parent.document.cookie="basket="+basket+";expires="+expireDate.toGMTString()+";path=/";viewBasket();}
function checkBasketItemStock(from_basket){if(!from_basket)from_basket=0;document.getElementById('process_frame2').src=global_url+"scripts/check_stock.php?"+from_basket;}
function checkBasketItemStockResult(err,from_basket){checkout_btn="<img src=\""+global_url+"images/checkout.png\"  border=\"0\" onmouseover=\"javascript:this.style.cursor='pointer';this.src='"+global_url+"images/checkout_over.png';\"  onmouseout=\"this.src='"+global_url+"images/checkout.png';\" onclick=\"javascript:checkBasketItemStock(2);\">";if(err!=""){if(from_basket>=1){document.getElementById('checkout_btn_div').innerHTML="<div style=\"font-size:14px;color:#ff0000;padding:10px;\">"+decode64(err)+"</div>";}else{alert(decode64(err));viewBasket();}}else{if(from_basket==1){document.getElementById('checkout_btn_div').innerHTML=checkout_btn;}else{shopCheckOut();}}}
function rollBrandList(start,delay){if(window['roll_brand_list']){clearTimeout(window['roll_brand_list']);}
if(parent.window['roll_brand_list']){clearTimeout(parent.window['roll_brand_list']);}
rollHomeImages();list=brandList;if(start==list.length){start=0;}
data=list[start];if(parent.document.getElementById('top_brand_id')){parent.document.getElementById('top_brand_id').innerHTML=decode64(data);try{document.getElementById('top_brand_id').innerHTML=decode64(data);}catch(e){}
if(list.length>1){start++;window['roll_brand_list']=setTimeout("rollBrandList("+start+","+delay+")",delay);}}else if(document.getElementById('top_brand_id')){document.getElementById('top_brand_id').innerHTML=decode64(data);if(list.length>1){start++;window['roll_brand_list']=setTimeout("rollBrandList("+start+","+delay+")",delay);}}
try{parent.resizePage();}catch(e){}}
function loadItem(cat1,cat2,product_id,module_id,auto){if(auto==null){auto=1;}
parent.loadCatalogue(product_id,cat1,cat2,'','',auto);}
function listControl(btn,unique_id){re_1=/btn_stop/gi
re_2=/btn_play/gi
img=document.getElementById('tool_btn_2_'+unique_id).src;stopped=img.match(re_1)?0:1;index=startList[unique_id]['index'];columns=startList[unique_id]['columns'];delay=startList[unique_id]['delay'];start=startList[unique_id]['start'];replace_all=startList[unique_id]['replace_all'];if(btn==1){if(stopped==0){listControl(2,unique_id);}
list=listArr[index];if(replace_all=='1'){start-=Math.abs(columns);}else{start--;}
if(start<0){start+=list.length;}
startList[unique_id]['start']=start;if(columns>list.length){columns=list.length;}
for(c=0;c<columns;c++){this_t_ind=start+c;if(this_t_ind>=list.length){this_t_ind=0+((start+c)-list.length);}
this_t=list[this_t_ind];if(document.getElementById('td_'+unique_id+'_'+c)){document.getElementById('td_'+unique_id+'_'+c).innerHTML=decode64(this_t);}}}
if(btn==2){if(stopped==1){img=document.getElementById('tool_btn_2_'+unique_id).src;img=img.replace(re_2,"btn_stop");document.getElementById('tool_btn_2_'+unique_id).src=img;if(replace_all==1){start+=Math.abs(columns);}else{start++;}
rollList(index,columns,delay,unique_id,start,replace_all)}else{if(window[unique_id]){clearTimeout(window[unique_id]);}
img=document.getElementById('tool_btn_2_'+unique_id).src;img=img.replace(re_1,"btn_play");document.getElementById('tool_btn_2_'+unique_id).src=img;}}
if(btn==3){if(stopped==0){listControl(2,unique_id);}
list=listArr[index];if(replace_all=='1'){start+=Math.abs(columns);}else{start++;}
if(start>=list.length){start=(start-list.length);}
startList[unique_id]['start']=start;if(columns>list.length){columns=list.length;}
for(c=0;c<columns;c++){this_t_ind=start+c;if(this_t_ind>=list.length){this_t_ind=0+((start+c)-list.length);}
this_t=list[this_t_ind];if(document.getElementById('td_'+unique_id+'_'+c)){document.getElementById('td_'+unique_id+'_'+c).innerHTML=decode64(this_t);}}}}
function checkOverBtn(btn){back_image=document.getElementById(btn).src;re1=/\.gif/i
re2=/\.jpg/i;re3=/\.png/i;if(back_image.match(re1)){back_image=back_image.replace(re1,"_over.gif");}else if(back_image.match(re2)){back_image=back_image.replace(re2,"_over.jpg");}else if(back_image.match(re3)){back_image=back_image.replace(re3,"_over.png");}
document.getElementById(btn).src=back_image;document.getElementById(btn).style.cursor='pointer';}
function checkOutBtn(btn){back_image=document.getElementById(btn).src;re1=/\_over/i
back_image=back_image.replace(re1,"");document.getElementById(btn).src=back_image;}
function checkRequiredOptions(){faillist="";to_focus=null;for(i in required_item_options_arr){name=required_item_options_arr[i];this_row="row_"+name;this_row=this_row.toLowerCase();this_row=this_row.replace(/\s/gi,"_");if((document.getElementById(this_row))&&(document.theForm[name])&&(document.getElementById(this_row).style.display=='block')){if(document.theForm[name].value==""){faillist+=(faillist=="")?"":", ";faillist+=name;if(!to_focus){to_focus=document.theForm[name];}}}}
if(faillist!=""){alert("Please complete the following options:-\r\n"+faillist);try{to_focus.focus();}catch(e){}
return false;}
return true;}
function checkItemOption(list,index){if(index!=-1){name=list.name;val=list.value;load_option=(val.split("|")[0]=="LOAD")?1:0;load_row=(val.split("|")[0]=="LOAD")?"row_"+val.split("|")[1]:"";this_row="row_"+name;this_row=this_row.toLowerCase();this_row=this_row.replace(/\s/gi,"_");elements=document.getElementsByTagName('tr');for(i=0;i<elements.length;i++){if((elements[i].id.substr(0,this_row.length+1)==this_row+";")||(elements[i].id==this_row)){if(elements[i].id!=this_row){elements[i].style.display=((load_option==1)&&(elements[i].id==load_row))?"block":"none";}}}
updateTotals();}}
function updateTotals(){fm=document.theForm;if(fm.linked_option){item_code=(fm.linked_option)?fm.linked_option.value:"no item code";}
total=0;x_arr=decode64(fm.x.value).split("|");cost=parseFloat(decode64(x_arr[0]));cost=parseFloat(cost);total+=cost;info_str="";re=/excludeoption_/;re1=/excludeall_/;for(i=0;i<fm.length;i++){if(fm[i].type=="select-one"){if((fm[i].value!="")&&(fm[i].name!="linked_option")&&(!fm[i].name.match(re1))){exclude=0;if(fm[i].name.match(re)){exclude=1;}
fm_name=fm[i].name.replace(re,"");for(c=0;c<catalogue_exclude_options.length;c++){if(catalogue_exclude_options[c]==fm_name){exclude=1;break;}}
if(fm[i].value.split("|")[0]=="LOAD"){exclude=1;}else{this_row="row_"+fm[i].name;this_row=this_row.toLowerCase();this_row=this_row.replace(/\s/gi,"_");if((document.getElementById(this_row))&&(document.getElementById(this_row).style.display=="none")){exclude=1;}else if(!document.getElementById(this_row)){}else{}}
if(exclude==0){if(fm[i].value.split("|")[0]!=""){str=fm_name+": "+fm[i].value.split("|")[0];this_cost=parseFloat(fm[i].value.split("|")[1]);if(!isNaN(this_cost)){total+=this_cost;}
info_str+=(info_str=="")?str:"<br>"+str;}}}}}
x=x_arr[0]+"|"+encode64(total+"")+"|"+x_arr[2]+"|"+x_arr[3]+"|"+x_arr[4]+"|"+x_arr[5]+"|"+x_arr[6]+"|"+x_arr[7];fm.x.value=encode64(x);total_str="<b>"+fm.CAT_PRICE_CURRENCY_SYMBOL.value+formatNumber(total,'decimal')+"</b>";if((document.theForm.CAT_SHOW_VAT_STR.value=="1")&&(document.theForm.vat_str.value!="")){total_str+=decode64(document.theForm.vat_str.value);}
document.theForm.info_str.value=info_str;document.getElementById('code_id').innerHTML=item_code;document.getElementById('info_id').innerHTML=info_str;document.getElementById('total_id').innerHTML=total_str;document.getElementById('total_table').style.display="block";try{parent.resizePage();}catch(e){}}
function loadOption(opt){if(opt!=null){option_img="";if(linked_options.length>0){for(i=0;i<linked_options.length;i++){this_item=linked_options[i]['item'];this_thumb=linked_options[i]['thumb'];this_product_name=linked_options[i]['name'];this_id=linked_options[i]['id'];this_descr=linked_options[i]['descr'];this_options=item_options_arr[i];this_price=linked_options[i]['price'];this_price_str=linked_options[i]['price_str'];this_buynow_btn=linked_options[i]['buynow_btn'];this_vat_str=linked_options[i]['vat_str'];this_vat_flag=linked_options[i]['vat_flag'];this_vat_rate=linked_options[i]['vat_rate'];this_uk_flag=linked_options[i]['uk_flag'];this_eu_flag=linked_options[i]['eu_flag'];this_rw_flag=linked_options[i]['rw_flag'];this_weight=linked_options[i]['weight'];this_footer_html_index=Math.abs(linked_options[i]['footer_html_index']);this_pdf_link=linked_options[i]['pdf_link']
if(this_item!=opt){if(this_thumb!=""){img_link=decode64(this_thumb);option_img+=(option_img=="")?img_link:" "+img_link;}}else{document.getElementById('buy_now_div').innerHTML=decode64(this_buynow_btn);document.getElementById('item_code_id').innerHTML=this_product_name;this_descr=decode64(this_descr);if(document.getElementById('descr_id').innerHTML!=this_descr){document.getElementById('descr_id').innerHTML=this_descr;}
fm=document.theForm;x_arr=decode64(fm.x.value).split("|");x=encode64(this_price+"")+"|"+x_arr[1]+"|"+encode64(this_vat_flag+"")+"|"+encode64(this_vat_rate+"")+"|"+encode64(this_uk_flag+"")+"|"+encode64(this_eu_flag+"")+"|"+encode64(this_rw_flag+"")+"|"+encode64(this_weight+"");fm.x.value=encode64(x);document.getElementById('price_id').innerHTML=decode64(this_price_str);document.theForm.product_id.value=this_id;document.theForm.vat_str.value=this_vat_str;if(document.theForm.linked_option){for(c=0;c<document.theForm.linked_option.length;c++){if(document.theForm.linked_option[c].value==this_product_name){document.theForm.linked_option.selectedIndex=c;break;}}}
if(document.getElementById('option_div')){document.getElementById('option_div').innerHTML=(this_options!="")?decode64(this_options):"";}
if(document.getElementById('cat_footer_div')){document.getElementById('cat_footer_div').innerHTML="<div id=\"cat_footer_html\">";document.getElementById('cat_footer_div').innerHTML+=parent.decode64(footer_html_arr[this_footer_html_index]);if(this_pdf_link!=""){document.getElementById('cat_footer_div').innerHTML+=parent.decode64(this_pdf_link);}
document.getElementById('cat_footer_div').innerHTML+="</div>";}}}
try{standard_len_choice_display_arr=Array();bifocal_len_choice_display_arr=Array();varifocal_len_choice_display_arr=Array();glassesFor(document.theForm['Glasses For'],document.theForm['Glasses For'].selectedIndex);}catch(e2){}
if(document.getElementById('option_img_id')){images_height=parseInt(document.getElementById('option_img_id').clientHeight);document.getElementById('option_img_id').innerHTML=option_img;}
updateTotals();rotateProductImages(0,opt);}else{}}}
function sortByVal(a,b){var x=a.val;var y=b.val;return((x<y)?-1:((x>y)?1:0));}
function sortByCost(a,b){var x=parseFloat(a.cost);var y=parseFloat(b.cost);return((x<y)?-1:((x>y)?1:0));}
function clearRotateProductImages(){if(window['rotate_images']){clearTimeout(window['rotate_images']);}}
function rotateProductImages(start,index){if(window['rotate_images']){clearTimeout(window['rotate_images']);}
try{if(start>=0){if(index==null){list=product_images}else{list=product_images[index];}
if(list.length==0){if(parent.document.getElementById('product_image_id')){parent.document.getElementById('product_image_id').src=global_url+"images/trans.gif";}
return false;}
if(start==list.length){start=0;}
img=list[start];if(parent.document.getElementById('product_image_id')){parent.document.getElementById('product_image_id').src=img;}}
start++;if(index==null){window['rotate_images']=setTimeout("rotateProductImages("+start+")",5000);}else{window['rotate_images']=setTimeout("rotateProductImages("+start+","+index+")",5000);}}catch(e){}}
function rollList(index,columns,delay,unique_id,start,replace_all,dis){if(window[unique_id]){clearTimeout(window[unique_id]);}
debug="index:"+index;debug+="\r\ncolumns:"+columns;debug+="\r\ndelay:"+delay;debug+="\r\nunique_id:"+unique_id;list=listArr[index];if(start>=list.length){start=(start-list.length);}
startList[unique_id]['start']=start;if(columns>list.length){columns=list.length;}
for(c=0;c<columns;c++){this_t_ind=start+c;if(this_t_ind>=list.length){this_t_ind=0+((start+c)-list.length);}
this_t=list[this_t_ind];if((document.getElementById('td_'+unique_id+'_'+c))||(parent.document.getElementById('td_'+unique_id+'_'+c))){if(document.getElementById('td_'+unique_id+'_'+c)){document.getElementById('td_'+unique_id+'_'+c).innerHTML=decode64(this_t);}
if(parent.document.getElementById('td_'+unique_id+'_'+c)){parent.document.getElementById('td_'+unique_id+'_'+c).innerHTML=decode64(this_t);}}else{dis=1;if(window[unique_id]){clearTimeout(window[unique_id]);}}}
if(!replace_all){replace_all=0;}
if(replace_all==1){start+=Math.abs(columns);}else{start++;}
if(Math.abs(delay)<5000){delay=5000;}
if((list.length>columns)&&(!dis)){window[unique_id]=setTimeout("rollList("+index+","+columns+","+delay+",'"+unique_id+"',"+start+","+replace_all+")",delay);}}
function editStrLen(str,maxLen,pos,spacer){re_str=/&nbsp;/gi
str=str.replace(re_str," ");if(str.length>maxLen){temp=str.substr(0,(maxLen-2))+"..";}else if(str.length<maxLen){temp=str;dif=maxLen-str.length;for(j=0;j<dif;j++){if(pos=="right"){temp=spacer+temp;}else{temp+=spacer;}}}else{temp=str;}
re_str2=/\s/gi;temp=temp.replace(re_str2,spacer);return temp;}
var password_pass=0;var countries_uk=Array();var countries_eu=Array();var countries_rw=Array();var ship_options=Array();var postage_options=Array();var inv_div=null;var inv_order_id=0;var inv_c_id=0;var pdf_complete=0;function checkAccType(box){if(box.checked==true){document.theForm.c_company_name.disabled=false;}else{document.theForm.c_company_name.disabled=true;document.theForm.c_company_name.value="";}}
function memberUpdate(url){expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()+1);parent.document.cookie="update_mem_details=1;expires="+expireDate.toGMTString()+";path=/";if(!url){memberLogin(1);}else{top.window.document.location.href=url;}}
function checkMemberUpdateLocation(){var loc=top.window.document.location+"";var loc_arr=loc.split("/");var last=loc_arr.pop();if(last=="checkout")top.window.document.location.href=global_url+"checkout";}
function PDFFail(failstr){pdf_complete=1;if(inv_div){inv_div.innerHTML=failstr;}}
function PDFEmailed(email){if(inv_div){inv_div.innerHTML="The invoice for this order has been successfully sent to '"+email+"'";}}
function startPDFCheck(tmp){document.getElementById('process_frame').src=global_url+"admin/pdf_check_tmp.php?"+tmp;}
function checkTmp(){if(pdf_complete==0){src=document.getElementById('process_frame').src;document.getElementById('process_frame').src=src;}}
function pdfFinished(pdf){pdf_complete=1;if(inv_div){pdf=encode64(pdf);inv_div.innerHTML="invoice created, sending to your default email....";document.getElementById('process_frame').src=global_url+"scripts/process_forms.php?todo=email_invoice&order_id="+inv_order_id+"&c_id="+inv_c_id+"&pdf="+pdf;}}
function requestOrderInvoice(order_id,c_id){pdf_complete=0;div=document.getElementById('inv_'+order_id+'_div');inv_div=null;if(div){div.innerHTML="requesting invoice, please wait...";inv_div=div;inv_order_id=order_id;inv_c_id=c_id;document.getElementById('process_frame').src=global_url+"scripts/process_forms.php?todo=generate_invoice&order_id="+order_id+"&c_id="+c_id;}}
function checkEnter(){if(window.event.keyCode==13){return true;}
return false;}
function formatShipping(field){postage_options=Array();for(i in ship_options){this_opt=decode64(ship_options[i]);descr=decode64(this_opt.split("|")[0]);min_weight=parseFloat(decode64(this_opt.split("|")[1]));max_weight=parseFloat(decode64(this_opt.split("|")[2]));min_value=parseFloat(decode64(this_opt.split("|")[3]));max_value=parseFloat(decode64(this_opt.split("|")[4]));uk_flag=Math.abs(decode64(this_opt.split("|")[5]));eu_flag=Math.abs(decode64(this_opt.split("|")[6]));rw_flag=Math.abs(decode64(this_opt.split("|")[7]));price_list=decode64(this_opt.split("|")[8]);postage_options.push({descr:descr,min_weight:min_weight,max_weight:max_weight,min_value:min_value,max_value:max_value,uk_flag:uk_flag,eu_flag:eu_flag,rw_flag:rw_flag,price_list:price_list});}
updatePostageOptions(field);}
function checkDiscountCode(field){val=field.value;fm=document.theForm;if(val!=""){document.getElementById('discount_status_str').innerHTML="checking code please wait...";tdata=decode64(fm.tdata.value);promotional_code=val
c_id=tdata.split("|")[5];str=encode64(promotional_code+"")+"|"+c_id;str=encode64(str);document.getElementById('process_frame').src=global_url+"scripts/check_details.php?checkcode"+str;}else{updateDiscount(0.00,"","");}}
function updateDiscount(d_val,p_code,d_status_txt){fm=document.theForm;tdata=decode64(fm.tdata.value);sub_total=parseFloat(decode64(tdata.split("|")[0]));postage=parseFloat(decode64(tdata.split("|")[1]));vat_total=parseFloat(decode64(tdata.split("|")[6]));vat_exempt=parseFloat(decode64(tdata.split("|")[7]));uk_flag=Math.abs(decode64(tdata.split("|")[8]));eu_flag=Math.abs(decode64(tdata.split("|")[9]));rw_flag=Math.abs(decode64(tdata.split("|")[10]));weight=parseFloat(decode64(tdata.split("|")[11]));discount=d_val;total=sub_total+postage-discount;total+=vat_total;promotional_code=p_code;c_id=decode64(tdata.split("|")[5]);tdata=encode64(sub_total+"")+"|"+encode64(postage+"")+"|"+encode64(discount+"")+"|"+encode64(total+"")+"|"+encode64(promotional_code+"")+"|"+encode64(c_id+"")+"|"+encode64(vat_total+"")+"|"+encode64(vat_exempt+"")+"|"+encode64(uk_flag+"")+"|"+encode64(eu_flag+"")+"|"+encode64(rw_flag+"")+"|"+encode64(weight+"");tdata=encode64(tdata);fm.tdata.value=tdata;document.getElementById('discount_str').innerHTML="£"+formatNumber(d_val,'decimal');document.getElementById('discount_status_str').innerHTML=d_status_txt;tstr="<b>£"+formatNumber(total,'decimal')+"</b>";document.getElementById('total_str').innerHTML=tstr;checkPostageOptions();}
function discountCodeRes(status,d_val,txt,d_type){if(status==0){updateDiscount(d_val,"",txt);}else{fm=document.theForm;d_val=parseFloat(d_val);d_type=Math.abs(d_type);tdata=decode64(fm.tdata.value);sub_total=parseFloat(decode64(tdata.split("|")[0]));sub2=sub_total;if(d_type==0){discount=sub2/100*d_val;discount=formatNumber(discount,'decimal');discount=parseFloat(discount);}else{discount=d_val;}
updateDiscount(discount,fm.discount_code.value,txt);}}
function processOrder(order_id,skip_submit){try{expireDate=new Date;expireDate.setHours(expireDate.getHours()+1);document.cookie="basket_order_id="+order_id+";expires="+expireDate.toGMTString()+";path=/";}catch(e){alert(e);}
if(!skip_submit){try{document.theForm.submit();}catch(e){alert(e);}
try{document.forms['theForm'].submit();}catch(e){alert(e);}}}
function hideError(){document.getElementById('error_box').style.display="none";}
function checkCheckoutForm(){form=document.theForm;toFocus=null;err_str="";faillist="";invalidlist="";to_focus=null;check_arr=Array();if(postage_option_selected==0){alert("This order cannot be processed without a shipping option");return false;}
check_arr.push({field:"c_firstname",txt:"first name",type:"text"});check_arr.push({field:"c_surname",txt:"surname",type:"text"});if((form.check_acc_type)&&(form.check_acc_type.checked==true)){check_arr.push({field:"c_company_name",txt:"company name",type:"text"});}
check_arr.push({field:"c_address1",txt:"the firstline of your address",type:"text"});check_arr.push({field:"c_town",txt:"town",type:"text"});check_arr.push({field:"c_postcode",txt:"postcode",type:"text"});check_arr.push({field:"c_country",txt:"country",type:"text"});check_arr.push({field:"c_telephone1",txt:"primary contact number",type:"text"});if(form.c_telephone2.value!=""){check_arr.push({field:"c_telephone2",txt:"secondary telephone number",type:"text"});}
check_arr.push({field:"c_email1",txt:"email address",type:"valid_text"});if(form.c_email2.value!=""){check_arr.push({field:"c_email2",txt:"secondary email address",type:"valid_text"});}
if(form.c_id.value=="new"){if(form.c_password.value==""){check_arr.push({field:"c_password",txt:"a password to use when returning to our site",type:"text"});}else if(form.c_password_confirm.value==""){check_arr.push({field:"c_password_confirm",txt:"confirm your password",type:"text"});}}
if((form.same_delivery)&&(form.same_delivery.type=="checkbox")&&(form.same_delivery.checked==false)){check_arr.push({field:"d_firstname",txt:"delivery first name",type:"text"});check_arr.push({field:"d_surname",txt:"delivery surname",type:"text"});check_arr.push({field:"d_address1",txt:"the firstline of your delivery address",type:"text"});check_arr.push({field:"d_town",txt:"delivery town",type:"text"});check_arr.push({field:"d_postcode",txt:"delivery postcode",type:"text"});check_arr.push({field:"d_country",txt:"delivery country",type:"text"});check_arr.push({field:"d_telephone1",txt:"delivery primary contact number",type:"text"});if(form.c_telephone2!=""){check_arr.push({field:"d_telephone2",txt:"secondary telephone number",type:"text"});}}
for(i=0;i<check_arr.length;i++){txt=check_arr[i]['txt'];field=check_arr[i]['field'];type=check_arr[i]['type'];if(type.substr(0,6)=='valid_'){type=type.substr(6);if((valid_format_error[field])&&(valid_format_error[field]==1)){invalidlist+=(invalidlist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="text"){if((form[field])&&(form[field].value=="")){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="text2"){field_val_ok=0;field_arr=field.split("|");for(f=0;f<field_arr.length;f++){if((form[field_arr[f]])&&(form[field_arr[f]].value!="")){field_val_ok=1;break;}}
if(field_val_ok==0){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field_arr[0]]:to_focus;}}
if(type=="checkbox"){if((form[field])&&(form[field].checked==false)){faillist+=(faillist=="")?txt:", "+txt;}}
if(type=="radio"){if((form[field])){radio_selected=0;for(r=0;r<form[field].length;r++){if(form[field][r].checked==true){radio_selected=1;break;}}
if(radio_selected==0){faillist+=(faillist=="")?txt:", "+txt;}}}
if(type=="file"){if((form[field])&&(form[field].value=="")){faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}else if((form[field])&&(!checkUploadFile(form[field].value))){txt+=" - in a valid word document format or plain text";faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}
if(type=="file2"){if((form[field])&&(form[field].value!="")){if(!checkUploadFile(form[field].value)){txt+="the document in a valid word document format or plain text";faillist+=(faillist=="")?txt:", "+txt;to_focus=(to_focus==null)?form[field]:to_focus;}}}}
if((invalidlist!="")||(faillist!="")){tmp="";tmp+=(invalidlist!="")?"The following details were not recognised:- <br>"+invalidlist+"<br><br>":"";tmp+=(faillist!="")?"Please complete the following:- <br>"+faillist+"<br>":"";document.getElementById('error_txt').innerHTML=tmp;document.getElementById('error_box').style.display="block";resizePage();if(toFocus!=null){toFocus.focus();}
try{to_focus.focus();to_focus.select();}catch(e){}}else{document.getElementById('error_box').style.display="none";document.getElementById('process_txt').innerHTML=decode64(document.theForm.CAT_PAYMENT_PROCESSING_TEXT.value+"");document.getElementById('btn_table').style.display="none";document.theForm.action=global_url+"checkout";document.theForm.todo.value="submit_form";document.theForm.submit();}}
function updateCustomerFail(str){document.getElementById('process_txt').innerHTML=str;document.getElementById('btn_table').style.display="block";resizePage();disableForm(false);document.theForm.action="javascript:";document.theForm.target="process_frame";}
function disableForm(bool){fm=document.theForm;for(i=0;i<fm.length;i++){fm[i].disabled=bool;}}
function highlightRow(row,color){row.style.backgroundColor=color;}
var total_postage_options=0;var postage_option_selected=0;var ship_opt="";var last_descr="";var default_postage=0;var default_postage_str="";var current_p_str="";var load_default_p=0;function selectPostage(p_str,price){if((p_str)&&(p_str!="")){p_str=decode64(p_str);}
current_p_str=p_str;expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+6);parent.document.cookie="default_p_str="+p_str+";expires="+expireDate.toGMTString()+";path=/";fm=document.theForm;tdata=decode64(fm.tdata.value);fm.p_opt.value=p_str;if((!p_str)&&(!price)){postage=0;pstr="--";document.getElementById('postage_str').innerHTML=pstr;}else{postage_option_selected=1;postage=parseFloat(price);pstr=(price==0)?"<b>FREE</b>":"£"+formatNumber(postage,'decimal');if(total_postage_options>1){p_action=(fm.d_country)?"javascript:load_default_p=2;updatePostageOptions(document.theForm.d_country);":"javascript:load_default_p=2;updatePostageOptions(document.theForm.c_country);";p_str+=". <a style=\"cursor:pointer;text-decoration:underline;\" onclick=\""+p_action+"\">Change</a>";}
if(document.getElementById('postage_text')){document.getElementById('postage_text').innerHTML=p_str;}
document.getElementById('postage_str').innerHTML=pstr;}
sub_total=parseFloat(decode64(tdata.split("|")[0]));discount=parseFloat(decode64(tdata.split("|")[2]));promotional_code=decode64(tdata.split("|")[4]);c_id=decode64(tdata.split("|")[5]);vat_total=parseFloat(decode64(tdata.split("|")[6]));vat_exempt=parseFloat(decode64(tdata.split("|")[7]));uk_flag=Math.abs(decode64(tdata.split("|")[8]));eu_flag=Math.abs(decode64(tdata.split("|")[9]));rw_flag=Math.abs(decode64(tdata.split("|")[10]));weight=parseFloat(decode64(tdata.split("|")[11]));total=sub_total+postage-discount;total+=vat_total;tdata=encode64(sub_total+"")+"|"+encode64(postage+"")+"|"+encode64(discount+"")+"|"+encode64(total+"")+"|"+encode64(promotional_code+"")+"|"+encode64(c_id+"")+"|"+encode64(vat_total+"")+"|"+encode64(vat_exempt+"")+"|"+encode64(uk_flag+"")+"|"+encode64(eu_flag+"")+"|"+encode64(rw_flag+"")+"|"+encode64(weight+"");tdata=encode64(tdata);fm.tdata.value=tdata;tstr="<b>£"+formatNumber(total,'decimal')+"</b>";document.getElementById('total_str').innerHTML=tstr;if(document.getElementById('ship_opt')){document.getElementById('ship_opt').style.display="none";}}
function checkPostageOptions(){fm=document.theForm;if((fm.same_delivery)&&(fm.same_delivery.checked==false)){updatePostageOptions(document.theForm.d_country,1);}else{updatePostageOptions(document.theForm.c_country,1);}}
function updatePostageOptions(field,checkflag){fm=document.theForm;if((field.name=="c_country")&&(fm.same_delivery)&&(fm.same_delivery.type=="checkbox")&&(fm.same_delivery.checked==false)){}else{val=(field.type=="select-one")?field[field.selectedIndex].value:field.value;this_in_uk=0;for(i in countries_uk){if(countries_uk[i]==val){this_in_uk=1;break;}}
this_in_eu=0;for(i in countries_eu){if(countries_eu[i]==val){this_in_eu=(this_in_uk==1)?0:1;break;}}
this_in_rw=0;for(i in countries_rw){if(countries_rw[i]==val){this_in_rw=1;break;}}
tdata=decode64(fm.tdata.value);sub_total=parseFloat(decode64(tdata.split("|")[0]));discount=parseFloat(decode64(tdata.split("|")[2]));current_total=sub_total-discount;total_postage_options=0;postage_option_selected=0;if(load_default_p==2){default_p_str=null;}else{theCookie=""+document.cookie;cookieName="default_p_str=";ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName==""){default_p_str=null;}else{ind1=theCookie.indexOf(';',ind);if(ind1==-1){ind1=theCookie.length;}
val_c=unescape(theCookie.substring(ind+cookieName.length,ind1));default_p_str=val_c;}}
load_default_p=0;load_default_postage_str="";load_default_postage=0;try{ship_opt="";last_descr="";default_postage=0;default_postage_str="";col_arr=Array("#f3fbff","#f9fcfd","#d6f1ff");toggle=0;avail_options_arr=Array();for(i in postage_options){show=0;if((this_in_uk==1)&&(postage_options[i]['uk_flag']==1)&&(parseFloat(postage_options[i]['min_value'])<=current_total)&&((parseFloat(postage_options[i]['max_value'])>=current_total)||(parseFloat(postage_options[i]['max_value'])==0))){show=1;}else if((this_in_eu==1)&&(postage_options[i]['eu_flag']==1)&&(parseFloat(postage_options[i]['min_value'])<=current_total)&&((parseFloat(postage_options[i]['max_value'])>=current_total)||(parseFloat(postage_options[i]['max_value'])==0))){show=1;}else if((this_in_rw==1)&&(postage_options[i]['rw_flag']==1)&&(parseFloat(postage_options[i]['min_value'])<=current_total)&&((parseFloat(postage_options[i]['max_value'])>=current_total)||(parseFloat(postage_options[i]['max_value'])==0))){show=1;}
if(show==1){descr=postage_options[i]['descr'];price_arr=postage_options[i]['price_list'].split("^");for(p in price_arr){row_id="p_"+i+"_"+p;ship_opt1="";price=parseFloat(price_arr[p].split("|")[0]);insurance=parseFloat(price_arr[p].split("|")[1]);opt_value=formatNumber(price,'decimal');border_top="";if(last_descr!=descr){last_descr=descr;border_top=(total_postage_options>0)?"border-top:1px solid #999999;":"";ship_opt1+="<td style=\"font-weight:bold;"+border_top+"\">"+descr+"</td>";toggle=(toggle==0)?1:0;}else{ship_opt1+="<td style=\""+border_top+"\">&nbsp;</td>";}
if(insurance>0){ins_text="with insurance up to £"+formatNumber(insurance,'full');}else if(price_arr.length>1){ins_text="no insurance";}else{ins_text="&nbsp;";}
p_str=descr;if(ins_text!="&nbsp;"){p_str+=", "+ins_text;}
if(checkflag){avail_options_arr.push(p_str);}
if(p_str==default_p_str){load_default_p=1;load_default_postage_str=encode64(p_str);load_default_postage=opt_value;}
p_str=encode64(p_str);ship_opt+="<tr id=\""+row_id+"\" style=\"background-color:"+col_arr[toggle]+";cursor:pointer\" onmouseover=\"highlightRow(this,'"+col_arr[2]+"');\" onmouseout=\"highlightRow(this,'"+col_arr[toggle]+"');\" onclick=\"selectPostage('"+p_str+"',"+opt_value+");\">";ship_opt+=ship_opt1;ship_opt+="<td style=\""+border_top+"\">"+ins_text+"</td>";ship_opt+="<td align=\"right\" style=\"width:100px;font-weight:bold;"+border_top+"\">£"+opt_value+"</td>";ship_opt+="</tr>";total_postage_options++;default_postage=opt_value;default_postage_str=p_str;}}}
if(!checkflag){document.getElementById('postage_str').innerHTML="--";if((load_default_p==1)){selectPostage(load_default_postage_str,load_default_postage);ship_opt="";postage_txt="";}else if(total_postage_options==1){selectPostage(default_postage_str,default_postage);ship_opt="";postage_txt="";}else if(total_postage_options>0){h_row="<tr style=\"background-color:#000000;color:#ffffff;\"><td colspan=\"3\">Choose your preferred shipping option</td></tr>";ship_opt="<table width=\"auto\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" style=\"text-align:left;\">"+h_row+ship_opt+"</table>";postage_txt="&nbsp;";}else{if(val==""){postage_txt="<font color='red'>Your address needs updating, before shipping options can be loaded.";}else{postage_txt="<font color='red'>Sorry, there are no shipping options to <b>"+val+"</b>. ";postage_txt+=decode64(fm.p_err.value);}
postage_txt+="</font>";selectPostage(null,null);}
if((document.getElementById('postage_text'))&&(postage_txt!="")){document.getElementById('postage_text').innerHTML=postage_txt;}
if(document.getElementById('ship_opt')){document.getElementById('ship_opt').innerHTML=ship_opt;document.getElementById('ship_opt').style.display=(ship_opt!="")?"block":"none";}}else{found=0;for(p in avail_options_arr){if(avail_options_arr[p]==current_p_str){found=1;postage_option_selected=1;break;}}
if(found==0){document.body.focus();updatePostageOptions(field);}}}catch(ep){}}}
function toggleDelivery(field){this_d=(field.checked==true)?"none":"block";document.getElementById('delivery_table_td').style.width=(parseInt(document.getElementById('main_page').style.width))+"px";document.getElementById('delivery_table').style.display=this_d;if(field.checked==true){updatePostageOptions(document.theForm.c_country);}else{updatePostageOptions(document.theForm.d_country);}
resizePage();}
function checkoutContinue(){fm=document.theForm;email=fm.customer_email.value;document.getElementById('password_fail_row').style.display="none";document.getElementById('email_fail_row').style.display="none";document.getElementById('process_row').style.display="none";document.getElementById('btn_row').style.display="block";if(!checkemail(email)){document.getElementById('email_fail_row').style.display="block";fm.customer_email.focus();fm.customer_email.select();resizePage();return false;}
if(fm.remember_checked.value=='1'){expireDate=new Date;expireDate.setMonth(expireDate.getMonth()+12);document.cookie="remember_me="+email+";expires="+expireDate.toGMTString()+";path=/";}
existing=(fm.existing_customer[0].checked==true)?false:true;password=fm.customer_password.value;customer_type=0;if(existing){customer_type=1;if(password==""){document.getElementById('password_fail_row').style.display="block";fm.customer_password.focus();resizePage();return false;}else if(password_pass==0){fm.customer_email.disabled=true;fm.existing_customer[0].disabled=true;fm.existing_customer[1].disabled=true;fm.customer_password.disabled=true;document.getElementById('status_txt').innerHTML="checking details please wait....";document.getElementById('process_row').style.display="block";document.getElementById('btn_row').style.display="none";email=parent.encode64(email);password=parent.encode64(password);str=email+"|"+password;str=parent.encode64(str);document.getElementById('process_frame').src=global_url+"scripts/check_details.php?"+str;return false;}}
str=email;str=parent.encode64(str);document.getElementById('status_txt').innerHTML="checking username please wait....";document.getElementById('process_row').style.display="block";document.getElementById('btn_row').style.display="none";document.getElementById('process_frame').src=global_url+"scripts/check_details.php?checkuser"+str;}
function checkoutProcess(res){fm=document.theForm;if(res){fm.customer_email.disabled=false;fm.existing_customer[0].disabled=false;fm.existing_customer[1].disabled=false;fm.customer_password.disabled=false;document.getElementById('status_txt').innerHTML=res;document.getElementById('btn_row').style.display="block";resizePage();}else{email=fm.customer_email.value;customer_type=(fm.existing_customer[0].checked==true)?0:1;password=fm.customer_password.value;email=parent.encode64(email);password=parent.encode64(password);str=email+"|"+password+"|"+customer_type;str=parent.encode64(str);fm.customer_email.disabled=true;fm.existing_customer[0].disabled=true;fm.existing_customer[1].disabled=true;fm.customer_password.disabled=true;document.getElementById('status_txt').innerHTML="processing details please wait....";document.getElementById('process_row').style.display="block";document.getElementById('btn_row').style.display="none";expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()+10);document.cookie="c_check="+str+";expires="+expireDate.toGMTString()+";path=/";var loc=top.window.document.location+"";top.window.location.href=loc;}}
function clearNewCustomer(){expireDate=new Date;expireDate.setMinutes(expireDate.getMinutes()-10);document.cookie="c_check=;expires="+expireDate.toGMTString()+";path=/";}
function checkScroll(){h1=Math.abs(document.getElementById('main_table').clientHeight)+20;try{parent.page_y=h1;parent.resizePage();}catch(e){}}
function checkPage(){if(top.location==self.location){}}
function checkNumber(field,type){switch(type){case"full":thisNum=parseInt(field.value);break;case"decimal":t1=field.value;t2=round_decimals(t1,2);t3=pad_with_zeros(t2,2);thisNum=t3;break;}
thisNum1=""+thisNum;if(thisNum1.substr(0,3)=="NaN"){field.value=(type=="full")?"0":"0.00";}else{field.value=thisNum}}
function formatNumber(num,type){switch(type){case"full":thisNum=parseInt(num);break;case"decimal":t1=num
t2=round_decimals(t1,2);t3=pad_with_zeros(t2,2);thisNum=t3;break;}
thisNum1=""+thisNum;if(thisNum1.substr(0,3)=="NaN"){return(type=="full")?"0":"0.00";}else{return thisNum;}}
function round_decimals(original_number,decimals){var result1=original_number*Math.pow(10,decimals)
var result2=Math.round(result1)
var result3=result2/Math.pow(10,decimals)
return pad_with_zeros(result3,decimals)}
function pad_with_zeros(rounded_value,decimal_places){var value_string=rounded_value.toString()
var decimal_location=value_string.indexOf(".")
if(decimal_location==-1){decimal_part_length=0
value_string+=decimal_places>0?".":""}
else{decimal_part_length=value_string.length-decimal_location-1}
var pad_total=decimal_places-decimal_part_length
if(pad_total>0){for(var counter=1;counter<=pad_total;counter++)
value_string+="0"}
return value_string}
document.write('<script type="text/javascript" src="http://www.lan.co.uk/scripts/bespoke/forms/proteus_forms.js"></scr'+'ipt>');