////////////////////////
//이벤트 리스너 셋트
////////////////////////
window.onload = function() {
    // <p> 엘리먼트 리스너 세트
	if (current_mid)
	{
		midpager(); //mid값에 따라 상단 그림을 변경시킴.
		//.ChangeUpper('http://www.kotul.net/htm_bin/i/head/hsp00.jpg');

	}else{

		alert('mid 값을 찾아낼 수 없습니다.');

	}
}
	//if(window.search_port()){
		//search_port();
	//}

	function midpager(){
		//제로보드 스킨이 아닌 기본 스킨일 적에,

		var uDate = new Date();

		var uYear = uDate.getFullYear(); //4자리 연도
		var uMon = uDate.getMonth() + 1; //1~12까지의 월
		var uDay = uDate.getDate(); //1~31일까지의 일
		
		if(uMon == '12' && uDay >= '23' && uDay <= '30')
		{//배경은, 크리스마스,
			ChangeUpper('http://www.kotul.net/htm_bin/i/head/h_xmas_'+uYear+'.jpg');

		}else if (uMon == '9' && uDay >= '7' && uDay <= '10')
		{//코털데이.
			ChangeUpper('http://www.kotul.net/htm_bin/i/head/h_kotul_'+uYear+'.jpg');

		}else if (uMon == '1' && uDay >= '1' && uDay <= '15')
		{//새해.
			ChangeUpper('http://www.kotul.net/htm_bin/i/head/h_newyear_'+uYear+'.jpg');

		}else{

		//평시
			if(current_mid=="frontpage"){
				ChangeUpper('http://www.kotul.net/htm_bin/i/head/h01.jpg');
			}else if (current_mid=="kotul")
			{ //코털닷넷소개
				ChangeUpper('http://www.kotul.net/htm_bin/i/head/h04.jpg');
			}else if (current_mid=="charactor")
			{ //캐릭터소개
				ChangeUpper('http://www.kotul.net/htm_bin/i/head/h03.jpg');
			}else if (current_mid=="freeboard")
			{ //자게소개
				ChangeUpper('http://www.kotul.net/htm_bin/i/head/h02.jpg');
			}else if (current_mid=="gallery")
			{ //캐릭터소개
				ChangeUpper('http://www.kotul.net/htm_bin/i/head/h03.jpg');
			}
		}
	}


	////////////////////////////
	//간단히 상단 그림을 변경할 수 있는 함수
	function ChangeUpper(picurl)
	{
			document.getElementById('top').style.backgroundImage = 'url('+picurl+')';
			document.getElementById('top_bgs').style.backgroundImage = 'url('+picurl+')';
			document.getElementById('top_bgs').style.backgroundPosition='center center';
	}
	/////////////////////////////
	//간단히 기본로고를 변경 할 수 있는 함수
	function ChangeLogo(logourl)
		{
			//특별히 슬픈 날이나, 기쁜 날이 아닌 평범한 때에,
			//한글날, 크리스마스날 로고교체
		}

	/////////////////////////////
	//이벤트 리쓰너 추가함수
function  commAddListener(parmObject, parmType, parmFunction, parmFalse) {

    if (parmObject.attachEvent) {
        parmObject.attachEvent("on" + parmType, parmFunction);
    } else {
        parmObject.addEventListener(parmType, parmFunction, parmFalse);
    }
}




	/*
    var clickHere = document.getElementById("clickHere");
    if (clickHere.attachEvent) {
        clickHere.attachEvent("onclick", mouseClick);   //IE
    } else {
        clickHere.addEventListener("click", mouseClick, false);  //Firefox
    }*/


//////////////////////////////
//XMLHttpRequest 생성합니다.
function newXMLHttpRequest(){
	
	var reqhttp;
	if(window.ActiveXObject){
		//IE
		try{
			reqhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			//시밤쾅
			try{
				reqhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e1){
				reqhttp = null;
			}
		}
	}else if(window.XMLHttpRequest){
		//IE 이와 파이어모에폭스등.
		try{
			reqhttp = new XMLHttpRequest;
		} catch(e){
			reqhttp = null;
		}
	}
	if(reqhttp==null){
		alert("지금 검색하고 계신 브라우저는 이 페이지에 있는 기능을 잘 활용치 못할 수도 있겠군요.ㅠㅠ");
		//나중에 다른 함수로 분리토록.
	}
	//alert("객체생성 OK");
	return reqhttp;
}
//////////////////////////////
//데이터 송수신
function Opensendstatus(iid,opfile){
	var xmlhttp = newXMLHttpRequest(); //객체생성
	xmlhttp.open("GET", opfile, true); //전송방법, URL, 통신방법
	xmlhttp.onreadystatechange = function()
	{ //처리상태변경발생하면....
		//alert("준비 상태 : "+xmlhttp.readyState+", 상태 : "+xmlhttp.status);
		if (xmlhttp.readyState == 4)
		{//섭 처리완료되면
			if (xmlhttp.status==200)//우완 성공
			{
					//midpager(); 
					mainControl(iid,xmlhttp); //메인처리
			}
		}		
	}
	xmlhttp.send(" ");
}
//////////////////////////////
//메인처리
function mainControl(iid,xmlhttp)//div등의 id값을 받아 결과를 내는 함수.
{
	//alert("디버그 : 부르셨삼2?");
	//midpager();
	document.getElementById(iid).innerHTML = xmlhttp.responseText;
}
/////////////////////////////
//호출검사
function calll(){
	 alert('부르셨나이까?');
}