//  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" */]];


function getCookie()
{
	theData   			= "a";
	theName   			= "srch_shibori_e=";		//Cookie Serch Name SHIBORIKOMI
	theName2			= "srch_hinban_e=";		//Cookie Serch Name HINBAN
	theCookie 			= document.cookie+";";
	chk_param 			= "XX";
	start 				= theCookie.indexOf(theName);
	var connectItems 	= ["XX","05","10","15","20","25","30"];		// CONNECT TYPE value list
	var hinsyuItems		= ["XX","05","10","15","20","22","25","30"];		// HINYSU value list
	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 list
	var typeItems		= ["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","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"];		// TYPE value list
	var tansi_tabItems 	= ["XX","05","10","15","20","25","30","35","45","50",
							"55","60","65","70","75","80"];				// TANSI TAB HABA value list

	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];
		hinsyu 			= shibori_param[1];
		series			= shibori_param[2];
		type			= shibori_param[3];
		tansi_tab		= shibori_param[4];
		kyokusu			= shibori_param[5];
		bosui1			= shibori_param[6];
		bosui2			= shibori_param[7];
		osumesu1		= shibori_param[8];
		osumesu2		= shibori_param[9];
		
		
		//alert(bosui1);
		if(!kyokusu.match(chk_param)){
			document.sibori.KYOKUSU.value = kyokusu;
		}

		if(bosui1.match("1")){
			document.sibori.BOSUI1.checked = true;
		}

		if(bosui2.match("2")){
			document.sibori.BOSUI2.checked = true;
		}

		if(osumesu1.match("1")){
			document.sibori.OSUMESU1.checked = true;
		}

		if(osumesu2.match("2")){
			document.sibori.OSUMESU2.checked = true;
		}
		

		for(i = 0 ; i < connectItems.length ; i++){
			if(connect_type.match(connectItems[i])){
				document.sibori.CONNECT_TYPE.selectedIndex = i;
			}
		}

		for(i = 0 ; i < hinsyuItems.length ; i++){
			if(hinsyu.match(hinsyuItems[i])){
				document.sibori.HINSYU.selectedIndex = i;
			}
		}

		for(i = 0 ; i < seriesItems.length ; i++){
			if(series.match(seriesItems[i])){
				document.sibori.SERIES.selectedIndex = 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);
			}
		}

		for(i = 0 ; i < tansi_tabItems.length ; i++){
			if(tansi_tab.match(tansi_tabItems[i])){
				document.sibori.TANSI_TAB.selectedIndex = i;
			}
		}
	}else{

		start = theCookie.indexOf(theName2);
		if (start != -1){
			end = theCookie.indexOf(";",start);
			theData = unescape(theCookie.substring(start+theName2.length,end));
		}
		
		if(theData !="a"){

			hinban_param 	= theData;

			if(hinban_param.length == 9){
				hinban_1 = hinban_param.substring(0,4);
				hinban_2 = hinban_param.substring(4,8);
				document.hinban.HINBAN1.value = hinban_1;
				document.hinban.HINBAN2.value = hinban_2;

			}else if(hinban_param.length == 10){
				hinban_1 = hinban_param.substring(0,4);
				hinban_2 = hinban_param.substring(4,8);
				hinban_3 = hinban_param.substring(8,9);
				document.hinban.HINBAN1.value = hinban_1;
				document.hinban.HINBAN2.value = hinban_2;
				document.hinban.HINBAN3.value = hinban_3;
			}else{
				hinban_1 = hinban_param.substring(0,4);
				hinban_2 = hinban_param.substring(4,8);
				hinban_3 = hinban_param.substring(8,10);
				document.hinban.HINBAN1.value = hinban_1;
				document.hinban.HINBAN2.value = hinban_2;
				document.hinban.HINBAN3.value = hinban_3;
			}
			
		}else{

		}
	}
	
}

/*=====================================================================
 [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]);
		}
	}
	
}