//  set the name of type_name
var type_name_e = [	["","S Type","M Type","L Type","T Type","W Type","X Type","Y Type","V Type","C Type","Z Type","YV Type","A Type","TK Type","NS Type","M-LC Type","L-MC Type"/* ,"SMJ Type" */,"RV Type","RK Type","Teihai Fuse","A1 Type","A1-S Type","A2 Type","A3 Type","B1 Type","B2 Type","C1 Type","Multi. FL Type","A1S-3P Type"/* ,"Batt. FL 1P Type","Batt. FL 2P Type","Batt. FL 3P Type","Batt. FL 5P Type","Batt. FL 6P Type","Block 7P Type","MFAV 6P Type","SPM Type I","SPM Type II","SPM Type III" */,"1.0III+2.3II","2.3II+4.8","2.3II+8.0","4.8+8.0","1.0III+2.3II+4.8","2.3II+4.8+8.0","A+NS","SSD+2.3II","0.64X0.64","1.5X0.8","2.8X0.8","6.3X0.8","9.5X1.2","Hybrid","Header","Specialty","Extraction","Standard Type","WPC Type"],		//Please choose
					["Can not choose"],		//0.64 Connector
					["Can not choose"],		//HS Connector
					["Can not choose"],		//RH Connector
					["Can not choose"],		//1.0III(040III) Connector
/*025 					["Can not choose"],		//SP Connector 025*/
					["Can not choose"],		//SSD Connector
					["Can not choose"],		//1.3(050) Connector
					["Can not choose"],		//1.5(060) Connector
					["Can not choose"],		//SDL Connector
					["Can not choose"],		//SDL-II Connector
					["Can not choose"],		//SWP Connector
					["Can not choose"],		//2.3(090) Connector
					["Can not choose"],		//2.3II(090II) Connector
					["Can not choose"],		//4.8(187) Connector
					["Can not choose"],		//New 250 Connector
					["Can not choose"],		//CN(A) Connector
					["Can not choose"],		//CN(B) Connector
/*090 					["Can not choose"],		//WPC250 Connector 090*/
					["Can not choose"],		//8.0(312) Connector
					["","Standard Type","WPC Type"],		//9.5(375) Connector
					["","1.0III+2.3II","2.3II+4.8","2.3II+8.0","4.8+8.0","1.0III+2.3II+4.8","2.3II+4.8+8.0","A+NS","SSD+2.3II"],		//Hybrid Connector
					["","A Type","TK Type","RV Type","RK Type","NS Type","M-LC Type","L-MC Type"/* ,"SMJ Type" */],		//91 Connector
					["","S Type","M Type","L Type","T Type","W Type","X Type","Y Type","V Type"],		//58 Connector
					["","C Type","Z Type","YV Type"],		//62 Connector
					["","0.64X0.64","1.5X0.8","2.8X0.8","6.3X0.8","9.5X1.2","Hybrid","Header","Specialty","Extraction"],		//YES Connector
					["Can not choose"],		//LA Terminal
					["Can not choose"],		//LE Terminal
					["Can not choose"],		//Kuwagata
					["Can not choose"],		//Optical
					["Can not choose"],		//LC CONNECTR
					["","Teihai Fuse"],		//Fuse
					["","A1 Type","A1-S Type","A2 Type","A3 Type","B1 Type","B2 Type","C1 Type","Multi. FL Type","A1-S3P Type"/* ,"Batt. FL 1P Type","Batt. FL 2P Type","Batt. FL 3P Type","Batt. FL 5P Type","Batt. FL 6P Type","Block 7P Type","MFAV 6P Type","SPM Type I","SPM Type II","SPM Type III" */]];

// parameter set of type_value_e
var type_value_e = [	["XX","005","010","015","020","025","030","035","040","045","050","055","060","065","070","075","080"/* ,"085" */,"090","095","100","105","110","115","120","125","130","135","140","145"/* ,"150","155","160","165","170","175","180","185","190","195" */,"200","215","220","225","230","245","255","260","265","270","275","280","285","290","295","300","305","310","315"],		//Please choose
					["XX"],		//0.64 Connector
					["XX"],		//HS Connector
					["XX"],		//RH Connector
					["XX"],		//1.0III(040III) Connector
/*025 					["XX"],		//SP Connector 025*/
					["XX"],		//SSD Connector
					["XX"],		//1.3(050) Connector
					["XX"],		//1.5(060) Connector
					["XX"],		//SDL Connector
					["XX"],		//SDL-II Connector
					["XX"],		//SWP Connector
					["XX"],		//2.3(090) Connector
					["XX"],		//2.3II(090II) Connector
					["XX"],		//4.8(187) Connector
					["XX"],		//New 250 Connector
					["XX"],		//CN(A) Connector
					["XX"],		//CN(B) Connector
/*090 					["XX"],		//WPC250 Connector 090*/
					["XX"],		//8.0(312) Connector
					["XX","310","315"],		//9.5(375) Connector
					["XX","200","215","220","225","230","245","255","260"],		//Hybrid Connector
					["XX","060","065","090","095","070","075","080"/* ,"085" */],		//91 Connector
					["XX","005","010","015","020","025","030","035","040"],		//58 Connector
					["XX","045","050","055"],		//62 Connector
					["XX","265","270","275","280","285","290","295","300","305"],		//YES Connector
					["XX"],		//LA Terminal
					["XX"],		//LE Terminal
					["XX"],		//Kuwagata
					["XX"],		//Optical
					["XX"],		//LC CONNECTR
					["XX","100"],		//Fuse
					["XX","105","110","115","120","125","130","135","140","145"/* ,"150","155","160","165","170","175","180","185","190","195" */]];

/*=============================================================
  [ saveCookieData]
==============================================================*/

function saveCookieData(code)
{
	theName  	= "pankuzu_e";			//Cookie name for pankuzu
	theName_url = "second_url_e";		//cookie name for URL 
	theURL_Value = document.URL + ":";
	
	//get connect type parameter
	theValue_1 	= document.sibori.CONNECT_TYPE.value;
	
	//if[True]then param is [01]
	if(document.sibori.BOSUI1.checked){
		theValue_2 = "01";
	}else{
		theValue_2 = "00";
	}
	if(document.sibori.BOSUI2.checked){
		theValue_3 = "01";
	}else{
		theValue_3 = "00";
	}
	
	if(code == null){
		theValue = theValue_1 + ":" + theValue_2 +":"+ theValue_3 +":";
	}else{
		theValue = theValue_1 + ":" + theValue_2 +":"+ theValue_3 +":"+code+":";
	}
	document.cookie = theName		+ "="+escape(theValue)		+ ";path=/;";
	document.cookie = theName_url	+ "="+escape(theURL_Value)	+ ";path=/;";
}

/*=============================================================
  [loadCookieData]
==============================================================*/

function loadCookieData(list)
{
	theData   			= "a";
	theName   			= "pankuzu_e=";
	theName_2			= "series_kind_e=";
	bosui				= "";
	pan_series_value	= "";
	var connectItems 	= ["XX","05","10","15","20","25","30"]
	var connectValues	= ["...","Wire to Wire","Wire to Board","Wire to Device",
							"Optical","Others:Fuse","Others:LA/LE Terminals"];		//Connector_type name
	var seriesItems		= ["XX","005","010","015","020","030","035","040","045","050",
							"055","060","065","070","075","080","085","095","100",
							"105","110","115","120","125","130","135","140","145","147","150","155"];	//Series [Value] Array
	var seriesValues	= ["...","0.64(025) Connector","HS Connectors","RH Connectors",
							"1.0III(040III) Connectors","SSD Connectors","1.3(050) Connectors",
							"1.5(060) Connectors","SDL Connectors","SDL-II Connectors","SWP Connectors",
							"2.3(090) Connectors","2.3II(090II) Connectors","4.8(187) Connectors",
							"New 250 Connectors","CN(A) Connectors","CN(B) Connectors",
							"8.0(312) Connectors","9.5(375) Connectors","Hybrid Connectors",
							"91 Connectors","58 Connectors","62 Connectors","YES/YESC Kaizen Connectors","LA Terminals",
							"LE Terminals","Kuwagata Terminals","MOST Connectors","LC Connectors","Fuse","FL"];	//Series[Value] Array
	theCookie = document.cookie + ";";
	start = theCookie.indexOf(theName);
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		theData = unescape(theCookie.substring(start+theName.length,end));
	}

	if(theData !="a"){
		shibori_param 	= theData.split(':');
		connect_type 	= shibori_param[0];
		bosui1	 		= shibori_param[1];
		bosui2			= shibori_param[2];
		series			= shibori_param[3];
		type			= shibori_param[4];
		
		// Set the param of default Connect type 
		for(i = 0 ; i < connectItems.length ; i++){
			if(connect_type.match(connectItems[i])){
				document.sibori.CONNECT_TYPE.selectedIndex = i;
				pan_connector = connectValues[i];
			}
		}
		//Set the param of default UnSealed checkbox
		if(bosui1.match("01")){
			document.sibori.BOSUI1.checked = true;
			bosui = ": Unsealed";
		}
		// Set the param of default Sealed checkbox
		if(bosui2.match("01")){
			document.sibori.BOSUI2.checked = true;
			bosui = ": Sealed";
		}
		// Set the param of default Series
		for(i = 0 ; i < seriesItems.length ; i++){
			if(series.match(seriesItems[i])){
				document.sibori.SERIES.selectedIndex = i;
				pan_series_value	= seriesValues[i];
			}
		}
		
		//Set the type list for Series
		setMenuItemLoad(document.sibori.SERIES.selectedIndex);
		
		//Set the type of default value
		for(i = 0 ; i < document.sibori.TYPE.length ; i++){
			if(type.match(document.sibori.TYPE.options[i].value)){
				document.sibori.TYPE.selectedIndex = i;
				//alert(document.sibori.TYPE.selectedIndex);
			}
		}
		
		if(list != null){
			if(connect_type.match("XX") && bosui.match("")){
				document.getElementById("pan_series").innerHTML	= pan_series_value;
			}else{
				document.getElementById("connect_sealed").innerHTML	= pan_connector +  bosui;
				document.getElementById("pan_series").innerHTML	= pan_series_value;
			}
		}else{
			document.getElementById("connect_sealed").innerHTML	= pan_connector +  bosui;
		}
	}else{
		start = theCookie.indexOf(theName_2);
		if (start != -1){
			end = theCookie.indexOf(";",start);
			theData = unescape(theCookie.substring(start+theName_2.length,end));
		}
		if(theData !="a"){
			shibori_param_2 	= theData.split(':');
			series_2 			= shibori_param_2[0];
			
			for(i = 0 ; i < seriesItems.length ; i++){
				if(series_2.match(seriesItems[i])){
					document.sibori.SERIES.selectedIndex = i;
				}
			}
		}
		
	}
}

/*=============================================================
  [callList]
==============================================================*/

function callList(type)
{
	theName  	= "pankuzu_e";		//Cookie name
	theName_url = "third_url_e";	//Cookie name for URL
	theURL_Value = document.URL + ":";
	
	//get the connector type param
	theValue_1 	= document.sibori.CONNECT_TYPE.value;
	
	if(document.sibori.BOSUI1.checked){
		theValue_2 = "01";
	}else{
		theValue_2 = "00";
	}
	if(document.sibori.BOSUI2.checked){
		theValue_3 = "01";
	}else{
		theValue_3 = "00";
	}
	//get the series param
	theValue_4 	= document.sibori.SERIES.value;
	
	theValue = theValue_1 + ":" + theValue_2 +":"+ theValue_3 +":" + theValue_4 + ":" + type + ":";
	document.cookie = theName		+ "=" +escape(theValue)		+ ";path=/;";
	document.cookie = theName_url	+ "=" +escape(theURL_Value)	+ ";path=/;";
	
	//document.mainfrm.submit()
	location.href	=	'/yazaki-web/servlet/ClassServlet_e?SERIES_e=' + document.sibori.SERIES.value + '&TYPE_e=' + type;
}

/*=============================================================
  [jump_second]
==============================================================*/

function jump_second()
{
	theData   			= "a";
	theName   			= "second_url_e=";
	
	theCookie = document.cookie + ";";
	
	start = theCookie.indexOf(theName);
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		theData = unescape(theCookie.substring(start+theName.length,end));
	}
	
	if(theData !="a"){
		shibori_param 	= theData.split(':');
		second_zone 	= shibori_param[1];
		//alert(shibori_param);
		location.href	=	second_zone;
	}
}

/*=============================================================
  [jump_third]
==============================================================*/

function jump_third()
{
	theData   			= "a";
	theName   			= "third_url_e=";
	
	theCookie = document.cookie + ";";
	
	start = theCookie.indexOf(theName);
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		theData = unescape(theCookie.substring(start+theName.length,end));
	}
	
	if(theData !="a"){
		shibori_param 	= theData.split(':');
		third_zone 	= shibori_param[1];
		location.href	= third_zone;
	}
}

/*=====================================================================
 [setMenuItemLoad]
======================================================================*/
function setMenuItemLoad(n)
{
	optlen = document.sibori.TYPE.options.length;
	for(num = optlen -1; num>= 0 ; num--){
		document.sibori.TYPE.options[num] = null;
		//clearOption(optlen,1);
	}
	
	if (type_name_e[n].length > 0)
	{
	
		for (num=0; num<type_name_e[n].length; num++)
		{
			document.sibori.TYPE.options[num] = new Option(type_name_e[n][num],type_value_e[n][num]);
		}
	}
	
}