// Copyright 2004 I-O DATA DEVICE,INC. All right reserved.
//  you can NOT copy this program without any approval.

function SetupMenuData () {
	
	window.MenuStyleBackColor = '#CAEFFF';
	window.MenuStyleFontColor = '#000000';
	
	window.MenuStyleHilightBack  = '#0066CC';
	window.MenuStyleHilghtColor = '#FFFFFF';
	
	window.HideMenu = false;
	window.MouseoutShortInterval = 350;
	window.checkOutTime = new Date();
	window.TopScroll = false;
	window.TopScrollRateMenu = null;
	
	window.onWindows = navigator.platform ? navigator.platform == "Win32" : false;
	window.macIE45 = document.getElementById && !window.onWindows && getExplorerVersion() == 4.5;
	
	prod2y = moveBySlicePos ( ArwProd2, 'top', 0);
	prod3y = moveBySlicePos ( ArwProd3, 'top', 0);
	window.offset_y = prod3y - prod2y;
	
	window.ActiveButton = null;
	window.ActiveMenu = null;
	window.MenuButton = new Object();
	window.Menus = new Object();
	a = new Array ( 'Prod', 'PIO', 'Support', 'DL', 'Hot', 'Company' ) ;
	for ( var i = 0; i < a.length; i++ ) {
		if ( ! window.MenuButton[ a[i] ] )
			window.MenuButton[ a[i] ] = new MenuButtonObj ( a[i] );
	}
	window.MenuButton['Company'].Offsetpos( -91, 24 );
}

//=========== Menu buttons ====================================

	function menuButtonObj_Closemenu () {
		if ( ! this.subobj ) return ;
		this.subobj.Close() ;
	}

	function menuButtonObj_MouseOver () {
		if ( ! this.subobj ) {
			this.subobj = new MenuObj( this.subid ) ;
			window.Menus[this.subid] = this.subobj ;
		}
		
		// check top scroll buttons.
		var u = document.location.href ;
		if ( this.code == 'Company' && u.search( /#top$/ ) > 10 && ! window.TopScroll ) {
			window.TopScroll = true;
			window.TopScrollRateMenu = this.code;
			setTimeout ( 'RateOpenTopMenu()', 2800 ) ;
			return ;
		} else {
			window.TopScroll = true;
			window.TopScrollRateMenu = null;
		}
		
		window.HideMenu = false ;
		this.subobj.setposition ( this.id, this.subobjoffx, this.subobjoffy );
		this.subobj.Open() ;
		if ( nowcode = window.ActiveButton ) {
			if ( nowcode != this.code ) 
				window.MenuButton[nowcode].Closemenu() ;
		}
		window.ActiveButton = this.code ;
	}
	
	function menuButtonObj_Offsetpos ( x, y ) {
		this.subobjoffx = x;
		this.subobjoffy = y;
		if ( this.subobj ) this.subobj.setposition ( this.id,x,y );
	}

function MenuBtnOver ( code ) {
	if ( window.MenuButton && window.MenuButton[code] ) MenuButton[code].MouseOver();
}

function MenuButtonObj ( code ) {
	this.code = code ;
	this.id = 'Btn'+code ;
	
	this.subid = 'Menu'+code ;
	this.subobj = null ;
	this.subobjoffx = 1;
	this.subobjoffy = 24;
	
	this.MouseOver	= menuButtonObj_MouseOver ;
	this.Closemenu	= menuButtonObj_Closemenu ;
	this.Offsetpos	= menuButtonObj_Offsetpos ;
}

function MouseOutMenu () {
	nowcode = window.ActiveButton ;
	if ( ! nowcode ) return ;
	offMouseTimeout ();
}

function RateOpenTopMenu () {
	if ( window.TopScrollRateMenu ) MenuBtnOver ( window.TopScrollRateMenu )
}

function CloseMenus () {
	if ( ! window.HideMenu ) return ;
	nowcode = window.ActiveButton ;
	if ( ! nowcode ) return ;
	window.MenuButton[nowcode].Closemenu() ;
	window.HideMenu = false ;
	window.ActiveButton = null;
}

//----------

	function menuObj_Open () {
		window.HideMenu = false ;
		window.ActiveMenu = this.id ;
		this.downlight ();
		
		if ( this.show ) return ;
		
		this.layerobj.timeoutswitch = false;
		if (this.layerobj.style) this.layerobj.style.visibility='visible';
		this.show = true ;
	}
	
	function menuObj_Close () {
		if ( ! this.show ) return ;
		this.downlight ();
		
		layer = this.layerobj;
		layer.timeoutswitch = false;
		if (layer.style) layer.style.visibility='hidden';
		
		this.show = false ;
		window.ActiveMenu = null ;
	}
	
	function menuObj_MouseOver ( itemid, submenuid, locate_num ) {
		window.HideMenu = false ;
		window.ActiveMenu = this.id ;
		this.hilight ( itemid ) ;
		if ( this.subid ) {
			window.Menus[this.subid].Close() ;
			this.subid = null;
		}
		if ( submenuid && document.getElementById( submenuid ) != null ) {
			if ( ! window.Menus[submenuid] ) 
				window.Menus[submenuid] = new MenuObj( submenuid, this.id ) ;
			if ( locate_num != null && navigator.appName != 'Netscape')
				moveLayer ( submenuid, 11, window.offset_y * locate_num - 6, 'ArwProd2' );
			else moveLayer ( submenuid, 11, -6, 'Arw'+itemid );
			window.Menus[submenuid].Open() ;
			this.subid = submenuid ;
		}
	}
	
	function menuObj_MouseOverWithSub ( itemid, submenuid, subitem ) {
		this.MouseOver ( itemid, submenuid );
		window.Menus[submenuid].hilight( subitem );
	}
	
	function menuObj_Click () {
		if ( ! this.hilightedItem ) {
			if ( this.pare ) 
				return ( window.Menus[this.pare].Click() ) ;
			else
				return false;
		}
		obj = document.getElementById( this.hilightedItem+'Link' );
		if ( obj && obj.href ) {
			parent.location = obj.href;
			return true;
		} else 
			return false;
	}

	function menuObj_hilight ( itemid ) {
		if ( ! itemid ) return ;
		if ( this.hilightedItem == itemid ) return ;
		if ( this.hilightedItem ) this.downlight ();
		
		if ( obj=document.getElementById( itemid ) ) {
			obj.style.backgroundColor = window.MenuStyleHilightBack;
			obj.style.color = window.MenuStyleHilghtColor;
		}
		if ( obj=document.getElementById('TdArw'+itemid ) )
			obj.style.backgroundColor = window.MenuStyleHilightBack;
		if ( obj=document.getElementById('TdMrk'+itemid ) )
			obj.style.backgroundColor = window.MenuStyleHilightBack;
		if ( obj=document.getElementById( itemid+'Link') )
			obj.style.color = window.MenuStyleHilghtColor;
		
		this.hilightedItem = itemid ;
	}

	function menuObj_downlight () {
		itemid = this.hilightedItem ;
		if ( ! itemid ) return ;
		
		if ( obj=document.getElementById( itemid ) ) {
			obj.style.backgroundColor = window.MenuStyleBackColor;
			obj.style.color = window.MenuStyleFontColor;
		}
		if ( obj=document.getElementById('TdArw'+itemid) )
			obj.style.backgroundColor = window.MenuStyleBackColor;
		if ( obj=document.getElementById('TdMrk'+itemid) )
			obj.style.backgroundColor = window.MenuStyleBackColor;
		if ( obj=document.getElementById(itemid+'Link') ) 
			obj.style.color = window.MenuStyleFontColor;
		
		this.hilightedItem = null ;
		if ( this.subid ) {
			window.Menus[this.subid].Close() ;
			this.subid = null ;
		}
	}

	function menuObj_setposition ( fromid, offx, offy ) {
		if ( ! this.layerobj ) this.layerobj = document.getElementById( this.id ) ;
		moveLayer ( this.id, offx, offy, fromid );
	}

function MenuObj ( myid, pareid ) {
	this.id = myid ;
	this.layerobj = document.getElementById( myid ) ;
	this.pare = pareid ;
	
	this.show = false ;
	this.hilightedItem = null ;
	this.subid = null ;
	
	this.Open	= menuObj_Open ;
	this.Close	= menuObj_Close ;
	this.MouseOver = menuObj_MouseOver ;
	this.MouseOverWithSub = menuObj_MouseOverWithSub ;
	this.Click	= menuObj_Click ;
	
	this.hilight = menuObj_hilight ;
	this.downlight = menuObj_downlight ;
	this.setposition = menuObj_setposition ;
}

function MouseOutItem () {
	id = window.ActiveMenu ;
	if ( ! id ) return ;
	window.Menus[id].downlight() ;
}

function ClickMenu () {
	id = window.ActiveMenu ;
	if ( ! id ) return ;
	window.Menus[id].Click() ;
}

//=========== Pulldown Menus ====================================

function offMouseTimeout () {
	delay = window.MouseoutShortInterval;
	var now = new Date();
	window.checkOutTime = new Date( now.getTime() + delay );
	window.HideMenu = true;
	setTimeout ( "checkTimeoutMenu()", delay+2 ) ;
}

function checkTimeoutMenu () {
	var now = new Date();
	if ( window.checkOutTime > now ) return ;
	if ( window.HideMenu ) CloseMenus();
}

// ===============

function moveLayer ( layerid, offsetx, offsety, fromImgid ) {
	var obj = document.getElementById(fromImgid);
	lyr = document.getElementById(layerid);
	x = moveBySlicePos (obj, 'left', offsetx);
	y = moveBySlicePos (obj, 'top',  offsety);
	lyr = document.getElementById(layerid);
	if (lyr != null) {
		lyr.style.pixelLeft = x;
		lyr.style.left = x + 'px';
		lyr.style.pixelTop = y;
		lyr.style.top = y + 'px';
	}
}

function moveBySlicePos (img, mode, pos) { 
	if (!document.layers) {
		var par = img;
		var lastOffset = 0;
	
		while( par ){
			switch (mode) {
				case 'left':
					if( par.leftMargin && ! window.onWindows ) pos += parseInt(par.leftMargin);
					if( (par.offsetLeft != lastOffset) && par.offsetLeft ) pos += parseInt(par.offsetLeft);
					if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
					par = window.macIE45 ? par.parentElement : par.offsetParent;
					break;
				case 'top':
					if( par.topMargin && !window.onWindows ) pos += parseInt(par.topMargin);
					if( (par.offsetTop != lastOffset) && par.offsetTop ) pos += parseInt(par.offsetTop);
					if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
					par = window.macIE45 ? par.parentElement : par.offsetParent;
					break;
			}
		}
		
	} else if (img) {
		switch (mode) {
			case 'left':
			case 'right':
				pos += img.x;
				break;
			case 'top':
				pos += img.y;
				break;
		}
	}
	return pos;
}

function getExplorerVersion() {
	var ieVers = parseFloat(navigator.appVersion);
	if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers;
	var tempVers = navigator.appVersion;
	var i = tempVers.indexOf( 'MSIE ' );
	if( i >= 0 ) {
		tempVers = tempVers.substring( i+5 );
		ieVers = parseFloat( tempVers ); 
	}
	return ieVers;
}

// Macromedia DreamWeaver Builtin Script

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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.getElementById) x=d.getElementById[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_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
