﻿function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//End of Macromedia Code

//with prototype.js
//pulldown menu
function pulldown(layerId) {
	document.getElementById(layerId).style.display = "block";
}
function pullup(layerId) {
	document.getElementById(layerId).style.display = "none";
}
//idiot safari, idiot apple, idiot idiot idiot
function on(obj) {
	obj.className = "safari";
}
function off(obj) {
	obj.className = "";
}

//tab menu
function resetTab() {
	str = document.URL;
	//Set First
	var i,s = "#tab",setD = 0;
	for (i = 1; i <= 5; i++) {
		if (str.match(s+i)) {
			var setD = i-1;
		}else{
		}
	}
	//Set Content Visibility & Color
	var d = document,num = setD,len = d.getElementsByClassName("tabs_bg").length;
	var len2 = d.getElementsByClassName("hansel").length+d.getElementsByClassName("title").length+d.getElementsByClassName("collect_content").length,len3 = len2/3;
	if (len != 0) {
		for (i = 0; i < len; i++) {
			d.getElementsByClassName("collect_content")[i].style.display = "none";
			d.getElementsByClassName("tabs_bg")[i].className = "tabs_bg";
		}
		if (len == len3) {
			for (i = 0; i < len; i++) {
				d.getElementsByClassName("hansel")[i].style.display = "none";
				d.getElementsByClassName("title")[i].style.display = "none";
			}
			d.getElementsByClassName("hansel")[num].style.display = "block";
			d.getElementsByClassName("title")[num].style.display = "block";
		}
		d.getElementsByClassName("collect_content")[num].style.display = "block";
		d.getElementsByClassName("tabs_bg")[num].className = "tabs_bg tabs_bg_active";
		albtm();
		setNum = len3;
	}
}
function collectTab(num) {
	var i,d = document,len = d.getElementsByClassName("tabs_bg").length,len2 = setNum;
	//Set Content Visibility & Color
	d.getElementsByClassName("tabs_bg_active")[0].className = "tabs_bg";
	for (i = 0; i < len; i++) {
		d.getElementsByClassName("collect_content")[i].style.display = "none";
	}
	if (len == len2) {
		for (i = 0; i < len; i++) {
			d.getElementsByClassName("hansel")[i].style.display = "none";
			d.getElementsByClassName("title")[i].style.display = "none";
		}
		d.getElementsByClassName("hansel")[num].style.display = "block";
		d.getElementsByClassName("title")[num].style.display = "block";
	}
	d.getElementsByClassName("collect_content")[num].style.display = "block";
	d.getElementsByClassName("tabs_bg")[num].className = "tabs_bg tabs_bg_active";
	albtm();
}
//Always bottom
//Set Always bottom for SickIE & SickSafari1.3.2
function albtm() {
	$('container').style.height = Element.getHeight($('container'))+"px";
	for (p = 0; p < 2; p++) {
		$("footer").style.top = Element.getHeight($('container'))+p-40+"px";
	}
	$('container').style.height = "";
}
function foot() {
	$("content").style.visibility = "hidden";
	var str = $("footer").style.top,str2 = $("content").style.visibility;
	$("footer").style.bottom = "0px";
	if (str.match("px")) {
		$("footer").style.top = "";
	}else{
	}
	if (str2.match("visible")) {
	}else{
		$("content").style.visibility = "visible";
	}
}
//with Accordion.js
function loadAccordions() {
	$('top_container').style.visibility = "hidden";
	//Beginning Width Setting
	var i,d = document,len = d.getElementsByClassName("horizontal_accordion_toggle").length;
	var wth = Element.getDimensions($('top_container')).width-1,minWth = wth-len*27,defSize = minWth+len*27+"px",maxWth = minWth-25+"px";
	$('top_container').style.width = defSize;
	for (i = 0; i < len; i++) {
		d.getElementsByClassName("innercontent")[i].style.width = maxWth;
	}
	//End Width Setting
	//Beginning Nomal section
	var topAccordion = new accordion('#top_container', {
		classNames : {
			toggle : 'horizontal_accordion_toggle',
			toggleActive : 'horizontal_accordion_toggle_active',
			content : 'horizontal_accordion_content'
		},
		defaultSize : {
			width : minWth
		},
		direction : 'horizontal'
	});
	// Open first one
	var j = len-1;
	topAccordion.activate($$('#top_container .horizontal_accordion_toggle')[j]);
	//End Nomal section
	//Beginning Height Setting
	var ret = Element.getHeight($('top_container'))+"px",ret2 = Element.getHeight($('top_container'))-1+"px";
	for (j = 0; j < len; j++) {
		d.getElementsByClassName("horizontal_accordion_toggle")[j].style.height = ret;
		d.getElementsByClassName("horizontal_accordion_content")[j].style.height = ret2;
	}
	d.getElementsByClassName("horizontal_accordion_toggle")[0].style.backgroundColor = "#fff";
	$('top_container').style.visibility = "visible";
	//End Height Setting
	albtm();
}
function bk() {
	history.back();
}
