
		
	//array : value , location, hierarchal position
	var menu = new Array( )
			menu[0] = new Array("<img border=0 src=\"images/home.gif\">", "index.shtml", "1.@!0.@!1" ),
			menu[1] = new Array("<img border=0 src=\"images/hot_deals.gif\">", "F_HD.shtml", "1.@!0.@!2" ),
			menu[2] = new Array("<img border=0 src=\"images/promotions.gif\">", "F_PS.shtml", "1.@!0.@!3" ),
			menu[3] = new Array("<img border=0 src=\"images/new_products.gif\">", "F_NP.shtml", "1.@!0.@!4" ),
			menu[4] = new Array("<img border=0 src=\"images/digital_cameras.gif\">", "H_Cameras.shtml", "1.@!0.@!5" ),
				menu[5] = new Array("Cybershot&reg;", "F_CS.shtml", "2.@!5.@!6" ),
					menu[6] = new Array("DSC-F707", "P_Feature_F707.shtml", "3.@!6.@!7" ),
					menu[7] = new Array("DSC-S85", "P_Feature_S85.shtml", "3.@!6.@!8" ),
					menu[8] = new Array("DSC-S75", "P_Feature_S75.shtml", "3.@!6.@!9"),
					menu[9] = new Array("DSC-P5", "P_Feature_P5.shtml", "3.@!6.@!10" ),
					menu[10] = new Array("DSC-P3", "P_Feature_P3.shtml", "3.@!6.@!11" ),
					menu[11] = new Array("DSC-P50", "P_Feature_P50.shtml", "3.@!6.@!12" ),
					menu[12] = new Array("DSC-P30", "P_Feature_P30.shtml", "3.@!6.@!13" ),
					menu[13] = new Array("DSC-P20", "P_Feature_P20.shtml", "3.@!6.@!14" ),
				menu[14] = new Array("CD Mavica&reg;", "F_CD.shtml", "2.@!5.@!15" ),
					menu[15] =new Array("MVC-CD300", "P_Feature_CD300.shtml", "3.@!15.@!16"), 
					menu[16] = new Array("MVC-CD200", "P_Feature_CD200.shtml", "3.@!15.@!17" ),
				menu[17] = new Array("FD Mavica&reg;", "F_FD.shtml", "2.@!5.@!18" ),
					menu[18] = new Array("MVC-FD92", "P_Feature_FD92.shtml", "3.@!18.@!19" ),
					menu[19] =new Array("MVC-FD87", "P_Feature_FD87.shtml", "3.@!18.@!20" ),
					menu[20] =new Array("MVC-FD75", "P_Feature_FD75.shtml", "3.@!18.@!21" ),
			menu[21] =new Array("<img border=0 src=\"images/camcorders.gif\">", "H_Camcorders.shtml", "1.@!0.@!22" );
				menu[22] = new Array("Hi8&#153;", "F_H8.shtml", "2.@!22.@!23" ),
					menu[23] = new Array("CCD-TR818", "P_Feature_TR818.shtml", "3.@!23.@!24" ),
					menu[24] = new Array("CCD-TRV68", "P_Feature_TRV68.shtml", "3.@!23.@!25" ),
					menu[25] = new Array("CCD-TRV88", "P_Feature_TRV88.shtml", "3.@!23.@!26" ),
					menu[26] = new Array("CCD-TRV98", "P_Feature_TRV98.shtml", "3.@!23.@!27" ),
				menu[27] = new Array("Digital8&reg;", "F_D8.shtml", "2.@!22.@!28" ),
					menu[28] = new Array("DCR-TRV230", "P_Feature_TRV230.shtml", "3.@!28.@!29" ),
					menu[29] = new Array("DCR-TRV330", "P_Feature_TRV330.shtml", "3.@!28.@!30" ),
					menu[30] = new Array("DCR-TRV530", "P_Feature_TRV530.shtml", "3.@!28.@!31" ),
					menu[31] = new Array("DCR-TRV730", "P_Feature_TRV730.shtml", "3.@!28.@!32" ),
					menu[32] = new Array("DCR-TRV830", "P_Feature_TRV830.shtml", "3.@!28.@!33" ),
				menu[33] = new Array("MiniDV", "F_DV.shtml", "2.@!22.@!34" ),
					menu[34] = new Array("DCR-TRV17", "P_Feature_TRV17.shtml", "3.@!34.@!35" ),
					menu[35] = new Array("DCR-PC9", "P_Feature_PC9.shtml", "3.@!34.@!36" ),
					menu[36] = new Array("DCR-TRV30", "P_Feature_TRV30.shtml", "3.@!34.@!37" ),
					menu[37] = new Array("DCR-PC120BT", "P_Feature_PC120BT.shtml", "3.@!34.@!38"),
					menu[38] = new Array("DCR-PC110", "P_Feature_PC110.shtml", "3.@!34.@!39" ),
					menu[39] = new Array("DCR-TRV900", "P_Feature_TRV900.shtml", "3.@!34.@!40"),
					menu[40] = new Array("DCR-VX2000", "P_Feature_VX2000.shtml", "3.@!34.@!41" ),
				menu[41] = new Array("Video Walkman&#153;", "F_VW.shtml", "2.@!22.@!42" ),
			menu[42] = new Array("<img border=0 src=\"images/accessories.gif\">", "F_AC.shtml", "1.@!0.@!43" ),
				menu[43] = new Array("Memory Stick&reg;", "A_MemStick.shtml", "2.@!43.@!44" ),
				menu[44] = new Array("Batteries & Chargers", "A_Battery.shtml", "2.@!43.@!45" ),
				menu[45] = new Array("Cases & Starter Kits", "A_Cases.shtml", "2.@!43.@!46" ),
				menu[46] = new Array("Lenses & Filters", "A_Lenses.shtml", "2.@!43.@!47" ),
				menu[47] = new Array("Lights & Flashes", "A_Lights.shtml", "2.@!43.@!48" ),
				menu[48] = new Array("Tripods", "A_Tripods.shtml", "2.@!43.@!49" ),
				menu[49] = new Array("i.LINK&reg; Cables", "A_iLink.shtml", "2.@!43.@!50" ),
				menu[50] = new Array("Printer Paper", "A_PrinterPaper.shtml", "2.@!43.@!51" ),
				menu[51] = new Array("CDR & CDRW Media", "A_CDR.shtml", "2.@!43.@!52" ),
				menu[52] = new Array("Other Accessories", "A_Other.shtml", "2.@!43.@!53" ),
			menu[53] = new Array("<img border=0 src=\"images/printers.gif\">", "F_PR.shtml", "1.@!0.@!54" ),
			menu[54] = new Array("<img border=0 src=\"images/technology.gif\">", "Technology.shtml", "1.@!0.@!55" ),
			menu[55] = new Array("<img border=0 src=\"images/help_me_decide.gif\">", "HelpMeDecide.shtml", "1.@!0.@!56" ),
			menu[56] = new Array("<img border=0 src=\"images/support.gif\">", "Support.shtml", "1.@!0.@!57" ),
			menu[57] = new Array("<img border=0 src=\"images/warranty_info.gif\">", "Warranty.shtml", "1.@!0.@!58" ),
			menu[58] = new Array("<img border=0 src=\"images/image_station.gif\">", "http://www.imagestation.com", "1.@!0.@!59" ),
			menu[59] = new Array("<img border=0 src=\"images/business_sales.gif\">","../b2b",  "1.@!0.@!60" );
	
	//create image states for each level
	// static = 1st position :: active== postion when selected :: over == positon when msd over :: noChild = last level :: noChild_over
	// do not have 2 states in a single family with the same image, instead copy the image and add on a 2 (ex. spacer2.gif)
	var L1_static = new Image( );
		L1_static.src = "images/spacer.gif";
	var L1_active = new Image( );
		L1_active.src = "images/arrow_down.gif";
	var L1_noChild = new Image( );
		L1_noChild.src = "images/spacer2.gif"
			
	var L2_static = new Image( );
		L2_static.src = "images/arrow_right.gif";
	var L2_active = new Image( );
		L2_active.src = "images/arrow_down.gif";
	var L2_noChild = new Image( );
		L2_noChild.src = "images/dot.gif"
		
	var L3_static = new Image( );
		L3_static.src = "images/dot.gif";
	var L3_active = new Image( );
		L3_active.src = "images/dot.gif";
	var L3_noChild = new Image( );
		L3_noChild.src = "images/dot.gif"
	
	// globals
	var xStart = 0;
	var yStart = 120;
	var menuHeight = 22;
	var menuWidth = 130;
	var menuIndent = 8;
	var lastObjChain="";
	var lastId="@!0";
	var imageWidth = 0;
	var busy=true;
	
	// create menu : array enumeration
	function createMenu( ){
	busy = true;
	var alias, xPosition, yPosition, vision, imageString,Icon, IconSrc;
	var n = 0;
		for(i=0;i<menu.length;++i){
			alias = decipher(menu[i][2])
			xPosition = menuIndent + xStart;
			yPosition =(alias[1]=="@!0")?(yStart+(menuHeight*n)):0;
	 		vision =(document.layers)?((alias[1]=="@!0")? "show" :"hide" ):((alias[1]=="@!0")? "visible" :"hidden" );
			//if child code
			 if(createIcon(alias[2])) iconSrc = eval("L"+alias[0]+"_static.src");
			 if(!createIcon(alias[2]) && alias[0]!="1") iconSrc ="images/dot.gif";
			 if(!createIcon(alias[2]) && alias[0]=="1") iconSrc="images/spacer2.gif";
		
			 icon = "<img src=\""+iconSrc+"\" name=\"img_"+alias[2]+"\" width=8 height=10 border=0 hspace=1>";
		 if(document.layers){
			 	document.write("<layer name=\""+alias[2]+"\" top=\""+yPosition+"\" left=\""+(xPosition+imageWidth)+"\" visibility=\""+vision+" \" z-index=\""+(10-alias[0])+"\"><a href=\""+menu[i][1]+"\" onClick=\"coreographer('"+alias[2]+"')\"  class=\"nav\" >"+icon+""+menu[i][0]+"</a></layer>");			 
			 	}
			 else if (document.all || document.getElementById){
			document.write("<div id=\""+alias[2]+"\""+
											"style=\"position:absolute;top:"+yPosition+";left:"+(xPosition+imageWidth)+";zindex:"+(10-alias[0])+";visibility:"+vision+";"+
											"\""+
											"\""+"onclick=\"coreographer('"+alias[2]+"')\">"+icon+"<a href=\""+menu[i][1]+"\" class=\"nav\">"+menu[i][0]+"</a></div>");
			}
			if(alias[1]=="@!0")	++n;
		}
	busy=false;
	}
	
	function createStyleSheet( ){
	var cbPixel = (document.layers && navigator.platform == "Win32" )? 10 : 9;
	var xPixel = (!document.all)? 1:0;
	document.write(
			"<style>"+
					".financing {color:#666666;text-decoration:none;}"+
					" A:hover{text-decoration:underline;}"+
					".nav {font-family:verdana;font-size:"+cbPixel+"px;color:#666666; text-decoration:none;}"+
					".blue11b {font-size:"+(12+xPixel)+"px;font-family:helvetica,arial,sans-serif;color:#6699cc;font-weight:bold;}"+
					".black10 {font-size:"+(10+xPixel)+"px;font-family:helvetica, arial, sans-serif;color:#000000;text-decoration:none;}"+
					".dkgray9 {font-size:"+(9+xPixel)+"px;font-family:helvetica, arial, sans-serif;color:#333333;text-decoration:none;}"+
			"</style>");
	}
	
	// function tells createMenu whether or not the obj has a child
	function createIcon(id){
	var alias;
		for(x=0;x<menu.length;++x){
			alias = decipher(menu[x][2]);		
			if (alias[1]==id) return true;
		}
		return false;
	}
	
	function iconX(name,level,state){
	var img_state;
	var img_name = ("img_"+name);		
		var currentIMG = (document.layers)?document.layers[name].document.images[img_name].src : document.images[img_name].src ;
		 if(state == "toggle"){
	 		if(currentIMG == eval("L"+level+"_noChild.src")) img_state =  eval("L"+level+"_noChild.src");
			else img_state = (currentIMG == eval("L"+level+"_active.src"))? eval("L"+level+"_static.src") : eval("L"+level+"_active.src");
			}
		else img_state = eval("L"+level+"_"+state+".src"); 
	 if(document.layers) document.layers[name].document.images[img_name].src = img_state;
	 else document.images[img_name].src = img_state;		
	}

	//brain
	function coreographer(id){
	var alias, valX, valY,vision,chainKey,keySplit;
	var affinity=allegiance(id);
	var iconChain = decipher(affinity);
	var chainClose = maintainState(affinity, id);
	var n = 0;
	
	for(i=0;i<menu.length;++i){
		alias=decipher(menu[i][2]);
		valX = ((alias[0]*menuIndent)+imageWidth);
		valY = (yStart+(n*menuHeight));
		
		for(y=0;y<iconChain.length;++y){
			if(iconChain[y]==alias[2]) iconX(alias[2],alias[0],"active");
			}		
		if(chainClose!=""){
			chainKey = decipher(chainClose);			
			for(x=0;x<chainKey.length;++x){
					keySplit =chainKey[x].split(":");				 
					if(keySplit[1]==alias[1]){	
						eclipse(alias[2],"hidden");
						iconX(keySplit[1], keySplit[0], "static")
					}
				}
			}

		if( checkString(alias[1], affinity ) || checkString(alias[2], affinity )){	
			repositioner(alias[2], valX, valY);
			eclipse(alias[2],"visible");
			++n
			}
	
		else if(alias[1]==id){
			vision = eclipse(alias[2]);
			
			if (vision){
				repositioner(alias[2], valX, valY);
				++n
				}
			}
		if(alias[2]==id) iconX(id,alias[0],"toggle");	
		}
	lastObjChain = affinity+"."+id;
	lastId = id;
	}
	
	// stabilizes menu by checking last chain with current chain then closing the differences 
	function maintainState(affinity,id){
		var chainClose=""
		var chainNow = decipher(affinity+"."+id);
		var chainLast = decipher(lastObjChain);
		if(chainNow.length<=chainLast.length){
			for(i=chainLast.length;i>0;--i){
				if (chainNow[i]!=chainLast[i]){
					chainClose = chainClose+i+":"+chainLast[i]+".";
					}	
				}
			}
		chainClose = chainClose.substring(0,(chainClose.length-1));
		return chainClose
	}
	
	// figure out what menu item should be open at the time of load
	function maintainSession( ){
	if(busy){
		setTimeout("maintainSession()", 2000);
	}
	else{
		var currentURL = document.URL;
		for(i=0;i<menu.length;++i){
			if (currentURL.indexOf(menu[i][1])!=-1){
				var alias = decipher(menu[i][2]);
				coreographer(alias[2]);
				break;		
				}
			}
		}
	}
	// outputs object chain in string format "obj,obj,obj..."
	function allegiance(id){
	var allegiant; 
	var affinity = "";
	var idVal = id;
	var idLevel = "";
	do {
		for(i=0;i<menu.length; ++i){
			allegiant=decipher(menu[i][2]);
			if(allegiant[2]==idVal){
				affinity = allegiant[1]+"."+affinity;
				idVal = allegiant[1];
				idLevel = allegiant[0];
				}
			}
		}while (idLevel != "1" )
	affinity = affinity.substring(0,(affinity.length-1));
	return affinity;
	}
	
	//visibility toggle ; unless specified
	function eclipse(id, state){
	var cb;
	var see = (document.layers)? "show" : "visible";
	var vanish = (document.layers)? "hide" : "hidden";
	var cbNull = (document.all)? null : undefined;
	
		if(document.layers) cb = document.layers[id];
		else if (document.all) cb = document.all[id].style;
		else if (document.getElementById) cb = document.getElementById(id).style; 
	
	with(cb){
			if (visibility==vanish && state == cbNull){
				visibility = see;
				return  true;	
			}		
			else if(visibility==see && state == cbNull){
				visibility = vanish;
				return  false;
			}		
			else if (state){
				visibility=(state == "visible")?see:vanish;
			}
		}
	}


	// changes any x and y coordinate
	function repositioner(id,valX, valY){
	
		if(document.layers)document.layers[id].moveToAbsolute(valX,valY); 
		else if (document.all) cb = document.all[id].style;
		else if (document.getElementById) cb = document.getElementById(id).style; 

	if(!document.layers){
		with(cb){
			left = valX;
			top = valY;
			}
		}
	}
	
	// list parser
	function decipher(id){
	var alias = id.split(".") ;
	return alias ;
	}
	
	// check for correct string value
	function checkString(alias, affinity){
		var stringLocation = affinity.indexOf(alias);
		if(stringLocation!=-1){
			if(affinity.charAt(stringLocation+(alias.length))=="" || affinity.charAt(stringLocation+(alias.length))=="."){
			 return true;
			 }
		}
		return false
	}
	
	createStyleSheet( );
	
	//netscape reload on resize
	//if(document.layers){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}

