/***************************************
* flash layer click
***************************************/
ScroolTop = function(className, id) {
	this.IE = document.all ? 1 : 0;
	this.NN = document.layer ? 1 : 0;
	this.N6 = document.getElementById ? 1 : 0;
	if(this.IE) this.layer = document.all(id);
	else if(this.NN) this.layer = document.layer[id];
	  else if(this.N6) this.layer = document.getElementById(id);
	else return;
	this.className = className;
	this.top = this.oldY = parseInt(this.layer.style.top,10);
	setInterval(this.className + ".move()", 10);
}

ScroolTop.prototype.move = function() {
	var diffY = (this.IE) ? document.body.scrollTop+this.top : self.pageYOffset+this.top; // 표준에는 document.documentElement.scrollTop
	if(diffY != this.oldY) {
		var percentY = .1 * (diffY - this.oldY);
		percentY = (percentY > 0) ? Math.ceil(percentY) : Math.floor(percentY);

		this.oldY += percentY;
		this.layer.style.top = this.oldY + "px";
	}
}

function goTop(orix,oriy,desx,desy) {
	var Timer;
	var winHeight = document.body.scrollTop;
	if(Timer) clearTimeout(Timer);
	startx = 0;
	starty = winHeight;
	if(!orix || orix < 0) orix = 0;
	if(!oriy || oriy < 0) oriy = 0;
	var speed = 7;
	if(!desx) desx = 0 + startx;
	if(!desy) desy = 0 + starty;
	desx += (orix - startx) / speed;
	if (desx < 0) desx = 0;
	desy += (oriy - starty) / speed;
	if (desy < 0) desy = 0;
	var posX = Math.ceil(desx);
	var posY = Math.ceil(desy);
	window.scrollTo(posX, posY);
	if((Math.floor(Math.abs(startx - orix)) < 1) && (Math.floor(Math.abs(starty - oriy)) < 1)){
		clearTimeout(Timer);
		window.scroll(orix,oriy);
	}else if(posX != orix || posY != oriy){
		Timer = setTimeout("goTop("+orix+","+oriy+","+desx+","+desy+")",15);
	}else{
		clearTimeout(Timer);
	}
}

function flashClose(){
  document.getElementById('flashPop').style.display="none";  
	//thisMovie("popup_frame").StopPlay();
}

function flashOn(){
	//alert('aaaaaaaaaa');
  document.getElementById('flashPop').style.display="block";
  
	//thisMovie("popup_frame").Play();
	//goTop();
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}
	else {
		return document[movieName]
	}
}

function mainMovie(p,w,h,id){
	var s_index
 	s_index=p

	document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+w+"\" height=\""+h+"\" id=\""+id+"\" name=\""+id+"\" align=\"middle\">")	;
	document.writeln("<param name=\"movie\" value=\""+s_index+"\" />");
	document.writeln("<param name=\"wmode\" value=\"transparent\" />");
	document.writeln("<!--[if !IE]> <-->");
	document.writeln("<object type=\"application/x-shockwave-flash\" data=\""+s_index+"\" width=\""+w+"\" height=\""+h+"\"  name=\""+id+"\">");
	document.writeln("<param name=\"wmode\" value=\"transparent\" />");
	document.writeln("<param name=\"allowScriptAccess\" value=\"always\" />");
	document.writeln("<p><img src=\"images/common/guideMainV.gif\" alt=\"\" /></p>");
	document.writeln("</object>");
	document.writeln("<!--> <![endif]-->");
	document.writeln("</object>");

}


/* 아이프레임 */
function doResize()
{
container.height = myframe.document.body.scrollHeight;
container.width = myframe.document.body.scrollWidth;
}

/* popup *****/
function makeWindow1(url,mode) {
  if      (mode == "1")
	 open(url, "win2", "status=no, resizable=no,width=490,height=520,top=0,left=0,toolbar=no,location=0,menubar=no,")
  else if (mode == "")
	 open(url, "win2")
}
function makeWindow2(url,mode) {
  if      (mode == "1")
	 open(url, "win2", "status=no, resizable=no,width=510,height=520,top=0,left=0,toolbar=no,location=0,menubar=no,scrollbars=yes")
  else if (mode == "")
	 open(url, "win2")
}
function makeWindow3(url,mode) {
  if      (mode == "1")
	 open(url, "win2", "status=no, resizable=no,width=510,height=520,top=0,left=0,toolbar=no,location=0,menubar=no,scrollbars=yes")
  else if (mode == "")
	 open(url, "win2")
}

function MakeObject(src,width,height)
{
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+width+' height='+height+'>')
	document.write ('<param name="movie" value='+src+'>')
	document.write ('<param name="quality" value="high">')
	document.write ('<PARAM NAME=wmode VALUE=transparent>')
	document.write ('<embed src='+src+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+width+' height='+height+' border="0"></embed></object>')
}
