function Toggle(elements) {
	var lang = location.href;
	var item = $(elements);
	var disp = Element.visible(item);
	if (lang.match(/j\.html/i)) {
		if(disp == 1) {
			Element.hide(item);
			$('sc_list').innerHTML = '<p class="pdon"><a href="javascript:void(0)" onclick="Toggle(\'sub_category\')">リストを表示する</a></p>';
		}else {
			Element.show(item);
			$('sc_list').innerHTML = '<p class="pdoff"><a href="javascript:void(0)" onclick="Toggle(\'sub_category\')">リストを非表示にする</a></p>';
		}
	} else {
		if(disp == 1) {
			Element.hide(item);
			$('sc_list').innerHTML = '<p class="pdon"><a href="javascript:void(0)" onclick="Toggle(\'sub_category\')">View List</a></p>';
		}else {
			Element.show(item);
			$('sc_list').innerHTML = '<p class="pdoff"><a href="javascript:void(0)" onclick="Toggle(\'sub_category\')">Hide List</a></p>';
		}
	}
}

function Toggle2(elements2) {
	var lang = location.href;
	var item2 = $(elements2);
	var disp = Element.visible(item2);
	if (lang.match(/j\.html/i)) {
		if(disp == 1) {
			Element.hide(item2);
			$('sr_list').innerHTML = '<p class="pdon"><a href="javascript:void(0)" onclick="Toggle2(\'series\')">リストを表示する</a></p>';
			
		}else {
			Element.show(item2);
			$('sr_list').innerHTML = '<p class="pdoff"><a href="javascript:void(0)" onclick="Toggle2(\'series\')">リストを非表示にする</a></p>';
		}
	} else {
		if(disp == 1) {
			Element.hide(item2);
			$('sr_list').innerHTML = '<p class="pdon"><a href="javascript:void(0)" onclick="Toggle2(\'series\')">View List</a></p>';
			
		}else {
			Element.show(item2);
			$('sr_list').innerHTML = '<p class="pdoff"><a href="javascript:void(0)" onclick="Toggle2(\'series\')">Hide List</a></p>';
		}
	}
}

function detail_show(elements) {
	var lang = location.href;
	var def_sr_id = $F('def_sr_id');
	if(def_sr_id == 0) {
		var noteObj = document.getElementsByClassName(elements);
//		Firefox3対策
		var noteObj_a = $A(noteObj);
		noteObj_a.each(function(obj){
			Element.show(obj);
		});
		if (lang.match(/j\.html/i)) {
			$('all_detail').innerHTML = '<a href="javascript:void(0)" onclick="detail_hide()" class="allproducts">ラインアップを非表示にする</a>';
		} else {
			$('all_detail').innerHTML = '<a href="javascript:void(0)" onclick="detail_hide()" class="allproducts">Hide Lineup</a>';
		}
	}
}

function detail_hide() {
	var lang = location.href;
	var def_sr_id = $F('def_sr_id');
	if(def_sr_id == 0) {
		var noteObj = document.getElementsByClassName('detail_list');
//		Firefox3対策
		var noteObj_a = $A(noteObj);
		noteObj_a.each(function(obj){
			Element.hide(obj);
		});
		if (lang.match(/j\.html/i)) {
			$('all_detail').innerHTML = '<a href="javascript:void(0)" onclick="detail_show(\'detail_list\')" class="allproducts">全てのラインアップを見る</a>';
		} else {
			$('all_detail').innerHTML = '<a href="javascript:void(0)" onclick="detail_show(\'detail_list\')" class="allproducts">See the Entire Lineup.</a>';
		}
	} else {
		Element.scrollTo('srtab');
	}
}

function sr_scroll() {
	Element.scrollTo('srtab');
}

function item_no_ajax(q_sr_id,q_item_no,sr_name,num) {
	var i = 0;
	for (i=0; i<$F('srcount'); i++) {
		if (num == i) {
			$('srcolor' + i).style.color = "#990000";
		} else {
			$('srcolor' + i).style.color = "#336699";
		}
	}
	var t_text = document.title;
	if (t_text.match(/(^.*?\s)(.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(|\s.*?\s)(\|\s.*?$)/)) {
		t_text = RegExp.$5+RegExp.$6+RegExp.$7+RegExp.$8+RegExp.$9;
	}
	if (t_text.match(/(^.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?$)/)) {
		t_text = RegExp.$3+RegExp.$4+RegExp.$5+RegExp.$6+RegExp.$7;
	}
	if (t_text.match(/(^.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?\s)(\|\s.*?$)/)) {
		t_text = RegExp.$2+RegExp.$3+RegExp.$4+RegExp.$5+RegExp.$6;
	}
/*
		document.title = q_item_no+' | '+sr_name+' '+t_text;
*/
	if (q_item_no) {
		document.title = q_item_no+' '+t_text;
	} else if (sr_name) {
		document.title = sr_name+' '+t_text;
	}
	if (location.href.match(/(http.*\/)(pro_item)(.*\/)(\d*\/)(.\.html)/)) {
		sc_url = RegExp.$1+'pro_sr'+RegExp.$3+RegExp.$5;
	} else {
		sc_url = location.href;
	}
	$("plist").innerHTML = ' &gt; <a href="'+sc_url+'">'+sr_name+'</a> &gt; '+q_item_no;
	var q_lang_id = $F('q_lang_id');
	var q_if_id = $F('q_if_id');
	var q_mc_id = $F('q_mc_id');
	var q_sc_id = $F('q_sc_id');
	var noURL = "/s2_ps/src/ajax_item_no.cgi?q_if_id=" + q_if_id + "&q_mc_id=" + q_mc_id + "&q_sc_id=" + q_sc_id + "&q_sr_id=" + q_sr_id + "&q_item_no=" + q_item_no + "&q_lang_id=" + q_lang_id + "&cache="+(new Date()).getTime();
	new Ajax.Updater("sr_print",noURL, { method: "get"});
	if (q_lang_id == 2) {
		$('lang_link').innerHTML = '<a href="http://www.ccs-inc.co.jp/s2_ps/src/pro_sr/'+q_if_id+'/'+q_mc_id+'/'+q_sc_id+'/'+q_sr_id+'/'+q_item_no+'/j.html"><img src="/common/gnavi5_off.gif" alt="JAPANESE" width="73" height="18" border="0" /></a>';
	} else {
		$('lang_link').innerHTML = '<a href="http://www.ccs-grp.com/s2_ps/src/pro_sr/'+q_if_id+'/'+q_mc_id+'/'+q_sc_id+'/'+q_sr_id+'/'+q_item_no+'/e.html"><img src="/common/gnavi5_off.gif" alt="ENGLISH" width="73" height="18" border="0" /></a>';
	}
}



new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if (objCN.hasOwnProperty(key)) {
					//parent type
					if(key == "parent CN"){
						for(var i=0 ; i<objCN[key].length ; i++){
							var max_height=0;
							var CCN = objCN[key][i].childNodes;
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j] && CCN[j].nodeType == 1){
									CCN[j].style.height="auto";
									max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
								}
							}
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j].style){
									var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									CCN[j].style.height =newheight+"px";
								}
							}
						}
					}else{
						var max_height=0;
						for(var i=0 ; i<objCN[key].length ; i++){
							objCN[key][i].style.height="auto";
							max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
						}
						for(var i=0 ; i<objCN[key].length ; i++){
							if(objCN[key][i].style){
								var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									objCN[key][i].style.height =newheight+"px";
							}
						}
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
		window.onresize=changeBoxSize;
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}
