﻿var xhm = new XMLHttpRequest();
var ch_content;
function c_content(){
	if(ch_content=="hidden"){
		document.getElementById("show").style.overflow="hidden";
	}else{
		document.getElementById("show").style.overflow="auto";
	}
}
function bst_content(){
	document.getElementById("show").style.overflow="hidden";
}
function getdata(str){
	ch_content="auto";
	document.getElementById("content").style.backgroundImage="url('BG/ctBG.png')";
	xhm.open("POST",str,true);
	xhm.setRequestHeader("Content-type","application/x-www-from-urlencode");
	xhm.onreadystatechange = respondseXHR;
	xhm.send();
}

function respondseXHR(){				
	if(xhm.readyState==4){	
		if(xhm.status == 200){
			document.getElementById("show").innerHTML=xhm.responseText;
		}
	}
}

function getPDFdata(str){
	ch_content="hidden";
	document.getElementById("content").style.backgroundImage="none";
	document.getElementById("show").innerHTML="<iframe src=' "+str+" ' width='100%' height='100%' border='0px'></iframe>";
}

function open_win(url){
	window.open(url);
}
function mainMouseOver(MOver){
	document.getElementById(MOver).style.backgroundImage="url('images/gg.gif')";
	document.getElementById(MOver+'in').style.backgroundColor="lightgray";
}
function mainMouseOut(MOut){
	document.getElementById(MOut).style.backgroundImage="url('images/gg.png')";
	document.getElementById(MOut+'in').style.backgroundColor="transparent";
}
function EMouseOver(btName){
	document.getElementById(btName).style.backgroundImage="url('Button/"+btName+"(Over).png')";
}

function EMouseOut(btName){
	document.getElementById(btName).style.backgroundImage="url('Button/"+btName+".png')";
}

function  EMouseDown(btName){
	document.getElementById(btName).style.backgroundImage="url('Button/"+btName+"(Click).png')";
}

function  EMouseUp(btName){
	document.getElementById(btName).style.backgroundImage="url('Button/"+btName+".png')";
}

function subNav(BT,SubBT){
	var str="<table><tr>";
	if(BT==4||BT==5){
		for(var i=1;i<SubBT-1;i++){
			str=str+"<td><a id='BT"+BT+"_"+i+"' href='javascript:'  onMouseOver='EMouseOver(&#34BT"+BT+"_"+i+"&#34);'  onclick='getdata(&#34Page"+BT+"/Page"+BT+"_"+i+".html&#34); document.getElementById(&#34subnav&#34).innerHTML=&#34 &#34;' onMouseOut='EMouseOut(&#34BT"+BT+"_"+i+"&#34);' onMouseDown='EMouseDown(&#34BT"+BT+"_"+i+"&#34);' onMouseUp='EMouseUp(&#34BT"+BT+"_"+i+"&#34);'></a></td>";
		}
		str=str+"<td><a id='BT"+BT+"_"+(SubBT-1)+"' href='javascript:'  onMouseOver='EMouseOver(&#34BT"+BT+"_"+(SubBT-1)+"&#34);'  onclick='getPDFdata(&#34Page"+BT+"/Page"+BT+"_"+(SubBT-1)+".pdf&#34); document.getElementById(&#34subnav&#34).innerHTML=&#34 &#34;' onMouseOut='EMouseOut(&#34BT"+BT+"_"+(SubBT-1)+"&#34);' onMouseDown='EMouseDown(&#34BT"+BT+"_"+(SubBT-1)+"&#34);' onMouseUp='EMouseUp(&#34BT"+BT+"_"+(SubBT-1)+"&#34);'></a></td>";
		str=str+"<td><a id='BT"+BT+"_"+SubBT+"' href='javascript:'  onMouseOver='EMouseOver(&#34BT"+BT+"_"+SubBT+"&#34);'  onclick='getdata(&#34Page"+BT+"/Page"+BT+"_"+SubBT+".html&#34); document.getElementById(&#34subnav&#34).innerHTML=&#34 &#34;' onMouseOut='EMouseOut(&#34BT"+BT+"_"+SubBT+"&#34);' onMouseDown='EMouseDown(&#34BT"+BT+"_"+SubBT+"&#34);' onMouseUp='EMouseUp(&#34BT"+BT+"_"+SubBT+"&#34);'></a></td>";
	}else{
		for(var i=1;i<=SubBT;i++){
			str=str+"<td><a id='BT"+BT+"_"+i+"' href='javascript:'  onMouseOver='EMouseOver(&#34BT"+BT+"_"+i+"&#34);'  onclick='getdata(&#34Page"+BT+"/Page"+BT+"_"+i+".html&#34); document.getElementById(&#34subnav&#34).innerHTML=&#34 &#34;' onMouseOut='EMouseOut(&#34BT"+BT+"_"+i+"&#34);' onMouseDown='EMouseDown(&#34BT"+BT+"_"+i+"&#34);' onMouseUp='EMouseUp(&#34BT"+BT+"_"+i+"&#34);'></a></td>";
		}
	}
	str=str+"</tr></table>";
	document.getElementById('subnav').innerHTML=str;
}
function head_con(head){
	document.getElementById('head_content').innerHTML=head;
}
function BackGround_img(BG){
	document.getElementById("content").style.backgroundImage="url('BG/"+BG+".png')";
}
