/********************************************************************

Vricks Republic Publishing S&A

Beginning : 2009-06-29

Final : 2009-07-30

*********************************************************************/

	var IMAGE_HOME	= "http://image.melon.com";//"http://image.melon.co.kr/svc/images";
	var WWW_HOME	= "http://www.melon.com/svc";//"http://www.melon.com/svc";
	var idxMSIE		= window.navigator.userAgent.indexOf("MSIE");
	
	document.write("<link rel=\"stylesheet\" href=\"" + WWW_HOME + "/css/main/main.css\" type=\"text/css\" 	\n/>");
	document.write("<!--[if IE]>	\n");
	document.write("<style type=\"text/css\">	\n");
	document.write("*html #conSiteMap { padding-bottom: 0; }	\n");
	document.write("*html #genre { padding-left: 0; width: 257px; }	\n");
	document.write("*html .myInfoLayerT h2, *html .myInfoLayerT em { padding: 0; margin-bottom: -3px; }	\n");
	document.write("*:first-child+html .myInfoLayerT h2, *:first-child+html .myInfoLayerT em { padding: 1px 0 0; margin-bottom: -3px; }	\n");
	document.write("*html .conBt a img, *html .conBt a input { margin-bottom: -5px; }	\n");
	document.write("*:first-child+html .conBt a img, *:first-child+html .conBt a input { margin-bottom: -5px; }	\n");
	document.write("*html span.bgLayerBottom { margin-top: -6px; }	\n");
	document.write("</style>	\n");
	document.write("<![endif]-->	\n");
	
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/html/common/gnblogo_info.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/common/auth_cookie.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/common_new.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/gnb.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/quick.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/jquery.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/main/include_scrolling.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/jquery.ui/jquery.dimensions.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/jquery.ui/ui.mouse.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/jquery.ui/ui.draggable.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/html/themepackage_album.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/XIJQuery.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/html/search_bar_script.js\"></script>"); 
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/html/search_rank_script.js\"></script>");
	document.write("<script type=\"text/javascript\" src=\"" + WWW_HOME + "/js/ref/melon_player_ocx2.js\" defer=\"defer\"></script>");
	
	/*
	if (idxMSIE < 0) // non ms ie
		document.write("<script type=\"text/javascript\" id=\"_OCX_PLAYER\" src=\"" + WWW_HOME + "/js/ref/melon_player_ocx2.js\"></script>");
	else // ms ie
		document.write("<script type=\"text/javascript\" id=\"_OCX_PLAYER\"></script>");
	*/
	document.write("<script type=\"text/javascript\" id=\"_COMMON_BUY\"></script>");
	document.write("<script type=\"text/javascript\" id=\"_VOD_PLAYER\"></script>");
	document.write("<script type=\"text/javascript\" id=\"_LPOP_BY_PROD\"></script>");
	document.write("<script type=\"text/javascript\" id=\"_WEBLOG_TRACE\"></script>");
	document.write("<script type=\"text/javascript\" id=\"_SPOP_BY_PROD\"></script>");
	//document.write("<script type=\"text/javascript\" id=\"_FLOATING_BANNER\"></script>");

	//ÇÃ·¡½Ã ·Îµù ÇÔ¼ö
	function swfObjFlashVars(src,w,h,swfid, vars){
		swf_html = '';
		swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+swfid+'">';
		swf_html += '<param name="allowScriptAccess" value="always">';
		swf_html += '<param name="movie" value="'+src+'">';
		swf_html += '<param name="quality" value="high">';
		swf_html += '<param name="wmode" value="transparent">';
		swf_html += '<param name="flashvars" value="xmlPath='+vars+'">';
		swf_html += '<embed src="'+src+'" flashvars="xmlPath='+vars+'" quality="high" width="'+w+'" height="'+h+'" name="'+swfid+'" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
		swf_html += '</object>';
		document.write(swf_html);
	}
	
	//¸ÞÀÎ ÇÃ·¡½Ã ÃÖ½Å¾Ù¹ü
	function swfObjMainFlashVars(src,w,h,swfid, vars, vars2){
		swf_html = '';
		swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+swfid+'">';
		swf_html += '<param name="allowScriptAccess" value="always">';
		swf_html += '<param name="movie" value="'+src+'">';
		swf_html += '<param name="quality" value="high">';
		swf_html += '<param name="wmode" value="transparent">';
		swf_html += '<param name="flashvars" value="xmlPath='+vars+'&xmlPath2='+vars2+'">';
		swf_html += '<embed src="'+src+'" flashvars="xmlPath='+vars+'&xmlPath2='+vars2+'" quality="high" width="'+w+'" height="'+h+'" name="'+swfid+'" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
		swf_html += '</object>';
		document.write(swf_html);
	}

	/**
	 * µðÆúÆ® ÀÌ¹ÌÁö Ç¥½Ã
	 * 
	 * @param obj
	 * @return
	 */
	function defaultImg(obj)
	{
	    //081007 ¸ÞÅ¸¿¡¼­ µðÆúÆ® ÀÌ¹ÌÁö Àü´Þ
	    var altSrc = 'http://image.melon.co.kr/svc/images/common/noimage.gif';       
	    obj.src = altSrc;
	}
	
	/**
	 * ±Ý¾×ÀÇ ÄÞ¸¶¸¦ ³Ö¾îÁØ´Ù.
	 * @param val ¼ýÀÚ¸¦ ³ÖÀ» ±Ý¾×
	 * @return ¼ýÀÚ°¡ µé¾î°£ ±Ý¾×
	 */
	function comma(strValue)
	{
		strValue=String(strValue);
		var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})'); 
		while(objRegExp.test(strValue)) 
		{
		   strValue = strValue.replace(objRegExp, '$1,$2');
		} 
		return strValue;
	}
	
	/**
	 * ¹®ÀÚ°¡ lenº¸°¡ Å©¸é ÀÚ¸£°í suffix Ãß°¡.
	 * @param str
	 * @param len
	 * @param surfix
	 * @return
	 */
	function cutString(str, len, suffix)
	{
		var nLen	= 0;
		if (str != null) nLen = str.length;
		if (nLen <= len)
			return str;
		else
			return str.substr(0, len) + suffix;
	}
	/**
	 * cookie nameÀ¸·Î ¸á·Ð µµ¸ÞÀÎÀÇ cookie value¸¦ °¡Á®¿Â´Ù.
	 * @param name
	 * @return
	 */
	function melon_getCookie( name )
	{
		var nameOfCookie = name + "=";
		var x = 0;
		while ( x <= document.cookie.length )
		{
			var y = (x+nameOfCookie.length);
			if (document.cookie.substring( x, y ) == nameOfCookie) {
				if ((endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
				return unescape( document.cookie.substring( y, endOfCookie ) );
			}
			x = document.cookie.indexOf( " ", x ) + 1;
		
			if ( x == 0 )
			break;
		}
		return "";
	}
	
	/**
	 * cookie name, value, expiredays·Î ÄíÅ° ¼³Á¤
	 * 
	 * @param name
	 * @param value
	 * @param expiredays
	 * @return
	 */
	function melon_setCookie( name, value, expiredays )
	{
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}
	
	/**
	 * top10 Streaming
	 * @param data
	 * @return
	 */
	function top10StAction()
	{
		var itemList	= arguments;
		var itemCount	= arguments.length;
		
		var songId;
		
		var objBody	= document.getElementsByTagName("body");
		
		var objForm	= document.getElementById("top10_dyna");
		
		//±âÁ¸ÀÇ form element°¡ ÀÖÀ¸¸é, child ³ëµå¸¦ ¸ðµÎ Áö¿î´Ù.
		//±âÁ¸ÀÇ form elememt°¡ ¾øÀ¸¸é »õ·Î »ý¼ºÇÑ´Ù.
		if(objForm == null || objForm == undefined)
		{
			objForm			= document.createElement("form");
			objForm.name	= "frm_top10";
			objForm.id		= "top10_dyna";
			objForm.method	= "post";
			objForm.target	= "openList";
		}
		else
		{
			while(objForm.hasChildNodes())
			{
				objForm.removeChild(objForm.firstChild);
			}
		}
		
		if (itemCount != 0)
		{
			for (var nLoop=0; nLoop<itemCount; nLoop++)
			{
				songId	= itemList[nLoop];
				
				var objChkBox		= document.createElement("input");
				objChkBox.type		= "checkbox";
				objChkBox.name		= "song_id";
				objChkBox.value		= songId;
				objChkBox.defaultChecked	= true;
				objChkBox.style.display = "none";
				
				objForm.appendChild(objChkBox);
			}
			
			objBody[0].insertBefore(objForm, objBody[0].lastChild);
			
			OCX_song_play_form('0', objForm);
		}
	}
	
	/**
	 * top10 Download
	 * @param data
	 * @return
	 */
	function top10DlAction()
	{
		var itemList	= arguments;
		var itemCount	= arguments.length;
		
		var songId;
		
		var arrSongList	= new Array();
		
		if (itemCount != 0)
		{
			for (var nLoop=0; nLoop<itemCount; nLoop++)
			{
				songId	= itemList[nLoop];
				arrSongList[nLoop]	= songId;
			}
			
			goProduct(arrSongList, 'FA0100', 1, '0')
		}
	}
	
	/**
	 * ¾Ù¹ü ÀÌµ¿ ½ºÅ©¸³Æ®
	 * @param albumId
	 * @return
	 */
	function goAlbumPage(albumId)
	{
		location.href	= WWW_HOME + "/studio/album_info.jsp?p_albumId=" + albumId + "&MAIN=MAIN_NA";
	}
	
	/**
	 * ¾ÆÆ¼½ºÆ® ÆäÀÌÁö ÀÌµ¿
	 * @param artistId
	 * @return
	 */
	function goArtistPage(artistId)
	{
		location.href	= WWW_HOME + "/studio/artist_profile.jsp?p_artistId=" + artistId + "&MAIN=MAIN_TO";
	}
	
	/**
	 * ÀÏÂ÷Æ® ¸ÞÀÎÀ¸·Î ÀÌµ¿
	 * @return
	 */
	function goDailyChartPage()
	{
		location.href	= WWW_HOME + "/html/melonchart/chart_daily_list.html?MAIN=MAIN_TO";
	}
	
	/**
	 * ½Ç½Ã°£Â÷Æ® ¸ÞÀÎÀ¸·Î ÀÌµ¿
	 * @return
	 */
	function goRealChartPage()
	{
		location.href	= WWW_HOME + "/static_html/melonchart/real/real_time_chart.jsp?MAIN=MAIN_TO";
	}
	
	/**
	 * Å×¸¶ ÆÐÅ°Áö È­¸é ±×¸®±â
	 * 
	 * @return
	 * @author Nishiki
	 */
	function viewThemePackage()
	{
		if (themePack != undefined && themePack != null)
		{
			var strLink, ranNum, thAlId, range = themePack.length, strBuf = "", stFunc = "", dlFunc = "";
			
			if (range > 0)
			{
				ranNum	= Math.floor(Math.random() * 10) % range;
				
				strBuf	+= "<div class=\"packageInfo\">	\n";
				strBuf	+= "<p><img src=\"" + IMAGE_HOME + themePack[ranNum].themeImage + "\" width=\"71\" height=\"28\" alt=\"" + themePack[ranNum].themeTitle + "\" /></p>";
				
				for (var i = 0; i < 2; i++)
				{
					thAlId		= themePack[ranNum][i].albumId;
					thAlType	= themePack[ranNum][i].albumType;
					
					stFunc	= "javascript:themePackAlbumPlay(" + thAlId + ", '" + thAlType + "');";
					
					if (themePack[ranNum][i].albumType == "O")
						strLink	= WWW_HOME + "/mybox/open/open_tag_view.jsp?oAlbumId=" + thAlId + "&MAIN=SKY";
					else
						strLink	= WWW_HOME + "/studio/album_info.jsp?p_albumId=" + thAlId + "&MAIN=SKY";
					
					dlFunc	= "javascript:themePackAlbumDown('0', '" + thAlId + "', '" + thAlType + "');";
						
					strBuf	+= "<div class=\"eventView" + (i+1) + "\">";
					strBuf 	+= "	<a href=\"" + strLink + "\"><img src=\"" + IMAGE_HOME + themePack[ranNum][i].albumImage + "\" width=\"75\" height=\"94\" alt=\"" + themePack[ranNum][i].albumName + "\" /></a>";
					strBuf	+= "</div>";
					strBuf	+= "<ul>";
					strBuf	+= "	<li><a href=\"" + stFunc + "\" title=\"ÀüÃ¼µè±â\"><img src=\"" + IMAGE_HOME +  "\/svc/09/images/common/mp3_package/btn_whole_listen.gif\" alt=\"ÀüÃ¼µè±â\" /></a></li>";
					strBuf	+= "	<li><a href=\"" + dlFunc + "\" title=\"ÀüÃ¼´Ù¿î·Îµå\"><img src=\"" + IMAGE_HOME + "\/svc/09/images/common/mp3_package/btn_whole_download.gif\" alt=\"ÀüÃ¼´Ù¿î·Îµå\" /></a></li>";
					strBuf	+= "</ul>";
				}
				strBuf	+= "</div>";

				document.write(strBuf);
				document.write("<iframe name=\"openList\" id=\"openList\" width=\"0\" height=\"0\" frameborder=\"0\" scrolling=\"no\" style=\"display:none;\"></iframe>");
			}
		}
	}
	
	var isReadyPlay	= 0;
	/**
	 * Å×¸¶ ÆÐÅ°Áö¿¡¼­ ¾Ù¹ü ÇÃ·¹ÀÌ¸¦ À§ÇÑ Æã¼Ç.
	 * ¼Óµµ °³¼±À» À§ÇØ¼­ ¿äÃ»ÀÌ ÀÖÀ»¶§ µ¿ÀûÀ¸·Î form »ý¼ºÇÑ´Ù.
	 * 
	 * @param albumId
	 * @param albumType
	 * @return
	 */
	function themePackAlbumPlay(albumId, albumType)
	{
		var hostName	= location.host;
		document.getElementById("openList").src = WWW_HOME + "/common/theme_pack_play.jsp?albumId=" + albumId + "&menuId=0&albumType=" + albumType + "&hostName=" + hostName + "&MAIN=SKY";
	}
	/**
	 * Å×¸¶ ÆÐÅ°Áö ¾Ù¹ü ´Ù¿î·Îµå
	 * - ±âº»ÀûÀ¸·Î Á¦°øµÇÁö ¾Ê¾Æ¼­ ¾Ù¹ü¾ÆÀÌµð·Î °î Á¤º¸ Á¶È¸ÈÄ Àü¼Û.
	 * 
	 * @param menuId
	 * @param albumId
	 * @param albumType 
	 */
	var _staticMenuId	= 0;	/* Àü¿ª ¸Þ´º ¾ÆÀÌµð */
	function themePackAlbumDown(menuId, albumId, albumType)
	{
		_staticMenuId	= menuId;
		/* °î¸ñ·ÏÀ» À§ÇÑ Ajax ¸ðµâ È£Ãâ */
		ajax_request("/AjaxService" , { command : "AxGetListThemePackSong" , ALBUM_ID : albumId , ALBUM_TYPE : albumType } , albumDownAction);
	}
	
	function albumDownAction(data)
	{
		var itemList	= data.AJAX_LIST;
		var itemCount	= data.AJAX_COUNT;
		
		var arrSongList	= new Array();
		
		var oSongId, songId;
		
		if(itemCount != 0) 
		{
			for (var nLoop=0; nLoop<itemCount; nLoop++)
			{
				oSongId 	= itemList[nLoop];
				songId		= oSongId.songId;
				
				arrSongList[nLoop]	= songId;
			}
		}
		
		goProduct(arrSongList, 'FA0100', 1, _staticMenuId);
	}
	
	
	/**
	 * ½ºÄ«ÀÌ½ºÅ©·¡ÆÛ ¹è³Ê Ãâ·Â
	 */
	function viewSkyscraperBanner()
	{
		if (skyscraperBanner != undefined && skyscraperBanner != null && skyscraperBanner.length > 0) {

			document.write("<div class=\"bannerView\">");
			
			for (var i=0; i<skyscraperBanner.length; i++) {
				var title = skyscraperBanner[i].title;
				var image = skyscraperBanner[i].image;
				var url = skyscraperBanner[i].url;
				var target = skyscraperBanner[i].target;
				
				//Å¸°Ù¼³Á¤
				target = (target == "C")?"_self":"skybanner";
				
				//url¼³Á¤
				if (url != "") {

					if (url.indexOf("?") > 0) {
						url = url + "&";
					}
					else {
						url = url + "?";
					}
					url = url + "SOURCE=LOWSKY";
				}
				
				//ÇÃ·¡½¬
				if (image.indexOf(".swf") > 0) {
					
					url = url.split("&").join("#@");
					
					document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"93\" height=\"80\" id=\"skybanner\" align=\"middle\">");
					document.write("<param name=\"allowScriptAccess\" value=\"always\" />");
					document.write("<param name=\"allowFullScreen\" value=\"true\" />");
					document.write("<param name=\"movie\" value=\""+IMAGE_HOME+image+"\" />");
					document.write("<param name=\"quality\" value=\"high\" />");
					document.write("<param name=\"FlashVars\" value=\"urlPath="+url+"&linkType="+target+"\" />");
					document.write("<param name=\"wmode\" value=\"transparent\" />");
					document.write("<embed src=\""+IMAGE_HOME+image+"\" FlashVars=\"urlPath="+url+"&linkType="+target+"\" width=\"93\" height=\"80\" quality=\"high\" id=\"left_navi\" align=\"middle\" allwScriptAccess=\"always\" allowFullScreen=\"true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
					document.write("</object>");
				}
				
				//ÀÌ¹ÌÁö
				else {
					if (url != "") {
						document.write("<a href=\"" + url + "\" target=\"" + target + "\"><img src=\"" + IMAGE_HOME + image +"\" alt=\"" + title + "\" /></a>");
					}
					else {
						document.write("<img src=\"" + IMAGE_HOME + image +"\" alt=\"" + title + "\" />");	
					}
				}
			}
			document.write("</div>");
		}
	}
	
	
	/*
	* ·Î±×ÀÎ µÈ »óÅÂ¿¡¼­ ÀÌµ¿ÇØ¾ß ÇÏ´Â °æ·ÎÀÇ °æ¿ì »ç¿ë.
	* - ·Î±×ÀÎÀÌ µÇ¾î ÀÖÁö ¾ÊÀ¸¸é ·Î±×ÀÎ ÆË¾÷ ·¹ÀÌ¾îµå¸¦ Ç¥½Ã ÈÄ ·Î±×ÀÎ ÈÄ ÀÌµ¿
	* - ·Î±×ÀÎ µÇ¾î ÀÖÀ¸¸é ÁöÁ¤µÈ °æ·Î·Î ÀÌµ¿
	*
	»ç¿ë¿¹ :
	    //ºñ·Î±×ÀÎ½Ã ½ºÅ©·Ñ È­¸é Áß¾Ó¿¡ ·Î±×ÀÎ ÆË¾÷ ·¹ÀÌ¾îµå Ç¥½Ã ¹× ·Î±×ÀÎ ÈÄ ÀÌµ¿. ·Î±×ÀÎ µÈ »óÅÂ¸é ¹Ù·Î returnPage ·Î ÀÌµ¿
	    loginCheckGoPage("/svc/sample/mv_main.jsp");

	    //ºñ·Î±×ÀÎ½Ã 500,350 À§Ä¡¿¡ ·Î±×ÀÎ ÆË¾÷ ·¹ÀÌ¾îµå Ç¥½Ã ¹× ·Î±×ÀÎ ÈÄ ÀÌµ¿. ·Î±×ÀÎ µÈ »óÅÂ¸é ¹Ù·Î returnPage ·Î ÀÌµ¿
	    loginCheckGoPage("/svc/sample/mv_main.jsp",500,350);
	    
	@param returnPage ·Î±×ÀÎ µÇ¾úÀ¸¸é ÀÌµ¿ÇÒ URL ÁöÁ¤
	@param clientX ÆË¾÷ X ÁÂÇ¥(»ý·«°¡´É, »ý·«½Ã clientY µµ »ý·«)
	@param clientY ÆË¾÷ Y ÁÂÇ¥(»ý·«°¡´É, »ý·«½Ã clientX µµ »ý·«) 
	*/
	function loginCheckGoPage(returnPage,clientX,clientY){
	    /*
	    WWW_HOME : /js/main/common.js
	    isMelonLogin(), getMemberKey() : /js/common/auth_cookie.js
	    */
	    var isLogin = isMelonLogin();
	    if(isLogin){
	        location.href=returnPage;
	    }else{
	        loginPopupLayerd(returnPage,clientX,clientY);
	    }
	}
	
	/*
	*·Î±×ÀÎ ÆË¾÷ ·¹ÀÌ¾îµå
	*
	»ç¿ë¿¹ :
	    //returnPage ÁöÁ¤ÇÏÁö ¾ÊÀ½, ½ºÅ©·ÑµÈ È­¸é Áß¾Ó À§Ä¡¿¡ ÆË¾÷ Ç¥½Ã
	    loginPopupLayerd();
	 
	    //returnPage ÁöÁ¤ÇÏÁö ¾ÊÀ½, 500,350 À§Ä¡¿¡ ÆË¾÷ Ç¥½Ã
	    loginPopupLayerd("",500,350);

	    //returnPage ÁöÁ¤ÇÔ, ½ºÅ©·ÑµÈ È­¸é Áß¾Ó À§Ä¡¿¡ ÆË¾÷ Ç¥½Ã
	    loginPopupLayerd("/svc/sample/phone_mv_down.jsp");

	    //returnPage ÁöÁ¤ÇÔ, 500,350 À§Ä¡¿¡ ÆË¾÷ Ç¥½Ã
	    loginPopupLayerd("/svc/sample/phone_mv_down.jsp",500,350);
	    
	@param returnPage ·Î±×ÀÎÈÄ ÀÌµ¿ÇÒ ÆäÀÌÁö¸¦ ÁöÁ¤(»ý·«°¡´É)    
	@param clientX ÆË¾÷ X ÁÂÇ¥(»ý·«°¡´É)
	@param clientY ÆË¾÷ Y ÁÂÇ¥(»ý·«°¡´É)    
	*/
	function loginPopupLayerd(returnPage,clientX,clientY){
	    var width = 339; 
	    if(clientX==undefined)var clientX=getCenterX()-Math.floor(width/2);
	    if(clientY==undefined)var clientY=getCenterY()-120;
	    if(returnPage==undefined||returnPage==""||returnPage==null){
	        var re = /\?/g;        
	        var re2 = /&/g;        
	        returnPage = top.document.URL.replace(re,escape("?")).replace(re2,escape("&"));
	        document.getElementById("frmContent").src="http://www.melon.com/PIMS/myMelon/newMyInfo/login/loginLayer.jsp?return_page="+returnPage;
	    }else{
	        document.getElementById("frmContent").src="http://www.melon.com/PIMS/myMelon/newMyInfo/login/loginLayer.jsp?return_page="+returnPage;
	    }
	    show_lpop_login('lp_pop_login','È¸¿ø ·Î±×ÀÎ',String(width),clientX,1000);
	    //login_lpop(clientX,clientY);    
	}
	
	
	function makeLayeredPopup()
	{	
		var lPopList;
		
		try
		{
			lPopList	= _LPOP_LIST.LPOP_LIST;
		}
		catch(err)
		{
			return;
		}
		
		var target		= "";
		var lPopFlg		= melon_getCookie("newLPop");

		if (lPopList.length > 0 && lPopFlg != "N") //B: blank, C: ÇöÀçÃ¢
		{/* ·¹ÀÌ¾îµå ÆË¾÷À» ¶ç¿ö¾ß ÇÑ´Ù.*/
			// X - Å«Å¸ÀÔ ÀÛÀº Å¸ÀÔ¿¡ µû¶ó ·¹ÀÌ¾îµå ÆË¾÷ÀÇ class¸¦ ´Þ¸® ÇØÁØ´Ù.
			// 2009. 09. 09 º¯°æ. ³ÐÀº °Í¸¸ ³ëÃâ
			var objLPop			= document.getElementById("layerdPopup");
			var objLPopImage	= document.getElementById("layerdPopup2Image");
			
			// ³ÐÀº ¹è³Ê
			if (lPopList[0].DP_TYPE == "W")
			{	
				var strBuff	= "";
				
				for (var nLoop = 0; nLoop < 2 && nLoop < lPopList.length; nLoop++)
				{
					var strClass = " class=\"eveImg\"";
					
					//2°ÇÀÌ»ó Ã¹¹øÂ° ¹è³Ê classÁ¤ÀÇ
					if (lPopList.length > 1 && nLoop == 0) {
						strClass = " class=\"eveImg top\"";
					}
				
					if (lPopList[nLoop].TARGET == "B")
						target 	= " target=_blank ";
					else
						target	= "";
					
					strBuff += "<div" + strClass + "><a href=\"" + lPopList[nLoop].LINK_URL + "\"" + target + " title=\"" + lPopList[nLoop].TITLE + "\"><img src=\"" + lPopList[nLoop].IMAGE + "\" /></a></div>";
				}

				objLPopImage.innerHTML	= strBuff;
			}
		}
	}
	
	function showLayeredPopup()
	{	
		var lPopFlg = melon_getCookie("newLPop");
		var objLPop = document.getElementById("layerdPopup");
		var lPopList;
		
		try
		{
			lPopList	= _LPOP_LIST.LPOP_LIST;
		}
		catch(err)
		{
			return;
		}
		
		if (lPopList.length > 0 && lPopFlg != "N")
		{
			objLPop.style.display	= "block";
		}
	}
	
	function delLayeredPopupDay()
	{
		hideLayeredPopup();
		melon_setCookie("newLPop", "N", 1);
	}
	
	function hideLayeredPopup()
	{
		var objLPop				= document.getElementById("layerdPopup");
		objLPop.innerHTML		= "";
		objLPop.style.display	= "none";
	}
	
	//³×Æ¼Áð¹èÆ²Ã­Æ®´Ý±â
	function mainBattleClose() {
		melon_setCookie( "_battleChart", "N", 1);
		document.getElementById("_battleChart").style.display="none";
	}
	
	//³×Æ¼Áð¹èÆ²Ã­Æ®DP
	function mainBattleShow() {
		var mPopFlg		= melon_getCookie("_battleChart");
		if (mPopFlg != "N")
		{
			document.getElementById("_battleChart").style.display = "block";
		}
	}
	
	//ÇöÀç ºê¶ó¿ìÁ® ³ôÀÌÀÇ Áß°£ À§Ä¡°ªÀ» ±¸ÇÑ´Ù.           
	function getCenterY(){
	    var height = 0; 
	    if( navigator.appName.indexOf("Microsoft") > -1 ){
	        height = document.body.clientHeight;
	    }else{
	        height = innerHeight;
	    }
	    //alert("height="+height);
	    return Math.floor(height/2);
	}

	//ÇöÀç ºê¶ó¿ìÁ® ³ÐÀÌÀÇ Áß°£ À§Ä¡°ªÀ» ±¸ÇÑ´Ù.
	function getCenterX(){
	    var width = 0; 
	    if( navigator.appName.indexOf("Microsoft") > -1 ){
	        width = document.body.clientWidth;
	    }else{
	        width = innerWidth;
	    }
	    //alert("width="+width);
	    return Math.floor(width/2);
	}
	
	//htmlÀÌ ½ÇÇàµÇ±âÀü ¸ÕÀú Ã³¸®µÇ´Â functionÀ¸·Î (¿ÜÇüÀÌ¶óµµ)¹Ýµå½Ã ÀÛ¼ºµÇ¾î¾ß ÇÑ´Ù.
	function ajax_init()
	{}
	
	//ajax ¿¡·¯ ¹ß»ý½Ã functionÀ¸·Î ¹Ýµå½Ã ÀÛ¼ºµÇ¾î¾ß ÇÑ´Ù.
	function ajax_error()
	{
		return false;
	}
	
	/**
	 * ¼Óµµ °³¼±À» À§ÇÑ onDemand Js loading °ú ·¹ÀÌ¾îµå ÆË¾÷.
	 */
	onload	= function()
	{
		/* onDemand javascript loading for large js files */
		//$("#_OCX_PLAYER")[0].src	= WWW_HOME + "/js/ref/melon_player_ocx2.js";
		$("#_COMMON_BUY")[0].src	= "/js/common_buy.js";
		$("#_VOD_PLAYER")[0].src	= WWW_HOME + "/js/ref/melon_vod_player.js";

		/* onDemand JS loading for weblog Trace */
		$("#_WEBLOG_TRACE")[0].src	= WWW_HOME + "/js/common/weblog_trace.js";
		
		/* ¹èÆ²Ã­Æ® */
		mainBattleShow();
		
		/* ·¹ÀÌ¾îµå ÆË¾÷ »ý¼º */
		makeLayeredPopup();
		
		/* ½Ã°£Â÷(¸ÞÀÎÇÁ·Î¸ð¼ÇÀÌ ¿­·È´Ù ´ÝÈ÷´Â)¸¦ µÎ°í ·¹ÀÌ¾îµå ÆË¾÷ È£Ãâ */
		setTimeout(showLayeredPopup, 1000);
	}