/*---------- Copyright 2010 Neotek Limited (http://www.neotek.co.nz). All rights reserved. -----------*/
 
/* ---------- /JS/v3/session.js ---------- */
var sessiontimeout=1200000;
var sessiontimer;
function showtimeout(){
top.NeotekPopup.Close();
var settings={
URL:'/useraccess/sessiontimeout.aspx',
Title:'',
AutoResize:true,
IncludeClose:false
};
top.NeotekPopup.Show(settings);
countdown();
}
function cancelsession(){
if(sessiontimer!=null){
clearTimeout(sessiontimer);
}
}
function resetsession(timeout){
if(timeout!=null&&IsNumeric(timeout)){
sessiontimeout=timeout;
}
cancelsession();
var delay=sessiontimeout-30000;
if(delay<30000){
delay=60000;
}
sessiontimer=setTimeout('checksession()',delay);
}
function IsNumeric(val){
if(isNaN(parseFloat(val))){
return false;
}
return true;
}
function checksession(){
neotekscript('/useraccess/session.aspx');
}
var countdowntimer;
function countdown(){
if(countdowntimer!=null){
clearTimeout(countdowntimer);
}
try{
s=document.getElementById("seconds").innerHTML;
if(s!=null&&s!=''){
if(s>0){
s--;
}else{
Logout();
top.NeotekPopup.Close();
var settings={
URL:'/useraccess/sessionloggedout.aspx',
Title:'',
AutoResize:true,
IncludeClose:false
};
top.NeotekPopup.Show(settings);
return;
}
document.getElementById("seconds").innerHTML=s;
}
}catch(e){
}
countdowntimer=setTimeout('countdown()',1000);
}
resetsession(1200000); 
/* ---------- /JS/objfade.js ---------- */
FadeObjects=new Object();
FadeTimers=new Object();
function Fade(object,destOp,rate,delta){
try{
if(typeof(object)!="object"){
setTimeout("Fade(object,"+destOp+","+rate+","+delta+")",0);
return;
}
clearTimeout(FadeTimers[object.sourceIndex]);
diff=destOp-object.filters.alpha.opacity;
direction=1;
if(object.filters.alpha.opacity>destOp){
direction=-1;
}
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if(object.filters.alpha.opacity!=destOp){
FadeObjects[object.sourceIndex]=object;
FadeTimers[object.sourceIndex]=setTimeout("Fade(FadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
}
}catch(e){
}
}
 
/* ---------- /JS/v3/corners.js ---------- */
function RoundCorner(){
this.Apply=Rounded;
var styleprefix="nr";
function Check(){
if(!document.getElementById||!document.createElement)
return(false);
var b=navigator.userAgent.toLowerCase();
if(b.indexOf("msie 5")>0&&b.indexOf("opera")==-1)
return(false);
return(true);
}
function Rounded(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
var l=v.length;
for(i=0;i<l;i++){
AddTop(v[i],bk,color,size);
AddBottom(v[i],bk,color,size);
}
}
function RoundedTop(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
AddTop(v[i],bk,color,size);
}
function RoundedBottom(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
AddBottom(v[i],bk,color,size);
}
function RoundedRight(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
AddRight(v[i],bk,color,size);
}
function AddTop(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn=styleprefix;
var lim=4;
if(size&&size=="small"){cn=styleprefix+"s";lim=2}
d.className=styleprefix+"top";
d.style.backgroundColor=bk;
for(i=1;i<=lim;i++){
var x=document.createElement("b");
x.className=cn+i;
x.style.backgroundColor=color;
d.appendChild(x);
}
el.insertBefore(d,el.firstChild);
}
function AddBottom(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn=styleprefix;
var lim=4;
if(size&&size=="small"){cn=styleprefix+"s";lim=2}
d.className=styleprefix+"bottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
var x=document.createElement("b");
x.className=cn+i;
x.style.backgroundColor=color;
d.appendChild(x);
}
el.appendChild(d,el.firstChild);
}
function AddRight(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn=styleprefix;
var lim=4;
d.className=styleprefix+"top";
d.style.backgroundColor=bk;
for(i=3;i<=lim;i++){
var x=document.createElement("b");
x.className=cn+i;
x.style.backgroundColor=color;
d.appendChild(x);
}
el.insertBefore(d,el.firstChild);
lim=2;
d=document.createElement("b");
d.className=styleprefix+"bottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
var x=document.createElement("b");
x.className=cn+i;
x.style.backgroundColor=color;
d.appendChild(x);
}
el.appendChild(d,el.firstChild);
}
function getElementsBySelector(selector){
var i;
var s=[];
var selid="";
var selclass="";
var tag=selector;
var objlist=[];
if(selector.indexOf(" ")>0){
s=selector.split(" ");
var fs=s[0].split("#");
if(fs.length==1)return(objlist);
return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
}
if(selector.indexOf("#")>0){
s=selector.split("#");
tag=s[0];
selid=s[1];
}
if(selid!=""){
objlist.push(document.getElementById(selid));
return(objlist);
}
if(selector.indexOf(".")>0){
s=selector.split(".");
tag=s[0];
selclass=s[1];
}
var v=document.getElementsByTagName(tag);
if(selclass=="")
return(v);
for(i=0;i<v.length;i++){
if(v[i].className==selclass){
objlist.push(v[i]);
}
}
return(objlist);
}
} 
/* ---------- /JS/DragDrop.js ---------- */
var origClass;
var caller;
var dragevent;
function cancelEvent(){
window.event.returnValue=false;
}
function setClass(el,cssclass,setOrig){
if(setOrig){origClass=el.className;}
if(origClass===''){origClass='MenuUnselected';}
el.className=cssclass;
}
function drop(callee){
dragevent=null;
setClass(window.event.srcElement,origClass,false);
var action=window.event.dataTransfer.getData("Text");
if(action.indexOf('top.DropMenuItemParentSet',0)!=-1){
if(caller==callee){
return false;
}
if(!confirm("Are you sure that you want to move the menu item?")){
return false;
}
}
if(action===null){return false;}
action=action.replace(new RegExp("<id>"),callee.mid);
action=action.replace(new RegExp("<node>"),callee.node);
action=action.replace(new RegExp("<this>"),'callee');
try{
eval(action);
}
catch(e){
return false;
}
}
function DragDrop(obj){
if(!!!window.event){return;}
if(window.event.button==1){
caller=obj;
dragevent=setTimeout("caller.dragDrop();",250);
}
}
function DragStart(data){
window.event.dataTransfer.setData("Text",data);
}
function DragStop(){
clearTimeout(dragevent);
dragevent=null;
}
function DragEnter(){
var dropobj=window.event.srcElement;
if(dropobj!=caller){
setClass(dropobj,"MenuDragEnter",true);
}
cancelEvent();
}
function DragOver(obj){
if((obj!=caller)&&(dragevent!==null)){
dragevent=null;
}
window.event.returnValue=false;
}
function DragLeave(){
setClass(window.event.srcElement,origClass,false);
cancelEvent();
}
 
/* ---------- /JS/v3/resize.js ---------- */
function p_setheight(obj){
if(document.documentElement!=null){
m_visibleheight=pixel(document.documentElement.clientHeight);
}else{
m_visibleheight=pixel(window.innerHeight);
}
m_visibleheight=m_visibleheight-obj.getAttribute('resize-y');
obj.style['height']=m_visibleheight+'px';
}
function p_setwidth(obj){
if(document.documentElement!=null){
m_visiblewidth=pixel(document.documentElement.clientWidth);
}else{
m_visiblewidth=pixel(window.innerWidth);
}
m_visiblewidth=m_visiblewidth-obj.getAttribute('resize-x');
obj.style['width']=m_visiblewidth+'px';
}
function p_setsize(obj){
if(obj.getAttribute('resize-y')!=null){
p_setheight(obj);
}
if(obj.getAttribute('resize-x')!=null){
p_setwidth(obj);
}
}
 
/* ---------- /JS/v3/scroll.js ---------- */
var scrollerArray=[];
function scrolleradd(name,width,offsetHeight){
scrollerArray[scrollerArray.length]=new scroller(name,width,offsetHeight);
}
function scrollerget(name){
var obj=null;
for(var i=0;i<scrollerArray.length;i++){
if(scrollerArray[i].name==name){obj=scrollerArray[i];break;}
}
return obj;
}
function pixel(pxVal){
var s_px=new String(pxVal);
if(s_px.indexOf('px',0)>0)
return s_px.substr(0,s_px.indexOf('px',0))-0;
else
return pxVal-0;
}
function scroller(name,width){
var m_scrollTop=0;
var m_visible=true;
var m_iScrollDistDef=2;
var m_iScrollSpeed=30;
var m_iScrollDist=m_iScrollDistDef;
var m_iNxt=null;
var m_iCur=false;
var m_visibleheight=100;
this.name=name;
this.width=width;
this.hide=p_hide;
this.scrollup=p_scrollup;
this.scrolldown=p_scrolldown;
this.scroll=p_scroll;
this.stopscroll=p_stopscroll;
this.window_onresize=p_window_onresize;
this.getElement=p_getElement;
this.move=p_move;
this.toggle=p_toggle;
this.setvisibility=p_SetVisibility;
function p_getElement(suffix){
return document.getElementById(this.name+suffix);
}
function p_window_onresize(){
var scrlayer=this.getElement('scrlayer');
if(scrlayer!=null){
p_setheight(scrlayer);
m_visibleheight=pixel(scrlayer.offsetHeight);
}
var curTop=this.move(0);
m_ScrollTop=curTop;
return false;
}
function p_move(dist){
div=this.getElement('content');
contentHeight=pixel(div.offsetHeight);
var new_top=pixel(div.style.top)+dist;
if(new_top<m_visibleheight-contentHeight)new_top=m_visibleheight-contentHeight;
if(new_top>0)new_top=0;
if(new_top<0){
this.getElement('up').style['display']='block';
}else{
this.getElement('up').style['display']='none';
}
if(m_visibleheight-new_top-contentHeight<0&&m_visibleheight<contentHeight){
this.getElement('down').style['display']='block';
}else{
this.getElement('down').style['display']='none';
}
div.style.top=new_top+'px';
return new_top;
}
function alignMenu(offset){
if(offset>0)curTop=moveUp(offset);
else curTop=moveDown(-offset);
ScrollTop=curTop;
}
function p_scrollup(){
try{
this.move(m_iScrollDist);
var me=this;
m_iNxt=setTimeout(function(){me.scrollup();},m_iScrollSpeed);
m_iScrollDist+=m_iScrollDistDef;
m_iCur=true;
}catch(e){
}
return false;
}
function p_hide(){
try{
var div=this.getElement('');
div.style.width='0px';
m_visible=false;
var divtab=this.getElement('tab');
if(divtab!=null)divtab.className='hidden';
if(this.name=='basket'){
if(this.getElement('promo')!=null){
this.getElement('promo').style.width=this.width+'px';
}
this.getElement('summary').style.display='block';
}
}catch(e){
}
return false;
}
function p_toggle(){
try{
var div=this.getElement('');
var w=pixel(div.style.width);
if(m_visible==true){
w=Math.floor(w*.9-1);
}else{
w=Math.floor(w*1.1+1);
}
var timeout=2;
if(w<=0){
m_visible=false;
w=0;
timeout=0;
}
if(w>=this.width){
m_visible=true;
w=this.width;
timeout=0;
}
div.style.width=w+'px';
if(this.name=='basket'){
if(this.getElement('promo')!=null){
this.getElement('promo').style.width=this.width-w+'px';
}
}
var me=this;
if(timeout>0){
setTimeout(function(){me.toggle();},timeout);
}else{
var divtab=this.getElement('tab');
if(divtab!=null)divtab.className=m_visible==true?'visible':'hidden';
if(this.name=='basket'){
this.getElement('summary').style.display=m_visible==true?'none':'block';
neotekscript('/main/control.aspx?ajax=1&action=loginps&ptype=18&pval='+(m_visible==true?'1':'0'));
}else{
neotekscript('/main/control.aspx?ajax=1&action=loginps&ptype=19&pval='+(m_visible==true?'1':'0'));
}
}
}catch(ex){
alert(ex);
}
return false;
}
function p_scrolldown(){
try{
this.move(-m_iScrollDist)
var me=this;
m_iNxt=setTimeout(function(){me.scrolldown();},m_iScrollSpeed);
m_iScrollDist+=m_iScrollDistDef;
m_iCur=true;
}catch(e){
}
return false;
}
function p_scroll(delta){
try{
this.move(delta);
}catch(e){
}
m_iScrollDist+=delta;
return false;
}
function p_stopscroll(){
try{
if(m_iCur){
clearTimeout(m_iNxt);
}
m_iScrollDist=m_iScrollDistDef;
m_iCur=false;
}catch(e){
}
return false;
}
function p_SetVisibility(state){
var div=this.getElement('');
var divtab=this.getElement('tab');
if(this.name=='basket'&&$('basketsummary')!=null){
divtab=$('basketsummary');
}
if(state==1){
div.style.display='block';
if(divtab!=null)divtab.style.display=(divtab.id!='basketsummary')?'block':'none';
m_visible=true;
}
else if(state==2){
div.style.display='block';
div.style.width='0px';
if(divtab!=null)divtab.style.display='block';
m_visible=false;
}else{
div.style.display='none';
if(divtab!=null)divtab.style.display='none';
m_visible=false;
}
}
}
 
/* ---------- /JS/v3/toolbar.js ---------- */
var uploadNewCat=0;
var mainmenuArray=new Array();
var mainmenuArrayCount=0;
function addmenuitem(parentid,text,id,tooltip,href,target,className,zindex){
var menuitem='';
if(parentid=='mainmenu'){
menuitem='<li  class="NeoNavi '+className+'" '+(id!=null?'id="li'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'>';
menuitem+='<a '+(id!=null?'id="'+id+'"':'')+' class="NeoNavi0 '+className+'" target="'+target+'" title="'+tooltip+'" href="'+href+'">'+text+'</a>';
menuitem+='</li>';
mainmenuArray[mainmenuArrayCount]=text;
mainmenuArrayCount+=1;
}else{
menuitem='<li class="NeoNavi '+className+'" '+(id!=null?'id="li'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'>';
menuitem+='<a '+(id!=null?'id="'+id+'"':'')+' class="NeoNavi '+className+'" target="'+target+'" title="'+tooltip+'" href="'+href+'">'+text+'</a>';
menuitem+='</li>';
if(document.getElementById('ul'+parentid)==null){
var el=document.getElementById(parentid);
if(el!=null){
var container='<span>'+el.innerHTML+'<span>';
el.innerHTML=container;
}
el=document.getElementById('li'+parentid);
if(el!=null){el.innerHTML+='<ul Class="NeoNavm" id="ul'+parentid+'"></ul>';}
}
}
var ul=document.getElementById('ul'+parentid);
if(ul!=null){ul.innerHTML+=menuitem;}
}
function addmenuitemold(parentid,text,id,tooltip,href,target,className,zindex){
addmenuitem(parentid,text,id,tooltip,href,target,className,zindex);
return;
var menuitem='';
if(parentid=='mainmenu'){
menuitem='<li  class="'+className+'" '+(id!=null?'id="li-'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'><div '+(id!=null?'id="'+id+'"':'')+'class="'+className+'"><a target="'+target+'" title="'+tooltip+'" href="'+href+'">'+text+'</a><div></li>';
mainmenuArray[mainmenuArrayCount]=text;
mainmenuArrayCount+=1;
}else{
menuitem='<li '+(id!=null?'id="'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'><a target="'+target+'" title="'+tooltip+'" href="'+href+'">'+text+'</a></li>';
if(document.getElementById('ul'+parentid)==null){
var el=document.getElementById(parentid);
if(el.parentElement.className=='button'||el.parentElement.className=='link'){
el.innerHTML+='<div class="dropdown"><ul id="ul'+parentid+'"></ul></div>';
}else{
el.innerHTML+='<div class="mini-zone"></div><div><ul id="ul'+parentid+'"></ul></div>';
}
}
}
var ul=document.getElementById('ul'+parentid);
ul.innerHTML+=menuitem;
}
function addmenuitemv3(parentid,text,id,tooltip,href,target,className,zindex){
addmenuitem(parentid,text,id,tooltip,href,target,className,zindex);
return;
var menuitem='';
if(parentid=='mainmenu'){
menuitem='<li  class="'+className+'" '+(id!=null?'id="li-'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'><a target="'+target+'" title="'+tooltip+'" href="'+href+'">'+
'<span class="'+className+'text" >'+text+'</span> <img src="/owner/'+'skin/images/blank.gif" class="'+className
+'mask" border=0  /><img src="/owner/'+'skin/images/blank.gif" class="'+className+'clicklayer" border=0  /></a></li>';
mainmenuArray[mainmenuArrayCount]=text;
mainmenuArrayCount+=1;
}else{
menuitem='<li '+(id!=null?'id="'+id+'"':'')+(zindex!=null?'style="z-index: '+zindex+';"':'')+'><a target="'+target+'" title="'+tooltip+'" href="'+href+'">'+text+'</a></li>';
if(document.getElementById('ul'+parentid)==null){
if(document.getElementById(parentid).parentElement.className=='button'){
document.getElementById(parentid).innerHTML+='<div class="dropdown"><ul id="ul'+parentid+'"></ul></div>';
}else{
document.getElementById(parentid).innerHTML+='<div class="mini-zone"></div><div><ul id="ul'+parentid+'"></ul></div>';
}
}
}
var ul=document.getElementById('ul'+parentid);
ul.innerHTML+=menuitem;
}
function clearmenu(id){
var ul=document.getElementById('ul'+id);
ul.innerHTML='';
}
function openHelp(){
var page='';
try{
page=top.InfoFrame.document.title;
}catch(e){
}
fnOpenDialog("main/help.aspx?page="+page,600,400,1,1);
}
function openFAQ(){
var page='Navigation';
fnOpenDialog("main/help.aspx?page="+page,600,400,1,1);
}
function QuickSearch(){
top.InfoFrame.location.href='catalog/productslist.aspx?txtSearch='+encodeURI(document.getElementById('SearchText').value.replace(/\+/g,"%2b"));
}
function QuickSearchCrossRef(){
var val=document.getElementById('SearchText');
if(val==null){val=top.InfoFrame.document.getElementById('SearchText');}
var x1=val.value.replace(/\+/g,"%2b");
var val2=document.getElementById('SearchText2');
if(val2==null)val2=top.InfoFrame.document.getElementById('SearchText2');
x2=val2.value.replace(/\+/g,"%2b");
var x='';
if(top.HideLeftPanel==0){x=x1;}else{x=x2;}
top.InfoFrame.location.href='catalog/GUDCrossRefSearch.aspx?txtSearch='+x;
document.getElementById('SearchText').value='';
}
function url(u){
if(u.indexOf('#')>-1){
u=u.substring(0,u.indexOf('#'));
}
return u;
}
function AccountSet(Name,Code,refreshScreen){
showprocessing();
top.document.getElementById("account").style['display']='block';
top.document.getElementById("loginform").style['display']='none';
top.setText(document.getElementById("accountName"),Name);
top.setText(document.getElementById("accountCode"),Code);
try{
top.uploadNewCat=0;
top.aLink=new Array();
top.aMenuItem=new Array();
neotekscript('/catalog/menu/menuajax.aspx');
b.loadFromDB();
resulthref=top.InfoFrame.location.href;
if(resulthref.indexOf('?')>-1){
resulthref+='&';
}else{
resulthref+='?';
}
var Mainurl=top.InfoFrame.location.pathname.toLowerCase();
if(Mainurl.indexOf('/basket/checkout')>-1){
b.cancelCheckout();
}else if(refreshScreen==null||refreshScreen){
top.InfoFrame.location.replace(resulthref+'refresh=1');
}
if(typeof Points=='object')
Points.Get();
}catch(e){
}
}
function setLoginAccount(canSelect,username,Name,Code){
showprocessing();
top.document.getElementById("btnPickAccount").style['display']=canSelect==1?'block':'none';
top.document.getElementById("account").style['display']='block';
top.document.getElementById("loginform").style['display']='none';
top.setText(top.document.getElementById("username"),username);
top.setText(top.document.getElementById("accountName"),Name);
top.setText(top.document.getElementById("accountCode"),Code);
top.aLink=new Array();
top.aMenuItem=new Array();
top.neotekscript('/catalog/menu/menuajax.aspx');
if(typeof Points=='object')
Points.Get();
}
function RRPOnly(bool){
neotekscript('/Main/SetRRPOnly.aspx?RRPOnly='+bool);
b.loadFromDB();
resulthref=top.InfoFrame.location.href;
if(resulthref.indexOf('checkout.aspx')>-1){
top.InfoFrame.location.replace(url(resulthref)+'?cancel=1');
}else{
if(top.InfoFrame.location.href.toLowerCase().indexOf('productslist.aspx')>-1&&top.InfoFrame.location.href.toLowerCase().indexOf('ref=')==-1){
QuickSearch();
}else{
top.InfoFrame.location.replace(url(resulthref));
}
}
}
var selectedAcTab;
function actabclick(li){
try{
if(li===selectedAcTab)return;
if(selectedAcTab!=null)selectedAcTab.className='';
li.className='select';
selectedAcTab=li;
if(li.id=='tabAll'){
findAccount('');
}else{
findAccount(li.innerHTML);
}
}catch(e){
alert(e.message);
}
}
function ListAccounts(xmlHttp){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
control=document.getElementById('listAccount');
control.innerHTML='';
loadXMLOptions(xmlHttp,control,'AccountList');
}
}
}
function findAccount(str){
if(str==null){
var str=$('TxtAccountSearch').value;
}
var url='/Ajax/ChangeAccount.aspx?Find='+str;
neotekscript(url,null,ListAccounts);
}
function changeAccount(selectObj){
if(selectObj==null){
var selectObj=$('listAccount');
}
try{
var url='/Ajax/ChangeAccount.aspx?Id='+selectObj.value;
neotekscript(url,null);
top.NeotekPopup.Close();
}catch(e){
}
}
function accountSelect(){
var settings={
Title:'',
URL:'/main/AccountSelect.htm',
IncludeClose:true,
AutoResize:true,
AllowDrag:false,
BackgroundColor:'Transparent'
};
top.NeotekPopup.Show(settings);
}
function fnOpenDialog(url,iWidth,iHeight,scrollbars,resizable){
if(scrollbars==null)scrollbars='no';
if(resizable==null)resizable='no';
var sOpts="menubar=no,status=no,toolbar=no,scrollbars="+scrollbars+",resizable="+resizable;
sOpts+=",height="+String(iHeight)+",width="+String(iWidth);
if("object"==typeof(window.screen)){
var iTop=window.screen.height/2-iHeight/2;
var iLeft=window.screen.width/2-iWidth/2;
sOpts+=",left="+String(iLeft)+",top="+String(iTop);
}
oDialog=parent.open(url,"_dialog",sOpts);
window.onblur=fnCloseWindow;
return false;
}
function fnCloseWindow(){
try{
oDialog.close();
}catch(e){}
}
function SearchModeRefresh(){
try{
top.content.results.document.clear();
}catch(e){}
try{
top.content.menu.menu.document.clear();
}catch(e){}
try{
top.content.menu.menu.location.replace(top.content.menu.menu.location.href);
}catch(e){}
try{
if(top.content.results.location.href.indexOf('checkout.aspx')>-1){
top.content.results.location.replace(top.content.results.location.href+'?cancel=1');
}else{
top.content.results.location.replace(top.content.results.location.href);
}
}catch(e){}
}
var loginregex='\\w+';
function LoginIsValid(value,regex){
if(value.length==0){
return true;
}
var rx=new RegExp(regex);
var matches=rx.exec(value);
return(matches!=null&&value==matches[0]);
}
function Login(){
var loginId=document.getElementById('login').value;
var password=document.getElementById('password').value;
var rememberPassword=document.getElementById('remember').checked;
var errorString="";
if(loginId==""){
errorString+="* Login cannot be blank!\n";
}
else if(LoginIsValid(loginId,top.loginregex)==false){
errorString+="* Login cannot contain non-alphanumeric characters!\n";
}
if(password==""){
errorString+="* Password cannot be blank!\n";
}
if(errorString!=""){
errorString="Your input generated the following error(s):\n\n"+errorString+
"\nPlease try again.";
alert(errorString);
return;
}
showprocessing();
var urlString='/main/CustomerLogin.aspx?ajax=1&LoginId='+loginId+'&Password='+
password+'&Remember='+rememberPassword;
if(top.b.checkedOut==1){
urlString+='&From=toolbarCheckedOut';
}
neotekscript(urlString);
}
function Logout(){
showprocessing();
neotekscript('/main/CustomerLogin.aspx?ajax=1&Logout=1');
}
function Register(){
top.document.location.href='/public/register.aspx';
}
function showloginform(){
AccountSet('','',false);
document.getElementById("account").style['display']='none';
document.getElementById("loginform").style['display']='block';
neotekscript('/main/menuajax.aspx?mainmenuVer='+mainmenuVer);
}
function reset(exit){
if(exit!=null){
top.document.location.replace(top.document.location.href);
}else{
top.InfoFrame.location.href='/contentpage.aspx';
showloginform();
}
}
function loginError(msg){
alert(msg);
}
function loginAccepted(cancelCheckout){
document.getElementById('login').value='';
document.getElementById('password').value='';
document.getElementById('remember').checked=false;
top.b.loadFromDB();
neotekscript('/main/menuajax.aspx');
if(cancelCheckout){
var host=top.document.location.host;
top.frames["InfoFrame"].location.replace('http://'+host+'/basket/checkoutcancel.aspx');
}
}
var hideobject;
var hideobjectowner;
function ElementVisible(owner,visible,Id){
hideobject=null;
var toggle=document.getElementById(Id);
if(visible==true){
if(owner.className.indexOf(' Highlight')==-1){
owner.className+=' Highlight';
}
toggle.style.display='block';
}else{
hideobject=toggle;
hideobjectowner=owner;
setTimeout('delayedhide();',50);
}
}
function delayedhide(){
if(hideobject!=null){
hideobject.style.display='none';
if(hideobjectowner.className!=null){
hideobjectowner.className=hideobjectowner.className.replace(' Highlight','');
}
}
}
function profile(){
try{
top.InfoFrame.window.location='/UserAccess/UserProfile.aspx';
}catch(ex){alert(ex.message);}
}
 
/* ---------- /JS/v3/common.js ---------- */
var sSkinPath='';
var wSplash;
var w=window.screen.width;
var h=window.screen.height;
function $(id){return document.getElementById(id);}
var ProcessingTimeout;
function showprocessing(){
if(ProcessingTimeout!=null){
window.clearTimeout(ProcessingTimeout);
}
try{
$('processing').style['display']="block";
}catch(e){
}
ProcessingTimeout=setTimeout(hideprocessing,5000);
try{
resetsession();
}catch(e){
}
}
function hideprocessing(){
window.clearTimeout(ProcessingTimeout);
ProcessingTimeout=null;
try{
$('processing').style.display="none";
}catch(e){
}
}
function edit(id){
var frame=top.frames['InfoFrame'];
if(frame==null){frame=window;}
frame.document.location.href='/editor3/editcontent.aspx?id='+id;
}
function editCat(id){
top.frames['InfoFrame'].document.location.href='/editor3/editcontent.aspx?categoryid='+id;
}
function cancelPropagation(Evnt){
try{
Evnt.cancelBubble=true;
}catch(e){
try{
Evnt.stopPropagation();
}catch(e2){
}
}
}
function GetXmlHttpObject(){
var objXMLHttp=null;
if(typeof XMLHttpRequest!="undefined"){
objXMLHttp=new XMLHttpRequest();
if(objXMLHttp.overrideMimeType){
objXMLHttp.overrideMimeType('text/xml');
}
}else{
if(window.ActiveXObject){
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return objXMLHttp;
}
function getFormValues(fobj){
var str="";
var formElem;
for(var i=0;i<fobj.elements.length;i++){
formElem=fobj.elements[i];
switch(formElem.type){
case"text":
str+=formElem.name+"="+escape(formElem.value)+"&";
break;
case"checkbox":
str+=formElem.name+"="+formElem.checked+"&";
break;
case"textarea":
str+=formElem.name+"="+escape(formElem.value)+"&";
break;
case"hidden":
str+=formElem.name+"="+escape(formElem.value)+"&";
break;
case"password":
str+=formElem.name+"="+escape(formElem.value)+"&";
break;
case"select-one":
str+=formElem.name+"="+formElem.options[formElem.selectedIndex].value+"&";
break;
}
}
str=str.substr(0,(str.length-1));
return str;
}
function neotekscript(url,params,callback){
try{
var xmlHttp=GetXmlHttpObject();
if(typeof callback=='undefined'||callback==null){
xmlHttp.onreadystatechange=function(){processScript(xmlHttp);};
}else{
xmlHttp.onreadystatechange=function(){callback(xmlHttp);};
}
if(typeof params=='undefined'||params==null){
xmlHttp.open('GET',url,true);
xmlHttp.send(null);
}else{
xmlHttp.open('POST',url,true);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length",params.length);
xmlHttp.setRequestHeader("Connection","close");
xmlHttp.send(params);
}
}catch(e){
alert(url+' error:'+e.message);
}
}
function processScript(xmlHttp){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var scripts=xmlHttp.responseXML.getElementsByTagName("scripts")[0];
if(scripts!=null){
var script='';
for(var i=0;i<scripts.childNodes.length;i++){
try{
if(scripts.childNodes[i].textContent!=null){
script=scripts.childNodes[i].textContent;
}else{
script=scripts.childNodes[i].text;
}
eval(script);
}catch(e){
alert(script+e.message);
}
}
}else{
alert('Failed to get a response!');
}
}
}
}
function frameLoaded(frame){
hideprocessing();
}
function showSplash(){
showprocessing();
}
function isEnter(e){
e=!!e?e:window.event;
return(e.keyCode==13);
}
function neotekText(url,callback,elementId){
try{
var xmlHttp=GetXmlHttpObject();
xmlHttp.open('GET',url,true);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200&&callback!=null)
if(typeof elementId=='undefined'||elementId==null){
callback(xmlHttp.responseText);
}else{
callback(getInnerHTML(xmlHttp.responseText,elementId));
}
}
};
xmlHttp.send(null);
}catch(e){
alert(e.message);
}
}
function getInnerHTML(html,elementId){
try
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(html);
}
catch(e)
{
try
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(html,"text/xml");
}
catch(e2){alert(e2.message);}
}
return xmlDoc.getElementById(elementId).innerHTML;
}
function addoption(control,value,text){
var optn=document.createElement("OPTION");
optn.text=text;
optn.value=value;
control.options.add(optn);
}
function setElementValue(id,value){
var control=document.getElementById(id);
switch(control.type){
case"checkbox":
control.checked=value;
break;
case undefined:
control.innerHTML=value;
break;
case"select-one":
for(i=0;i<control.length;i++){
if(control[i].value==value)
{control.selectedIndex=i;}
}
break;
default:
control.value=value;
break;
}
}
function getElementValue(id){
var control=document.getElementById(id);
switch(control.type){
case"checkbox":
return control.checked;
break;
case"select-one":
return control.options[control.selectedIndex].value;
break;
default:
return control.value;
break;
}
}
function loadXMLOptions(xmlHttp,control,rootname){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var options=xmlHttp.responseXML.getElementsByTagName(rootname)[0];
if(options!=null){
var option='';
for(var i=0;i<options.childNodes.length;i++){
try{
if(options.childNodes[i].textContent!=null){
option=options.childNodes[i].textContent;
}else{
option=options.childNodes[i].text;
}
value=options.childNodes[i].attributes[0].value;
addoption(control,value,option);
}catch(e){
}
}
}else{
alert('Failed to get a response!');
}
}
}
}
function toggle(showButton,hideButton)
{
var theButton=document.getElementById(hideButton);
if(theButton.style.display!="none"){
theButton.style.display="none";
theButton=document.getElementById(showButton);
theButton.style.display="block";
}
}
function toTop(){
if(top.document.location.href!=document.location.href){
top.document.location.replace(document.location.href);
}
}
function isNumeric(x){
var RegEx=/^[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?$/;
var result=x.match(RegEx);
if(result==null){
return false;
}else{
return true;
}
}
function setText(obj,text){
obj.innerHTML=text;
}
function ResetPassword(){
top.frames['InfoFrame'].document.location.href='/public/forgottenPassword.aspx';
}
var Event={
Add:function(obj,evt,func,capture){
if(!!!obj)return;
if(typeof(func)!='function')return;
if(obj.addEventListener)obj.addEventListener(evt,func,capture);
else if(obj.attachEvent)obj.attachEvent('on'+evt,func);
return;
},
Remove:function(obj,evt,func,capture){
if(!!!obj)return;
if(typeof func!='function')return;
if(obj.removeEventListener)obj.removeEventListener(evt,func,capture);
else if(obj.detachEvent)obj.detachEvent('on'+evt,func);
return;
},
Fire:function(obj,evt){
if(obj==null)return;
if(obj.fireEvent!=null){
obj.fireEvent('on'+evt);
}else
{
var e=document.createEvent('MouseEvents');
e.initEvent(evt,false,false);
obj.dispatchEvent(e);
}
},
Get:function(e){
try{
if(!e){
e=window.event;
}
if(e.layerX){
e.offsetX=e.layerX;
e.offsetY=e.layerY;
}
if(e.type=='mouseover'&&!e.relatedTarget){
e.relatedTarget=e.fromElement;
}
else if(e.type=='mouseout'&&!e.relatedTarget){
e.relatedTarget=e.toElement;
}
e.src=e.srcElement||e.target;
e.key=e.keyCode||e.charCode;
return e;
}catch(ex){
}
return null;
}
};
function Querystring(qs){
this.params={};
if(qs==null)qs=location.search.substring(1,location.search.length);
if(qs.length==0)return;
qs=qs.replace(/\+/g,' ');
var args=qs.split('&');
for(var i=0;i<args.length;i++){
var pair=args[i].split('=');
var name=decodeURIComponent(pair[0]);
var value=(pair.length==2)?decodeURIComponent(pair[1]):name;
this.params[name]=value;
}
}
Querystring.prototype.get=function(key,default_){
var value=this.params[key];
return(value!=null)?value:default_;
};
Querystring.prototype.contains=function(key){
var value=this.params[key];
return(value!=null);
};
function ForceFrame(){
if(top.InfoFrame==null){
window.location.replace('/default.aspx?url='+Url.encode(top.document.location.href));
}
}
var Url={
encode:function(string){
return escape(this._utf8_encode(string));
},
decode:function(string){
return this._utf8_decode(unescape(string));
},
_utf8_encode:function(string){
string=string.replace(/\r\n/g,"\n");
var utftext="";
for(var n=0;n<string.length;n++){
var c=string.charCodeAt(n);
if(c<128){
utftext+=String.fromCharCode(c);
}
else if((c>127)&&(c<2048)){
utftext+=String.fromCharCode((c>>6)|192);
utftext+=String.fromCharCode((c&63)|128);
}
else{
utftext+=String.fromCharCode((c>>12)|224);
utftext+=String.fromCharCode(((c>>6)&63)|128);
utftext+=String.fromCharCode((c&63)|128);
}
}
return utftext;
},
_utf8_decode:function(utftext){
var string="";
var i=0;
var c=c1=c2=0;
while(i<utftext.length){
c=utftext.charCodeAt(i);
if(c<128){
string+=String.fromCharCode(c);
i++;
}
else if((c>191)&&(c<224)){
c2=utftext.charCodeAt(i+1);
string+=String.fromCharCode(((c&31)<<6)|(c2&63));
i+=2;
}
else{
c2=utftext.charCodeAt(i+1);
c3=utftext.charCodeAt(i+2);
string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));
i+=3;
}
}
return string;
}
};
try{
top.hideprocessing();
}catch(e){
}
 
/* ---------- /JS/imgpopup.js ---------- */
function popImage(src,id){
if(id!=null){
imgWin=window.open('../Catalog/popupimage.aspx?id='+id,'','scrollbars=no,width=620,height=470,left=50,top=50')
}else{
id=src;
imgWin=window.open('../Catalog/popupimage.aspx?id='+id,'','scrollbars=no,width=620,height=470,left=50,top=50')
}
}
 
/* ---------- /JS/v3/basket2.js ---------- */
function Basket(name,ver,orderRef,cookieID,containerId){
var m_arrProd=new Array;
var m_arrSortProd=new Array;
var m_arrNotifications=new Array;
var m_lastUpdatedID;
var m_lastModTime=0;
var m_debug=false;
var m_debugTrace='';
var m_startTime=0;
var m_reCheckTicks=5000;
var m_errorMessage='';
var m_budgetAmount=-1;
var m_overBudget=false;
var m_endItemCheck=false;
this.version=ver;
this.name=name;
this.orderRef=orderRef;
this.cookieID=cookieID;
this.containerId=containerId;
this.items=function(){return m_arrProd;};
this.offline=0;
this.checkedOut=0;
this.isList=0;
this.BulkWrite=0;
this.MinOrderVal=0;
this.TotalVal=0;
this.previousLineNo=p_previousLineNo;
this.renumberItems=p_renumberItems;
this.paintTotals=p_paintTotals;
this.lineNo=p_lineNo;
this.index=p_index;
this.a=p_addItem;
this.s=p_setItem;
this.n=p_addNotification;
this.deserialise=p_deserialise;
this.serialise=p_serialise;
this.clientAdd=p_addItem;
this.clientSet=p_setItem;
this.clientSetQty=p_setQty;
this.clientDelete=p_deleteItem;
this.clientEmpty=p_deleteAll;
this.loadFromDB=p_loadFromDB;
this.addItemDB=p_addItemDB;
this.deleteItemDB=p_deleteItemDB;
this.emptyDB=p_emptyDB;
this.pendingUpdate=p_pendingUpdate;
this.pendingDelete=p_pendingDelete;
this.loadCookie=p_loadfromCookie;
this.saveToCookie=p_saveToCookie;
this.paint=p_paint;
this.postBasket=p_postBasket;
this.paintitem=p_paintitem;
this.paintNotifications=p_paintNotifications;
this.paintNotification=p_paintNotification;
this.painted=p_painted;
this.checkout=p_checkout;
this.secureCheckout=p_secureCheckout;
this.cancelCheckout=p_cancelCheckout;
this.formatCurrency=formatCurrency;
this.setMessage=p_setMessage;
this.setDetails=p_setDetails;
this.setDetailMinOrder=p_setDetailMinOrder;
this.setMinOrderVal=p_setMinOrderVal;
this.setMinOrderReached=p_setMinOrderReached;
this.checkItem=p_checkItem;
this.status=p_status;
this.checkDel=p_checkDel;
this.GetMinTick=p_getMinTick;
this.getElement=p_getElementById;
this.createElement=p_createElement;
this.loadOnlineBasket=p_loadOnlineBasket;
this.VersionParameter=p_VersionParameter;
this.setErrorMsg=p_setErrorMessage;
this.getErrorMsg=p_getErrorMessage;
this.showPopup=p_showPopup;
this.setBudgetAmount=p_setBudgetAmount;
this.getBudgetAmount=p_getBudgetAmount;
this.setOverBudget=p_setOverBudget;
this.isOverBudget=p_isOverBudget;
this.endItemCheck=p_endItemCheck;
function p_loadOnlineBasket(siteURL){
var s='';
var bi=this.items();
for(var i=0;i<bi.length;i++){
s+=bi[i].productId+'%7C'+bi[i].qty+'%5E';
}
if(s.length>2){
s=s.substr(0,s.length-3);
}
top.location.href=('http://'+siteURL+'/UserAccess/Login.aspx?OfflineBasket='+s);
}
function p_addItem(id,code,desc,qty,price,stock){
var i=this.index(id);
if(i>-1){
var tQty=m_arrProd[i].qty;
var tCode=m_arrProd[i].code;
var tDesc=m_arrProd[i].description;
var tPrice=m_arrProd[i].price;
var tStock=m_arrProd[i].stock;
m_arrProd[i].qty+=qty;
m_arrProd[i].code=code;
m_arrProd[i].description=desc;
m_arrProd[i].price=price;
m_arrProd[i].stock=stock;
m_arrProd[i].deleted=0;
m_arrProd[i].modified=new Date().valueOf();
}else{
m_arrProd.unshift(new BasketItem(id,code,desc,price,qty,stock));
i=0;
arraySearch(id,0,i);
}
if(this.offline&&!this.isList){
this.saveToCookie(1);
this.paint();
}else{
if(!this.BulkWrite){this.paintitem(i);}
}
return i;
}
function p_setItem(id,code,desc,qty,price,stock){
var i=this.index(id);
if(i>-1){
var tQty=m_arrProd[i].qty;
var tCode=m_arrProd[i].code;
var tDesc=m_arrProd[i].description;
var tPrice=m_arrProd[i].price;
var tStock=m_arrProd[i].stock;
m_arrProd[i].code=code;
m_arrProd[i].description=desc;
m_arrProd[i].price=price;
m_arrProd[i].qty=qty;
m_arrProd[i].stock=stock;
m_arrProd[i].deleted=0;
m_arrProd[i].modified=new Date().valueOf();
}else{
m_arrProd.unshift(new BasketItem(id,code,desc,price,qty,stock));
i=0;
arraySearch(id,0,i);
}
if(this.offline&&!this.isList){
this.saveToCookie(1);
this.paint();
}else{
if(!this.BulkWrite){
this.paintitem(i);
}
}
return i;
}
function p_setQty(id,qty){
var i=this.index(id);
if(i>-1){
var tQty=m_arrProd[i].qty;
m_arrProd[i].qty=qty;
if(this.offline&&!this.isList){
this.saveToCookie(1);
this.paint();
}else{
this.paintitem(i);
}
}
return i;
}
function p_addNotification(id,href,tooltip,classname){
m_arrNotifications.unshift(new Notification(id,href,tooltip,classname));
}
function p_getElementById(id){
return document.getElementById(id);
}
function p_createElement(id){
return document.createElement(id);
}
function p_deleteItem(id){
m_debugTrace='';
var modTime=new Date().valueOf();
var i=this.index(id);
m_debugTrace+='Delete item index '+i+'.\n';
if(i>-1){
arraySearch(id,1);
m_arrProd[i].deleted=1;
m_arrProd[i].qty=0;
if(this.offline&&!this.isList){
m_arrProd.splice(i,1);
this.saveToCookie(1);
this.paint();
}else{
var itemDiv=this.getElement('DivBskt'+id);
if(itemDiv!=null){
var lineNo=this.lineNo(id);
var theParent=itemDiv.parentNode;
theParent.removeChild(itemDiv);
if(m_arrSortProd.length>0){
this.renumberItems(i);
}else{
this.status('No items in your basket');
}
}else{
m_debugTrace+='Delete item '+i+' failed.\n';
}
}
}
m_debugTrace+='delete Item took '+(new Date().valueOf()-modTime)+'ms.\n';
if(m_debug){alert(m_debugTrace);}
this.paintTotals();
return i;
}
function p_lineNo(id){
var lineNo=this.getElement('Num'+id).innerHTML;
lineNo=Number(lineNo.substr(0,lineNo.length-2));
return lineNo;
}
var m_lastRenum=0;
function p_renumberItems(startIndex,modTime){
if(modTime==null){modTime=new Date().valueOf();}
if(m_lastRenum>modTime){return;}
m_lastRenum=modTime;
if(startIndex==null){startIndex=0;}
var lineNo=this.previousLineNo(startIndex);
var count=0;
for(var idx=startIndex;idx<m_arrProd.length;idx++){
count++;
if(count>30){
setTimeout('top.b.renumberItems('+idx+','+modTime+')',300);
m_debugTrace+='renumber Items break took '+(new Date().valueOf()-modTime)+'ms.\n';
return;
}
if(m_arrProd[idx].deleted==0){
lineNo++;
try{
this.getElement('Num'+m_arrProd[idx].productId).innerHTML=lineNo+'. ';
}catch(e){
lineNo--;
}
}
}
m_debugTrace+='renumber Items took '+(new Date().valueOf()-modTime)+'ms.\n';
}
function p_deleteAll(){
m_arrSortProd.length=0;
m_arrProd.length=0;
this.BulkWrite=1;
if(this.offline&&!this.isList){
this.saveToCookie(1);
}
this.paint();
this.BulkWrite=0;
}
function p_VersionParameter(){
if(this.version==null){this.version=1;}
return'version='+this.version;
}
function p_previousLineNo(idx){
try{
if(idx==null||idx<=0){
lineNo=0;
}else{
var aboveIdx=-1;
for(i=idx-1;i>=0&&aboveIdx==-1;i--){
if(m_arrProd[i].deleted==0){aboveIdx=i;}
}
if(aboveIdx>-1){
lineNo=this.getElement('Num'+m_arrProd[aboveIdx].productId).innerHTML;
lineNo=Number(lineNo.substr(0,lineNo.length-2));
}else{lineNo=0;}
}
}catch(e){
lineNo=0;
}
return lineNo;
}
function p_paintitem(idx,lineNo){
var modTime=new Date().valueOf();
if(this.isList){return;}
var i=m_arrProd[idx];
var pid=i.productId;
m_debugTrace+='paint item '+pid+'.\n';
if(!lineNo){
lineNo=this.previousLineNo(idx)+1;
}
var url;
var onChange;
if(this.offline){
url='../ProductDetails/'+pid+'.htm';
onChange='return top.objBasket.clientSetQty('+pid+', this.value)';
}else{
url='../Catalog/ProductDetails.aspx?productID='+pid;
onChange='return top.SetQty('+pid+', this.value)';
}
this.status('');
var itemDiv=this.getElement('DivBskt'+pid);
if(itemDiv!=null){
this.getElement('Num'+pid).innerHTML=lineNo+'. ';
if(i.description!=''){this.getElement('desc'+pid).innerHTML=i.description;}
if(i.code!=''){this.getElement('code'+pid).innerHTML=i.code;}
this.getElement('Qty'+pid).value=i.qty;
if(i.qty<1){this.getElement('Qty'+pid).style.background='#ff9999';}else{this.getElement('Qty'+pid).style.background='#ffffff';}
this.getElement('uPrice'+pid).innerHTML='<B>@</B>'+formatCurrency(i.price,true);
if(i.qty==0){
this.getElement('tot'+pid).innerHTML=''+formatCurrency(i.qty*i.price,false);
}else{
this.getElement('tot'+pid).innerHTML=''+formatCurrency(i.qty*i.price,true);
}
this.getElement('uNotify'+pid).innerHTML='';
}else{
var s='<div class="basketItem">';
s+='<div class="line1">';
s+='<span id="Num'+pid+'" class="lineNo">'+lineNo+'. </span>';
s+='<A id="desc'+pid+'" onmouseup="return top.cSts();" class=ModelName onmousedown="return top.sSts(this);" onmouseover="return top.sSts(this);" title="Click for detailed product information" onmouseout="return top.cSts();" href="'+url+'" target=InfoFrame>'+i.description+'</A>';
s+='</div><div class="line2">';
s+='<A id="code'+pid+'" onmouseup="return top.cSts();" class=ModelNumber onmousedown="return top.sSts(this);" onmouseover="return top.sSts(this);" title="Click for detailed product information" onmouseout="return top.cSts();" href="'+url+'" target=InfoFrame>'+i.code+'</A>';
s+='<div class="basketItemNotifications" id="uNotify'+pid+'"></div>';
s+='<div class="CancelButton" onmouseover="return top.sSts(this);" title="Remove Item from Basket" onclick="';
if(this.offline){
s+='top.objBasket.clientDelete('+pid+');';
}else{
s+='top.Drop('+pid+');';
}
s+='" onmouseout="return top.cSts();">';
s+='</div>';
s+='</div>';
s+='<div class="line3"><input id="Qty'+pid+'" name="Qty" type="text" value="'+i.qty+'" maxlength="5" size="3" class="basketQty" onChange="'+onChange+'" style="width:30px';
if(i.qty<1){s+=';background:#ff9999';}
s+='" onFocus="this.select();"/>';
s+='<span class="unitCost" ID="uPrice'+pid+'"><strong>@</strong>'+formatCurrency(i.price,true);
s+='</span>';
s+='<span class="totalCost" id="tot'+pid+'">';
if(i.qty==0){
s+=''+formatCurrency(i.qty*i.price,false);
}else{
s+=''+formatCurrency(i.qty*i.price,true);
}
s+='</span></div></div>';
if(this.BulkWrite){
return'<div id="DivBskt'+pid+'" class="item">'+s+'</div>';
}else{
var start=new Date().valueOf();
var basket=this.getElement('basketcontent');
var newItem=this.createElement("div");
newItem.setAttribute("id","DivBskt"+pid);
newItem.setAttribute("class","item");
if(!basket.childNodes[0])
basket.appendChild(newItem);
else
basket.insertBefore(newItem,basket.childNodes[0]);
this.getElement("DivBskt"+pid).innerHTML=s;
m_debugTrace+='insert new div took '+(new Date().valueOf()-start)+'ms.\n';
this.renumberItems();
}
}
i.modified='';
m_debugTrace+='paint item took '+(new Date().valueOf()-modTime)+'ms.\n';
this.paintTotals();
this.setMessage('');
return s;
}
function p_setMessage(msg){
window.status=msg;
try{
this.getElement('basketmsg').innerHTML=msg;
if(msg==''){
this.getElement('basketmsg').style.display='none';
}else{
this.getElement('basketmsg').style.display='block';
}
}catch(e){
}
}
function p_status(msg){
var msgDiv=this.getElement('bstatus');
if(msgDiv==null){
return;
}
msgDiv.innerHTML=msg;
}
function p_paintTotals(){
var bi=m_arrProd;
var sum=0;
var items=0;
var idx0=-1;
for(var i=0;i<bi.length;i++){
if(bi[i].deleted==0){
if(idx0==-1){idx0=i;}
sum+=(bi[i].qty*bi[i].price);
items+=bi[i].qty;
}
}
this.TotalVal=sum;
this.setMinOrderReached(this.MinOrderVal,this.TotalVal);
this.getElement("basketSummaryTotal").innerHTML=formatCurrency(sum,false);
this.getElement("basketTotal").innerHTML=formatCurrency(sum,false);
this.getElement("basketquantity").innerHTML=items;
try{
basketscroller.move(0);
}catch(e){}
}
function p_paint(){
if(this.isList){return;}
var s='<TABLE cellSpacing=0 cellPadding=0 width=100% border=0><TR><TD><span id="ErrorMsg" class="ErrorText"></span></TD></TR></TABLE>';
if(this.containerId==null){
this.containerId='scrlayer';
}
this.getElement(this.containerId).innerHTML=s;
var bi=m_arrProd;
var sum=0;
var items=0;
if(m_arrSortProd.length==0){
this.status('No items in your basket');
}else{
s='';
var lineNo=1;
var idx0=-1;
for(var i=0;i<bi.length;i++){
if(bi[i].deleted==0){
if(idx0==-1){
idx0=i;
}
s+=this.paintitem(i,lineNo);
sum+=(bi[i].qty*bi[i].price);
items+=bi[i].qty;
lineNo++;
}
}
if(lineNo>0){this.renumberItems(0);}
this.getElement('basketcontent').innerHTML=s;
this.getElement('Qty'+bi[idx0].productId).select();
}
if(this.offline){
var f=this.p_basketSet().basketbottom.document.forms[0];
f.Total.value=formatCurrency(sum,false);
}
this.paintTotals();
}
function p_paintNotifications(){
var arrNot=m_arrNotifications;
for(var i=0;i<arrNot.length;i++){
this.paintNotification(arrNot[i].id,arrNot[i].href,arrNot[i].tooltip,arrNot[i].classname);
}
m_arrNotifications.length=0;
}
function p_paintNotification(id,href,tooltip,classname){
var span=this.getElement('uNotify'+id);
if(span!=null&&typeof(span)!='undefined'){
span.innerHTML+='<A onmousedown="return top.sSts(this);" onmouseover="return top.sSts(this);" onmouseup="return top.cSts();" onmouseout="return top.cSts();" title="'+tooltip+'" href="'+href+'" target=InfoFrame><div class="'+classname+'" ></div></a>';
}
}
function p_pendingUpdate(id,i,modTime){
var start=new Date().valueOf();
if(!i){i=this.index(id);}
var itemDiv=this.getElement('DivBskt'+id);
if(itemDiv!=null){
this.getElement('uPrice'+id).innerHTML='';
this.getElement('tot'+id).innerHTML='Calculating...';
}
m_arrProd[i].painted=0;
if(modTime){m_arrProd[i].modified=modTime;}
m_debugTrace+='pending update took '+(new Date().valueOf()-start)+'ms.\n';
return i;
}
function p_pendingDelete(id,modTime){
var i=this.index(id);
if(i>-1){
var itemDiv=this.getElement('DivBskt'+id);
if(itemDiv!=null){
this.getElement('uPrice'+id).innerHTML='';
this.getElement('tot'+id).innerHTML='Deleting...';
}
m_arrProd[i].painted=0;
if(modTime){m_arrProd[i].modified=modTime;}
return i;
}
}
function p_setDetails(freight,FreightTitle){
try{
f=document.getElementById('basketFreight');
f.title=FreightTitle;
if(freight==0){
f.className='FreeFreight';
}else{
f.className='ChargeFreight';
}
}catch(e){
}
}
function p_setDetailMinOrder(minOrderTitle){
try{
f=document.getElementById('basketMinOrderValue');
f.title=minOrderTitle;
}catch(e){
}
}
function p_setMinOrderReached(minOrderValue,totalvalue){
try{
f=document.getElementById('basketMinOrderValue');
if(minOrderValue>0){
if(totalvalue>=minOrderValue){
f.className='MinOrderValueReached';
f.title='';
}else{
f.className='MinOrderValue';
}
}else{
f.className='NoMinOrderValue';
f.title='';
}
}catch(e){
}
}
function p_setMinOrderVal(minOrderValue){
try{
this.MinOrderVal=minOrderValue;
}catch(e){
}
}
function p_painted(id,painted){
var i=this.index(id);
if(i>-1){
m_arrProd[i].painted=painted;
return i;
}
}
function p_index(id){
for(var i=0;i<m_arrProd.length;i++){
if(m_arrProd[i].productId==id){
return i;
}
}
return-1;
}
function p_checkout(){
if(this.isList){
alert('You cannot Check Out a List!\nAdd the list to the basket first.');
return;
}
if(this.items().length==0){
alert('You cannot proceed to the Check Out with an empty Basket!');
return;
}
if(this.MinOrderVal>0){
if(this.TotalVal<this.MinOrderVal){
alert('You cannot proceed to the Check Out, Your total '+formatCurrency(this.TotalVal,false)+' is less than Min Order Value ('+formatCurrency(this.MinOrderVal,false)+')!');
return;
}
}
if(this.isOverBudget()){
this.showPopup('You have gone over your budget of '+formatCurrency(this.getBudgetAmount(),false)+' by '+
formatCurrency(Math.abs(this.getBudgetAmount()-this.TotalVal),false),'Checkout');
return;
}
if(this.checkedOut==1){
this.cancelCheckout();
return;
}
this.checkedOut=1;
if(document.getElementById('BasketDesc')){
document.getElementById('BasketDesc').style.display='none';
}
this.status('Your basket contents are at the Check Out!');
this.getElement('basketcontent').innerHTML='';
this.getElement('basketTotal').innerText='';
this.orderRef=this.getElement('orderRef').value;
this.getElement('orderRef').value='';
var url;
if(this.offline){
url=top.location.pathname;
if(top.location.pathname.substring(0,1)=='/'){
url=top.location.pathname.substring(1);
}
url=url.substring(0,url.indexOf('index.htm'));
url+='basket/CheckOut.htm?orderRef='+this.orderRef;
}else{
url='../basket/CheckOut3.aspx?orderRef='+this.orderRef;
}
var Mainurl=top.InfoFrame.location.pathname.toLowerCase();
if(Mainurl.indexOf('/basket/checkout')>-1){
top.InfoFrame.document.body.onunload=null;
}
url=unescape(url);
top.InfoFrame.location.replace(url);
}
function p_secureCheckout(){
if(this.isList){
alert('You cannot Check Out a List!\nAdd the list to the basket first.');
return;
}
if(this.items().length==0){
alert('You cannot proceed to the Check Out with an empty Basket!');
return;
}
if(this.MinOrderVal>0){
if(this.TotalVal<this.MinOrderVal){
alert('You cannot proceed to the Check Out, Your total '+formatCurrency(this.TotalVal,false)+' is less than Min Order Value ('+formatCurrency(this.MinOrderVal,false)+')!');
return;
}
}
if(this.isOverBudget()){
alert('You have gone over your budget of '+formatCurrency(this.getBudgetAmount(),false)+' by '+
formatCurrency(Math.abs(this.getBudgetAmount()-this.TotalVal),false));
return;
}
if(this.checkedOut==1){
this.cancelCheckout();
return;
}
this.checkedOut=1;
if(document.getElementById('BasketDesc')){
document.getElementById('BasketDesc').style.display='none';
}
this.status('Your basket contents are at the Check Out!');
this.getElement('basketcontent').innerHTML='';
document.getElementById('basketTotal').value='';
this.orderRef=document.getElementById('orderRef').value;
document.getElementById('orderRef').value='';
var url;
if(this.offline){
url=top.location.pathname;
url=url.substring(0,url.indexOf('index.htm'));
url+='basket/CheckOut.htm?orderRef='+this.orderRef;
}else{
url='https://'+top.location.host+'/basket/checkout3.aspx?orderRef='+this.orderRef;
}
var Mainurl=top.InfoFrame.location.pathname.toLowerCase();
if(Mainurl.indexOf('/basket/checkout')>-1){
top.InfoFrame.document.body.onunload=null;
}
top.InfoFrame.location.replace(url);
if(top.intervalID!=null){
clearInterval(top.intervalID);
}
top.intervalID=setInterval("checkCheckoutFinished()",pollInterval);
}
function p_cancelCheckout(noredirect){
this.checkedOut=0;
var r=top.frames['InfoFrame'];
var loc=r.location.pathname.substr(r.location.pathname.length-21,21);
loc=loc.toLowerCase();
if(loc.indexOf('basket/checkout')>-1){
var d=r.document;
try{
d.getElementById('LblHeader').innerText='Check Out Cancelled!';
d.getElementById('Message').innerText='Your Order was cancelled and items were placed back in your basket.';
r.ignoreUnload=true;
d.getElementById('pnlDetails').innerHTML='';
}catch(e){}
}else if(!noredirect){
if(loc.indexOf('/basket/checkout')>-1){
r.location.replace('../basket/CheckOutCancel.aspx');
}
}
var total=0;
var bi=this.items();
this.checkedOut=0;
if(!BasketVisible){
if(top.frames['toolbar'].document.getElementById('BasketDesc')){
top.frames['toolbar'].document.getElementById('BasketDesc').style.display='';
}
}
for(var i=0;i<bi.length;i++){
total+=bi[i].qty*bi[i].price;
}
this.getElement("basketTotal").value=formatCurrency(total,false);
this.TotalVal=total;
this.setMinOrderReached(this.MinOrderVal,this.TotalVal);
this.getElement("orderRef").value=this.orderRef;
this.BulkWrite=1;
this.paint();
this.BulkWrite=0;
}
function formatCurrency(num,showPOA){
num=num.toString().replace(/\$|\,/g,'');
if(isNaN(num)){
if(showPOA==true)
return'POA';
else
return'$0.00';
}else{
if(num<=0&&showPOA==true){
return'POA';
}
sign=(num==(num=Math.abs(num)));
num=Math.floor(num*100+0.50000000001);
cents=num%100;
num=Math.floor(num/100).toString();
if(cents<10){
cents="0"+cents;
}
for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){
num=num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
}
return(((sign)?'':'-')+'$'+num+'.'+cents);
}
}
function p_deserialise(str){
var props=str.split('\n');
var name;
var type;
var value;
for(var i=0;i<props.length;i++){
var keys=props[i].split('=');
if(keys.length>2){
name=unescape(keys[0]);
type=keys[1];
value=unescape(keys[2]);
switch(type){
case's':
eval('this.'+name+'=\''+value+'\';');
break;
default:
if(name=='BasketItem'){
var BIs=value.split(';');
for(var j=0;j<BIs.length;j++){
m_arrProd[j]=deserialise(unescape(BIs[j]),new BasketItem);
arraySearch(j,0,j);
}
}else{
eval('this.'+name+'='+value+';');
}
}
}
}
}
function p_serialise(){
var ret='';
var newline=false;
for(var prop in this){
if(typeof(this[prop])!='undefined'&&this[prop]!=null){
switch(typeof(this[prop])){
case'function':
case'object':
break;
case'string':
if(newline)ret+='\n';
ret+=escape(prop)+'=';
ret+='s=';
ret+=escape(this[prop]);
newline=true;
break;
default:
if(newline){
ret+='\n';
}
ret+=escape(prop)+'=';
ret+='v=';
ret+=escape(this[prop]);
newline=true;
}
}
}
if(newline){
ret+='\n';
}
ret+='BasketItem=a=';
var BIs='';
for(var i=0;i<m_arrProd.length;i++){
if(i>0){
BIs+=';';
}
BIs+=escape(serialise(m_arrProd[i]));
}
ret+=escape(BIs);
return ret;
}
function p_loadfromCookie(basketname){
var bn='B';
var c=Get_Cookie(bn);
if(c!=null){
this.deserialise(c);
}
}
function p_saveToCookie(autoSave){
var s=this.serialise();
var len=escape(s).length;
if(len<4088){
Set_Cookie('B',s,addDay(new Date(),62));
if(document.cookie.length==0){
alert(len+' apparently is too long for the basket!!\nThe basket was not saved. Please remove some line items.');
return false;
}
return true;
}else{
if(autoSave==1){
alert('Your basket has reached its saved offline limit. While you may add further items to your basket, no further items will be added to your saved offline basket.');
}else{
alert('Your basket cant be saved as it is too large. The data length is currently '+len+' and the maximum length allowed is 4088.\n\nPlease remove some items from your basket.');
}
return false;
}
}
function p_loadFromDB(id,qty){
this.setMessage('Loading basket...');
this.postBasket('Load');
}
function p_addItemDB(id,qty,code,desc){
m_debugTrace='';
var modTime=new Date().valueOf();
var i=this.index(id);
m_debugTrace+='index lookup took '+(new Date().valueOf()-modTime)+'ms.\n';
if(i>-1){
if(m_arrProd[i].qty>0&&id!=m_lastUpdatedID){
if(!confirm("This item already exists in your basket! Do you still wish to add it?")){return;}
}
}
this.setMessage('Updating basket...');
m_lastUpdatedID=id;
i=this.clientAdd(id,code,desc,qty,0,1);
this.pendingUpdate(id,i,modTime);
setTimeout('top.b.checkItem('+id+','+m_arrProd[i].qty+',0,'+modTime+')',m_reCheckTicks);
this.postBasket('Update','../','&id='+id+'&qty='+m_arrProd[i].qty+'&tick='+modTime,modTime);
m_debugTrace+='client item add took '+(new Date().valueOf()-modTime)+'ms. ';
if(m_debug){alert(m_debugTrace);}
}
function p_deleteItemDB(id){
m_debugTrace='';
var modTime=new Date().valueOf();
this.pendingDelete(id,modTime);
this.setMessage('Updating basket...');
setTimeout('top.b.checkDel('+id+',0)',m_reCheckTicks);
this.postBasket('Delete','../','&id='+id,modTime);
m_debugTrace+='delete Item took '+(new Date().valueOf()-modTime)+'ms.\n';
if(m_debug){
alert(m_debugTrace);
}
}
function p_emptyDB(){
this.cancelCheckout();
this.setMessage('Emptying basket...');
this.postBasket('Empty','../');
}
function p_getMinTick(){
var min=8640000000000000;
for(var i=0;i<m_arrProd.length;i++){
if(m_arrProd[i].modified!=''){
min=Math.min(min,m_arrProd[i].modified);
}
}
return min;
}
function p_checkItem(id,qty,retries,modTime){
if(this.m_endItemCheck==true){
this.m_endItemCheck=false;
return;
}
var now=new Date().valueOf();
if(m_lastModTime<now-(retries*1000)){
var i=this.index(id);
if(i>-1){
if(m_arrProd[i].modified!=''&&modTime>=m_arrProd[i].modified){
if(retries<5){
var minTick=this.GetMinTick();
setTimeout('top.b.checkItem('+id+','+qty+','+(retries+1)+','+modTime+')',m_reCheckTicks);
this.postBasket('get','../','&tick='+minTick,modTime);
}else{
if(retries==5){
setTimeout('top.b.checkItem('+id+','+qty+','+(retries+1)+','+modTime+')',m_reCheckTicks);
this.postBasket('Update','../','&id='+id+'&qty='+qty+'&tick='+modTime,modTime);
}else{
if(confirm('Failed to add item '+m_arrProd[i].description+' ('+m_arrProd[i].code+')! Try again?')){
setTimeout('top.b.checkItem('+id+','+qty+',0,'+modTime+')',m_reCheckTicks);
this.postBasket('Update','../','&id='+id+'&qty='+qty+'&tick='+modTime,modTime);
}else{this.clientDelete(id);}
}
}
}
}
}else{
setTimeout('top.b.checkItem('+id+','+qty+','+retries+','+modTime+')',m_reCheckTicks);
}
}
function p_checkDel(id,retries){
var now=new Date().valueOf();
if(m_lastModTime<now-(retries*1000)){
var i=this.index(id);
if(i>-1){
if(m_arrProd[i].deleted==0){
if(retries<5){
setTimeout('top.b.checkDel('+id+','+(retries+1)+')',m_reCheckTicks);
this.postBasket('Delete','','&id='+id);
}else{
if(confirm('Failed to delete '+m_arrProd[i].description+' ('+m_arrProd[i].code+')! Try again?')){
this.deleteItemDB(Id);
}else{this.paintitem(i);}
}
}
}
}else{
setTimeout('top.b.checkDel('+id+','+retries+')',m_reCheckTicks);
}
}
function p_postBasket(action,prefix,params,modTime){
if(!modTime){modTime=new Date().valueOf();}
if(!params){params='';}
if(!prefix){prefix='';}
m_lastModTime=new Date().valueOf();
var url=prefix+'basket/action.aspx?'+this.VersionParameter()+'&action='+action+params;
top.neotekscript(url);
}
function sortItem(value,index){
this.value=value;
this.index=index;
}
function arraySearch(vValue,RemoveCount,index){
var iIdx=-1;
var idx=-1;
if(index!=null){
index=m_arrProd.length;
}
if(m_arrSortProd.length==0){
if(index!=null){
m_arrSortProd.splice(0,0,new sortItem(vValue,index));
return 0;
}
return-1;
}
if(RemoveCount==null){RemoveCount=0;}
var iStartIndex,iEndIndex,iMiddleIndex;
iStartIndex=0;
iMiddleIndex=-1;
iEndIndex=m_arrSortProd.length-1;
while(iIdx==-1){
iMiddleIndex=iStartIndex+Math.ceil((iEndIndex-iStartIndex)/2);
switch(vValue){
case m_arrSortProd[iStartIndex].value:idx=iStartIndex;
case m_arrSortProd[iMiddleIndex].value:idx=iMiddleIndex;
case m_arrSortProd[iEndIndex].value:idx=iEndIndex;
}
if(idx>-1){
if(RemoveCount>0){
m_arrSortProd.splice(idx,RemoveCount);
return-1;
}
return m_arrProd.length-m_arrSortProd[idx].index;
}
if(iStartIndex==iMiddleIndex){
iIdx=iStartIndex;
}else if(iEndIndex==iMiddleIndex){
iIdx=iEndIndex;
}else if(vValue>m_arrSortProd[iMiddleIndex].value){
iStartIndex=iMiddleIndex+1;
}else if(vValue<m_arrSortProd[iMiddleIndex].value){
iEndIndex=iMiddleIndex-1;
}
}
if(iIdx>-1&&index!=null){
if(vValue<m_arrSortProd[iIdx].value){iIdx--;}
if(iIdx<0){iIdx=0;}
if(vValue>m_arrSortProd[iIdx].value){iIdx++;}
m_arrSortProd.splice(iIdx,0,new sortItem(vValue,index));
}
return-1;
}
}
function BasketItem(id,code,desc,price,qty,stock){
this.productId=id;
this.code=code;
this.description=desc;
this.price=price;
this.qty=qty;
this.stock=stock;
this.painted=0;
this.deleted=0;
this.modified='';
}
function Notification(id,href,tooltip,classname){
this.id=id;
this.href=href;
this.tooltip=tooltip;
this.classname=classname;
}
function deserialise(str,obj){
var props=str.split('\n');
var name;
var type;
var value;
for(var i=0;i<props.length;i++){
var keys=props[i].split('=');
if(keys.length>2){
name=unescape(keys[0]);
type=keys[1];
value=unescape(keys[2]);
switch(type){
case's':
eval('obj.'+name+'=\''+strEsc(value)+'\';');
break;
default:
eval('obj.'+name+'='+value+';');
}
}
}
return obj;
}
function serialise(obj){
var ret='';
var newline=false;
for(var prop in obj){
if(typeof(obj[prop])!='undefined'&&obj[prop]!=null){
if(newline){ret+='\n';}
ret+=escape(prop)+'=';
switch(typeof(obj[prop])){
case'string':
ret+='s=';
break;
case'object':
ret+='o=';
break;
default:
ret+='v=';
}
ret+=escape(obj[prop]);
}
newline=true;
}
return ret;
}
function strEsc(str){
return str;
}
function p_setErrorMessage(message){
this.m_errorMessage=message;
}
function p_getErrorMessage(){
return this.m_errorMessage;
}
function p_showPopup(theMessage,title){
top.NeotekPopup.Close();
var settings={
URL:null,
ShowClose:true,
DoFade:true,
Title:title,
Message:theMessage,
CloseOnLoseFocus:false,
BackgroundColor:'White',
Rounded:false,
Height:50,
Width:300
};
top.NeotekPopup.Show(settings);
return;
}
function p_setBudgetAmount(theAmount){
this.m_budgetAmount=theAmount;
}
function p_getBudgetAmount(){
return this.m_budgetAmount;
}
function p_setOverBudget(isOver){
this.m_overBudget=isOver
}
function p_isOverBudget(){
if(this.m_budgetAmount<0){
return false;
}
if(this.TotalVal>this.m_budgetAmount){
return true;
}
else{
return false;
}
}
function p_endItemCheck(endCheck){
this.m_endItemCheck=endCheck;
}
var BasketNotify={
Set:function(setting){
switch(setting.Type){
case"element":
b.n(setting.ProductId,setting.Extended.href,setting.Extended.title,setting.Class);
break;
case"popup":
break;
case"script":
try{
eval(setting.Value);
}catch(ex){}
break;
}
}
};
 
/* ---------- /JS/v3/basket.js ---------- */
var OrderEntryMode=false;
var BasketVisible=true;
var intervalID;
var b;
var pollInterval=500;
var checkoutLoaded;
b=new Basket(null,3,null,null,'basketcontent');
function Pick(Id,Action,Code,Description,evnt){
cancelPropagation(evnt);
if(Action.toLowerCase()=='add'){
b.addItemDB(Id,1,Code,Description);
}else{
basketAction('Adding Items...','../Basket/','?Action='+Action+'&ID='+Id);
}
}
function Drop(Id){
b.deleteItemDB(Id);
}
function EmptyBasket(){
b.emptyDB();
}
function quickAdd(code,qty){
if(code==null){
code=document.getElementById('productCode').value;
}
if(qty==null){
qty=document.getElementById('quantity').value;
}
if(b.checkedOut){
b.cancelCheckout();
}
basketAction('Adding Item...','','?Action=qAdd&Code='+escape(code)+'&Qty='+qty);
}
function SetQty(Id,qty){
var q=Number(qty);
if(!isNaN(q)){
b.pendingUpdate(Id);
basketAction('Updating Item...','','?Action=Update&Id='+Id+'&Qty='+parseInt(q,10));
return true;
}else{
return false;
}
}
function basketAction(t,path,actn){
try{
b.setMessage(t);
}catch(e){
nothing=0;
}
neotekscript('../basket/action.aspx'+actn+'&version=3'+'&'+b.VersionParameter);
}
function basketCheckout(){
top.b.checkout();
}
function basketSecureCheckout(){
top.b.secureCheckout();
}
function basketQuote(){
top.InfoFrame.location.replace('Quote.aspx');
}
function setOrderRef(obj){
basketAction('setting reference','','?action=setref&ref='+escape(obj.value));
}
function toggleMode(obj){
var w=screen.availWidth;
alert("the width is "+w);
var l=0;
if(!OrderEntryMode){
OrderEntryMode=true;
l=screen.availWidth-210;
w=210;
obj.title='Maximise window';
}else{
OrderEntryMode=false;
obj.title='Shrink window for Order entry';
}
var h=screen.availHeight;
var t=0;
window.moveTo(l,t);
window.resizeTo(w,h);
return true;
}
function BasketDesc(txt,i){
div=top.toolbar.document.getElementById("BasketDesc");
try{
top.setText(div,txt);
}catch(e){
if(typeof(i)!='undefined'&&i!=null){
i=1;
}
if(i<5){
setTimeout('top.BasketDesc(\''+txt+'\', '+i+')',1000);
}
}
}
function ReqInfoPopUp(RecordID){
if(RecordID>0){
var w=500;
var h=330;
var sw=window.screen.width;
var sh=window.screen.height;
var l=(sw-w)/2;
var t=(sh-h)/2;
wItem=window.open("BasketInfoPopUp.aspx?Id="+RecordID,"_item",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=" + h + ",width=" + w + "');
wItem.blur();
wItem.resizeTo(w,h);
wItem.moveTo(l,t);
wItem.focus();
}
}
function FocusOn(e,trgt){
var iKeyCode,strKey,objInput;
var strUserA=navigator.userAgent.toLowerCase();
if(strUserA.indexOf("msie")>-1){
iKeyCode=e.keyCode;
objInput=e.srcElement;
}else{
iKeyCode=e.which;
objInput=e.target;
}
if(iKeyCode==43){
trgt.focus();
trgt.select();
return false;
}
}
function checkCheckoutFinished()
{
var mainUrl;
try{
mainUrl=top.InfoFrame.location.pathname.toLowerCase();
if(checkoutLoaded&&mainUrl!='/basket/checkoutcancel.aspx'){
clearInterval(intervalID);
checkoutLoaded=false;
b.cancelCheckout(1);
basketAction('','../basket/','refresh');
}
}
catch(e){
if(!checkoutLoaded){
checkoutLoaded=true;
}
}
}
function basketvisible(visible){
var b=document.getElementById('basket');
if(visible==true){
b.style['display']='block';
}else{
b.style['display']='none';
}
var b=document.getElementById('basketsummary');
b.style['display']='none';
try{
basketscroller.move(0);
}catch(e){}
}
function insufficientStockNotification(suppliedQuantity,requestedQuantity)
{
var settings;
if(suppliedQuantity==null&&requestedQuantity==null){
settings={
URL:'/Alert.aspx?AlertId=1',
Message:'',
CloseOnLoseFocus:false,
Width:350,
Title:'Insufficient Stock',
ShowClose:true,
AutoResize:false
};
}
else{
settings={
URL:'/Alert.aspx?AlertId=1&supplied='+suppliedQuantity+'&requested='+
requestedQuantity,
Message:'',
CloseOnLoseFocus:false,
Width:350,
Title:'Insufficient Stock',
ShowClose:true,
AutoResize:false
};
}
top.NeotekPopup.Show(settings);
}
function showBasketPopup(message){
return;
}
function QuickAddCallback(){
};
function quickAddAlert(message){
b.getElement('basketmsg').innerHTML=message;
}
function quickAddReset(){
b.getElement('productCode').value='item code';
b.getElement('productCode').blur();
b.getElement('quantity').value='1';
}
 
/* ---------- /JS/v3/Menu.js ---------- */
var menuArray=new Array();
var aMenuItem=new Array();
var aLink=new Array();
var iMenuWidth=300;
var iTitleChars=100;
var sHiddenMenuItems='';
var ShowMenuItemNo=0;
var menuScrollTop=0;
var basketScrollTop=0;
var BasketTotalReady=false;
var iLink=0;
var admin=false;
var iClaimId=0;
var sType='Component';
var iCurMenuItem=0;
var oTargetMenu;
var catMenuLastItem=0;
var catdivType=1;
var breakout=null;
var setTheory=false;
if(typeof(UseSetTheory)!='undefined'){
setTheory=UseSetTheory;
}
function menuitem(Id,Text,Image,LinkId,Reference,Parent,FirstChild,LastChild,Next,Previous,Indent,IsNode,IsLoaded,IsActive){
this.Id=Id;
this.Parent=Parent;
this.FirstChild=FirstChild;
this.LastChild=LastChild;
this.Text=Text;
this.LinkId=LinkId;
this.Reference=Reference;
this.Indent=Indent;
this.IsNode=IsNode;
this.IsLoaded=IsLoaded;
this.IsActive=IsActive;
this.Next=Next;
this.Previous=Previous;
this.Image=Image;
}
function menulink(Ref,Target){
this.Ref=Ref;
this.Target=Target;
}
function setText(obj,text){
if(obj.innerHTML!=null){
obj.innerHTML=text;
}else if(document.getElementById){
rng=document.createRange();
rng.setStartBefore(div);
htmlFrag=rng.createContextualFragment(text)
while(obj.hasChildNodes())obj.removeChild(Node.lastChild);
obj.appendChild(htmlFrag);
}
}
function MenuItemIndentAmount(iItem,containerId){
var idx=iItem;
var iIndent=0;
if(document.getElementById('concertina')!=null){
while(menuArray[containerId][idx].Parent!=0){
idx=MenuItemIndex(menuArray[containerId][idx].Parent);
iIndent=parseInt(iIndent)+parseInt(menuArray[containerId][idx].Indent);
}
}
else{
while(aMenuItem[idx].Parent!=0){
idx=MenuItemIndex(aMenuItem[idx].Parent);
iIndent=parseInt(iIndent)+parseInt(aMenuItem[idx].Indent);
}
}
return iIndent;
}
function setParentIndent(iItem,iIndent,containerId){
if(document.getElementById('concertina')!=null){
return setIndent(menuArray[containerId][iItem].Parent,iIndent);
}
else{
return setIndent(aMenuItem[iItem].Parent,iIndent);
}
}
function setIndent(iItem,iIndent,containerId){
var idx=iItem;
if(document.getElementById('concertina')!=null){
if(menuArray[containerId][idx].Indent==0){
var iIndent=0;
while(menuArray[containerId][idx].Parent!=0){
idx=menuArray[containerId][idx].Parent;
iIndent=parseInt(iIndent)+parseInt(menuArray[containerId][idx].Indent);
}
idx=iItem;
menuArray[containerId][idx].Indent=iIndent-iIndent;
}
return menuArray[containerId][idx].Indent;
}
else{
if(aMenuItem[idx].Indent==0){
var iIndent=0;
while(aMenuItem[idx].Parent!=0){
idx=aMenuItem[idx].Parent;
iIndent=parseInt(iIndent)+parseInt(aMenuItem[idx].Indent);
}
idx=iItem;
aMenuItem[idx].Indent=iIndent-iIndent;
}
return aMenuItem[idx].Indent;
}
}
function addMenuItem(iParent,id,text,linkId,linkRef,isNode,isActive,imageURL,containerId){
if(document.getElementById('concertina')!=null){
idx=menuArray[containerId].length;
if(idx==0){idx=1;}
var iPos=idx;
var iPrevious=0;
if(iParent!=0){
iPrevious=menuArray[containerId][iParent].LastChild;
menuArray[containerId][iParent].LastChild=iPos;
if(iPrevious==0){
menuArray[containerId][iParent].FirstChild=iPos;
}
menuArray[containerId][iParent].IsLoaded=true;
}else{
iPrevious=iPos-1
}
menuArray[containerId][iPos]=new menuitem(id,text,imageURL,linkId,linkRef,
iParent,0,0,0,iPrevious,0,isNode,
!isNode,isActive,containerId);
if(iPrevious!=0){
menuArray[containerId][iPrevious].Next=iPos;
}
return iPos;
}
else{
idx=aMenuItem.length;
if(idx==0){idx=1;}
var iPos=idx;
var iPrevious=0;
if(iParent!=0){
iPrevious=aMenuItem[iParent].LastChild;
aMenuItem[iParent].LastChild=iPos;
if(iPrevious==0){
aMenuItem[iParent].FirstChild=iPos;
}
aMenuItem[iParent].IsLoaded=true;
}else{
iPrevious=iPos-1
}
aMenuItem[iPos]=new menuitem(id,text,imageURL,linkId,linkRef,iParent,0,0,0,iPrevious,0,isNode,!isNode,isActive);
if(iPrevious!=0){
aMenuItem[iPrevious].Next=iPos;
}
return iPos;
}
}
function addLink(Ref,Target){
idx=aLink.length;
var iPos=idx;
aLink[iPos]=new menulink(Ref,Target);
return iPos;
}
function MenuItemLevel(iItem,containerId){
if(document.getElementById('concertina')!=null){
if(menuArray[containerId][iItem].Parent==0)
return 1;
else
return MenuItemLevel(menuArray[containerId][iItem].Parent,containerId)+1;
}
else{
if(aMenuItem[iItem].Parent==0)
return 1;
else
return MenuItemLevel(aMenuItem[iItem].Parent)+1;
}
}
function MenuItemIndexPath(iItem){
if(aMenuItem[iItem].Parent==0)
return iItem;
else
return MenuItemIndexPath(aMenuItem[iItem])+
','+iItem;
}
function Menu(iItem,container,containerId){
if(document.getElementById('concertina')!=null){
ShowMenuItemNo=iItem;
curMenuItemIndex=menuArray[containerId][iItem].Parent;
container.innerHTML='<ul width="100%" id="div1">'+MenuHTML(iItem,null,containerId)+'</ul>';
}
else{
ShowMenuItemNo=iItem;
curMenuItemIndex=aMenuItem[iItem].Parent;
container.innerHTML='<ul width="100%" id="div1">'+MenuHTML(iItem,null)+'</ul>';
}
}
function MenuHTML(iItem,container,containerId){
var str='';
if(document.getElementById('concertina')!=null){
idx=iItem;
iLevel=MenuItemLevel(iItem,containerId);
if(iLevel!=1){
if(menuArray[containerId][iItem].IsActive||admin){
str=str+MenuItemHTML(iItem,containerId)
if(iItem>catMenuLastItem){
str=str+'<div width="100%" ID="div'+iItem+'" STYLE="display:none">';
}
}
}
if(menuArray[containerId][idx].FirstChild!=0){
for(var find=menuArray[containerId][idx].FirstChild;find!=0;find=menuArray[containerId][find].Next){
str=str+MenuHTML(find,null,containerId);
}
}
if(iLevel!=1){
if(iItem>catMenuLastItem){
str=str+'</div>';
}
}
}
else{
idx=iItem;
iLevel=MenuItemLevel(iItem);
if(iLevel!=1){
if(aMenuItem[iItem].IsActive||admin){
str=str+MenuItemHTML(iItem)
if(iItem>catMenuLastItem){str=str+'<div width="100%" ID="div'+iItem+'" STYLE="display:none">';}
}
}
if(aMenuItem[idx].FirstChild!=0){
for(var find=aMenuItem[idx].FirstChild;find!=0;find=aMenuItem[find].Next){
str=str+MenuHTML(find,null);
}
}
if(iLevel!=1){
if(iItem>catMenuLastItem){
str=str+'</div>';
}
}
}
return str;
}
function getMenuHTML(iItem,container){
iLevel=MenuItemLevel(iItem);
var str='';
if(iLevel!=1){
if(aMenuItem[iItem].IsActive||admin){
str=str+MenuItemHTML(iItem)
if(iItem>catMenuLastItem){str=str+'<div width="100%" ID="div'+iItem+'" STYLE="display:none">';}
}
}
if(aMenuItem[idx].FirstChild!=0){
for(var find=aMenuItem[idx].FirstChild;find!=0;find=aMenuItem[find].Next){
str=str+getMenuHTML(find,null);
}
}
if(iLevel!=1){
if(iItem>catMenuLastItem){
str=str+'</div>';
}
}
}
function getConcertinaMenuHTML(iItem,container,containerId){
iLevel=MenuItemLevel(iItem,containerId);
var str='';
if(iLevel!=1){
if(menuArray[containerId][iItem].IsActive||admin){
str=str+MenuItemHTML(iItem,containerId)
if(iItem>catMenuLastItem){
str=str+'<div width="100%" ID="div'+iItem+'" STYLE="display:none">';
}
}
}
if(menuArray[containerId][idx].FirstChild!=0){
for(var find=menuArray[containerId][idx].FirstChild;find!=0;find=menuArray[containerId][find].Next){
str=str+getConcertinaMenuHTML(find,null,containerId);
}
}
if(iLevel!=1){
if(iItem>catMenuLastItem){
str=str+'</div>';
}
}
}
function InsertChildHTML(iItem,control,container,showItem,containerId){
idx=iItem;
if(document.getElementById('concertina')!=null){
if(showItem&&(menuArray[containerId][iItem].IsActive||admin)){
control.innerHTML=control.innerHTML+MenuItemHTML(iItem);
}
if(menuArray[containerId][idx].FirstChild!=0){
var childDiv;
if(containerId==0){
childDiv=GetElement(container,'ndiv'+iItem);
}else{
childDiv=GetElement(container,'cat'+containerId+'ndiv'+iItem);
}
for(var find=menuArray[containerId][idx+cFirstChild];find!=0;find=menuArray[containerId][find].Next){
InsertChildHTML(find,childDiv,container,true);
}
}
if(showItem){
control.innerHTML=control.innerHTML;
}
}
else{
if(showItem&&(aMenuItem[iItem].IsActive||admin)){
control.innerHTML=control.innerHTML+MenuItemHTML(iItem);
}
if(aMenuItem[idx].FirstChild!=0){
var childDiv=GetElement(container,'ndiv'+iItem);
for(var find=aMenuItem[idx+cFirstChild];find!=0;find=aMenuItem[find].Next){
InsertChildHTML(find,childDiv,container,true);
}
}
if(showItem)control.innerHTML=control.innerHTML;
}
}
function MenuItemHTML(iItem,containerId){
if(document.getElementById('concertina')!=null){
if(iItem>catMenuLastItem){
idx=iItem;
s_Validation=new String(','+sHiddenMenuItems+',');
if(s_Validation.indexOf(','+menuArray[containerId][idx].Id+',')>-1){
if(menuArray[containerId][idx]==0){
return'';
}
}
var title=menuArray[containerId][idx].Text;
var image=menuArray[containerId][idx].Image;
var menuitemid=menuArray[containerId][idx].Id;
text=menuArray[containerId][idx].Text;
iLevel=MenuItemLevel(iItem,containerId);
if(text.length>iTitleChars-(iLevel*3)){
text=text.substring(0,iTitleChars-(iLevel*3))+'...';
}
iLinkId=menuArray[containerId][idx].LinkId;
iLinkIndex=iLinkId;
if(iLevel==1){
return'';
}
iIndent=(iLevel-2)*13;
iRemainingWidth=iMenuWidth-iIndent;
sCSSClass='menuLevel'+(iLevel-1);
if(menuArray[containerId][iItem].IsActive==false)sCSSClass=sCSSClass+' style="color:gray"';
sHRef='<A id="n'+iItem+'" name="n'+iItem+'" class="menuItem" href="#" ';
if(setTheory||menuArray[containerId][iItem].IsNode==0){
sHRef+=' onclick="javascript: return nodeClick('+iItem+', '+iLinkId+', ';
if(aLink[iLinkIndex].Ref==''){
sHRef='window';
}else{
sHRef+=aLink[iLinkIndex].Target;
}
sHRef+=', window, '+containerId+')" ';
}else{
sHRef+=' onclick="javascript: return toggleNode('+iItem+', document, '+containerId+')" ';
}
sHRef+=' onMouseOver="return sSts(this);"';
sHRef+=' onMouseDown="return sSts(this);"';
sHRef+=' onMouseUp="return cSts();"';
sHRef+=' onMouseOut="return cSts();"';
sHRef+=' title="'+title+'">';
if(image==null){
sHRef+=text;
}else{
sHRef+='<img onmouseover="Fade(this,60,10,5);" onmouseout="Fade(this,100,10,5);" style="FILTER: alpha(opacity=100)" src="'+image+'">';
}
sHRef+='</a>';
sMenu='<li ';
sMenu+=' STYLE="display:block"';
sMenu+=' class="'+sCSSClass+'" >';
if(setTheory&&menuArray[containerId][iItem].IsNode==1){
if(containerId==0){
sMenu+='<span id="div'+iItem+'" class="expand" ';
}else{
sMenu+='<span id="cat'+containerId+'div'+iItem+'" class="expand" ';
}
alert('containerId: '+containerId);
sMenu+=' onclick="javascript: return toggleNode('+iItem+', document, '+containerId+')"';
sMenu+='>&nbsp;</span>';
}
sMenu+='<span>'+sHRef;
if(menuArray[containerId][iItem].IsNode==1){
if(containerId==0){
sMenu+='<ul id="ndiv'+iItem+'" style="display:none;"></ul>';
}else{
sMenu+='<ul id="cat'+containerId+'ndiv'+iItem+'" style="display:none;"></ul>';
}
}
sMenu+='</span></li>';
return sMenu;
}
else{
return'';
}
}
else{
if(iItem>catMenuLastItem){
idx=iItem;
s_Validation=new String(','+sHiddenMenuItems+',');
if(s_Validation.indexOf(','+aMenuItem[idx].Id+',')>-1){
if(aMenuItem[idx]==0)return'';
}
var title=aMenuItem[idx].Text;
var image=aMenuItem[idx].Image;
var menuitemid=aMenuItem[idx].Id;
text=aMenuItem[idx].Text;
iLevel=MenuItemLevel(iItem);
if(text.length>iTitleChars-(iLevel*3))text=text.substring(0,iTitleChars-(iLevel*3))+'...';
iLinkId=aMenuItem[idx].LinkId;
iLinkIndex=iLinkId;
if(iLevel==1)return'';
iIndent=(iLevel-2)*13;
iRemainingWidth=iMenuWidth-iIndent;
sCSSClass='menuLevel'+(iLevel-1);
if(aMenuItem[iItem].IsActive==false)sCSSClass=sCSSClass+' style="color:gray"';
sHRef='<A id="n'+iItem+'" name="n'+iItem+'" class="menuItem" href="#" ';
if(setTheory||aMenuItem[iItem].IsNode==0){
sHRef+=' onclick="javascript: return nodeClick('+iItem+', '+iLinkId+', ';
if(aLink[iLinkIndex].Ref==''){
sHRef='window';
}else{
sHRef+=aLink[iLinkIndex].Target;
}
sHRef+=', window)" ';
}else{
sHRef+=' onclick="javascript: return toggleNode('+iItem+', document)" ';
}
sHRef+=' onMouseOver="return sSts(this);"';
sHRef+=' onMouseDown="return sSts(this);"';
sHRef+=' onMouseUp="return cSts();"';
sHRef+=' onMouseOut="return cSts();"';
sHRef+=' title="'+title+'">';
if(image==null){
sHRef+=text;
}else{
sHRef+='<img onmouseover="Fade(this,60,10,5);" onmouseout="Fade(this,100,10,5);" style="FILTER: alpha(opacity=100)" src="'+image+'">';
}
sHRef+='</a>';
sMenu='<li ';
sMenu+=' STYLE="display:block"';
sMenu+=' class="'+sCSSClass+'" >';
if(setTheory&&aMenuItem[iItem].IsNode==1){
sMenu+='<span id="div'+iItem+'" class="expand" ';
sMenu+=' onclick="javascript: return toggleNode('+iItem+', document)"';
sMenu+='>&nbsp;</span>';
}
sMenu+='<span>'+sHRef;
if(aMenuItem[iItem].IsNode==1){
sMenu+='<ul id="ndiv'+iItem+'" style="display:none;"></ul>';
}
sMenu+='</span></li>';
return sMenu;
}
else{
return'';
}
}
}
function inMenuItem(iItem,cur_item,containerId){
if(document.getElementById('concertina')!=null){
if(iItem==cur_item)
return true;
else{
if(cur_item==0)
return false;
else
return inMenuItem(iItem,menuArray[containerId][cur_item],containerId);
}
}
else{
if(iItem==cur_item)
return true;
else{
if(cur_item==0)
return false;
else
return inMenuItem(iItem,aMenuItem[cur_item]);
}
}
}
function nodeClick(node_num,linkId,target,container,containerId){
if(breakout!=null){
try{
breakout(GetElement(container,'n'+node_num));
}catch(e){
}
}
oTargetMenu=container;
var node=GetElement(container,'n'+node_num);
if(document.getElementById('concertina')!=null){
if(iCurMenuItem!=0){
if(setTheory){
GetElement(container,'n'+iCurMenuItem).className='menuItem MenuVisited';
}else{
GetElement(container,'n'+iCurMenuItem).className='menuItem MenuUnselected';
}
}
node.className='menuItem MenuSelected';
iCurMenuItem=node_num;
if(node.style.color=='gray')return false;
idx=node_num;
text=menuArray[containerId][idx].Text;
iNodeId=menuArray[containerId][idx].Id;
linkRef=menuArray[containerId][idx].Reference;
iHRefId=linkId;
sURL=aLink[iHRefId].Ref;
if(sURL.indexOf('mailto:')!=0){
if(sURL.indexOf('?')==-1)
sURL+='?';
else
sURL+='&';
sURL+='Id='+iNodeId+'&Ref='+linkRef;
top.showprocessing();
}
target.location.href=sURL;
return false;
}
else{
if(iCurMenuItem!=0){
if(setTheory){
GetElement(container,'n'+iCurMenuItem).className='menuItem MenuVisited';
}else{
GetElement(container,'n'+iCurMenuItem).className='menuItem MenuUnselected';
}
}
node.className='menuItem MenuSelected';
iCurMenuItem=node_num;
if(node.style.color=='gray')return false;
idx=node_num;
text=aMenuItem[idx].Text;
iNodeId=aMenuItem[idx].Id;
linkRef=aMenuItem[idx].Reference;
iHRefId=linkId;
sURL=aLink[iHRefId].Ref;
if(sURL.indexOf('mailto:')!=0){
if(sURL.indexOf('?')==-1)
sURL+='?';
else
sURL+='&';
sURL+='Id='+iNodeId+'&Ref='+linkRef;
top.showprocessing();
}
target.location.href=sURL;
return false;
}
}
function toggleNode(node_num,container,containerId){
if(breakout!=null){
try{
breakout(GetElement(container,'n'+node_num));
}catch(e){
}
}
oTargetMenu=container;
if(document.getElementById('concertina')!=null){
var Node;
var img;
if(containerId==0){
Node=GetElement(container,'ndiv'+node_num);
img=GetElement(container,'div'+node_num);
}else{
Node=GetElement(container,'cat'+containerId+'ndiv'+node_num);
img=GetElement(container,'cat'+containerId+'div'+node_num);
}
if(Node.style['display']=="none"){
var menuDiv=Node.parentNode;
while(menuDiv.id.indexOf('category')!=0){
menuDiv=menuDiv.parentNode;
}
hideExpandedMenus(Node.parentNode.parentNode.parentNode);
var menuElement=Node.parentNode;
var elementxCoord=menuElement.offsetTop;
menuDiv.style['top']=-elementxCoord+'px';
var menuUpButton=GetElement(container,'category'+containerId+'up')
menuUpButton.style['display']="block";
idx=node_num;
if(menuArray[containerId][idx].IsLoaded){
Node.style['display']="block";
if(setTheory){img.className=img.className.replace('expand','shrink');}
}else{
if(setTheory){
img.className=img.className.replace('expand','processing');
}
if(admin){
neotekscript('/catalog/menu/menuajax.aspx?admin=1&parentNode='+node_num+'&Id='+menuArray[containerId][idx].Id+
'&TypeId='+top.iCurMenuType+'&containerId='+containerId);
}else{
neotekscript('/catalog/menu/menuajax.aspx?parentNode='+node_num+'&Id='+menuArray[containerId][idx].Id+
'&TypeId='+top.iCurMenuType+'&containerId='+containerId);
}
}
}else{
Node.style['display']="none";
if(setTheory){img.className=img.className.replace('shrink','expand');}
}
try{
categoryscroller.move(0);
}catch(e){}
return false;
}
else{
var Node=GetElement(container,'ndiv'+node_num);
var img=GetElement(container,'div'+node_num);
var menuDiv=Node.parentNode;
while(menuDiv.id.indexOf('category')!=0){
menuDiv=menuDiv.parentNode;
}
if(Node.style['display']=="none"){
idx=node_num;
if(aMenuItem[idx].IsLoaded){
Node.style['display']="block";
if(setTheory){img.className=img.className.replace('expand','shrink');}
}else{
if(setTheory){
img.className=img.className.replace('expand','processing');
}
if(admin){
neotekscript('/catalog/menu/menuajax.aspx?admin=1&parentNode='+node_num+'&Id='+aMenuItem[idx].Id+'&TypeId='+top.iCurMenuType);
}else{
neotekscript('/catalog/menu/menuajax.aspx?parentNode='+node_num+'&Id='+aMenuItem[idx].Id+'&TypeId='+top.iCurMenuType);
}
}
}else{
Node.style['display']="none";
if(setTheory){img.className=img.className.replace('shrink','expand');}
}
try{
categoryscroller.move(0);
}catch(e){}
return false;
}
}
function NodeHTML(iParent,sHTML,containerId){
if(document.getElementById('concertina')!=null){
if(iParent!=0){
for(var find=menuArray[containerId][iParent].FirstChild;find!=0;find=menuArray[containerId][find].Next){
if(menuArray[containerId][find].IsActive||admin){
sHTML=sHTML+MenuItemHTML(find,containerId)
}
}
menuArray[containerId][iParent].IsLoaded=true;
}
}
else{
if(iParent!=0){
for(var find=aMenuItem[iParent].FirstChild;find!=0;find=aMenuItem[find].Next){
if(aMenuItem[find].IsActive||admin){
sHTML=sHTML+MenuItemHTML(find)
}
}
aMenuItem[iParent].IsLoaded=true;
}
}
return sHTML;
}
function GetElement(container,id){
return document.getElementById(id);
}
function insertChildNodes(iParent,container,containerId){
if(document.getElementById('concertina')!=null){
var sContent=NodeHTML(iParent,'',containerId);
Node=GetElement(null,'cat'+containerId+'ndiv'+iParent);
setText(Node,sContent);
Node.style['display']="block";
if(setTheory){
var img=GetElement(container,'cat'+containerId+'div'+iParent);
img.className=img.className.replace('processing','shrink');
}
try{
categoryscroller.move(0);
}catch(e){}
}
else{
var sContent=NodeHTML(iParent,'');
Node=GetElement(null,'ndiv'+iParent);
setText(Node,sContent);
Node.style['display']="block";
if(setTheory){
var img=GetElement(container,'div'+iParent);
img.className=img.className.replace('processing','shrink');
}
try{
categoryscroller.move(0);
}catch(e){}
}
}
function closeNodes(){
try{
for(var i=0;i<aMenuItem.length;i++){
var Node=GetElement(document,'ndiv'+i);
var img=GetElement(document,'div'+i);
if(Node){Node.style['display']="none";}
if(setTheory){
if(img){img.className=img.className.replace('shrink','expand');}
}
}
categoryscroller.move(0);
}catch(e){}
}
function hideExpandedMenus(menuRoot){
var menuToHide;
for(i=0;i<menuRoot.childNodes.length;++i){
if(menuRoot.childNodes[i].tagName=='LI'){
menuToHide=menuRoot.childNodes[i].childNodes[0].childNodes[1];
if(typeof(menuToHide)!='undefined'){
menuToHide.style['display']='none';
}
}
}
}
 
/* ---------- /JS/v3/MenuType.js ---------- */
var iCurMenuItemType=0;
var iLinkType=0;
var aMenuItemType=new Array();
var aLinkType=new Array();
var curCatMenu='';
var curCatMenuId=0;
var goCategoryBottom=0;
var goCategoryTop=0;
var goBasketBottom=0;
var goBasketTop=0;
var HideLeftPanel=0;
var mainmenuVer=0;
function menuitemType(Id,Text){
this.Id=Id;
this.Text=Text;
}
function menulinkType(Ref,Target){
this.Ref=Ref;
this.Target=Target;
}
function addMenuItemType(coid,id,text){
aMenuItemType[coid]=new menuitemType(id,text);
}
function setTextType(obj,text){
if(obj.innerHTML!=null){
obj.innerHTML=text;
}
}
function addLinkType(id,Ref,Target){
aLinkType[id]=new menulinkType(Ref,Target);
}
function MenuType(iItem,container){
ShowMenuItemNo=iItem;
curMenuItemIndex=0;
var strt='';
var ilength=aMenuItemType.length;
for(var ii=1;ii<ilength;ii++){
strt=strt+'<ul width="100%" id="catdiv'+ii+'">'+MenuHTMLType(iItem,null)+'</ul>';
iItem=iItem+1;
}
container.innerHTML=strt;
}
function MenuTypeNew(iItem,container){
ShowMenuItemNo=iItem;
curMenuItemIndex=0;
var strt='';
var ilength=aMenuItemType.length;
for(var ii=1;ii<ilength;ii++){
strt=strt+'<ul width="100%" id="catdiv'+ii+'">'+MenuHTMLTypeNew(iItem,null)+'</ul>';
iItem=iItem+1;
}
container.innerHTML=strt;
}
function MenuHTMLType(iItem,container){
var str='';
idx=iItem;
str+=MenuItemHTMLType(iItem)+'<div width="100%" ID="cdiv'+iItem+'" STYLE="display:none">';
str+='</div>';
return str;
}
function MenuHTMLTypeNew(iItem,container){
var str='';
idx=iItem;
str+=MenuItemHTMLTypeNew(iItem)+'<div width="100%" id="catHolder'+iItem+'" ';
str+=' class="CatMenuHide" ';
str+='loading="0" >';
str+='<div id="processing'+iItem+'cat" style ="position:absolute; top:20%;">';
str+='</div>';
str+='<div id="categoryMain'+iItem+'wrap" style ="position:relative;">';
str+='<div id="category'+iItem+'scrlayer" onmousewheel="return scrollerget(\'category'+iItem+'\').scroll(event.wheelDelta/2)">';
str+='<div  id="category'+iItem+'up"   style="display:none;" onmousedown="return scrollerget(\'category'+iItem+'\').scrollup();"'+
' onmouseout="return scrollerget(\'category'+iItem+'\').stopscroll();" '+
' onmouseup="return scrollerget(\'category'+iItem+'\').stopscroll();">';
str+='</div>';
str+='<div width="100%" id="category'+iItem+'content"  onresize="checkcatcontentsize('+iItem+');" style ="z-index:500;">';
str+='</div>';
str+='<div  id="category'+iItem+'down"   style="display:none;" onmousedown="return scrollerget(\'category'+iItem+'\')'+
'.scrolldown();" onmouseout="return scrollerget(\'category'+iItem+'\').stopscroll();" '+
' onmouseup="return scrollerget(\'category'+iItem+'\').stopscroll();">';
str+='</div>';
str+='</div>';
str+='</div>';
str+='</div>';
str+='<div width="100%" ID="cdiv'+iItem+'" STYLE="display:none">';
str+='</div>';
str+='</li>';
return str;
}
function MenuItemHTMLType(iItem){
idx=iItem;
var title=aMenuItemType[idx].Text;
var menuitemid=aMenuItemType[idx].Id;
text=aMenuItemType[idx].Text;
iLevel=1;
iLinkId=aMenuItemType[idx].LinkId;
iLinkIndex=iLinkId;
sCSSClass='menuLevel'+0;
sHRef='<A id="cn'+iItem+'" name="cn'+iItem+'" class="menuType" href="javascript: TypeClick('+iItem+')" ';
sHRef+=' onMouseOver="return sSts(this);"';
sHRef+=' onMouseDown="return sSts(this);"';
sHRef+=' onMouseUp="return cSts();"';
sHRef+=' onMouseOut="return cSts();"';
sHRef+=' title="Click to view '+title+'">';
sHRef+=text;
sHRef+='</a>';
sMenu='<li ';
sMenu+=' STYLE="display:block"'
sMenu+=' class="'+sCSSClass+'" >';
sMenu+='<span class="menuTypeSpan">'+sHRef;
if(aMenuItemType[iItem].IsNode==1){
sMenu+='<ul id="cndiv'+iItem+'" style="display:none;"></ul>';
}
sMenu+='</span></li>';
return sMenu;
}
function MenuItemHTMLTypeNew(iItem){
idx=iItem;
var title=aMenuItemType[idx].Text;
var length=aMenuItemType.length-1;
var menuitemid=aMenuItemType[idx].Id;
var catType=aMenuItemType[idx].Id;
text=aMenuItemType[idx].Text;
iLevel=1;
iLinkId=aMenuItemType[idx].LinkId;
iLinkIndex=iLinkId;
sCSSClass='menuLevel'+0;
sHRef='<A id="cn'+iItem+'" name="cn'+iItem+'" class="menuType" href="javascript: top.CatMenuClick('+iItem+', '+length+', '+catType+');" ';
sHRef+=' onMouseOver="return sSts(this);"';
sHRef+=' onMouseDown="return sSts(this);"';
sHRef+=' onMouseUp="return cSts();"';
sHRef+=' onMouseOut="return cSts();"';
sHRef+=' title="Click to view '+title+'">';
sHRef+='<div id="divb'+iItem+'" class="CategoryButtonTop">';
sHRef+=text;
sHRef+='</div>';
sHRef+='</a>';
sMenu='<li ';
sMenu+=' STYLE="display:block"'
sMenu+=' class="'+sCSSClass+'" >';
sMenu+='<span class="menuTypeSpan">'+sHRef;
if(aMenuItemType[iItem].IsNode==1){
sMenu+='<ul id="cndiv'+iItem+'" style="display:none;"></ul>';
}
sMenu+='</span>';
return sMenu;
}
function TypeClick(index){
var menuType=aMenuItemType[index].Id;
if(top.iCurMenuType!=0){
document.getElementById('cn'+top.iCurMenuType).className='menuType';
}
document.getElementById('cn'+index).className='menuTypeActive';
top.iCurMenuType=index;
neotekscript('/catalog/menu/menuajax.aspx?Type='+menuType);
}
function TypeClickNew(ItemCat,CatType){
var elem='catHolder'+ItemCat;
if(document.getElementById(elem).getAttribute('loading')<1)
{
showcatprocessing(ItemCat);
neotekscript('/catalog/menu/menuajax.aspx?Type='+CatType+'&containerId='+ItemCat);
document.getElementById(elem).loading=1;
uploadNewCat=1;
}
}
function showcatprocessing(Type){
if(ProcessingTimeout!=null)
window.clearTimeout(ProcessingTimeout);
try{
document.getElementById('processing'+Type+'cat').style['display']="block";
}catch(e){
}
ProcessingTimeout=setTimeout(hidecatprocessing,5000)
}
function hidecatprocessing(Type){
window.clearTimeout(ProcessingTimeout);
ProcessingTimeout=null;
try{
document.getElementById('processing'+Type+'cat').style['display']="none";
}catch(e){
}
}
function CatMenuClick(ItemCat,nn,CatType){
var elem='';
goCategoryBottom=0;
goCategoryTop=0;
for(var ix=1;ix<nn+1;ix++){
elem='catHolder'+ix;
document.getElementById(elem).className='CatMenuHide';
}
elem='catHolder'+ItemCat;
document.getElementById(elem).className='CatMenuShow';
TypeClickNew(ItemCat,CatType);
var elem2='category'+ItemCat+'scrlayer';
curCatMenu='category'+ItemCat;
curCatMenuId=ItemCat;
var allHeights=pixel(document.getElementById('cn1').offsetHeight)*scrollerArray.length;
resizeElement('category');
var hh=scrollerHeight(elem2,allHeights);
}
function scrollerHeight(name,offsetHeight){
var vheight=500;
if(document.documentElement!=null){
vheight=pixel(document.documentElement.clientHeight);
}else{
vheight=pixel(window.innerHeight);
}
vheight=vheight-pixel(document.getElementById('toolbar').offsetHeight);
vheight=vheight-pixel(document.getElementById('categorytop').offsetHeight);
vheight=vheight-pixel(document.getElementById('categorybottom').offsetHeight);
vheight=vheight-offsetHeight+'px';
document.getElementById(name).style['height']=vheight;
return vheight;
}
function checkcatcontentsize(numcat){
var divcon=document.getElementById('category'+numcat+'content');
var contentHeight=pixel(divcon.offsetHeight);
var divscr=document.getElementById('category'+numcat+'scrlayer');
var scrlayerHeight=pixel(divscr.offsetHeight);
if(contentHeight>scrlayerHeight)
{document.getElementById(top.curCatMenu+'down').style['display']='block';
goCategoryBottom+=1;
}
else{document.getElementById(top.curCatMenu+'down').style['display']='none';goCategoryBottom=0;
}
return null;
}
function ShowHideLeftPanel(wcat,wInfo,catHide){
var w2=pixel(document.getElementById('category').style['width']);
var x=top.InfoFrame.location.href;
var len=x.length-24;
var y=x.substring(0,len);
var ylen=y.length;
var z=x.substring(ylen);
if((z=='EditContent.aspx?Id=2010')||(z=='EditContent.aspx?Id=2020')||(z=='EditContent.aspx?Id=2030')||(z=='EditContent.aspx?Id=2040')||(z=='EditContent.aspx?Id=2050')
||(z=='EditContent.aspx?Id=2060')||(z=='EditContent.aspx?Id=1010')||(z=='EditContent.aspx?Id=1020')||(z=='EditContent.aspx?Id=1030')||(z=='EditContent.aspx?Id=1035')
||(z=='EditContent.aspx?Id=1040')||(z=='EditContent.aspx?Id=1050')||(z=='EditContent.aspx?Id=1060')||(z=='EditContent.aspx?Id=1070')||(z=='EditContent.aspx?Id=3010')
||(z=='EditContent.aspx?Id=2020')||(z=='EditContent.aspx?Id=3030')||(z=='EditContent.aspx?Id=3040')||(z=='EditContent.aspx?Id=4010')||(z=='EditContent.aspx?Id=4020')
||(z=='EditContent.aspx?Id=4030')||(z=='/EditContent.aspx?Id=171'))catHide=1;
if((z=='ContentPage.aspx?Id=2010')||(z=='ContentPage.aspx?Id=2020')||(z=='ContentPage.aspx?Id=2030')||(z=='ContentPage.aspx?Id=2040')||(z=='ContentPage.aspx?Id=2050')
||(z=='ContentPage.aspx?Id=2060')||(z=='ContentPage.aspx?Id=1010')||(z=='ContentPage.aspx?Id=1020')||(z=='ContentPage.aspx?Id=1030')||(z=='ContentPage.aspx?Id=1035')
||(z=='ContentPage.aspx?Id=1040')||(z=='ContentPage.aspx?Id=1050')||(z=='ContentPage.aspx?Id=1060')||(z=='ContentPage.aspx?Id=1070')||(z=='ContentPage.aspx?Id=3010')
||(z=='ContentPage.aspx?Id=2020')||(z=='ContentPage.aspx?Id=3030')||(z=='ContentPage.aspx?Id=3040')||(z=='ContentPage.aspx?Id=4010')||(z=='ContentPage.aspx?Id=4020')
||(z=='ContentPage.aspx?Id=4030'))catHide=1;
if(catHide==1){
wInfo=wInfo+(wcat);
document.getElementById('category').style['width']='0px';
}else{
document.getElementById('category').style['width']=wcat+'px';
}
document.getElementById('InfoFrame').style['width']=wInfo+'px';
}
 
/* ---------- /JS/Status.js ---------- */
function sSts(el){
if(el.status)
window.status=el.status;
else
window.status=el.title;
return true;
}
function cSts(){
window.status='';
return true;
} 
/* ---------- /JS/rollover.js ---------- */
var aImg=new Array();
function setImg(img,i){
try{img.src=aImg[i].src;}catch(e){img.src=i;}
}
function rImg(x){
if(x.oSrc){x.src=x.oSrc;}
}
function lImg(src){
for(i=0;i<aImg.length;i++){
if(aImg[i].src==src){return i;}
}
aImg[i]=new Image();
aImg[i].src=src;
return i;
}
 
/* ---------- /JS/v3/MenuAdmin.js ---------- */
function $(id){return document.getElementById(id);}
function MenuItemMove(fromId,Offset,con){
try{
var url='/Catalog/Menu/menuItem.aspx?Id='+aMenuItem[fromId].Id+'&RefMenuId='+0+'&Action=move&Offset='+Offset;
neotekscript(url,null,MenuItemAjaxResponse);
return true;
}
catch(ex){
alert(ex.message);
}
}
var NewItemDoc;
function MenuItemAjaxResponse(xmlHttp){
if(xmlHttp.readyState==4&&xmlHttp.status==200){
var url='/Catalog/Menu/menuajax.aspx';
var text=xmlHttp.responseText;
text=text.toString().substring(text.search('<html>'));
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML('<div>'+text+'</div>');
var scripts=xmlDoc.getElementsByTagName('script');
for(var i=0;i<scripts.length;++i){
var script=scripts[i].text;
eval(script);
}
}
}
function MenuItemNew(iParentItem,con){
NewItemDoc=con;
iCurMenuItem=iParentItem;
var Node=GetElement(con,'n'+iParentItem);
idx=iParentItem;
var url='/Catalog/Menu/menuItem.aspx?Action=New&id='+aMenuItem[idx].Id;
if(aMenuItem[idx].Id===null){
alert(url);
return;
}
if(Node.style.display=="none"){
if(aMenuItem[idx]){
Node.style.display="";
neotekscript(url,null,MenuItemAjaxResponse);
}else{
neotekscript(url+'&parentNode='+iParentItem,null,MenuItemAjaxResponse);
}
}else{
neotekscript(url,null,MenuItemAjaxResponse);
}
}
function MenuItemNameSet(iItem,value,con){
var node=GetElement(con,'n'+iItem);
node.style.display='';
node.title=value;
var url='/Catalog/Menu/menuItem.aspx?Action=rename&id='+aMenuItem[iItem].Id+'&Title='+value;
neotekscript(url,null,MenuItemAjaxResponse);
iLevel=MenuItemLevel(iItem);
if(value.length>iTitleChars-(iLevel*3)){value=value.substring(0,iTitleChars-(iLevel*3))+'...';}
node.innerHTML=value;
aMenuItem[iItem].Text=value;
node=GetElement(con,'edit'+iItem);
node.style.display='none';
return false;
}
function MenuItemParentSet(iItem,ParentItem,con){
var idx=iItem;
var oldParentItem=aMenuItem[idx].Parent;
if(ParentItem!=oldParentItem&&ParentItem!==0){
aMenuItem[iItem].Parent=ParentItem;
neotekscript('/Catalog/Menu/menuItem.aspx?Action=ParentSet&id='+aMenuItem[iItem].Id+'&ParentId='+aMenuItem[ParentItem].Id+'&RefMenuId='+aMenuItem[oldParentItem].Id,null,MenuItemAjaxResponse);
}
iCurMenuItem=0;
var innerHTML;
var ndivobj=GetElement(con,'n'+iItem);
if(ndivobj){
ndivobj.style.display='none';
ndivobj.innerHTML='';
ndivobj.id='orphan';
var divobj=ndivobj.parentNode.parentNode;
innerHTML=divobj.innerHTML;
divobj.style.display='none';
divobj.innerHTML='';
divobj.id='orphan';
}
if(ParentItem!=oldParentItem){
var Previous=aMenuItem[idx].Previous;
var Next=aMenuItem[idx].Next;
if(Previous!==0){
if(Next!==0){
aMenuItem[Previous].Next=Next;}
}else{
aMenuItem[oldParentItem].FirstChild=Next;
}
if(Next!==0){
aMenuItem[Next].Previous=Previous;
}else{
aMenuItem[oldParentItem].LastChild=Previous;
}
if(Next===0&&Previous===0){
aMenuItem[oldParentItem].IsNode=false;
toggleNode(oldParentItem,con);
}
}
if(ParentItem!==0){
var parent=aMenuItem[ParentItem];
var item=aMenuItem[idx];
if(parent.IsActive){
aMenuItem[idx].LinkId=0;
insertChildNodes(ParentItem,null);
}
}
}
function MenuItemRename(iItem,con){
GetElement(con,'n'+iItem).style.display='none';
var input=GetElement(con,'edit'+iItem);
if(!!!input){
input=document.createElement('input');
input.id='edit'+iItem;
var obj=GetElement(con,'n'+iItem);
obj.parentNode.appendChild(input);
input.onkeypress=function(e){if(isEnter(e)){MenuItemNameSet(iItem,input.value,null);}};
}
input.style.display='';
input.value=aMenuItem[iItem].Text;
input.focus();
}
function InsertNewItem(id){
var con=NewItemDoc;
var iParentItem=iCurMenuItem;
var iNewItem=addMenuItem(iParentItem,id,'New category',1,1,false,true);
MenuItemParentSet(iNewItem,iParentItem,con);
var itemobj=GetElement(con,'n'+iNewItem);
var parentobj=GetElement(con,'n'+iParentItem);
itemobj.className='MenuSelected';
parentobj.className='MenuUnselected';
iCurMenuItem=iNewItem;
MenuItemRename(iNewItem,con);
}
function getNodeById(id){
idx=cId;
while(idx<aMenuItem.length){
if(aMenuItem[idx]==id){
return(idx-cId)/cMenuItemDim+1;
}
idx+=cMenuItemDim;
}
return 0;
}
function RenameNewItem(id){
var con=NewItemDoc;
var iParentItem=iCurMenuItem;
var iNewItem=getNodeById(id);
var itemobj=GetElement(con,'n'+iNewItem);
var parentobj=GetElement(con,'n'+iParentItem);
itemobj.className='MenuSelected';
parentobj.className='MenuUnselected';
iCurMenuItem=iNewItem;
MenuItemRename(iNewItem,con);
}
function MenuItemIndent(iItem,con){
var newparentitem=aMenuItem[iItem].Previous;
if(newparentitem>1){MenuItemParentSet(iItem,newparentitem,con);}
}
function DropMenuItemParentSet(iItem,objParent){
var moveToObjId=objParent.id.replace('n','');
var parentId=aMenuItem[moveToObjId].Parent;
if(parentId===null){parentId=0;}
if(MenuItemMove(iItem,moveToObjId)){
var url='/Catalog/Menu/menuItem.aspx?Id='+aMenuItem[iItem].Id;
if(parentId==aMenuItem[iItem].Parent){
url+='&Action=move&RefMenuId='+aMenuItem[moveToObjId].Id+'&Offset=-1';
}else{
url+='&Action=ParentSet&ParentId=';
if(aMenuItem[parentId].Id>1){
url+=aMenuItem[parentId].Id;
}
else{
url+='0&RefMenuId='+aMenuItem[moveToObjId].Id;
}
}
neotekscript(url,null,MenuItemAjaxResponse);
}
}
function isChild(iParentItem,iItem){
if(aMenuItem[iItem].IsNode===false){
return false;
}else if(iParentItem==iItem){
return true;
}else{
return isChild(iParentItem,aMenuItem[iItem].Parent);
}
}
function MenuItemDelete(iItem,con){
if(confirm("Are you sure you want to permenantly delete "+aMenuItem[iItem].Text+"?")){
MenuItemParentSet(iItem,0,con);
neotekscript('/Catalog/Menu/menuItem.aspx?Action=Delete&id='+aMenuItem[iItem].Id,null,MenuItemAjaxResponse);
}
}
function MenuItemOutdent(iItem,con){
var oldParentItem=aMenuItem[iItem].Parent;
var newparentitem=aMenuItem[oldParentItem].Parent;
MenuItemParentSet(iItem,newparentitem,con);
}
function MenuItemActiveToggle(iItem,con){
var node=GetElement(con,'n'+iItem);
var active=0;
var idx=iItem;
if(aMenuItem[idx].IsActive===false){
node.style.color='';
aMenuItem[idx].IsActive=true;
active=1;
}else{
node.style.color='gray';
aMenuItem[idx].IsActive=false;
active=0;
}
var url='/Catalog/Menu/menuItem.aspx?Action=active&id='+aMenuItem[idx].Id+'&Active='+active;
neotekscript(url,null,MenuItemAjaxResponse);
}
 
/* ---------- /JS/v3/NeotekPopup.js ---------- */
var NeotekPopup={
_title:null,
_url:null,
_src:null,
_includeClose:true,
_className:null,
_closeOnLoseFocus:false,
_width:'200',
_height:'400',
_allowDrag:true,
_customPosition:null,
_doFade:false,
_doAnimate:null,
_fadeBoxIn:false,
_autoResize:true,
_backgroundColor:'Transparent',
_showTriangle:null,
_message:'',
SetDefault:function(){
var o=NeotekPopup;
o._title=null;
o._url=null;
o._src='';
o._includeClose=true;
o._className='neotekPopupBase';
o._closeOnLoseFocus='';
o._width='600';
o._height='420';
o._allowDrag=true;
o._customPosition=null;
o._doFade=true;
o._doAnimate=null;
o._fadeBoxIn=false;
o._autoResize=false;
o._backgroundColor=null;
o._showTriangle=null;
o._message='';
return o;
},
Show:function(settings){
var o=NeotekPopup.SetDefault();
if(settings.Title)o._title=settings.Title;
if(settings.URL)o._url=settings.URL;
if(settings.src)o._src=settings.src;
if(settings.IncludeClose!=null)o._includeClose=settings.IncludeClose;
if(settings.ClassName)o._className=settings.ClassName;
if(settings.CloseOnLoseFocus!=null)o._closeOnLoseFocus=settings.CloseOnLoseFocus;
if(settings.Width)o._width=settings.Width;
if(settings.Height)o._height=settings.Height;
if(settings.AllowDrag!=null)o._allowDrag=settings.AllowDrag;
if(settings.DoFade!=null)o._doFade=settings.DoFade;
if(settings.Animate)o._doAnimate=settings.Animate;
if(settings.FadeBoxIn!=null)o._fadeBoxIn=settings.FadeBoxIn;
if(settings.AutoResize!=null)o._autoResize=settings.AutoResize;
if(settings.BackgroundColor)o._backgroundColor=settings.BackgroundColor;
if(settings.ShowTriangle!=null)o._showTriangle=settings.ShowTriangle;
if(settings.Message!=''&&settings.Message!=null)o._message=settings.Message;
if(settings.Position){
var e=!!settings.Position?settings.Position:window.event;
var ooo=null;
try{ooo=top.document.getElementById('InfoFrame');}catch(ex){}
var offsetTop=0
var offsetLeft=0;
if(ooo){
offsetTop=ooo.offsetTop;
offsetLeft=ooo.offsetLeft;
}
o._customPosition=[e.clientX+offsetLeft,e.clientY+offsetTop];
}
o.Popup();
if(o._message!='')
setTimeout('NeotekPopup.GetUrlCallback(NeotekPopup._message);',100);
else if(o._src!='')
NeotekPopup.GetImage(o._src);
else
o.GetUrl(o._url);
},
Close:function(){
var o=$top('Neotek_Popup');
if(o)o.style.display='none';
Fade.FadeOut('fadePopup',60);
if(o)document.body.removeChild(o);
},
GetUrl:function(url){
url=url.replace('~/','http://'+window.location.host+'/');
try{
top.neotekText(url,NeotekPopup.GetUrlCallback,null);
}catch(ex){neotekText(url,NeotekPopup.GetUrlCallback,null);}
},
GetImage:function(src){
var bgColour=NeotekPopup._backgroundColor;
var o=$top('Neotek_Popup_Content');
if(!!!o)return;
if(bgColour)
o.style.backgroundColor=bgColour;
o.innerHTML='<img src=\"'+src+'\"/>';
var i=new Image();
i.onload=NeotekPopup.SetPosition;
i.src=src;
},
GetUrlCallback:function(retVal){
var bgColour=NeotekPopup._backgroundColor;
var o=$top('Neotek_Popup_Content');
if(!!!o)return;
if(bgColour)
o.style.backgroundColor=bgColour;
o.innerHTML=retVal;
NeotekPopup.SetPosition();
},
SetPosition:function(){
var bgColour=NeotekPopup._backgroundColor;
if(NeotekPopup._doAnimate)
Animate.Start('Neotek_Popup',[50,50],[NeotekPopup._width,o.offsetHeight],1000,NeotekPopup._doAnimate);
o=$top('Neotek_Popup');
o.style.display='block';
if(NeotekPopup._fadeBoxIn)Fade.FadeIn(o.id,100,1000);
if(NeotekPopup._autoResize){
o.style.width=null;
o.style.height=null;
}else{
o.style.width=NeotekPopup._width+'px';
o.style.height=NeotekPopup._height+'px';
}
var scrollY=0;
try{scrollY=parseInt(GetScrollPosition());}catch(ex){}
var xPos='left';
var left=0;
var topPos=0;
o.style.margin='0px';
var screenW=GetScreenWidth();
var screenH=GetScreenHeight();
var offset=5;
if(NeotekPopup._customPosition){
topPos=NeotekPopup._customPosition[1]+scrollY-offset;
left=NeotekPopup._customPosition[0]-offset;
}else{
topPos=(screenH/2)-(NeotekPopup._height/2)+scrollY;
left=(screenW/2)-(NeotekPopup._width/2);
}
if(NeotekPopup._customPosition){
var rightedge=left+parseInt(o.offsetWidth);
if(rightedge>screenW){
xPos='right';
left=left-o.offsetWidth+(offset*2);
}
var isTop=true;
bottomedge=topPos+o.offsetHeight;
if(bottomedge>screenH){
topPos=topPos-o.offsetHeight+(offset*2);
isTop=false;
}
if(NeotekPopup._showTriangle==null){
NeotekPopup._showTriangle=new Array();
NeotekPopup._showTriangle[1]=isTop?'top':'bottom';
NeotekPopup._showTriangle[0]=xPos;
}
}
if(left<0){
left=10;
}
o.style.left=left+'px';
if(topPos<0){
xPos='none';
topPos=10;
}
o.style.top=topPos+'px';
var title=$top('neotekPopupTitle');
if(title&&bgColour)title.style.backgroundColor=bgColour;
if(bgColour)
$top('popContentArea').style.backgroundColor=bgColour;
if(Set.isTop){
top.RoundedTop("div#Neotek_Popup","Transparent",bgColour);
top.RoundedBottom("div#roundedDivBottom","Transparent",bgColour);
}else{
RoundedTop("div#Neotek_Popup","Transparent",bgColour);
RoundedBottom("div#roundedDivBottom","Transparent",bgColour);
}
if(NeotekPopup._showTriangle&&xPos!='none'){
NeotekPopup._showTriangle=new Array();
NeotekPopup._showTriangle[1]=isTop?'top':'bottom';
NeotekPopup._showTriangle[0]=xPos;
var isTop=(NeotekPopup._showTriangle[1].toLowerCase()=='top');
NeotekPopup.DisplayTriangle(o,NeotekPopup._showTriangle[0],isTop,bgColour);
}
var o=$top('Neotek_Popup_Content');
var scripts=o.getElementsByTagName('script');
for(var i=0;i<scripts.length;++i){
try{
eval(scripts[i].innerHTML);
}catch(e){}
}
},
Popup:function(){
var o=Set.doc.createElement('div');
o.className=NeotekPopup._className;
o.id='Neotek_Popup';
o.style.width=NeotekPopup._width+'px';
var innerText='';
if(NeotekPopup._title!=''&&NeotekPopup._title!=null){
innerText+='<div id="neotekPopupTitle" class="neotekPopupTitle" ';
if(NeotekPopup._allowDrag)innerText+=' title="Click, hold and move to drag" ';
innerText+='>';
innerText+='<div id="roundedDivTop"></div>';
innerText+=NeotekPopup._title+'</div>';
}
if(NeotekPopup._includeClose)
innerText+='<div class="neotekPopupClose" onclick="NeotekPopup.Close()"></div>';
innerText+='<div id="popContentArea" class="Neotek_Popup_Content Neotek_Popup_BackgroundColour"><div id="Neotek_Popup_Content"></div></div>';
innerText+='<div id="roundedDivBottom"></div>';
o.innerHTML=innerText;
var doClose=null;
if(NeotekPopup._closeOnLoseFocus){
doClose=NeotekPopup.Close;
o.onmouseout=NeotekPopup.OnLooseFocus;
}
if(NeotekPopup._doFade){
Fade.Create('fadePopup','divModalFade',1500,doClose);
}
try{Set.doc.body.appendChild(o);}catch(ex){}
if(NeotekPopup._allowDrag){
var drg=$top('neotekPopupTitle');
if(!!!drg)drg=o;
Drag.Init(drg,o);
o.onDragStart=function(){
var oo=$top('triangleDiv');
if(!!!oo)return;
if(oo.style.display!='none')
oo.style.display='none';
}
}
},
DisplayTriangle:function(obj,XPos,isTop,bgColour){
var triangleTxt='<div style="position:relative;display:block;height:20px;"><div id="triangleDiv" class="triangle"></div><div id="triangleOverlayDiv" class="triangleoverlay"></div></div>';
if(!isTop){
obj.innerHTML=obj.innerHTML+triangleTxt;
}else{
obj.innerHTML=triangleTxt+obj.innerHTML;
}
var os=$top('Neotek_Popup').style;
var t=$top('triangleDiv');
var to=$top('triangleOverlayDiv');
if(!!!t)return;
t.style.borderColor='Transparent';
t.style.borderWidth='20px';
t.style.borderStyle='Solid';
t.style.position='absolute';
to.style.borderColor='Transparent';
to.style.borderStyle='Solid';
to.style.borderWidth='17px';
to.style.position='absolute';
if(isTop){
t.style.top='-23px';
t.style.borderBottomColor=bgColour;
to.style.top='-17px';
to.style.borderBottomColor='white';
os.top=parseInt(os.top.replace('px',''))-5+'px';
}else{
t.style.top='-10px';
t.style.borderTopColor=bgColour;
to.style.top='-11px';
to.style.borderTopColor='white';
os.top=parseInt(os.top.replace('px',''))-25+'px';
}
var width=obj.offsetWidth;
var Left=0;
switch(XPos.toLowerCase()){
case"left":
Left=30;
os.left=parseInt(os.left.replace('px',''))-45+'px';
break;
case"center":
Left=(width/2)-10;break;
case"right":
Left=width-60;
os.left=parseInt(os.left.replace('px',''))+40+'px';
break;
}
t.style.left=Left+'px';
to.style.left=Left+3+'px';
},
OnLooseFocus:function(e){
e=!!e?e:window.event;
var o=e.target||e.srcElement;
fixOnMouseOut(this,e,'NeotekPopup.Close()');
}
};
function GetWhichDocument(){
var obj=null;
try{
if(top.document.getElementById('InfoFrame')!=null){
obj=top.document;
}else{
obj=document;
}
}catch(ex){obj=document;}
return obj;
}
function DetermineIfTop(){
if(top!=null){
try{
if(top.document.getElementById('InfoFrame')!=null){
return true;
}else{
return false;
}
}
catch(ex){return false;}
}else{
return false;
}
}
var Set={
doc:GetWhichDocument(),
isTop:DetermineIfTop()
};
function $top(id){return Set.doc.getElementById(id);}
var Fade={
Create:function(id,className,zIndex,closeOnClick){
if(!!!zIndex)zIndex=15000;
var fadeDiv=Set.doc.createElement('div');
fadeDiv.id=id;
fadeDiv.className=className;
fadeDiv.style.zIndex=zIndex;
fadeDiv.onclick=closeOnClick;
Set.doc.body.appendChild(fadeDiv);
Fade.FadeIn(fadeDiv.id,60,500);
},
FadeIn:function(id,opacity,ms){
var o=$top(id);
o.style.opacity=0;
o.style.display='block';
Fade.ToggleFade(id,ms,opacity);
},
FadeOut:function(id,opacity){
var o=$top(id);
if(!!!o)return;
Fade.ToggleFade(id,500,opacity);
},
ToggleFade:function(el,milli,opac){
var currOpacity=$top(el).style.opacity;
if(currOpacity!=0){
Fade.DoFade(el,milli,opac,0);
}else{
Fade.DoFade(el,milli,0,opac);
}
},
DoFade:function(el,milli,start,end){
var fadeTime=Math.round(milli/100);
var i=0;
if(start<end){
for(j=start;j<=end;j++){
var expr="Fade.ChangeOpacity('"+el+"',"+j+")";
var timeout=i*fadeTime;
setTimeout(expr,timeout);
i++;
}
}
else if(start>end){
for(j=start;j>=end;j--){
var expr="Fade.ChangeOpacity('"+el+"',"+j+", true)";
var timeout=i*fadeTime;
setTimeout(expr,timeout);
i++;
}
}
},
ChangeOpacity:function(el,opacity,val){
var image=$top(el);
if(image==null)return;
image.style.MozOpacity=(opacity/100);
image.style.filter="alpha(opacity="+opacity+")";
image.style.opacity=(opacity/100);
if(image.style.opacity==0&&val){
if(!!image)Set.doc.body.removeChild(image);
}
}
};
var Drag={
obj:null,
Init:function(o,rootElem){
if(!!!o)return;
o.onmousedown=Drag.Start;
o.root=rootElem;
o.onDragStart=null;
},
Start:function(e){
var o=Drag.obj=this;
e=Drag.FixE(e);
var y=parseInt(o.root.style.top);
var x=parseInt(o.root.style.left);
o.lastMouseX=e.clientX;
o.lastMouseY=e.clientY;
if(o.onDragStart!=null)o.onDragStart(e);
Set.doc.onmousemove=Drag.Drag;
Set.doc.onmouseup=Drag.End;
},
Drag:function(e){
e=Drag.FixE(e);
var o=Drag.obj;
if(!!!o)return;
var ey=e.clientY;
var ex=e.clientX;
var y=parseInt(o.root.style.top);
var x=parseInt(o.root.style.left);
if(!!!y)y=ey+o.offsetHeight+(o.root.offsetTop/2);
if(!!!x)x=parseInt(o.root.offsetLeft)+(parseInt(o.root.clientWidth)/2);
var nx,ny;
nx=x+(ex-o.lastMouseX);
ny=y+(ey-o.lastMouseY);
if(ny<150&&!!!o.root.style.top)ny+=150;
o.root.style.left=nx+'px';
o.root.style.top=ny+'px';
o.lastMouseX=ex;
o.lastMouseY=ey;
},
End:function(e){
Set.doc.onmousemove=null;
Set.doc.onmouseup=null;
Drag.obj.root.lastMouseX=null;
Drag.obj.root.lastMouseY=null;
Drag.obj=null;
},
FixE:function(e){
if(Set.isTop){
if(typeof e=='undefined')e=top.window.event;
}else{
if(typeof e=='undefined')e=window.event;
}
if(typeof e.layerX=='undefined')e.layerX=e.offsetX;
if(typeof e.layerY=='undefined')e.layerY=e.offsetY;
return e;
}
};
var Animate={
_strSize:[0,0],
_endSize:[1,1],
_tempVal:null,
Start:function(id,strSize,endSize,ms,type){
Animate._tempVal=null;
var o=$(id);
if(!!!o)return;
o.style.width=strSize[0]+'px';
o.style.height=strSize[1]+'px';
Animate._strSize=strSize;
Animate._endSize=endSize;
var expr;
switch(type.toLowerCase()){
case"topleft":expr="Animate.ExpandFromTopLeft";break;
case"left":expr="Animate.ExpandFromLeft";break;
case"topright":expr="Animate.ExpandFromTopRight";break;
case"right":expr="Animate.ExpandFromRight";break;
case"top":expr="Animate.ExpandFromTop";break;
case"bottom":expr="Animate.ExpandFromBottom";break;
default:expr="Animate.ExpandFromTopLeft";break;
}
Animate.Resize(o.id,ms,expr);
},
Resize:function(id,milli,type){
var start=Animate._strSize[0];
var end=Animate._endSize[0];
var fadeTime=Math.round(milli/1000);
var screenH=GetScreenHeight();
for(i=start;i<=end;++i){
var x=i;
var y=parseInt(Animate._strSize[1])+i;
var expr=type+"('"+id+"',"+x+", "+y+", "+screenH+")";
var timeout=i*fadeTime;
setTimeout(expr,timeout);
}
},
ExpandFromTopLeft:function(id,x,y){
var o=$(id);if(!!!o)return;
if(x<=Animate._endSize[0])o.style.width=x+'px';
if(y<=Animate._endSize[1])o.style.height=y+'px';
},
ExpandFromLeft:function(id,x,y){
var o=$(id);if(!!!o)return;
if(x<=Animate._endSize[0])o.style.width=x+'px';
o.style.height=Animate._endSize[1]+'px';
},
ExpandFromTopRight:function(id,x,y){
var o=$(id);if(!!!o)return;
var left=Animate._tempVal;
var endSizeX=parseInt(Animate._endSize[0]);
if(Animate._tempVal==null){
left=parseInt(o.style.left.replace('px',''));
if(isNaN(left))left=endSizeX-parseInt(o.offsetLeft)+50;
Animate._tempVal=left;
}
left=left+endSizeX-parseInt(x);
o.style.left=left+'px';
if(x<=endSizeX)o.style.width=x+'px';
if(y<=Animate._endSize[1])o.style.height=y+'px';
},
ExpandFromRight:function(id,x,y){
var o=$(id);if(!!!o)return;
var left=Animate._tempVal;
var endSizeX=parseInt(Animate._endSize[0]);
if(Animate._tempVal==null){
left=parseInt(o.style.left.replace('px',''));
if(isNaN(left))left=endSizeX-parseInt(o.offsetLeft)+50;
Animate._tempVal=left;
}
left=left+endSizeX-parseInt(x);
o.style.left=left+'px';
if(x<=endSizeX)o.style.width=x+'px';
o.style.height=Animate._endSize[1]+'px';
},
ExpandFromTop:function(id,x,y){
var o=$(id);if(!!!o)return;
if(y<=Animate._endSize[1])o.style.height=y+'px';
o.style.width=Animate._endSize[0]+'px';
},
ExpandFromBottom:function(id,x,y,screenH){
var o=$(id);if(!!!o)return;
var top=Animate._tempVal;
var endSizeY=parseInt(Animate._endSize[1]);
if(Animate._tempVal==null){
top=parseInt(o.style.top.replace('px',''));
if(isNaN(top))top=endSizeY-(parseInt(o.offsetTop)+parseInt(o.offsetHeight));
Animate._tempVal=top;
}
var chk=top;
var endSizeY=parseInt(Animate._endSize[1]);
if(screenH-endSizeY<100&&screenH-endSizeY>0){chk-=(screenH-endSizeY)+80;}
top=top+endSizeY-parseInt(y);
if(top>chk)o.style.top=top+'px';
if(y<=Animate._endSize[1])o.style.height=y+'px';
o.style.width=Animate._endSize[0]+'px';
o.style.marginTop='0px';
}
};
function GetScreenHeight(){
iw=0;var doc=null;
try{doc=top.document;}catch(ex){doc=document;}
ih=(doc.documentElement.clientHeight?doc.documentElement.clientHeight:doc.body.clientHeight);
return ih;
}
function GetScreenWidth(){
iw=0;var doc=null;
try{doc=top.document;}catch(ex){doc=document;}
iw=(doc.documentElement.clientWidth?doc.documentElement.clientWidth:doc.body.clientWidth);
return iw;
}
function GetScrollPosition(){
if(typeof top.window.pageYOffset!="undefined"){
var scroll=top.window.pageYOffset;
}else if(typeof top.document.documentElement.scrollTop!="undefined"){
var scroll=top.document.documentElement.scrollTop;
}else{
var scroll=top.document.body.scrollTop;
}
return scroll;
}
function is_child_of(parent,child){
if(child!=null){
while(child.parentNode){
if((child=child.parentNode)==parent)
return true;
}
}
return false;
}
function fixOnMouseOut(element,event,JavaScript_code){
var current_mouse_target=null;
if(event.toElement)
current_mouse_target=event.toElement;
else if(event.relatedTarget)
current_mouse_target=event.relatedTarget;
if(!is_child_of(element,current_mouse_target)&&element!=current_mouse_target)
eval(JavaScript_code);
}
function NCheck(){
if(!document.getElementById||!document.createElement)
return(false);
var b=navigator.userAgent.toLowerCase();
if(b.indexOf("msie 5")>0&&b.indexOf("opera")==-1)
return(false);
return(true);
}
function Rounded(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
var l=v.length;
for(i=0;i<l;i++){
AddTop(v[i],bk,color,size);
AddBottom(v[i],bk,color,size);
}
}
function RoundedTop(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
AddTop(v[i],bk,color,size);
}
function RoundedBottom(selector,bk,color,size){
var i;
var v=getElementsBySelector(selector);
for(i=0;i<v.length;i++)
AddBottom(v[i],bk,color,size);
}
function AddTop(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size&&size=="small"){cn="rs";lim=2;}
d.className="rtop";
d.style.backgroundColor=bk;
for(i=1;i<=lim;i++){
var x=document.createElement("b");
x.className=cn+i;
if(color)
x.style.backgroundColor=color;
else
x.className+=' Neotek_Popup_BackgroundColour';
d.appendChild(x);
}
el.insertBefore(d,el.firstChild);
}
function AddBottom(el,bk,color,size){
var i;
var d=document.createElement("b");
var cn="r";
var lim=4;
if(size&&size=="small"){cn="rs";lim=2;}
d.className="rbottom";
d.style.backgroundColor=bk;
for(i=lim;i>0;i--){
var x=document.createElement("b");
x.className=cn+i;
if(color)
x.style.backgroundColor=color;
else
x.className+=' Neotek_Popup_BackgroundColour';
d.appendChild(x);
}
el.appendChild(d,el.firstChild);
}
function getElementsBySelector(selector){
var i;
var s=[];
var selid="";
var selclass="";
var tag=selector;
var objlist=[];
if(selector.indexOf(" ")>0){
s=selector.split(" ");
var fs=s[0].split("#");
if(fs.length==1)return(objlist);
return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
}
if(selector.indexOf("#")>0){
s=selector.split("#");
tag=s[0];
selid=s[1];
}
if(selid!=""){
objlist.push(document.getElementById(selid));
return(objlist);
}
if(selector.indexOf(".")>0){
s=selector.split(".");
tag=s[0];
selclass=s[1];
}
var v=document.getElementsByTagName(tag);
if(selclass=="")
return(v);
for(i=0;i<v.length;i++){
if(v[i].className==selclass){
objlist.push(v[i]);
}
}
return(objlist);
}
function SubmitNewAddressForm(f){
var o=$('__VIEWSTATE');
if(o){
o.parentNode.removeChild(o);
}
o=$('CityID');
for(var i=0;i<o.options.length;++i){
o.options[i].value=o.options[i].innerHTML;
}
var str=getFormValues(f);
neotekscript('/Basket/NewDeliveryAddress.aspx',str);
}
function AddressSaved(Id){
var Address='';
Address=document.getElementById('Street1').value;
Address+=", ";
Address=document.getElementById('Street2').value;
Address+=", ";
Address=document.getElementById('Town').value;
Address+=", ";
Address=document.getElementById('CityID').value;
if(opener==null){
top.InfoFrame.setAddress(Address,Id);
top.InfoFrame.window.location.reload();
NeotekPopup.Close();
}else{
opener.setAddress(Address,Id);
window.close();
}
} 
/* ---------- /JS/v3/ProductView.js ---------- */
function favouriteclick(e){
try{
var srcel=Event.Get(e).src;
var id=srcel.getAttribute('productid');
var cssclass=srcel.className;
if(id!=null){
var action='Remove';
if(cssclass!='favourite')action='Add';
top.neotekscript('/Catalog/Favourites.aspx?Action='+action+'&ProductID='+id+'&AJAX=1',null,processScriptLocal);
}
}catch(e){
alert(e.message);
}
}
function processScriptLocal(xmlHttp){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var scripts=xmlHttp.responseXML.getElementsByTagName("scripts")[0];
if(scripts!=null){
var script='';
for(var i=0;i<scripts.childNodes.length;i++){
try{
if(scripts.childNodes[i].textContent!=null){
script=scripts.childNodes[i].textContent;
}else{
script=scripts.childNodes[i].text;
}
eval(script);
}catch(e){
alert(script+e.message);
}
}
}else{
alert('Failed to get a response!');
}
}
}
}
function favouriteSet(id,state){
var el=document.getElementById('favourite'+id);
if(el!=null){
if(state==true){
el.title=el.ontitle;
el.className='favourite';
}else{
el.title=el.offtitle;
el.className='notfavourite';
}
}
}
var ProductImages={
Show:function(){
var nodes=document.getElementsByTagName('IMG');
var lth=nodes.length;
for(var i=0;i<lth;++i){
var o=nodes[i].getAttribute('path');
if(o!=null){
nodes[i].src=o;
nodes[i].style.display='block';
nodes[i].style.filter='alpha(opacity=100)';
}
}
},
Hide:function(){
var nodes=document.getElementsByTagName('IMG');
var lth=nodes.length;
for(var i=0;i<lth;++i){
var o=nodes[i].getAttribute('path');
if(o!=null)nodes[i].style.display='none';
}
},
Check:function(){
var o=document.getElementById('chkShowImages');
if(!!!o)alert('chkShowImages Element not found');
if(o.checked){
ProductImages.Show();
}
else{
ProductImages.Hide();
}
},
Checked:function(){
var o=document.getElementById('chkShowImages');
if(!!!o)alert('chkShowImages Element not found');
var ShowImages='true'
if(o.checked){
ShowImages='true';
}
else{
ShowImages='false';
}
var url='/Catalog/ProductView.aspx'+QueryString('ShowImages',ShowImages)
top.neotekText(url,null);
ProductImages.Check();
}
};
function ShowLoadingImage(){
var oo=document.getElementById('ItemPanel');
oo.innerHTML='';
var div=document.createElement('div');
div.style.textAlign='center';
div.innerHTML='<img src="/Owner/Skin/images/progress.gif" />';
oo.appendChild(div);
}
function ChangeProductView()
{
var o=document.getElementById('ListStyle');
var view=o.options[o.selectedIndex];
view=view.getAttribute('ViewID');
ShowLoadingImage();
top.neotekText('/Catalog/ProductView.aspx'+QueryString('ChangeView',view),ProductViewCallback);
}
function ChangeSearchMode()
{
var o=document.getElementById('ListSearchMode');
var mode=o.options[o.selectedIndex];
mode=mode.getAttribute('ModeID');
ShowLoadingImage();
window.location='/Catalog/ProductView.aspx'+QueryString('SearchMode',mode);
}
function ChangePage(PageNum){
ShowLoadingImage();
window.location='/Catalog/ProductView.aspx'+QueryString('PageNo',PageNum);
}
function QueryString(key,value){
var url=window.location.search;
if(url.length>1)url=url.substring(1);
else return null;
var querystring='';
var keyValuePairs=url.split("&");
for(var i=0;i<keyValuePairs.length;++i){
var k=keyValuePairs[i].split('=')[0];
if(k.toLowerCase()!=key.toLowerCase()){
if(k.toLowerCase()=='ref'||k.toLowerCase()=='id'||k.toLowerCase()=='txtsearch'||k.toLowerCase()=='tempview'){
querystring+='&'+keyValuePairs[i];
}
}
}
querystring+='&'+key+'='+value;
return'?'+querystring.substring(1);
}
function UpdatePageSize(e){
e=e||window.event;
var o=e.target||e.srcElement;
window.location='/Catalog/ProductView.aspx'+QueryString('PageSize',o.value);
}
function ProductViewCallback(retVal){
var o=document.getElementById('ItemPanel');
if(o){
o.innerHTML=retVal;
var scriptNodes=o.getElementsByTagName('script');
var lth=scriptNodes.length;
for(var i=0;i<lth;++i){
if(scriptNodes[i].src!=''){
var script=document.createElement('script');
script.src=scriptNodes[i].src.toString();
o.appendChild(script);
}
else
eval(scriptNodes[i].innerHTML);
}
}
}
function ShowInventoryPopup(e,id)
{
var settings={
URL:'/Catalog/InventoryPopup.aspx?Ajax=1&ProductId='+id,
Title:'Inventory',
ShowClose:true,
Position:e,
ShowTriangle:false,
Width:400,
DoFade:false,
CloseOnLoseFocus:false
};
top.cancelPropagation(e);
top.NeotekPopup.Show(settings);
e=e||window.event;
var obj=e.target||e.srcElement;
if(obj.className=='NoStock'){
ShowInventoryPopupEtaTab(0);
}
}
function ShowInventoryPopupEtaTab(count){
if(count>10)return;
if(top.$('invETATab')){
top.ShowTab(1);
}else{
setTimeout('ShowInventoryPopupEtaTab('+(count+1)+')',500);
}
}
function ShowImage(e,imageURL)
{
var settings={
src:imageURL,
ShowClose:false,
Position:e,
AutoResize:true,
DoFade:false,
CloseOnLoseFocus:true
};
top.cancelPropagation(e);
top.NeotekPopup.Show(settings);
}
function ShowTab(num)
{
var stock=document.getElementById('invStockTbl');
var eta=document.getElementById('invETATbl');
if(num==0){
stock.style.display='block';
eta.style.display='none';
}else{
stock.style.display='none';
eta.style.display='block';
}
}
function OnUnloadCheck(){
var hasItems=false;
var df=document.forms['OrderPad'];
if(df){
if(df.Qty){
if(df.Qty.length){
for(var i=0;i<df.Qty.length;i++){
var qty;
if(df.Qty[i].value==""){
qty=0;
}
else{
qty=df.Qty[i].value
}
var orgQty;
if(df.OrgQty[i].value==""){
orgQty=0;
}
else{
orgQty=df.OrgQty[i].value
}
if((qty-orgQty)>0){
hasItems=true;
break
}
}
}
else if(df.OrgQty!=undefined){
var orgQty;
var qty;
if(df.OrgQty.value==""){
orgQty=0;
}
else{
orgQty=parseInt(df.OrgQty.value);
}
if(df.Qty.value==""){
qty=0;
}
else{
qty=parseInt(df.Qty.value);
}
if((qty-orgQty)>0){
hasItems=true;
}
}
else{
hasItems=(df.Qty.value!='');
}
}
}
if(hasItems){
if(confirm('You have items not yet submitted to your basket.\n Would you like to add these to your basket now?')){
var vals=top.getFormValues(df);
top.neotekscript(df.action,vals);
}
}
}
window.onbeforeunload=OnUnloadCheck;//IE "can't run from freed script" error if onunload tried.(IE7,Vista) 
/* ---------- /JS/v3/setup.js ---------- */
sSkinPath='/default';
setTheory=true;
var categoryscroller;
var basketscroller;
var mainmenuVer=0;
var turnOffPageToggleForCurrentPage=false;
function resizeElement(name){
try{
var obj=document.getElementById(name);
if(obj!=null){
p_setsize(obj);
}
}catch(e){
}
}
function window_onresize(){
try{
categoryscroller.window_onresize();
basketscroller.window_onresize();
resizeElement('basketpromo');
resizeElement('InfoFrame');
}catch(e){
alert(e);
}
return false;
}
window.onresize=window_onresize;
function onstartup(){
document.getElementById('account').style['display']='none';
if(top.InfoFrame.location.href=='about:blank'){
var qs=new Querystring()
if(qs.contains('url')){
top.InfoFrame.location.href=Url.decode(qs.get('url'));
}else{
top.InfoFrame.location.href="\contentpage.aspx";
}
}
categoryscroller=new scroller('category',200);
basketscroller=new scroller('basket',200);
window_onresize();
b.loadFromDB();
neotekscript('/main/menuajax.aspx?mainmenuVer='+mainmenuVer);
if(document.getElementById('concertina')!=null){
neotekscript('/catalog/menu/menutypeXML.aspx');
}else{
neotekscript('/catalog/menu/menuajax.aspx');
}
if(document.getElementById('menuTypeContent')!=null){
neotekscript('/catalog/menu/menutypeXML.aspx');
}
}
function categoryvisible(visible)
{
var b=$('category');
if(visible==true){
b.style.display='block';
}else{
b.style.display='none';
}
var width=pixel(b.style.width)||b.offsetWidth;
if(width<=1){
categoryscroller.toggle();
}
}
function CheckInfoFrameForContent(){
var o=top.InfoFrame;
if(!!!o){return;}
if(o.window.location.pathname!='/ContentPage.aspx'&&!turnOffPageToggleForCurrentPage){
categoryvisible(true);
}
turnOffPageToggleForCurrentPage=false;
}
function RetailCheckBox(rrpOnly){
var obj=$('RRPOnly1_ChkRRPOnly');
if(obj){
obj.checked=rrpOnly;
}
}
var Setup={
requestCount:0,
Load:function(){
Setup.requestCount=3;
$('account').style['display']='none';
if(top.InfoFrame.location.href=='about:blank'){
var qs=new Querystring();
if(qs.contains('url')){
top.InfoFrame.location.href=Url.decode(qs.get('url'));
}else{
top.InfoFrame.location.href="\contentpage.aspx";
}
}
categoryscroller=new scroller('category',200);
basketscroller=new scroller('basket',200);
window_onresize();
b.loadFromDB();
neotekscript('/main/menuajax.aspx?mainmenuVer='+mainmenuVer,null,Setup.Callback);
if($('concertina')!=null){
neotekscript('/catalog/menu/menutypeXML.aspx',null,Setup.Callback);
}else{
neotekscript('/catalog/menu/menuajax.aspx',null,Setup.Callback);
}
if($('menuTypeContent')!=null){
neotekscript('/catalog/menu/menutypeXML.aspx',null,Setup.Callback);
}
},
Callback:function(xmlHttp){
--Setup.requestCount;
processScript(xmlHttp);
if(Setup._count<=0){
hideprocessing();
Setup.requestCount=0;
}
}
};
window.onload=Setup.Load;
