var NoFirstMenus = 5; //Number of main menus

//Only 3 levels of sub menu
//Array('URL','Text for Link',Number of subs,internal or external link)
Menu1 = new Array('Index.asp','Home Page',0,0);
Menu2 = new Array('','Applications',5,0);
	Menu2_1 = new Array('automotive/index.html','Automotive',12,0);
		Menu2_1_1 = new Array('automotive/abs.html','Anti-Lock Brakes (ABS)',0,0);
		Menu2_1_2 = new Array('automotive/airbag.html','Airbags',0,0);
		Menu2_1_3 = new Array('automotive/bluetooth.html','Bluetooth® ICs',0,0);
		Menu2_1_4 = new Array('automotive/entertainment.html','Car Entertainment',2,0);
			Menu2_1_4_1 = new Array('automotive/4ch_pwamp.html','4-Channel Power ICs',0,0);
			Menu2_1_4_2 = new Array('automotive/cdmp3_dvd.html','CD/MP3/DVD',0,0);
		Menu2_1_5 = new Array('automotive/display_controller.html','Display Controller',0,0);
		Menu2_1_6 = new Array('automotive/eps.html','Electronic Power Steering (EPS)',0,0);
		Menu2_1_7 = new Array('automotive/evs.html','EV and HEV Systems',0,0);
		Menu2_1_8 = new Array('automotive/lighting.html','Lighting',0,0);
		Menu2_1_9 = new Array('automotive/micro.html','Microcontrollers',3,0);
			Menu2_1_9_1 = new Array('automotive/autocortexm3.html','Cortex M3 Line-up',0,0);
			Menu2_1_9_2 = new Array('automotive/functionalsafety.html','Functional Safety',0,0);
			Menu2_1_9_3 = new Array('automotive/motorcontroltechnology.html','Motor Control Technology',0,0);
		Menu2_1_10 = new Array('automotive/motordriver.html','Motor Driver',0,0);
		Menu2_1_11 = new Array('storagesolutions/transhare.html','TranShare™',0,0);
		Menu2_1_12 = new Array('automotive/visconti.html','Visconti',0,0);
	Menu2_2 = new Array('applications/homeappliances/index.html','Home Appliances',5,0);
		Menu2_2_1 = new Array('motorcontrol/index.html','Motor Control ASSPs',0,0);
		Menu2_2_2 = new Array('applications/homeappliances/mcumotorcont/Index.html','MCU Based Motor Control',0,0);
		Menu2_2_3 = new Array('applications/homeappliances/photocoupler/Index.html','Photocoupler',0,0);
		Menu2_2_4 = new Array('applications/homeappliances/powerproducts/Index.html','Power Products',0,0);
		Menu2_2_5 = new Array('applications/homeappliances/predriver/Index.html','Pre-Driver',0,0);
	Menu2_3 = new Array('applications/industrialsystems/index.html','Industrial Systems',0,0);
	Menu2_4 = new Array('mobile/index.html','Mobile Handsets',7,0);
		Menu2_4_1 = new Array('mobile/SystemMemory.html','System Memory',0,0);
		Menu2_4_2 = new Array('mobile/RemovableMemory.html','Removable Memory',0,0);
		Menu2_4_3 = new Array('mobile/IlluminationSensor.html','Illumination Sensor',0,0);
		Menu2_4_4 = new Array('mobile/PowerBooster.html','Power Booster',0,0);
		Menu2_4_5 = new Array('mobile/TFTDisplay.html','TFT Display',0,0);
		Menu2_4_6 = new Array('mobile/LEDs_Drivers.html','LEDs & Drivers',0,0);
		Menu2_4_7 = new Array('mobile/peripheral_lsi.html','Mobile Peripheral ICs',5,0);
			Menu2_4_7_1 = new Array('mobile/camerabridge.html','Camera Bridge',0,0);
			Menu2_4_7_2 = new Array('mobile/displaybridgehub.html','Display Bridge/Hub',0,0);
			Menu2_4_7_3 = new Array('mobile/EDISCO.html','Display Buffer',0,0);
			Menu2_4_7_4 = new Array('mobile/ioexpander.html','IO Expander',0,0);
			Menu2_4_7_5 = new Array('mobile/tvoutputbuffer.html','Mobile TV-Out/Display Buffer',0,0);
	Menu2_5 = new Array('TransferJet/index.html','Wireless Systems',0,0);
Menu3 = new Array('','Products',13,0);
	Menu3_1 = new Array('ASIC/index.html','ASIC & Foundry',8,0);
		Menu3_1_1 = new Array('ASIC/technology.html','ASIC Technology',2,0);
			Menu3_1_1_1 = new Array('ASIC/rfcmos.html','RFCMOS',0,0);
			Menu3_1_1_2 = new Array('ASIC/universalArray.html','Universal Array',0,0);
		Menu3_1_2 = new Array('ASIC/DesignService.html','ASIC Design Services',2,0);
			Menu3_1_2_1 = new Array('ASIC/EDA.html','Electronic Design Automation',0,0);
			Menu3_1_2_2 = new Array('ASIC/detailedEDA.html','Design Flow Details',0,0);
		Menu3_1_3 = new Array('ASIC/ProductionServices.html','Production Services',0,0);
		Menu3_1_4 = new Array('ASIC/IPs.html','Intellectual Properties',7,0);
			Menu3_1_4_1 = new Array('ASIC/EmbeddedARMCores.html','Embedded ARM® Core',0,0);
			Menu3_1_4_2 = new Array('ASIC/EmbeddedMIPSCores.html','Embedded MIPS Core',0,0);
			Menu3_1_4_3 = new Array('ASIC/EmbeddedMemory.html','Embedded Memory',0,0);
			Menu3_1_4_4 = new Array('ASIC/MixedSignalCores.html','Mixed Signal Cores',0,0);
			Menu3_1_4_5 = new Array('ASIC/FPDCore.html','Flat Panel Display Driver',0,0);
			Menu3_1_4_6 = new Array('ASIC/MIPI.html','MIPI-D-PHY',0,0);
			Menu3_1_4_7 = new Array('ASIC/USB.html','USB 2.0 PHY',0,0);
		Menu3_1_5 = new Array('ASIC/SoCs_Platforms.html','Advanced Product Development Solutions',3,0);
			Menu3_1_5_1 = new Array('ASIC/SoCSolution.html','SoC Solution',0,0);
			Menu3_1_5_2 = new Array('ASIC/IDMModel.html','Open and Advanced IDM Model',0,0);
			Menu3_1_5_3 = new Array('ASIC/universalArray.html','Universal Array',0,0);
		Menu3_1_6 = new Array('ASIC/Packages.html','Packages',8,0);
			Menu3_1_6_1 = new Array('ASIC/CPS.html','CPS',0,0);
			Menu3_1_6_2 = new Array('ASIC/PBGA.html','PBGA',0,0);
			Menu3_1_6_3 = new Array('ASIC/PBGAFC.html','PBGA[FC]',0,0);
			Menu3_1_6_4 = new Array('ASIC/PFBGA.html','PFBGA',0,0);
			Menu3_1_6_5 = new Array('ASIC/QFP.html','QFP',0,0);
			Menu3_1_6_6 = new Array('ASIC/QFN.html','QFN/QON',0,0);
			Menu3_1_6_7 = new Array('ASIC/WCSP.html','WCSP',0,0);
			Menu3_1_6_8 = new Array('ASIC/SiP.html','SiP',0,0);
		Menu3_1_7 = new Array('ASIC/AboutASIC&Foundry.html','More About ASIC & Foundry',0,0);
		Menu3_1_8 = new Array('ASIC/ASICSiteMap.html','ASIC Site Map',0,0);
	Menu3_2 = new Array('ASSP/index.html','ASSPs',2,0);
		Menu3_2_1 = new Array('ASSP/tc90708.html','HDMI Adapter IC',0,0);
		Menu3_2_2 = new Array('TransferJet/index.html','TransferJet™',0,0);
	Menu3_3 = new Array('diodes/index.html','Diodes',0,0);
	Menu3_4 = new Array('products/ddc/index.html','Displays & Devices',0,0);
	Menu3_5 = new Array('products/driverlsi/index.html','Driver IC',3,0);
		Menu3_5_1 = new Array('products/driverlsi/interfacedrivers/Index.html','Interface Drivers',0,0);
		Menu3_5_2 = new Array('motorcontrol/index.html','Motor Control ASSPs',0,0);
		Menu3_5_3 = new Array('products/driverlsi/LEDDrivers.html','LED Drivers',0,0);
	Menu3_6 = new Array('linear/index.html','General Purpose Linear ICs',0,0);
	Menu3_7 = new Array('logic/index.html','General Purpose Logic ICs',5,0);
		Menu3_7_1 = new Array('logic/standardlogic.html','Standard Logic',0,0);
		Menu3_7_2 = new Array('ParamSearch/logic_cmos.html','Standard Logic Parametric Search',0,0);
		Menu3_7_3 = new Array('logic/lmos.html','Single-Gate Logic (LMOS)',0,0);
		Menu3_7_4 = new Array('ParamSearch/logic_lmos.html','Single-Gate Logic (LMOS) Parametric Search',0,0);
		Menu3_7_5 = new Array('logic/advancedlogic.html','Advanced Logic',4,0);
			Menu3_7_5_1 = new Array('logic/selection_levelshifter1.html','Dual-Supply Unidirectional Level Shifters',0,0);
			Menu3_7_5_2 = new Array('logic/selection_levelshifter2.html','Dual-Supply Bidirectional Level Shifters',0,0);
			Menu3_7_5_3 = new Array('logic/selection_levelshifter3.html','Logic Gate with Level-Shifting Function',0,0);
			Menu3_7_5_4 = new Array('logic/function_busswitch.html','List of Bus Switches by Feature',0,0);
	Menu3_8 = new Array('memory/index.html','Memory',6,0);
		Menu3_8_1 = new Array('memory/nand.html','Emb. NAND Flash',8,0);
			Menu3_8_1_1 = new Array('memory/slc.html','SLC NAND',0,0);
			Menu3_8_1_2 = new Array('memory/slc_sb.html','SLC NAND Small Block ',0,0);
			Menu3_8_1_3 = new Array('memory/slc_lbmc.html','SLC NAND Large Block',0,0);
			Menu3_8_1_4 = new Array('memory/slc_lblc.html','SLC NAND Large Capacity',0,0);
			Menu3_8_1_5 = new Array('memory/togglenand.html','SLC NAND Toggle Interface',0,0);
			Menu3_8_1_6 = new Array('memory/mlc.html','MLC NAND Flash',0,0);
			Menu3_8_1_7 = new Array('memory/emmc.html','e•MMC™',0,0);
			Menu3_8_1_8 = new Array('memory/SmartNAND.html','SmartNAND™',0,0);
		Menu3_8_2 = new Array('memory/mcp.html','MCP Memory',0,0);
		Menu3_8_3 = new Array('ssd/index.html','Solid State Drive (SSD)',5,0);
			Menu3_8_3_1 = new Array('ssd/ssd/index.html','What Are SSDs?',0,0);
			Menu3_8_3_2 = new Array('ssd/toshiba-ssd/index.html','Toshiba SSDs',0,0);
			Menu3_8_3_3 = new Array('ssd/message/index.html','Message',0,0);
			Menu3_8_3_4 = new Array('ssd/lineup/index.html','Product Lineup',0,0);
			Menu3_8_3_5 = new Array('ssd/faq/index.html','FAQs',0,0);
		Menu3_8_4 = new Array('storagesolutions/index.html','Content Storage Solutions',8,0);
			Menu3_8_4_1 = new Array('','<b>Products</b>',0,0);
			Menu3_8_4_2 = new Array('storagesolutions/microsd.html','Low Density MicroSD Cards',0,0);
			Menu3_8_4_3 = new Array('storagesolutions/transhare.html','TranShare™',0,0);
			Menu3_8_4_4 = new Array('','<b>Markets</b>',0,0);
			Menu3_8_4_5 = new Array('storagesolutions/ebooks.html','eBooks',0,0);
			Menu3_8_4_6 = new Array('storagesolutions/electronicmanuals.html','Electronic Manuals',0,0);
			Menu3_8_4_7 = new Array('storagesolutions/multimediadistribution.html','Multi Media Distribution',0,0);
			Menu3_8_4_8 = new Array('storagesolutions/softwaredistribution.html','Software Distribution',0,0);
		Menu3_8_5 = new Array('http://www.toshiba-memory.com','Cards & USB Sticks for Consumers',0,1);
		Menu3_8_6 = new Array('FlashAir/index.html','FlashAir™ Wireless LAN SD Card',0,0);
	Menu3_9 = new Array('microcontroller/index.html','Microcontroller',3,0);
		Menu3_9_1 = new Array('microcontroller/ARM9.html','ARM9',2,0);
			Menu3_9_1_1 = new Array('microcontroller/TMPA900Family.html','TMPA900 Family',0,0);
			Menu3_9_1_2 = new Array('microcontroller/TMPA910Family.html','TMPA910 Family',0,0);
		Menu3_9_2 = new Array('microcontroller/Cortex.html','Cortex M3',7,0);
			Menu3_9_2_1 = new Array('microcontroller/TMPM320.html','TMPM320',0,0);
			Menu3_9_2_2 = new Array('microcontroller/TMPM330.html','TMPM330',0,0);
			Menu3_9_2_3 = new Array('automotive/micro.html','TMPM350',2,0);
			Menu3_9_2_4 = new Array('microcontroller/TMPM360.html','TMPM360',0,0);
			Menu3_9_2_5 = new Array('microcontroller/TMPM370.html','TMPM370',0,0);
			Menu3_9_2_6 = new Array('microcontroller/TMPM380.html','TMPM380',0,0);
			Menu3_9_2_7 = new Array('microcontroller/TMPM390.html','TMPM390',0,0);
		Menu3_9_3 = new Array('ParamSearch/mcu.html','Parametric Search',0,0);
	Menu3_10 = new Array('opto/index.html','Optical Semiconductor Devices',2,0);
		Menu3_10_1 = new Array('couplers/index.html','Photocouplers & Photorelays',11,0);
			Menu3_10_1_1 = new Array('couplers/photocoupler_ic_logic.html','Photocouplers for Logic & IPM Drive',0,0);
			Menu3_10_1_2 = new Array('couplers/photocoupler_ic_igbt.html','Photocouplers for IGBT/MOSFET',0,0);
			Menu3_10_1_3 = new Array('ParamSearch/photo_ic.html','IC Output Parametric Search',0,0);
			Menu3_10_1_4 = new Array('couplers/photocoupler_transistor.html','Transistor Output Photocouplers ',0,0);
			Menu3_10_1_5 = new Array('ParamSearch/photo_transistor.html','Transistor Output Parametric Search ',0,0);
			Menu3_10_1_6 = new Array('couplers/photocoupler_triac.html','Triac Output Photocouplers',0,0);
			Menu3_10_1_7 = new Array('ParamSearch/photo_triac.html','Triac Output Parametric Search',0,0);
			Menu3_10_1_8 = new Array('couplers/photocoupler_photovoltaic.html','Photovoltaic Output Photocouplers',0,0);
			Menu3_10_1_9 = new Array('ParamSearch/photo_voltaic.html','Photovoltaic Output Parametric Search',0,0);
			Menu3_10_1_10 = new Array('couplers/photorelays.html','Photorelays (MOSFET Output)',0,0);
			Menu3_10_1_11 = new Array('ParamSearch/photo_photorelay.html','Photorelays Parametric Search',0,0);
		Menu3_10_2 = new Array('LEDS/index.html','Visible LEDs',9,0);
			Menu3_10_2_1 = new Array('LEDS/see_through_indicator.html','See-Through Type',0,0);
			Menu3_10_2_2 = new Array('LEDS/led_smd_hf.html','High Luminous Flux Type',0,0);
			Menu3_10_2_3 = new Array('LEDS/flattop.html','Flat-top Type',0,0);
			Menu3_10_2_4 = new Array('LEDS/led_smd_plcc.html','Flat-top Type PLCC',0,0);
			Menu3_10_2_5 = new Array('LEDS/led_smd_mini_plcc.html','Flat-top Type Mini PLCC',0,0);
			Menu3_10_2_6 = new Array('LEDS/led_smd_2125.html','Flat-top Type 2125',0,0);
			Menu3_10_2_7 = new Array('LEDS/led_smd_1608.html','Flat-top Type 1608',0,0);
			Menu3_10_2_8 = new Array('LEDS/led_smd_lens.html','Lens-top Type',0,0);
			Menu3_10_2_9 = new Array('ParamSearch/led.html','LED Parametric Search',0,0);
	Menu3_11 = new Array('rfdevices/index.html','Radio-Frequency Devices',0,0);
	Menu3_12 = new Array('sensors/index.html','Sensors',0,0);
	Menu3_13 = new Array('transistors/index.html','Transistors',1,0);
		Menu3_13_1 = new Array('transistors/mosfet.html','MOSFETs',3,0);
			Menu3_13_1_1 = new Array('automosfet/index.html','Automotive MOSFETs',0,0);
			Menu3_13_1_2 = new Array('dtmos/index.html','DTMOS',0,0);		
			Menu3_13_1_3 = new Array('ParamSearch/mosfets.html','Parametric Search',0,0);
Menu4 = new Array('','Support',10,0);	
	Menu4_1 = new Array('feedback/index.html','Contact Us',1,0);
		Menu4_1_1 = new Array('feedback/toshibaoffices.html','Toshiba Offices',0,0);
	Menu4_2 = new Array('https://b2bis.toshiba.de/EDGEServices/ESamplingGateway/','Product Samples',0,1);
	Menu4_3 = new Array('http://service.stkcheck.com/?mfg=7201ea5c-ff99-41bb-83fb-3c4e9c71f287','Stock Check',0,1);
	Menu4_4 = new Array('xref/xref.html','Cross Reference',0,0);
	Menu4_5 = new Array('ParamSearch/all_parts.html','General Part Number Search',0,0);
	Menu4_6 = new Array('products/eldec/index.html','Engineering Services',0,0);
	Menu4_7 = new Array('support/environment.html','Environment',2,0);
		Menu4_7_1 = new Array('support/environmentpolicy.html','Environment Policy',0,0);
		Menu4_7_2 = new Array('WEEE_RoHS/WEEE_RoHS.html','WEEE & RoHS',0,0);
	Menu4_8 = new Array('support/quality.html','Quality & Reliability',0,0);
	Menu4_9 = new Array('feedback/distributioncentre.html','Distributors',0,0);
	Menu4_10 = new Array('support/ECommerce.html','Toshiba\'s E-Commerce Capabilities',0,0);
Menu5 = new Array('','About Toshiba Electronics Europe',5,0);
	Menu5_1 = new Array('aboutus/index.html','About Us',4,0);
		Menu5_1_1 = new Array('aboutus/Impressum.html','Impressum',0,0);
		Menu5_1_2 = new Array('aboutus/PrivacyPolicy.html','Privacy Policy FAQ',1,0);
			Menu5_1_2_1 = new Array('aboutus/OnlinePrivacyPolicy.html','Online Privacy Policy',0,0);
		Menu5_1_3 = new Array('aboutus/terms.html','Terms & Conditions',0,0);
		Menu5_1_4 = new Array('aboutus/management.html','Toshiba Management',0,0);
	Menu5_2 = new Array('http://www.toshiba-europe.com/csr/index.html','European Corporate Social Responsibility',0,1);
	Menu5_3 = new Array('calendar/index.html','Events Calendar',0,0);
	Menu5_4 = new Array('pressoffice/index.asp','Press Releases',0,0);
	Menu5_5 = new Array('rss/index.html','RSS Feeds',0,0);


var md;
function SetDepth(d){
if (d==0){md=0};
if (d==1){md='../'};
if (d==2){md='../../'};
if (d==3){md='../../../'};
if (d==4){md='../../../../'};
}

function doKeySearch(f) {

	if (f.CiRestriction.value == "Keyword Search")
	  {
	    alert("Please enter a value for the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  } 
	
	  if (f.CiRestriction.value == "")
	  {
	    alert("Please enter a value for the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }
	
	  if (f.CiRestriction.value.length < 3)
	  {
	    alert("Please enter at least 3 characters in the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }
	
	  if (f.CiRestriction.value.length > 100)
	  {
	    alert("Please enter at most 100 characters in the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }

	var pos = illChars(f.CiRestriction.value);
	if(pos == -1){
		f.action = url;
		return true;
		}
	else{
		alert('There is an illeagal character within the search string.');
		return false;
		}

}

function SearchMenu(d){
document.write("<div id=mmArea>");
document.write("<div class=head>Search</div>");
document.write("</div>");
document.write("<ul class=list-mm1>");
document.write("<li><a href=http://www.semicon.toshiba.co.jp/openb2b/websearch/start.jsp target=_blank>Search Datasheets on Toshiba Semicon. site</a></li>");
document.write("</ul>");
document.write("<ul class=list-mm1>");
if (d == 0){document.write("<li><a href=Search/index.html>Site Search</a></li><br><br>");
	document.write("<FORM ACTION=search/Query.idq METHOD=GET ONSUBMIT=\"return doKeySearch(this)\"");
	}
else {document.write("<li><a href=" + md + "Search/index.html>Site Search</a></li><br><br>");
	document.write("<FORM ACTION=" + md + "search/Query.idq METHOD=GET ONSUBMIT=\"return doKeySearch(this)\"");
	}
	document.write("NAME=Search><INPUT TYPE=hidden NAME=CiMaxRecordsPerPage VALUE=10>");
	document.write("&nbsp;<INPUT TYPE=hidden NAME=CiSort VALUE=rank[d]>");
	document.write("<INPUT TYPE=TEXT NAME=CiRestriction SIZE=16 MAXLENGTH=100>");
if (d == 0){document.write("<img border=0 src=images/arrow_mm.gif onclick=submit(); width=12 height=12>");} 
else {document.write("<img border=0 src=" + md + "images/arrow_mm.gif onclick=submit(); width=12 height=12>");}
document.write("</FORM>");
document.write("</ul>");
}

function expander(sub){
var f = document.getElementById(sub);
if ( f.style.display != 'none' ) {f.style.display = 'none';}
else {f.style.display = '';}
}

function sub3rdMenu(m,mn,sm,sm2,sm3,menu,noOfSubs){
var i;
var j;
document.write("<ul class=list-mm2>");
for (i=1;i<=noOfSubs;i++){
	j = eval(menu+'_'+i);
	if (j[0].length > 0){
	if (j[3]==1){document.write("<li><a target=_blank href=" + j[0] + ">" + j[1] + " </a></li>")}
	else{if (md==0){document.write("<li><a href=" + j[0] + ">" + j[1] + "</a></li>")}
		else {a = menu.substring(4,5);
			if ((mn==a)&&(sm3==i)){
				document.write("<li><a class=\"selected2\" href=" + md + j[0] + ">" + j[1] + "</a>");
				}
			else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a></li>");}
			}
		}
		
		}
	else {document.write("<div>"+j[1]+"</div>")}
		
	}
document.write("</ul>");
}

function sub2ndMenu(m,mn,sm,sm2,sm3,menu,noOfSubs){
var i;
var j;
document.write("<ul class=list-mm2>");
for (i=1;i<=noOfSubs;i++){
	j = eval(menu+'_'+i);
	if (j[3]==1){document.write("<li><a target=_blank href=" + j[0] + ">" + j[1] + "</a></li>")}
	else{if (md==0){document.write("<li><a href=" + j[0] + ">" + j[1] + "</a></li>")}
		else {a = menu.substring(4,5);
			if ((mn==a)&&(sm2==i)){
				if ((mn==a)&&(sm2==i)&&(sm3==0)){
					document.write("<li><a class=\"selected2\" href=" + md + j[0] + ">" + j[1] + "</a>");
					if (j[2]>0){
						sub3rdMenu(m,mn,sm,sm2,sm3,menu+'_'+i,j[2]);
						document.write("</li>");}
					}
				else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a>");
					if (j[2]>0){
						sub3rdMenu(m,mn,sm,sm2,sm3,menu+'_'+i,j[2]);
						document.write("</li>");}
					}
				}
			else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a></li>");}
			}
		}
	}
document.write("</ul>");
}

//menu number, menu array name, sub menu numbers, number of subs taken from menu array
function subMenu(m,mn,sm,sm2,sm3,menu,noOfSubs){
var i;
var j;
var a;

document.write("<div id=M"+m+"Sub style='display:None'>");
document.write("<ul class=list-mm2>");
for (i=1;i<=noOfSubs;i++){
	j = eval(menu+'_'+i);
	if (j[3]==1){document.write("<li><a target=_blank href=" + j[0] + ">" + j[1] + "</a></li>")}
	else{if (md==0){document.write("<li><a href=" + j[0] + ">" + j[1] + "</a></li>")}
		else {a = menu.substring(4,5);
			if ((mn==a)&&(sm==i)){
				if ((mn==a)&&(sm==i)&&(sm2==0)){
					document.write("<li><a class=\"selected2\" href=" + md + j[0] + ">" + j[1] + "</a>");
					if (j[2]>0){						
						sub2ndMenu(m,mn,sm,sm2,sm3,menu+'_'+i,j[2]);
						document.write("</li>");}
					}
				else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a>");
					if (j[2]>0){
						sub2ndMenu(m,mn,sm,sm2,sm3,menu+'_'+i,j[2]);
						document.write("</li>");}
					}
				}
			else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a></li>");}
			}
		}
	}
document.write("</ul>");
document.write("</div>");
}



function Menu(d,mn,sm,sm2,sm3){
var i;
var j;
SetDepth(d);
document.write("<div id=mmArea>");
document.write("<div class=head>Main Menu</div>");

for (i=1;i<=NoFirstMenus;i++){
	j = eval('Menu'+i);
	document.write("<ul class=list-mm1>");
	if ((j[0]=='')&&(j[2]>0)){
		document.write("<li><div id=M"+ i + " class=Outline style='cursor: pointer' onclick=expander('M" +i+ "Sub')>" + j[1] + "</div>");
		subMenu(i,mn,sm,sm2,sm3,'Menu'+i,j[2]);
			if(mn==i){expander('M' +i+ 'Sub');}
		document.write("</li>");}
	else {if(md==0){document.write("<li><a href=" + j[0] + ">" + j[1] + "</a></li>");}
		else{if(mn==i){document.write("<li><a class=\"selected2\" href=" + md + j[0] + ">" + j[1] + "</a></li>");}
			else{document.write("<li><a href=" + md + j[0] + ">" + j[1] + "</a></li>");}}
			}
	document.write("</ul>");
	}
document.write("</div>");
SearchMenu(d);
}

function escapeHTML(text) {
  var replacements = {"<": "&lt;", ">": "&gt;",
                      "&": "&amp;", "\"": "&quot;"};
  return text.replace(/[<>&"]/g, function(character) {
    return replacements[character];
  });
}

function illChars(text){
var chrs = new Array("&","<",">","\"","\'");
for (var i=0;i<chrs.length-1;i++){
	if(text.indexOf(chrs[i])>-1){
		return i;
		}
	}
	return -1;
}

var search = new Array();
search["number"] = "/ParamSearch/all_parts.html";
search["word"] = "/search/Query.idq";
function doSearch(f) {
	var url;
	var chk;
	if (f.CiRestriction.value == "Keyword Search")
	  {
	    alert("Please enter a value for the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  } 
	
	  if (f.CiRestriction.value == "")
	  {
	    alert("Please enter a value for the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }
	
	  if (f.CiRestriction.value.length < 3)
	  {
	    alert("Please enter at least 3 characters in the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }
	
	  if (f.CiRestriction.value.length > 100)
	  {
	    alert("Please enter at most 100 characters in the Keyword search field.");
	    f.CiRestriction.focus();
	    return false;
	  }

	
	for (var i = 0; i < f.search_type.length; i++) {
		if (f.search_type[i].checked) {
			url = search[f.search_type[i].value];			
			chk = f.search_type[i].value
			//for Keyword
			if (chk=="word") {
				var pos = illChars(f.CiRestriction.value);
				if(pos == -1){
					f.action = url;
					return true;
					}
				else{
					alert('There is an illeagal character within the search string.');
					return false;
					}
				}
			// for part number
			if (chk=="number"){
				f.partfilter.value = escapeHTML(f.CiRestriction.value);
				f.action = url;
				return true;
				}
		}
	}
}


