/* this function is used for created a drop box that lets you jump to a particular
URL. The form_reference parameter represents a reference to the current form in case
 there is more than one form defined in a document
 
 example: 
 <select name="example_select" size="1" onChange="dropDownLink(this.form, ARRAY_REFERNCE)">
 
- NOTE: pass the corret array name refernce 
- an option is set to a value of false if no action should be taken. 
 
 */

function dropDownLink(form_reference, select_tag_name) //PARAMETER: select_tag_name is the <select name=""> attribute value
{
	var url = form_reference[select_tag_name].options[form_reference[select_tag_name].selectedIndex].value;
	if(url != "false")
	{
		window.top.location.href=url;
	}
}
/* 

USAGE:
<select NAME="dropDown" onChange="dropDownLink(this.form, url_array_object_name)" >




original (old) sybtax
<select NAME="TestForm" 
onChange="GoURL(form.TestForm.options[form.TestForm.selectedIndex].value)">

*/

/* this function is used for rollover changing images for hardware spec & pop up window*/
function newImage(arg) 
{
	if (document.images) 
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() 
{
	if (document.images && (preloadFlag == true)) 
	{
		for (var i=0; i<changeImages.arguments.length; i+=2) 
		{
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() 
{
	if (document.images) 
	{
		rollovertitle_tapedeck_over = newImage("contents/images/rollovertitle-tapedeck_over.gif");
		rollovertitle_computer_over = newImage("contents/images/rollovertitle-computer_over.gif");
		rollovertitle_triton_over = newImage("contents/images/rollovertitle-triton_over.gif");
		rollovertitle_headphone_over = newImage("contents/images/rollovertitle-headphone_ove.gif");
		rollovertitle_monitor_over = newImage("contents/images/rollovertitle-monitor_over.gif");
		rollovertitle_mixer_over = newImage("contents/images/rollovertitle-mixer_over.gif");
		b_medialab_hard_01_mzipdriver_over = newImage("contents/images/b_medialab_hard_01-mzipdriv.gif");
		b_medialab_hard_01_msimac_over = newImage("contents/images/b_medialab_hard_01-msimac_o.gif");
		name_utapedeck_over = newImage("contents/images/name-utapedeck_over.gif");
		name_utriton_over = newImage("contents/images/name-utriton_over.gif");
		name_umixer_over = newImage("contents/images/name-umixer_over.gif");
		name_uzip_over = newImage("contents/images/name-uzip_over.gif");
		name_uimac_over = newImage("contents/images/name-uimac_over.gif");
		name_uheadphone_over = newImage("contents/images/name-uheadphone_over.gif");
		preloadFlag = true;
	}
}



function MM_goToURL() 
	{ 
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}

function myWindow(theURL,winName,features) 
	{ 
	  window.open(theURL,winName,features);
	}



/* BEGIN - Open New window in the center of screen */
function NewWindow(mypage, myname, w, h, scroll) 
	{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
/* END - Open New window in the center of screen */


/* BEGIN - Scroll message */
/*
			// change this to where you store the blank.gif image
			var blank = "images/blank.gif";
			
			topedge = 1;  // location of news box from top of page
			leftedge = 0;  // location of news box from left edge
			boxheight = 48;  // height of news box
			boxwidth = 150;  // width of news box
			scrollheight = 106; // total height of all data to be scrolled
			
			function scrollnews(cliptop) 
				{
					if (document.layers) 
						{
							newsDiv = document.news;
							newsDiv.clip.top = cliptop;
							newsDiv.clip.bottom = cliptop + boxheight;
							newsDiv.clip.left = 0;
							newsDiv.clip.right = boxwidth + leftedge;
							newsDiv.left = leftedge;
							newsDiv.top = topedge - cliptop;
						}
					else 
						{
							newsDiv = news.style;
							newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
							newsDiv.pixelLeft = leftedge;
							newsDiv.pixelTop = topedge - cliptop;
						}
					cliptop = (cliptop + 1) % (scrollheight + boxheight);
					newsDiv.visibility='visible';
					setTimeout("scrollnews(" + cliptop + ")", 100);
				}
*/
/* END - Scroll message */

/* LC menu dropdown */
var cssdropdown={
disappeardelay: 150, //set delay in miliseconds before menu disappears onmouseout

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

showhide:function(obj, e, visible, hidden){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden"
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e, "visible", "hidden")
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay)
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
}
}

