function resize(){
	var obj = document.getElementById("isae_swf");
	var width = document.body.clientWidth;
	var height = document.body.clientHeight;
	var widthMin = 1000;
	var heigthMin = 700;
	var widthInit = 1200;
	var heightInit = 800;
	if(width < widthMin) width = widthMin;
	if(height < heigthMin) height = heigthMin;
	obj.width = width;
	obj.height = height;
	var board = document.getElementById("board");
	//419 141
	board.style.left = 419 + (width - widthInit)/2;
	board.style.top = 141 + (height - heightInit)/2;
}

var board_root = "/board/?mid=";

function showBoard(id){
	
	var object = "board";
	var obj;

	if(document.getElementByID){
		obj = document.getElementById(object)
		obj.style.visibility = "visible";
	} else if(document.layers && document.layers[object] != null){
		obj = document.layers[object]
		obj.visibility = "visible";
	} else if(document.all){
		obj = document.all[object];
		obj.style.visibility = "visible";
	}
	
	var url = board_root+id;
	setURL(url);
	
}

function setURL(url){
	
	var iframeName = "boardIFrame";
	var iframe;
	
	if(document.getElementByID){
		iframe = document.getElementById(iframeName)
	} else if(document.layers && document.layers[iframeName] != null){
		iframe = document.layers[iframeName]
	} else if(document.all){
		iframe = document.all[iframeName];
	}
	
	if(iframe.src != url) iframe.src = url;
	
}

function hideBoard(){

	var object = "board";
	var obj;

	if(document.getElementByID){
		obj = document.getElementById(object)
		obj.style.visibility = "hidden";
	} else if(document.layers && document.layers[object] != null){
		obj = document.layers[object]
		obj.visibility = "hidden";
	} else if(document.all){
		obj = document.all[object];
		obj.style.visibility = "hidden";
	}
	
	setURL("board_init.html");
	
}


var xmlDoc = null ;

function mailingList(mode,email, password){
	
	//alert("mailinglist: mode="+mode+" email="+email+" password="+password);
	
	if (typeof window.ActiveXObject != 'undefined' ) {
		xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
		xmlDoc.onreadystatechange = processMailingList ;
	} else {
		xmlDoc = new XMLHttpRequest();
		xmlDoc.onload = processMailingList ;
	}
	
	var params = "mode="+mode+"&email="+email+"&password="+password;
	
	xmlDoc.open( "POST", "/utility/mailingList/", true );
	//xmlDoc.open( "POST", "http://vm2003/mailingList/", true );
	xmlDoc.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlDoc.setRequestHeader("Content-length", params.length);
	xmlDoc.setRequestHeader("Connection", "close");
	xmlDoc.send( params );
	
}

function processMailingList() {
	
	if ( xmlDoc.readyState != 4 ) return ;
	
	var rtn = xmlDoc.responseText;
	
	if(rtn=="noPassword"){
		alert("비밀번호를 입력 해주세요");
	} else if(rtn=="noEmail"){
		alert("이메일주소를 입력해주세요");
	} else if(rtn=="invalidPassword"){
		alert("비밀번호를 네자리 이상 입력해주세요");
	} else if(rtn=="checkPassword"){
		alert("비밀번호를 확인해주세요");
	} else if(rtn=="checkEmail"){
		alert("이메일주소를 확인해주세요");
	} else if(rtn=="exists"){
		alert("이미 가입하셨습니다");
	} else if(rtn=="noExists"){
		alert("가입하지 않으셨습니다");
	} else if(rtn=="joinOk"){
		alert("이새 메일링리스트에 가입해주셔서 감사합니다 ");
	} else if(rtn=="leaveOk"){
		alert("이새 메일링리스트를 탈퇴하셨습니다 ");
	}
	//
	//document.getElementById("result").value = xmlDoc.responseText;
	//
}
		

function openBlog(){
	window.open("/blog/","isaeBlog");
}

function franchiseInfo(){
	window.open("/franchise_info.html", "franchise_info", "scrollbars=no, resizable=no, toolbar=no, location=no, status=no, width=400, height=500");
}

var popupNo = 0;
var popupX = 0;

function getCookie(name) {
	name = "POPUP_"+name;
	var from_idx = document.cookie.indexOf(name+'=');
	if (from_idx != -1) { 
		from_idx += name.length + 1
		to_idx = document.cookie.indexOf(';', from_idx) 
		if (to_idx == -1) {
			to_idx = document.cookie.length
		}
		return unescape(document.cookie.substring(from_idx, to_idx))
	}
}


function makePopup(image, width, height, title, url, target, id){
	loc=window.open("utility/popup/popup.php?image="+image+"&title="+title+"&url="+url+"&target="+target+"&id="+id,"isaePop"+popupNo,"toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+(height+20));
	loc.moveTo(window.screenLeft + popupX, window.screenTop);
	popupNo++;
	popupX+=width+20;

}

