/**********************************************************************************************************
'*	ÇÁ·Î±×·¥¸í			: siteFunction.js
'*	±â´É		    	: ÇÑÈ­ÀÌ±Û½º¿¡¼­¸¸ »ç¿ëÇÏ´Â ÀÚ¹Ù½ºÅ©¸³Æ®
'*  ¸¸µç³¯Â¥			: 2007-02-20
'*	¸¶Áö¸· ¼öÁ¤ÀÏ		:
'*	¸¶Áö¸· ¼öÁ¤ÀÚ		:
'*	¹öÁ¯ : 1.0
'*	±âÅ¸ »çÇ×			:
'*********************************************************************************************************/
// ¸Þ´º ¸µÅ©¸¦ À§ÇÑ URL Á¤ÀÇ

var CONST_SITE			= "http://www.hanwhaeagles.co.kr";
var CONST_SSL_SITE		= "https://www.hanwhaeagles.co.kr";

// »õÃ¢À¸·Î ÀÌ¹ÌÁö º¸±â
function windowResize(path){
	window.open(CONST_SITE+'/Library/common/windowResize.asp?pic_path='+path, 'img', 'top=200,left=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')
}
	//»õÃ¢ ¶Ù¿ì±â - ½ÂÁ¾
function popUpOpen(file,w,h){

	window.open(file, 'Popup','width='+w+',height='+h+',top=200,left=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')
}
function popupImage(path){
	window.open('/Library/common/popupImage.asp?pic_path='+path, 'mascot','width=200,height=200,top=200,left=200,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')
}
// ·Î±×ÀÎ ¿©ºÎ¸¦ ¹¯´Â´Ù
function confirmLogin(site, isLogin){
	if(isLogin=='False'){
		var url = getLoginUrl(site);

		if(confirm("È¸¿ø¸¸ÀÌ ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?")){
			location.href = url;
		}else{
			return;
		}
	}
}


//°æ°í ÈÄ ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿
function AlertGoLogin()
{
	if(confirm("È¸¿ø¸¸ÀÌ ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?")){
		location.href=CONST_SSL_SITE+"/kor/member/login.asp?goURL="  + escape(location.href);
	}
}

//°æ°í ÈÄ »óÀ§ ÇÁ·¹ÀÓ ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿
function AlertTargetLogin()
{
	if(confirm("È¸¿ø¸¸ÀÌ ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?")){
		parent.location.href=CONST_SSL_SITE+"/kor/member/login.asp?goURL="  + escape(window.parent.location);
	}
}

//°æ°í ÈÄ ÆË¾÷Ã¢ ¿¬Ã¢ ·Î±×ÀÎ ÆäÀÌÁö·Î ÀÌµ¿
function AlertOpenerLogin()
{
	if(confirm("È¸¿ø¸¸ÀÌ ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?")){
		location.href=CONST_SSL_SITE+"/kor/players/minisite/miniMainLogin.asp?goURL="  + escape(window.parent.location);
	}
}

//¸Þ½ÃÁö È®ÀÎ ÈÄ ÇØ´ç url·Î ÀÌµ¿
function ConfirmGo(msg, url)
{
	if(confirm(msg + "ÇÏ½Ã°Ú½À´Ï±î?")){
		location.href = url;
	}
}

// ÆË¾÷¿¡¼­ ºÎ¸ðÃ¢ url·Î ÀÌµ¿
function OpenerGo(url)
{
	parent.opener.location.href = url;
	opener.document.body.focus();
}

//ÀÌ¹ÌÁö »çÀÌÁî Á¶Á¤
function getSize(target_img, maxWidth, maxHeight) {

	var gwidth = 0;		// º¯°æÀü ÀÌ¹ÌÁö °¡·ÎÅ©±â
	var gheight = 0;	// º¯°æÀü ÀÌ¹ÌÁö ¼¼·ÎÅ©±â
	var swidth = 0;		// º¯°æÈÄ ÀÌ¹ÌÁö °¡·ÎÅ©±â
	var sheight = 0;	// º¯°æÈÄ ÀÌ¹ÌÁö ¼¼·ÎÅ©±â
	var vwidth = maxWidth;	// Ãâ·ÂÇÒ È­¸é °¡·ÎÅ©±â
	var v_height = maxHeight;	// Ãâ·ÂÇÒ È­¸é ¼¼·ÎÅ©±â
	imgname = new Image();
	imgname.src = target_img.src;
//		alert(imgname.width+","+imgname.height);
	gwidth = imgname.width;
	gheight = imgname.height;

	if (gwidth <= vwidth) {
		if (gheight <= v_height) {
			swidth = gwidth;
			sheight = gheight;
		} else {
			swidth = parseInt((v_height*gwidth)/gheight);
			sheight = v_height;
		}
	} else {
		if (gheight <= v_height) {
			swidth = vwidth;
			sheight = parseInt((vwidth*gheight)/gwidth);
		} else {
			if (parseFloat(v_height/vwidth) <= parseFloat(gheight/gwidth)) {
				swidth = parseInt((v_height*gwidth)/gheight);
				sheight = v_height;
			} else {
				swidth = vwidth;
				sheight = parseInt((vwidth*gheight)/gwidth);
			}
		}
	}
	//eval("document." + nn).width = swidth;
	//eval("document." + nn).height = sheight;
	//	alert(swidth+","+sheight);
	target_img.onload = null;
	target_img.src = imgname.src;
	target_img.width = swidth;
	target_img.height = sheight;
}

//ifram ¸®»çÀÌÁî
function doResize(name)
{
	try
	{
		var oBody   = document.frames(name).document.body;
		var oIFrame = document.all(name);
		var frmWidth  = oBody.scrollWidth;
		var frmHeight = oBody.scrollHeight;

		if(frmHeight ==0){
			//alert("ÇÁ·¹ÀÓÀÇ »çÀÌÁî Á¶ÀýÁßÀÔ´Ï´Ù.");
			frmWidth  = oBody.scrollWidth;
			frmHeight = oBody.scrollHeight;
		}

		oIFrame.style.height = frmHeight;
		oIFrame.style.width = frmWidth;
	}
	catch (e)
	{
		window.status = "IFrame Resize Error";
	}
}

//¹Ìµð¾î ¿ÀºêÁ§Æ® »ý¼º
function callMedia(){
	document.write ("<OBJECT ID=\"MediaPlayer1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" STANDBY=\"Loading Windows Media layer components...\" TYPE=\"application/x-oleobject\">");
	document.write ("<PARAM NAME=\"FileName\" VALUE=\"\">");
	document.write ("<PARAM NAME=\"ShowControls\" VALUE=\"False\">");
	document.write ("<PARAM NAME=\"AutoRewind\" VALUE=\"True\">");
	document.write ("<PARAM NAME=\"AutoStart\" VALUE=\"False\">");
	document.write ("<PARAM NAME=\"Volume\" VALUE=\"-1\">");
	document.write ("<PARAM NAME=\"Volume\" VALUE=\"-1\">");
	document.write ("<PARAM NAME=\"AllowScan\" VALUE=\"True\">");
	document.write ("<PARAM NAME=\"AudioStream\" VALUE=\"-1\">");
	document.write ("<PARAM NAME=\"BufferingTime\" VALUE=\"8\">");

	document.write ("</OBJECT>");
}


/* ¸¶ÀÌ½º ¿À¹ö ½ºÅ©¸³Æ®_¿µÃ¶ */
function initRollovers()
{
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++)
	{
		if (aImages[i].className == 'imgover')
		{
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_ov'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function()
			{
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function()
			{
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_ov'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}
window.onload = initRollovers;

/* ¹Ì´ÏÈ¨ÇÇ ³×ºñ°ÔÀÌ¼Ç */
function naviSel(num,str,str2){
	imgOver=new Array();imgOut=new Array();
	imgOver[1]="/kor/images/players/miniSite/navi01_ov.png";
	imgOver[2]="/kor/images/players/miniSite/navi02_ov.png";
	imgOver[3]="/kor/images/players/miniSite/navi03_ov.png";
	imgOver[4]="/kor/images/players/miniSite/navi04_ov.png";
	imgOut[1]="/kor/images/players/miniSite/navi01.png";
	imgOut[2]="/kor/images/players/miniSite/navi02.png";
	imgOut[3]="/kor/images/players/miniSite/navi03.png";
	imgOut[4]="/kor/images/players/miniSite/navi04.png";
	divName=eval(str);
	divName.style.zIndex=num;
}

function flashWindowOpen(menuCd) {
	if (menuCd == "MN103000")
	{
		 var nowURL;
	 	 nowURL = escape(location.href)

		 // Äü¸Þ´º¼³Á¤ ÆË¾÷
		 NewWindow(CONST_SITE+"/kor/member/memberQuick.asp?nowURL=" + nowURL, "popQuickMenu", "605", "560", "no")
	}
	else if (menuCd == "MN000000")
	{
		location.href = CONST_SITE+'/'
	}
}

function flashWindowOpenEng(menuCd) {
	if (menuCd == "MN000000")
	{
		location.href = CONST_SITE+'/eng/main.asp'
	}
}

function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}

// Mvp ÆäÀÌÁö ÀÌµ¿½Ã ·Îµù¹Ù ÆË¾÷Ã¢ ¶ç¿ì±â
function moveMVPage(w,h,idx,src)
{
	if (screen.width < 1025){
		LeftPosition=0;
		TopPosition=0;
	} else {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}

	window.open('/kor/fun/mvp/popLoading.asp',idx,'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h+',scrollbars=no,left='+LeftPosition+',top='+TopPosition);

	location.href=src;
}

/*080319 quick*/
function quickMenu(str) {
	 this.top		= 300;														// default top À§Ä¡;
	 this.left	= 920;														// default left À§Ä¡;
	 this.ele		= document.getElementById(str);		//¾×¼Ç element

	 this.footlimit = 300;											//ÇÏ´Ü¿¡¼­ 300±îÁö limit.
	 this.timer = null;

	 this.yHeight = parseInt(document.documentElement.scrollHeight); //¹®¼­³ôÀÌ
	 this.ele.limit = this.yHeight- this.footlimit; //

	 // element  position, left, top value setup
	 this.ele.style.position	=	"absolute";
	 this.ele.style.top				= this.top+"px";
	 this.ele.style.left			=	this.left+"px";
	 this.moveY	= this.top;

	}
	quickMenu.prototype.pos = function(){this.ele.style.top=this.moveY+"px"; }
	quickMenu.prototype.move = function(){

		this.end = document.documentElement.scrollTop+this.top; /*½ºÅ©·ê¹Ù+À§Ä¡°ª*/
		this.moveY +=   Math.floor((this.end - this.moveY ) / 10 );

		if(this.moveY>this.ele.limit){this.moveY = this.ele.limit;}
		this.pos();// À§Ä¡°ª ÀÔ·Â
		this.timer = setTimeout(this.name+".move()",10);
	}

	quickMenu.prototype.start = function(){

		this.start = parseInt (this.ele.style.top);
		this.timer = setTimeout(this.name+".move()",10);
	}
 /*080324 add*/
 function viewFlash(source,id,width,height,wmode, otherParam) {

	document.write( "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width="+width+" height="+height+" id="+id+"><param name=allowScriptAccess value=sameDomain><param name=wmode value="+wmode+" /><param name=movie value="+source+" /><param name=quality value=high />"+otherParam+"<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+width+" height="+height+" showmenu=false></embed></object>");
}