/*
È°¼ºÈ­ ½Ã html¿¡ »ðÀÔ
<SCRIPT LANGUAGE="JavaScript" src="html.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">flashObject("board.swf", 869, 553);</SCRIPT>
*/
// easy method
function flashObject(id, url, width, height) {
	var param = new Array();	
	param["movie"]		= url;
	param["width"]		= width;
	param["height"]		= height;
	param["quality"]	= "high";
	param["id"]			= id;
	param["bgcolor"]	= "#ffff00";
	//param["loop"]		= "true";
	param["loop"]		= "false";
	param["wmode"]		= "transparent";
	//param["wmode"]		= "window";
	makeFlashObject(param);
}

// Flash Object »ý¼º
function makeFlashObject(param) {
	var params		= new Array();
	var classID		= "D27CDB6E-AE6D-11cf-96B8-444553540000";
	var codeBase	= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0";
	var type		= "application/x-shockwave-flash";
	var pluginsPage	= "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";
	var cnt = 0;

	var movie		= param["movie"] == null	? ""	: param["movie"];
	var width		= param["width"] == null	? "0"	: param["width"];
	var height		= param["height"] == null	? "0"	: param["height"];
	var id			= param["id"] == null		? ""	: param["id"];
	var quality		= param["quality"] == null	? ""	: param["quality"];
	var bgcolor		= param["bgcolor"] == null	? ""	: param["bgcolor"];//alert(bgcolor);
	var loop		= param["loop"] == null		? ""	: param["loop"];
	var wmode		= param["wmode"] == null	? ""	: param["wmode"];

	// Ç×¸ñ °Ë»ç
	if (movie == "") return;

	params["classID"]		= classID;
	params["codeBase"]		= codeBase;
	params["width"]			= width;
	params["height"]		= height;
	params["type"]			= type;
	params["pluginsPage"]	= pluginsPage;
	params["params"]		= new Array();
	params["name"]			= id;

	// ¼¼ºÎÆÄ¶ó¸ÞÅÍ ÁöÁ¤
	params["params"][cnt++] = new paramValue("movie"	, movie);
	if (quality != "")	params["params"][cnt++] = new paramValue("quality"	, quality);
	if (bgcolor != "")	params["params"][cnt++] = new paramValue("bgcolor"	, bgcolor);
	if (loop != "")		params["params"][cnt++] = new paramValue("loop"		, loop);
	if (wmode != "")	params["params"][cnt++] = new paramValue("wmode"	, wmode);

	//alert(params["params"][2].name+", "+params["params"][2].value);
	params["extParam"]		= makeEmbedObject(params, false);  //alert(params["extParam"]);
	params["id"]			= id;
	params["name"]			= "";

	makeActiveXObject(params);
}

// ActiveX Objext »ý¼º
function makeActiveXObject(param) {
	var makeString	= "";
	var classID		= param["classID"] == null	? ""	: param["classID"];
	var codeBase	= param["codeBase"] == null	? ""	: param["codeBase"];
	var width		= param["width"] == null	? "0"	: param["width"];
	var height		= param["height"] == null	? "0"	: param["height"];
	var id			= param["id"] == null		? ""	: param["id"];
	var name		= param["name"] == null		? ""	: param["name"];
	var bgcolor		= param["bgcolor"] == null	? ""	: param["bgcolor"];
	var params		= param["params"];
	var extParam	= param["extParam"] == null	? ""	: param["extParam"];
		
	if (classID == "") return;

	// object ±âº»Á¤º¸
	
	//Áß¾ÓÁ¤·Ä ¾Æ´Ò¶§
	makeString += "<object classid=\"clsid:" + classID + "\" width=" + width + " height=" + height;
	
	//Áß¾ÓÁ¤·ÄÀÏ¶§ 
	//makeString += "<object classid=\"clsid:" + classID + "\" width='100%' height='100%'";

	if (codeBase != "") {
		makeString += " codebase=\"" + codeBase + "\"";
	}

	if (id != "") {
		makeString += " id=\"" + id + "\"";
	}
	
	if (name != "") {
		makeString += " name=\"" + name + "\"";
	}
	
	makeString += ">\n";

	// ÆÄ¶ó¸ÞÅÍ ÁöÁ¤
	if (params != null) {
		for (var i=0; i < params.length; i++) {
			if (params[i].value == "") continue;

			makeString += "\t<param name=\"" + params[i].name + "\" value=\"" + params[i].value + "\">\n";
		}
	}

	// ±âÅ¸ÆÄ¶ó¸ÞÅÍ
	if (extParam != "") {
		makeString += "\t" + extParam;
	}

	makeString += "</object>\n";

	//document.write ("<!--",makeString,"-->");
	//alert(makeString);
	//makeString = "<table width="+ width +" height="+ height+" border='0' cellspacing='0' cellpadding='0'><tr><td><div id='flash_area'>"+ makeString +"</div></td></tr></table>";
	document.write (makeString);
	
}

// embed Object »ý¼º
function makeEmbedObject(param, print) {
	var makeString = "";
	var type		= param["type"] == null			? ""	: param["type"];
	var pluginsPage	= param["pluginsPage"] == null	? ""	: param["pluginsPage"];
	var width		= param["width"] == null		? "0"	: param["width"];
	var height		= param["height"] == null		? "0"	: param["height"];
	var id			= param["id"] == null			? ""	: param["id"];
	var name		= param["name"] == null			? ""	: param["name"];
	var src			= param["src"] == null			? ""	: param["src"];
	var bgcolor		= param["bgcolor"] == null	? ""	: param["bgcolor"];
	var params		= param["params"];

	makeString += "<embed width=" + width + " height=" + height;

	if (type != "") {
		makeString += " type=\"" + type + "\"";
	}

	if (pluginsPage != "") {
		makeString += " pluginsPath=\"" + pluginsPage + "\"";
	}

	if (id != "") {
		makeString += " id=\"" + id + "\"";
	}
	
	if (name != "") {
		makeString += " name=\"" + name + "\"";
	}

	if (src != "") {
		makeString += " src=\"" + src + "\"";
	}

	// ÆÄ¶ó¸ÞÅÍ ÁöÁ¤
	if (params != null) {
		for (var i=0; i < params.length; i++) {
			if (params[i].value == "") continue;

			if ((params[i].name.toLowerCase() == "movie" || params[i].name.toLowerCase() == "filename") 
				&& makeString.indexOf("src=\"") < 0) {
				makeString += " src=\"" + params[i].value + "\"";
			}
			else {
				makeString += " " + params[i].name + "=\"" + params[i].value + "\"";
			}
		}
	}

	makeString += ">\n";

	if (print) {
		document.write (makeString);
	}

	return makeString;
}
// paramValue
function paramValue(name, value) {
	this.name	= name;
	this.value	= value;
}

//open fullscreen html (ex : main.html ...)
function main_pop_full(url) {
    var intWidth = screen.availWidth - 10;
    var intHeight = screen.availHeight - 15;
  	var tempX = 0;
	var tempY = 0;
	window.open(url,"main","left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");	
}

//open fix html and move center (ex : main.html ...)
/*
function main_pop_fx_c(url, width, heigh) {
	var intWidth = width;
	var intHeight = heigh;
  	var tempX = (screen.width/2)-(intWidth / 2);
	var tempY = (screen.height/2)-(intHeight / 2);
	window.open(url,"main","left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}
*/

function main_pop_fx_c(url) { //alert(url);
	var intWidth = 1000;
	var intHeight = 680;
  	var tempX = (screen.width/2)-(intWidth / 2);
	var tempY = (screen.height/2)-(intHeight / 2);
	window.open(url,"main","left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}



//open fix html and move fix (ex : main.html ...)
function main_pop_fx(url, width, heigh, left, top) {
	var intWidth = width;
	var intHeight = heigh;
  	var tempX = left;
	var tempY = top;
	window.open(url,"main","left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}


//event popup object
function popupValue(name, url, width, height, left, top) {
	this.name	= name;
	this.url	= url;
	this.width	= width;
	this.height	= height;	
	this.left 	= left;
	this.top 	= top;
}

//open event html (ex : popup.html ...)
function event_pop(param) {
	var param = param;
	var pop = new Array(); 
	var temp = new Array(); 
	var temp2 = new Array(); 
	var left = 10;
	var top = 10;	
	
	//param = "popup.html,300,300|popup2.html,300,300|popup.html,300,300|popup2.html,300,300";
	temp = param.split("|");
	//alert(temp.length);
	for (var i=0; i<temp.length; i++)
	{
		temp2 = temp[i].split(",");

		if(i!=0) {
			left = parseInt(left) + parseInt(prv) + parseInt("10");
		}
		pop[i] = new popupValue("popup_"+i, temp2[0], temp2[1], temp2[2], left, top);
		prv = temp2[1];
		
		//document.write(temp2[0], temp2[1], temp2[2]);
	}
	
	for (var i=0; i<pop.length; i++)
	{ //alert(pop[i].left);
		event_pop_real(pop[i].url, pop[i].name, pop[i].width, pop[i].height, pop[i].left, pop[i].top);
	}
	
	
	//pop[count++] = new popupValue("popup_"+count, );
	//url, width, height
}

//open event html (ex : popup.html ...)
function event_pop_real(url, name, width, heigh, left, top) { alert("event_pop_real");
	var intWidth = width;
	var intHeight = heigh;
  	var tempX = left;
	var tempY = top;
	window.open(url,name,"left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}

function event_end () {
	var end = "200801221700";
	var now = new Date(); 	
	year=now.getYear();
	month=(now.getMonth()+1);
	date=now.getDate();	
	hour=now.getHours();
	minutes=now.getMinutes();
	if(month < 10)
		month = "0"+month;
	var current = year.toString() + month.toString() + date.toString() + hour.toString() + minutes.toString();
	alert(current);	
	var cnt=1;
	if (parseInt(current)>parseInt(end)) {
		if (cnt=1) {
			alert("end!!"); //flash¿¡¼­ ÀÌºÎºÐ¿¡ exit³ª mod=no¸¦ ³Ö¾î ½Ã°£ÀÌ Áö³ª¸é µ¥ÀÌÅÍ°¡ µðºñ¿¡ ¾È½ÎÀÌµµ·Ï ÇÑ´Ù. php·Î º¯È¯ ÇÊ¿ä
			cnt++;
		}
	}
}

function change_flash_wh ( id, width, height ) {
	document.getElementById(id).width = width;
	document.getElementById(id).height = height;
	document.getElementById(id).style.verticalAlign = "middle";
}

function open_popup(url) { //alert("open_popup");
	//url = "map.html";
	name = "_blank";
	var intWidth = 612;
	var intHeight = 792;
	var tempX = 10;
	var tempY = 10;
	window.open(url,name,"left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");

}

function open_popup2(url) {
	name = "_blank";
	var intWidth = 1024;
	var intHeight = 700;
  	var tempX = (screen.width/2)-(intWidth / 2);
	var tempY = (screen.height/2)-(intHeight / 2);
	window.open(url,name,"left="+tempX+",top="+tempY+",width="+intWidth+",height="+intHeight+",scrollbars=0");

}


var w=1000;
var h=900;
var left=250;
var top=0;
function showIframe(url) { //alert(url);
	document.all["Layer2"].style.backgroundImage = "none";
	document.all["Layer1"].style.width = w;
	document.all["Layer1"].style.height = h;
	document.all["Layer2"].style.width = w;
	document.all["Layer2"].style.height = h;
	document.getElementById("cartoon").width = w;
	document.getElementById("cartoon").height = h;  	  	
	document.getElementById("cartoon").src = url;
	document.all["Layer1"].style.left = left;
	document.all["Layer1"].style.top = top;
	document.all["Layer2"].style.left = left;
	document.all["Layer2"].style.top = top;  
	setTimeout('real_showIframe()', 1000);
	document.all["Layer1"].style.visibility = "visible";
	document.all["Layer2"].style.visibility = "visible";  
}
function real_showIframe() {
  document.all["Layer1"].style.zIndex = 5;
  document.all["Layer2"].style.zIndex = 2;
}

function AlldisappearIframe() { //alert("AlldisappearIframe");
	document.getElementById("cartoon").src = "about:blank";
	document.all["Layer1"].style.visibility = "hidden";
	document.all["Layer2"].style.visibility = "hidden";
	document.all["Layer1"].style.zIndex = 2;
	document.all["Layer2"].style.zIndex = 5;    
}

function popup_open()
{
	var intWidth = 450;
	var intHeight = 500;
	var intLeft = 10;
	var intTop = 10;
  	var tempX = (screen.width)-(10);
	var tempY = (screen.height)-(15);
	window.open("pop_1227.html","popup","left="+intLeft+",top="+intTop+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}

function popup_open_2()
{
	var intWidth = 300;
	var intHeight = 450;
	var intLeft = 470;
	var intTop = 10;
  	var tempX = (screen.width)-(10);
	var tempY = (screen.height)-(15);
	window.open("hansel_popup.html","popup_2","left="+intLeft+",top="+intTop+",width="+intWidth+",height="+intHeight+",scrollbars=0");
}

function win_open(URL)
{
	var intWidth = 1024;
	var intHeight = 768;
	var intLeft = 50;
	var intTop = 50;
  	var tempX = (screen.width)-(10);
	var tempY = (screen.height)-(15);
	var sStatus='toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
	window.open(URL,"hansel_open","left="+intLeft+",top="+intTop+",width="+intWidth+",height="+intHeight+","+sStatus);
} 