﻿// JScript File

function co(element,mode) {
    if (mode=="in") {
      cursortype = 'hand'
      colorval = '#131644'
    } else if (mode=="out") {
      cursortype = ''
      colorval = '#6B6C8A'
    }
  element.style.background=colorval;
  element.style.cursor=cursortype;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


//--------public---------

//drops
	num_drops=5
	first_drop_offset_from_centre=100 //gives reference point for resizing
	drop_width=300 //for evenly-spaced; if you have a gap between your menus, include that in here


//------private---------

//get platform info
	agt=navigator.userAgent.toLowerCase();

	ff=(agt.indexOf('firefox')!=-1)?1:0
	ie=(document.all) ? 1:0
	if(ie){
		ie4=(agt.indexOf('msie 4.01')!=-1) ? 1:0
		ie5=(agt.indexOf('msie 5.01')!=-1) ? 1:0
		}
	else { ie4=0;ie5=0 }

	ns=(document.layers) ? 1:0
	ns6=(document.getElementByID) ? 1:0

	win=( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) )
	mac=(agt.indexOf("mac")!=-1);

	imgs=(document.images) ? 1:0


//----------------------dropdowns------------------------

//define images

//private functions
	offset=first_drop_offset_from_centre
	dropsloaded=0
	timerID=null

//show a drop
	function showdrop(num,theimg,newsrc){
		if(dropsloaded){
			clearTimeout(timerID)
			hideall()
			if(ie || ff) { theblah="document.getElementById('drop"+num+"').style.visibility='visible'" }
			if(ns) { theblah="document.drop"+num+".visibility='show'" }
			eval(theblah); swpimg(theimg,newsrc)
			}
		}

//hide timer
	function hidedrop(){
		if(dropsloaded){
			timerID=window.setTimeout('hideall()',600); return
			}
		}

//hide all
	function hideall(){
		if(dropsloaded){
			swpback()
			for(i=1;i<=num_drops;i++){
				if(ie || ff) { theblah="document.getElementById('drop"+i+"').style.visibility='hidden'" }
				if(ns) { theblah="document.drop"+i+".visibility='hide'" }
				eval(theblah)
				}
			}
		}

//keep drop
	function keepdrop(){
		if(dropsloaded){
			clearTimeout(timerID)
			}
		}


//register initial layer position - for irregularly spaced drops
	layerpos=new Array()
	function registerlayer(num){
		if(ie || ff) { layerpos[num]=eval("document.getElementById('drop"+num+"').style.pixelLeft") }
		if(ns) { layerpos[num]=eval("document.drop"+num+".left") }
	}

//positioning
	function reposition(num){

if (num==5)
{	
	layeroffset=layerpos[num]
		temp_newpos=5
		if(temp_newpos<0) { temp_newpos=0 }
		newpos=temp_newpos	
		if(ie || ff) { theblah="document.getElementById('drop"+num+"').style.left=newpos" }
		if(ns) { theblah="document.drop"+num+".left=newpos" }
		eval(theblah);
		if(ie4) { eval("drop"+num+".style.width=160") } //fix silly width bug in IE4
		if((ie) && mac) { eval("drop"+num+".style.width=160") }
		
} else {
	
	layeroffset=layerpos[num]
		temp_newpos=120+(num*90)
		if(temp_newpos<0) { temp_newpos=0 }
		newpos=temp_newpos	
		if(ie || ff) { theblah="document.getElementById('drop"+num+"').style.left=newpos" }
		if(ns) { theblah="document.drop"+num+".left=newpos" }
		eval(theblah);
		if(ie4) { eval("drop"+num+".style.width=160") } //fix silly width bug in IE4
		if((ie) && mac) { eval("drop"+num+".style.width=160") }
	}

	
		}

//image swapper
		clickedimg=""; overimg=""; downimg=""

	function swpimg(theimg,newsrc){
//		if(imgs){
//			oldsrc=document.images[theimg].src; overimg=theimg
//			document.images[theimg].src=newsrc
//			}
	}

	function swpback(){
//		if(overimg!="" && overimg!=clickedimg &&overimg!=downimg){
//			if(imgs){ document.images[overimg].src=oldsrc }
//			}
		}

	function clickit(){
//		if(clickedimg!=""){
//			document.images['clickedimg'].src=clickedimgoldsrc
//			}
//		clickedimg=overimg; clickedgimgoldsrc=oldsrc
		}


//down image controller
//	function set_down_img(){
//		if(page_sect && page_sect!=""){
//			downimg=page_sect
//			if(document.images[page_sect]){
//				document.images[page_sect].src="/_artwork/topnav/square_"+page_sect+".gif"
//				}
//			}
//		else{ downimg=0 }
//		}


//NS resize fix
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
		if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
	MM_reloadPage(true);

//------------------------end dropdowns--------------------



//set up ezine - enables us to have a rollover on the sign up button
	function ezine(){
		theform=document.forms['ezine']
		theurl=theform.action+"?"
		for(k=0;k<theform.length;k++){
			theurl=theurl+theform.elements[k].name+"="+theform.elements[k].value+"&"
			}
		top.location.href=theurl
		}


function local_init(){

	if(ns) { init_local_layers(); } //ie does this inline

	}



//maintain layer positions

	//register local layers
	local_layer=new Array()
	local_layerpos=new Array()

	local_layer[0]="newsflash"; local_layerpos[0]=10
	local_layer[1]="container"; local_layerpos[1]=10
	local_layer[2]="favourites"; local_layerpos[2]=10


	function local_reposition(){
		if(ie || ff) { thewindowwidth=document.body.clientWidth }
		if(ns && win) { thewindowwidth=window.innerWidth-14 }  //ns weirdness
		if(ns && mac) { thewindowwidth=window.innerWidth-10 }  //ns weirdness
		for(i=0;i<local_layer.length;i++){
			layername=local_layer[i]; layeroffset=local_layerpos[i]
			temp_newpos=180+((i+1)*75)
			if(temp_newpos<5) { temp_newpos=5 }
			newpos=temp_newpos
			if(ie || ff) { theblah="document.getElementById('"+ layername+"').style.left=newpos;"}
			if(ns) { theblah="document."+layername+".left=newpos" }
			eval(theblah);
			}
		}


//set it all going
	function init_local_layers(){
		scroller_is_loaded=1
		local_reposition()
		changeflash()
		if(ie || ff){ scroller_height=content.scrollHeight;
			container.style.visibility="visible"
			newsflash.style.visibility="visible"
			favourites.style.visibility="visible"  }
		if(ns){ scroller_height=document.container.layers['content'].document.height
			document.container.visibility="show"
			document.newsflash.visibility="show"
			document.favourites.visibility="show" }
		}



function wildcard()
{

msgWindow=window.open("/help/search_wildcard.aspx","Wildcard","toolbar=no,width=400,height=300,directories=no,status=no,scrollbars=no,resizable=no,menubar=no")

}
function switchadv()
{

	var tmp;
	tmp="";

	tmp= tmp + "&artnr=" + document.form1.artnr.value;
	tmp= tmp + "&varenr=" + document.form1.varenr.value;

	//if (document.form1.status1.checked) { tmp = tmp + "&status1=on"; }
	if (document.form1.status2.checked) { tmp = tmp + "&status2=on"; }
	if (document.form1.status3.checked) { tmp = tmp + "&status3=on"; }
	if (document.form1.status4.checked) { tmp = tmp + "&status4=on"; }

	if (document.form1.statusb2.checked) { tmp = tmp + "&statusb2=on"; }
	if (document.form1.statusb3.checked) { tmp = tmp + "&statusb3=on"; }
	if (document.form1.statusb4.checked) { tmp = tmp + "&statusb4=on"; }


	//if (document.form1.laag1.checked) { tmp = tmp + "&laag1=on"; }
	if (document.form1.laag2.checked) { tmp = tmp + "&laag2=on"; }
	if (document.form1.laag3.checked) { tmp = tmp + "&laag3=on"; }

	if (document.form1.haand1.checked) { tmp = tmp + "&haand1=on"; }
	if (document.form1.haand2.checked) { tmp = tmp + "&haand2=on"; }

	if (document.form1.varetype1.checked) { tmp = tmp + "&varetype1=on"; }
	if (document.form1.varetype2.checked) { tmp = tmp + "&varetype2=on"; }
	if (document.form1.varetype3.checked) { tmp = tmp + "&varetype3=on"; }
	if (document.form1.varetype4.checked) { tmp = tmp + "&varetype4=on"; }
	if (document.form1.varetype5.checked) { tmp = tmp + "&varetype5=on"; }
	if (document.form1.varetype6.checked) { tmp = tmp + "&varetype6=on"; }
	//if (document.form1.varetype7.checked) { tmp = tmp + "&varetype7=on"; }
	if (document.form1.varetype8.checked) { tmp = tmp + "&varetype8=on"; }

	//if (document.form1.mat1.checked) { tmp = tmp + "&mat1=on"; }
	if (document.form1.mat2.checked) { tmp = tmp + "&mat2=on"; }
	if (document.form1.mat3.checked) { tmp = tmp + "&mat3=on"; }
	if (document.form1.mat4.checked) { tmp = tmp + "&mat4=on"; }
	if (document.form1.mat5.checked) { tmp = tmp + "&mat5=on"; }
	if (document.form1.mat6.checked) { tmp = tmp + "&mat6=on"; }
	if (document.form1.mat7.checked) { tmp = tmp + "&mat7=on"; }
	if (document.form1.mat8.checked) { tmp = tmp + "&mat8=on"; }
	if (document.form1.mat9.checked) { tmp = tmp + "&mat9=on"; }
	if (document.form1.mat10.checked) { tmp = tmp + "&mat10=on"; }

	if (document.form1.vareform1.checked) { tmp = tmp + "&vareform1=on"; }
	if (document.form1.vareform2.checked) { tmp = tmp + "&vareform2=on"; }
	if (document.form1.vareform3.checked) { tmp = tmp + "&vareform3=on"; }
	if (document.form1.vareform4.checked) { tmp = tmp + "&vareform4=on"; }
	if (document.form1.vareform5.checked) { tmp = tmp + "&vareform5=on"; }

	if (document.form1.rum1.checked) { tmp = tmp + "&rum1=on"; }
	if (document.form1.rum2.checked) { tmp = tmp + "&rum2=on"; }
	if (document.form1.rum3.checked) { tmp = tmp + "&rum3=on"; }
	if (document.form1.rum4.checked) { tmp = tmp + "&rum4=on"; }
	if (document.form1.rum5.checked) { tmp = tmp + "&rum5=on"; }

	self.location.href ="intern.asp?action=advsearch" + tmp;

}
