// Todo: NexonPlayer ¸¦ Å¬·¡½º·Î ¸¸µéÀÚ
var MP = new Object;
SilverlightControl = function()
{
    this.bWindowless = false;
    this.background = "#FFFFFFFF";
    this.playtime = 0;
    this.disableArticleInfoPanel = false;
    this.disableMovieListPanel = false;
    this.disableScrapButton = false;
    this.disableOtherMovieButton = false;
}

SilverlightControl.prototype = 
{
    createControl: function()
    {
		var _checkSilverlight = installSilverlight.check();
		var countMovie = "0";
		if(countMovie == "0")
		{
			switch (_checkSilverlight)
			{
				case "alpha version" :
					countMovie = "1";
					var renderHtml = '<div id="setSilverlight">';
					renderHtml += '	<div style="border:1px solid #E3E3E3;width:598px;height:448px;text-align:center;">';
					renderHtml += '		<img style="margin-top:107px" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/img_silverlight_install.gif" />';
					renderHtml += '	</div>';
					renderHtml += '</div>';
					document.getElementById(this.parentID).innerHTML = renderHtml;
				break;
				case "installed" :
					silverlightInstallLog("Installed");
					var scene = new NexonPlayer.Page();
					
					// [strong mandatory] ¾øÀ¸¸é ÇÃ·¹ÀÌ¾î »ý¼º Â÷´Ü - ¿¡·¯
					// this.ID - ¿¡·¯
					// this.XAMLURL - ¿¡·¯

					// [weak mandatory] ¾øÀ¸¸é ÇÃ·¹ÀÌ¾î¿¡¼­ ¿À·ù ¸Þ½ÃÁö ÆË¾÷ - ¿¹¿Ü Ã³¸® (±â´É Á¤Áö)
					// this.movieURL - µ¿¿µ»ó Á¤º¸ ¾øÀ½ ¿¹¿Ü
					// this.fontURL - ÆùÆ® ¾øÀ½ ¿¹¿Ü

					// [optional] ¾øÀ¸¸é ¿©±â¼­, È¤Àº ÇÃ·¹ÀÌ¾î¿¡¼­ ¾Ë¾Æ¼­ Ã³¸® - Á¤»ó ÀÛµ¿
					// this.hostID - createControl ÀÇ ¹ÝÈ¯°ªÀ¸·Î ½Ç¹ö¶óÀÌÆ® ÄÁÆ®·Ñ HTML ¸®ÅÏ
					// this.bWindowless - ±âº»°ª:false
					// this.background - ±âº»°ª:"#FFFFFFFF"
					// this.articleXML
					// this.recommandXML
					// this.footerURL
					// this.thumbnailURL
					// this.playtime - ±âº»°ª:00:00
					// this.disableArticleInfoPanel - ±âº»°ª:false
					// this.disableMovieListPanel - ±âº»°ª:false
					// this.disableScrapButton - ±âº»°ª:false
					// this.disableOtherMovieButton - ±âº»°ª:false
					//
					this.playtime = secondsToString(this.playtime);
					
					var alertErr = false;
					var err = "½Ç¹ö¶óÀÌÆ® ÄÁÆ®·Ñ¿¡¼­ ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù.    \n";
					err += "¸Þ¼­µå:createControl   \n";
					if (this.ID == undefined || this.ID == null || this.ID == "")
					{
						err += "¸Þ½ÃÁö:strID ¹ÌÀÔ·Â   \n";
						alertErr = true;
					}
					if (this.XAMLURL == undefined || this.XAMLURL == null || this.XAMLURL == "")
					{
						err += "¸Þ½ÃÁö:strXAMLURL ¹ÌÀÔ·Â   \n";
						alertErr = true;
					}
					
					if (alertErr == true) 
					{
						alert(err);
						return err.replace("\n", "<br>");
					}
					document.getElementById(this.parentID).innerHTML = 
					"<div style='width:600px;height:486px;margin-bottom:0 auto 15px auto;'>" +
					Silverlight.createObjectEx({
						source: this.XAMLURL,
						parentElement: document.getElementById(this.hostID),
						id: this.ID,
						properties: {
							width: "100%",
							height: "100%",
							isWindowless: this.bWindowless == true ? "true" : "false",
							background: this.background,
							version: "1.0.21115"
						},
						events: {
							onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
							onError: Silverlight.createDelegate(scene, scene.handleError)
						},
						context: {
							articleXML: this.articleXML,
							recommandXML: this.recommandXML,
							movieURL: this.movieURL,
							fontURL: this.fontURL,
							footerURL: this.footerURL,
							thumbnailURL: this.thumbnailURL,
							playtime: this.playtime,
							disableArticleInfoPanel: this.disableArticleInfoPanel,
							disableMovieListPanel: this.disableMovieListPanel,
							disableScrapButton: this.disableScrapButton,
							disableOtherMovieButton: this.disableOtherMovieButton
						}
					})
					+ "</div>";
				break;
				case "not installed" :
					countMovie = "1";
					var installInterval = setInterval(checkInstallFunc,1000);
					silverlightInstallLog("NotInstalled");
					if(navigator.userAgent.toLowerCase().indexOf("mac") == -1)
					{
						var renderHtml = '<div id="setSilverlight">';
						renderHtml += '	<div style="border:1px solid #E3E3E3;width:598px;height:448px;position:relative;">';
						renderHtml += '		<a href="http://silverlight.dlservice.microsoft.com/download/d/1/5/d15d3b25-358c-432c-8634-68151cfd0c98/Silverlight.exe"><img style="position:absolute;top:0;left:0;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/basic_setsilverlight.gif" /></a>';
						renderHtml += '		<img style="position:absolute;top:8px;left:80px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/txt_silverlight1.gif" alt="µ¿¿µ»óÀ» º¸±â À§ÇØ¼­´Â ¸¶ÀÌÅ©·Î¼ÒÇÁÆ®»çÀÇ ½Ç¹ö¶óÀÌÆ®(Silverlight)¸¦ ´Ù¿î·Îµå ¹Þ¾Æ¾ß ÇÕ´Ï´Ù" border="0" />';
						renderHtml += '		<img style="position:absolute;top:31px;left:271px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/logo_silverlight.gif" alt="Microsoft Silverlight" border="0" />';
						renderHtml += '		<a href="http://silverlight.dlservice.microsoft.com/download/d/1/5/d15d3b25-358c-432c-8634-68151cfd0c98/Silverlight.exe"><img style="position:absolute;top:199px;left:268px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/download_silverlight.gif" alt="Download Silverlight" border="0" /></a>';
						renderHtml += '	</div>';
						renderHtml += '	<img src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/movie_upload/play_bar.JPG" alt="Dummy Control Bar" border="0" />';
						renderHtml += '</div>';
						//Windows¿ë ½Ç¹ö¶óÀÌÆ® ¼³Ä¡°¡ µÇ¾î¾ßÇÔ
						//http://silverlight.dlservice.microsoft.com/download/d/1/5/d15d3b25-358c-432c-8634-68151cfd0c98/Silverlight.exe
						document.getElementById(this.parentID).innerHTML = renderHtml;
					}
					else
					{
						var renderHtml = '<div id="setSilverlight">';
						renderHtml += '	<div style="border:1px solid #E3E3E3;width:598px;height:448px;position:relative;">';
						renderHtml += '		<a href="http://silverlight.dlservice.microsoft.com/download/c/1/6/c164f709-193c-4e52-a624-55ba12917d23/silverlight.dmg"><img style="position:absolute;top:0;left:0;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/basic_setsilverlight.gif" /></a>';
						renderHtml += '		<img style="position:absolute;top:8px;left:80px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/txt_silverlight1.gif" alt="µ¿¿µ»óÀ» º¸±â À§ÇØ¼­´Â ¸¶ÀÌÅ©·Î¼ÒÇÁÆ®»çÀÇ ½Ç¹ö¶óÀÌÆ®(Silverlight)¸¦ ´Ù¿î·Îµå ¹Þ¾Æ¾ß ÇÕ´Ï´Ù" border="0" />';
						renderHtml += '		<img style="position:absolute;top:31px;left:271px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/logo_silverlight.gif" alt="Microsoft Silverlight" border="0" />';
						renderHtml += '		<a href="http://silverlight.dlservice.microsoft.com/download/c/1/6/c164f709-193c-4e52-a624-55ba12917d23/silverlight.dmg"><img style="position:absolute;top:199px;left:268px;" src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/download_silverlight.gif" alt="Download Silverlight" border="0" /></a>';
						renderHtml += '	</div>';
						renderHtml += '	<img src="http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/movie_upload/play_bar.JPG" alt="Dummy Control Bar" border="0" />';
						renderHtml += '</div>';
						//MAC¿ë ½Ç¹ö¶óÀÌÆ® ¼³Ä¡°¡ µÇ¾î¾ßÇÔ
						//http://silverlight.dlservice.microsoft.com/download/c/1/6/c164f709-193c-4e52-a624-55ba12917d23/silverlight.dmg
						document.getElementById(this.parentID).innerHTML = renderHtml;
					}
				break;
				case "not supported" :
					MP = new MediaPlayer();
					MP.ClientID		= this.ID;
					MP.LoadFile( this.movieFileInfo , MP.ClientID, this.oidArticle, this.oidBoard );
					document.getElementById(this.parentID).innerHTML = MP.Write();
					MP.versionCheck(MP.ClientID);
				break;
			}
		}
    }
}


if (!window.Silverlight) 
	window.Silverlight = {};

Silverlight.createDelegate = function(instance, method) {
	return function() {
		return method.apply(instance, arguments);
	}
}
if (!window.NexonPlayer)
	window.NexonPlayer = {};

NexonPlayer.Page = function() 
{
	
}

String.prototype.trim = function() 
{
    return this.replace(/^\s+|\s+$/g,"");
}

var PlayerState = 
{ 
    None: "None",
    Stopped: "Stopped",
    Playing: "Playing",
    Paused: "Paused",
    Buffering: "Buffering",
    Opening: "Opening",
    Closed: "Closed",
    End_Element: "End_Element"
};

function Invalid(value)
{
    return (value == undefined || value == null || value == "");
}

function URLDecode(strEncode) 
{
    var isRegExp = /\ + /g;
    return unescape(String(strEncode).replace(isRegExp,"")); 
}

function GetElements(obj)
{
    var ret = "";
    for(var each_pro in obj)
    {
        ret += each_pro + "\r\n"; // + "=" + obj[each_pro] + "\r\n";
    }
    return ret;
}

function XMLEncode(strEncode)
{
    var temp = strEncode;
    temp = temp.replace("&", "&amp;");  // ¼ø¼­ ÁÖÀÇ!!
    temp = temp.replace("<", "&lt;");
    temp = temp.replace(">", "&gt;");
    temp = temp.replace("'", "&apos;");
    temp = temp.replace('"', "&quot;");
    return temp;
}

function XMLDecode(strEncode)
{
    var temp = strEncode;
    temp = temp.replace("&lt;", "<");
    temp = temp.replace("&gt;", ">");
    temp = temp.replace("&apos;", "'");
    temp = temp.replace("&quot;", '"');
    temp = temp.replace("&amp;", "&");  // ¼ø¼­ ÁÖÀÇ!!
    return temp;
}

// double ÃÊ¸¦ ºÐ:ÃÊ ¹®ÀÚ¿­·Î º¯È¯
secondsToString = function(seconds)
{
    var datetime = new Date(0, 0, 0, 0, 0, seconds)

    var min = datetime.getMinutes();
    var sec = datetime.getSeconds();

    if (sec < 10) {sec = "0" + sec;}
    if (min < 10) {min = "0" + min;}

    return min + ":" + sec;
}


function sendRequest(httpRequest, URL, params, callback, method) 
{
	var httpMethod = method ? method : 'GET';

	if (httpMethod != 'GET' && httpMethod != 'POST') 
	{
		httpMethod = 'GET';
	}

	var httpParams = (params == null || params == '') ? null : params;
	var httpUrl = URL;

	if (httpMethod == 'GET' && httpParams != null) 
	{
		httpUrl = httpUrl + "?" + httpParams;
	}
    
    try
    {
	    httpRequest.open(httpMethod, httpUrl, true);
	}
	catch (e)
	{
	    alert("HttpRequest°´Ã¼ ¿À·ù \r\nOpen ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.");
	    return null;
	}
	httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	httpRequest.setRequestHeader('Cache-Control', 'no-cache');
	httpRequest.onreadystatechange = callback;
	httpRequest.send(httpMethod == 'POST' ? httpParams : null);
	
	return httpRequest;
}

RecommandMovie = function(title, thumbnailURL, articleURL)
{
    this.title = title;
    this.thumbnailURL = thumbnailURL;
    this.articleURL = articleURL;
}


// ÃßÃµ¿µ»ó ¸®½ºÆ®¿ë Å¬·¡½º
MovieList = function()
{
    this.list = new Array();
    this.index = 0;
}

MovieList.prototype = 
{
    addMovie: function(title, thumbnailURL, articleURL)
    {
        this.list[this.index] = new RecommandMovie(title, thumbnailURL, articleURL);
        this.index++;
    },
    
    getLength: function()
    {
        return this.list.length;
    }, 
    
    IncreaseIndex: function(inc)
    {
        if (this.list.length <= 0) return null;
        this.index += inc;
        while (this.index < 0) this.index += this.list.length;
        while (this.index >= this.list.length) this.index -= this.list.length;
    },
    
    getMovie: function()
    {
        if (this.list.length <= 0) return null;
        while (this.index >= this.list.length) this.index -= this.list.length;
        return this.list[this.index++];
    }
}

// ³Ø½¼ ÇÃ·¹ÀÌ¾î Å¬·¡½º
NexonPlayer.Page.prototype =
{
	handleLoad: function(control, userContext, rootElement)
	{
		this.control = control;
		this.root = rootElement;
		this.userContext = userContext;

        // for Debug Mode
	    this.version = "0.9.4.5";
	    this.getControl("txtVersion").text = this.version;
	    this.txtDebug = this.getControl("txtDebug");
	    this.panDebug = this.getControl("panDebug");
	    this.panDebug.visibility = "Collapsed";
	    this.useDebugMode = true;   // µð¹ö±× ¸ðµå »ç¿ë ¿©ºÎ
	    this.debugMode = false;     // µð¹ö±× ¸ðµå »óÅÂ
        this.Debug("NexonPlayer Version " + this.version);
        this.debugModePassword = [71, 72, 71, 77]; // 3439
        this.debugEntering = false; // µð¹ö±× ¸ðµå ÁøÀÔÁß (ºñ¹Ð¹øÈ£ ÀÔ·ÂÁß)
        this.debugModePasswordIndex = 0;    // ÀÔ·ÂÁßÀÎ ºñ¹Ð¹øÈ£ ÀÎµ¦½º

        this.checkAndInitParams();
        this.initControls();
        this.requestXML();
        this.downloadFont(userContext.fontURL);
        this.addEventHandler();
    },
    
    // ¸Å°³º¯¼ö Ã¼Å© ¹× ÃÊ±âÈ­
    checkAndInitParams: function()
    {
        this.Debug("*Parameter check");
	    // [weak mandatory] ¾øÀ¸¸é ÇÃ·¹ÀÌ¾î¿¡¼­ ¿À·ù ¸Þ½ÃÁö ÆË¾÷ - ¿¹¿Ü Ã³¸® (±â´É Á¤Áö)
	    // movieURL - µ¿¿µ»ó Á¤º¸ ¾øÀ½ ¿¹¿Ü
	    // fontURL - ÆùÆ® ¾øÀ½ ¿¹¿Ü

	    // [optional] ¾øÀ¸¸é ÇÃ·¹ÀÌ¾î¿¡¼­ ¾Ë¾Æ¼­ Ã³¸® - Á¤»ó ÀÛµ¿
	    // articleXML - µ¿¿µ»ó Á¤º¸ ÆÇ³Ú Ç¥½Ã ¾ÈÇÔ
	    // recommandXML - ÃßÃµ¿µ»ó ÆÇ³Ú Ç¥½Ã ¾ÈÇÔ
	    // footerURL - ÆÛ°¡±â URL ¿¡¼­ Á¦¿Ü
	    // thumbnailURL - ÆÛ°¡±â ±â´É »ç¿ë ºÒ°¡
	    // this.playtime - ±âº»°ª:00:00
	    // this.disableArticleInfoPanel - ±âº»°ª:false
	    // this.disableMovieListPanel - ±âº»°ª:false
	    // this.disableScrapButton - ±âº»°ª:false
	    // this.disableOtherMovieButton - ±âº»°ª:false

        // ¿¹¿Ü Ã³¸®        
        var alertErr = false;
        var err = "³Ø½¼ ÇÃ·¹ÀÌ¾î ¿¹¿Ü°¡ ¹ß»ýÇß½À´Ï´Ù.    \r\n";
        err += "¿¹¿ÜÅ¸ÀÔ:ParameterException   \r\n";
        if (Invalid(this.userContext.movieURL))
        {
	        err += "¸Þ½ÃÁö:µ¿¿µ»óURL ¹ÌÀÔ·Â   \r\n";
	        alertErr = true;
        }
        if (Invalid(this.userContext.fontURL))
        {
	        err += "¸Þ½ÃÁö:ÆùÆ®URL ¹ÌÀÔ·Â   \r\n";
	        alertErr = true;
        }
        
        // UI ºñÈ°¼ºÈ­ ¿É¼Ç
        this.disableArticleInfoPanel = this.userContext.disableArticleInfoPanel;
        this.disableMovieListPanel = this.userContext.disableMovieListPanel;
        this.disableScrapButton = this.userContext.disableScrapButton;
        this.disableOtherMovieButton = this.userContext.disableOtherMovieButton;
        this.disableThumbnailImage = false; // ´ëÇ¥ÀÌ¹ÌÁö

        // ¿É¼Ç °ü°è Ã³¸®
        if (Invalid(this.userContext.articleXML))
        {
            this.disableArticleInfoPanel = true;
            this.disableScrapButton = true;
            this.disableOtherMovieButton = true;
        }
        if (Invalid(this.userContext.recommandXML))
        {
            this.disableMovieListPanel = true;
        }
        
        // ÀÏ¹Ý µ¥ÀÌÅÍ (»ç¿ëÇÏ´Â °÷¿¡¼­ »óÈ²¿¡ ¸Â°Ô ÀÚÃ¼ Ã³¸®)
        this.strThumbnailURL = this.userContext.thumbnailURL;
        this.footerURL = this.userContext.footerURL;

        if (Invalid(this.userContext.thumbnailURL))
        {
            this.disableThumbnailImage = true;
        }
        if (Invalid(this.userContext.footerURL))
        {
            this.footerURL = "";
        }
        this.playtime = this.userContext.playtime;
        
        this.Debug("disableArticleInfoPanel = " + this.disableArticleInfoPanel.toString());
        this.Debug("disableMovieListPanel = " + this.disableMovieListPanel.toString());
        this.Debug("disableScrapButton = " + this.disableScrapButton.toString());
        this.Debug("disableOtherMovieButton = " + this.disableOtherMovieButton.toString());
        this.Debug("disableThumbnailImage = " + this.disableThumbnailImage.toString());
        this.Debug("strThumbnailURL = " + this.userContext.thumbnailURL);
        this.Debug("footerURL = " + this.footerURL);
        this.Debug("movieURL = " + this.userContext.movieURL);
        this.Debug("fontURL = " + this.userContext.fontURL);
        
        if (alertErr == true) 
        {
            alert(err);
            this.Debug("Parameter error: " + err);
            return err.replace("\r\n", "<br>");
        }
        this.Debug("*Parameter check complete");
    },

    // ¿¡·¯ ÇÚµé·¯    
    handleError: function(sender, eventArgs)
    {
	    var d, c = eventArgs.ErrorType;
	    var alertSkip = false;
    	
	    d = eventArgs.ErrorCode;
    	
	    var a = "\r\n³Ø½¼ ÇÃ·¹ÀÌ¾î¿¡¼­ ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù.\r\n";
    	
	    a += "¿¡·¯ÄÚµå: " + d + "\r\n";
	    a += "¿¡·¯Å¸ÀÔ: " + c + "       \r\n";
	    a += "¸Þ½ÃÁö: " + eventArgs.ErrorMessage + "     \r\n";
    	
	    if (c == "ParserError")
	    {
		    a += "XamlÆÄÀÏ: " + eventArgs.xamlFile + "     \r\n";
		    a += "Çà: " + eventArgs.lineNumber + "     \r\n";
		    a += "¿­: " + eventArgs.charPosition + "     \r\n";
	    }
	    else if (c == "RuntimeError")
	    {
		    if (b.lineNumber != 0)
		    {
			    a += "Çà: " + eventArgs.lineNumber + "     \r\n";
			    a += "¿­: " + eventArgs.charPosition + "     \r\n";
		    }
		    a += "¸Þ¼­µå: " + eventArgs.methodName + "     \r\n";
	    }
	    else if (c == "MediaError")
	    {
	        switch (this.playerState)
	        {
	            case PlayerState.None:
	            case PlayerState.Closed:
	            {
	                // ¹Ìµð¾î ¿ÀÇÂ Áß ¿¡·¯. URLÀÌ °»½ÅµÇ¾úÀ» ¼ö ÀÖ´Ù. Àç½Ãµµ 1È¸ ÇÊ¿ä.
	                if (this.mediaOpenRetry == false)
	                {
	                    this.mediaOpenRetry = true;
	                    sendRequest(this.httpRequest3, this.userContext.movieURL, null, Silverlight.createDelegate(this, this.MovieURLLoadComplete), "GET");
	                    alertSkip = true;
	                    this.Debug("MediaError #1");
	                }
	                else
	                {
	                    a += "(Àç½Ãµµ 1È¸)    \r\n";
	                    var msg = "¾Æ·¡¿Í °°Àº ÀÌÀ¯·Î µ¿¿µ»óÀ» \r\nÁ¤»óÀûÀ¸·Î º¸¿©µå¸®Áö ¸øÇÏ°í ÀÖ½À´Ï´Ù.     \r\n\r\n - Áö¿øÇÏÁö ¾Ê´Â ÄÚµ¦\r\n - µ¿¿µ»ó °æ·Î ¼Õ»ó\r\n - ÀÏ½ÃÀû ¼­ºñ½º Àå¾Ö";
	                    alert(msg);
	                    this.Debug(msg);
	                    alertSkip = true;
	                }
	                break;
	            }
	            case PlayerState.Stopped:
	            case PlayerState.Playing:
	            case PlayerState.Paused:
	            case PlayerState.Buffering:
	            case PlayerState.Opening:
	            {
	                break;
	            }
	            default: break;
	        }
        }
    	
    	if (alertSkip == false)
    	{
    	    alert(a);
    	    this.Debug(a);
    	}
    },
    
    initControls: function()
    {
		// [Assign Controls]
		// ¹Ýº¹ÀûÀ¸·Î Á¢±ÙÇÏ´Â °´Ã¼¸¸ ¸â¹öº¯¼ö·Î ¸¸µç´Ù. 
		// ÀÏÈ¸¼ºÀ¸·Î Á¢±ÙÇÏ´Â °´Ã¼´Â Á÷Á¢ this.getControl(), this.addControlHandler À¸·Î ÂüÁ¶ÇÏ¿© »ç¿ë.
		this.canvasRoot = this.getControl("Page");  // rootElement
		this.timer = this.getControl("timer");
		this.medScreen = this.getControl("medScreen");
		this.panScreen = this.getControl("panScreen");
		this.imgCapture = this.getControl("imgCapture");
		this.panMovieInfo = this.getControl("panMovieInfo");
		
		// ÄÁÆ®·Ñ·¯
		this.btnPlay = this.getControl("btnPlay");
		this.btnPause = this.getControl("btnPause");
		this.btnStart = this.getControl("btnStart");
		this.btnStop = this.getControl("btnStop");
		this.btnFullScreen = this.getControl("btnFullScreen");
	    this.txtPosition = this.getControl("txtPosition");
	    this.txtDuration = this.getControl("txtDuration");

		this.btnPlay_rollover = this.getControl("btnPlay_rollover");
		this.btnPause_rollover = this.getControl("btnPause_rollover");

        // Àç»ý ÇÁ·Î±×·¡½º¹Ù
		this.rctBackground = this.getControl("rctBackground");
		this.rctDownload = this.getControl("rctDownload");
		this.rctProgress = this.getControl("rctProgress");
		this.panProcessbar = this.getControl("panProcessbar");
		this.btnProgress = this.getControl("btnProgress");

		// volume control
		this.btnVolumeControl = this.getControl("btnVolumeControl");
		this.ctlVolume = this.getControl("ctlVolume");
		this.rctVolumeBackground = this.getControl("rctVolumeBackground");
		this.rctVolumeProgress = this.getControl("rctVolumeProgress");
		this.btnVolume = this.getControl("btnVolume");
		this.panVolumebar = this.getControl("panVolumebar");
		
		this.showVolumeControl = this.getControl("showVolumeControl");
		this.hideVolumeControl = this.getControl("hideVolumeControl");
		this.hideVolumeControlTimer = this.getControl("hideVolumeControlTimer");
		
		// Àç»ý Á¾·á È­¸é ¹öÆ°
		this.btnReplay = this.getControl("btnReplay");
		this.btnOtherMovie = this.getControl("btnOtherMovie");
		
        // buffering panel
		this.panBuffering = this.getControl("panBuffering");
		this.txtBufferingProgress = this.getControl("txtBufferingProgress");
		this.rctBufferingBackground = this.getControl("rctBufferingBackground");
		this.rctBufferingProgress = this.getControl("rctBufferingProgress");
		
		// Ã¤¿ì±â ¹öÆ°
		this.btnFull = this.getControl("btnFull");
		this.btnFullBack = this.getControl("btnFullBack");
		this.show_btnFullBack = this.getControl("show_btnFullBack");
		
		// ÃßÃµ¿µ»ó ÀÌ¹ÌÁö
		this.img_1 = this.getControl("img_1");
		this.img_1_2 = this.getControl("img_1_2");
		this.img_2 = this.getControl("img_2");
		this.img_2_2 = this.getControl("img_2_2");
		this.img_3 = this.getControl("img_3");
		this.img_3_2 = this.getControl("img_3_2");
		this.img_4 = this.getControl("img_4");
		this.img_4_2 = this.getControl("img_4_2");
		
		this.panScrab = this.getControl("panScrab");
		
		this.panMessage = this.getControl("panMessage");
		
		// ÀüÃ¼È­¸é ¾Ë¸²
		this.panFullscreenNotice = this.getControl("panFullscreenNotice");
		this.FullscreenAlert = this.getControl("FullscreenAlert");
		
        // [Init controls]
        this.playerState = PlayerState.None;
        
        // ¹Ìµð¾î ¿ÀÇÂ Àç½Ãµµ Ä«¿îÆ®
        this.mediaOpenRetry = false;
        
        // ÀÚµ¿ Àç»ý ±ÝÁö
        this.openComplete = false;
        this.medScreen.autoPlay = false;
        this.medScreenMouseover = false;
        
        // Å¬¸®ÇÎ ¿µ¿ª ¹é¾÷
        this.rootClip = this.root.clip;
        
        // ±¤°í ¼³Á¤
        this.firstStart = true;
        
        // Ã¤¿ì±â ¼³Á¤
        this.fitScreen = true;      // È­¸é¿¡ ²À ¸Â´Â´Ù (ÃÊ±â°ª)
        this.useStretch = false;    // Ã¤¿ì±â »ç¿ë ¾ÈÇÔ (È­¸é¿¡ ²À ¸Â´õ¶óµµ ÀüÃ¼È­¸é¿¡¼­´Â Ã¤¿ì±â »ç¿ë)
        this.medScreen.cursor = "None";
        this.stretchScreen = false;     // Ã¤¿ì±â »óÅÂ (true=Ã¤¿ì±â, false=º¸Åë)
        this.medScreen.stretch = "None";

        // ÀüÃ¼È­¸é
        this.btnFullScreen.cursor = "Arrow";
        this.panFullscreenNotice.visibility = "Collapsed";
        
        // Àç»ý ´ë±â (Àç»ý °¡´ÉÇÑ »óÅÂ°¡ µÇ¸é Àç»ý ½ÃÀÛ)
        this.readyToPlay = false;
        
        // Àç»ý Àá±Ý (µ¿¿µ»ó URL À» ¹Þ¾Æ¿À´Â µ¿¾È ¹öÆ° Àá±Ý)
        this.playLock = false;   // µ¿¿µ»ó Open µ¿¾ÈÀº Play,Pause,Stop À» Àá±Ù´Ù. ±âº»°ª false
        
        this.txtDuration.text = this.playtime;

        this.btnFull.visibility = "Collapsed";
        this.btnFullBack.visibility = "Collapsed";
        this.panBuffering.visibility = "Collapsed";
        
        if (this.disableMovieListPanel == true)
        {
            this.getControl("panMovieList").visibility = "Collapsed";
        }
        if (this.disableOtherMovieButton == true)
        {
            this.btnOtherMovie.visibility = "Collapsed";
            this.btnReplay["Canvas.Left"] = 242.0;
        }

        if (this.disableThumbnailImage == true)
        {
            this.imgCapture.visibility = "Collapsed";
        }
		else
        {
			if( this.strThumbnailURL=="" )
			{
				this.imgCapture.source = "http://s.nx.com/S2/Portal/Nexon/Nexon2007/image/global/basic_setsilverlight.gif";
			}
			else
			{
				this.imgCapture.source = this.strThumbnailURL;
			}
            
        }
                
        // µ¿¿µ»ó ÃÑ Àç»ý½Ã°£ (ÃÊ)
        this.duration = 0.0;
        // ÇÁ·Î±×·¡½º ÃÖ´ë ±æÀÌ
		this.progressWidth = this.rctBackground.width;
        // ÇÁ·Î±×·¡½º ¹öÆ°ÀÇ ½ÃÀÛÀ§Ä¡
        this.progressButtonBase = this.btnProgress["Canvas.Left"];
        
        this.downloadRate = 0.0;
        
        // ¹öÆÛ¸µ ÃÖ´ë ±æÀÌ (¹öÆÛ¸µ Rectangle Æø)
        this.bufferingWidth = this.rctBufferingBackground.width;
        
        // 
        this.counter1= 0;   // Media Download Progress ¿ë
        this.counter2 = 0;  // Timer ¿ë

        // Àç»ý ÇÁ·Î±×·¡½º ¹Ù(½½¶óÀÌ´õ)
        this.btnProgressMouseDown = false; // Àç»ý ÇÁ·Î±×·¡½º¿¡¼­ ¸¶¿ì½º µå·¡±× ÁßÀÎ°¡?
        
        this.panMovieInfo.visibility = "Collapsed";
        this.imgCapture.visibility = "Visible";
        
        // ½ºÅ©·¦ ¹öÆ°
        if (this.disableScrapButton == false)
        {
            this.getControl("btnScrap").cursor = "Hand";
        }
        else
        {
            this.getControl("btnScrap").cursor = "Arrow";
            this.getControl("btnScrap").opacity = 0.5;
        }
        
        // MovieList
        this.movieListLock = true;
        
        // Volume Control
        this.showVolumeControl.stop();
        this.ctlVolume.visibility = "Collapsed";
        this.btnVolumeMouseDown = false; // º¼·ý ÄÁÆ®·Ñ¿¡¼­ ¸¶¿ì½º µå·¡±× ÁßÀÎ°¡?
        
        // Full Screen
        this.medScreenOriginLeft = this.medScreen["Canvas.Left"];
        this.medScreenOriginTop = this.medScreen["Canvas.Top"];
        this.medScreenOriginWidth = this.medScreen.width;
        this.medScreenOriginHeight = this.medScreen.height;
        
        this.PageOriginWidth = this.canvasRoot.width;
        this.PageOriginHeight = this.canvasRoot.height;
    
        this.panScrab.visibility = "Collapsed";
        this.panMessage.visibility = "Collapsed";
    },
    
    requestXML: function()
    {
        // ´ëÇ¥ÀÌ¹ÌÁö
        /*this.httpRequest0 = getXMLHttpRequest();
        sendRequest(this.httpRequest0, this.userContext.thumbnailURL, null, Silverlight.createDelegate(this, this.ThumbnailURLLoadComplete), "GET");*/
        
        // °Ô½Ã¹° Á¤º¸
        if (this.disableArticleInfoPanel == false)
        {
            this.httpRequest1 = getXMLHttpRequest(); 
            sendRequest(this.httpRequest1, this.userContext.articleXML, null, Silverlight.createDelegate(this, this.ArticleXMLLoadComplete), "GET");
        }
        
        // ÃßÃµ¿µ»ó Á¤º¸
        if (this.disableMovieListPanel == false)
        {
            this.httpRequest2 = getXMLHttpRequest();
            sendRequest(this.httpRequest2, this.userContext.recommandXML, null, Silverlight.createDelegate(this, this.RecommandXMLLoadComplete), "GET");
        }
    },
    
    downloadFont: function(fontURL)
    {
        // Font downloader
		var downloader = this.control.createObject("downloader");
	
		downloader.addEventListener("Completed", Silverlight.createDelegate(this, this.handleDownloadCompleted));
		downloader.open("GET", fontURL);
		downloader.send();
    },
    
    addEventHandler: function()
    {
		// [Add Event Handlers]
		this.canvasRoot.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.canvasRoot_MouseLeave));
		this.canvasRoot.addEventListener("KeyDown", Silverlight.createDelegate(this, this.canvasRoot_KeyDown));
		
		this.btnPlay.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnPlay_MouseLeftButtonDown));
		this.btnPlay.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnPlay_MouseEnter));
		this.btnPlay.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnPlay_MouseLeave));
		this.btnPause.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnPause_MouseLeftButtonDown));
		this.btnPause.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnPause_MouseEnter));
		this.btnPause.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnPause_MouseLeave));

		this.btnStart.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnStart_MouseEnter));
		this.btnStart.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnStart_MouseLeave));
		this.btnStart.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnStart_MouseLeftButtonDown));

		this.btnStop.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnStop_MouseEnter));
		this.btnStop.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnStop_MouseLeave));
		this.btnStop.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnStop_MouseLeftButtonDown));

        this.medScreen.addEventListener("MediaOpened", Silverlight.createDelegate(this, this.medScreen_MediaOpened));
        this.medScreen.addEventListener("MediaEnded", Silverlight.createDelegate(this, this.medScreen_MediaEnded));
        this.medScreen.addEventListener("DownloadProgressChanged", Silverlight.createDelegate(this, this.medScreen_DownloadProgressChanged));
        this.medScreen.addEventListener("BufferingProgressChanged", Silverlight.createDelegate(this, this.medScreen_BufferingProgressChanged));
        this.medScreen.addEventListener("CurrentStateChanged", Silverlight.createDelegate(this, this.medScreen_CurrentStateChanged));
        this.panScreen.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.medScreen_MouseLeftButtonDown));
        this.panScreen.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.medScreen_MouseEnter));
        this.panScreen.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.medScreen_MouseLeave));

        this.btnProgress.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnProgress_MouseLeftButtonDown));
        this.btnProgress.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.btnProgress_MouseLeftButtonUp));
        this.btnProgress.addEventListener("MouseMove", Silverlight.createDelegate(this, this.btnProgress_MouseMove));
        
        this.rctBackground.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.rctBackground_MouseLeftButtonDown));
        this.rctDownload.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.rctBackground_MouseLeftButtonDown));
        this.rctProgress.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.rctBackground_MouseLeftButtonDown));
        
        this.ctlVolume.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.ctlVolume_MouseEnter));
        this.ctlVolume.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.ctlVolume_MouseLeave));
        this.hideVolumeControlTimer.addEventListener("Completed", Silverlight.createDelegate(this, this.hideVolumeControl_Completed));

        this.btnVolumeControl.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnVolumeControl_MouseEnter));
        this.btnVolumeControl.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnVolumeControl_MouseLeave));
        this.btnVolumeControl.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnVolumeControl_MouseLeftButtonDown));
        this.hideVolumeControl.addEventListener("Completed", Silverlight.createDelegate(this, this.hideVolumeControl_Completed));
        this.panVolumebar.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.panVolumebar_MouseLeftButtonDown));
        
        this.btnVolume.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnVolume_MouseLeftButtonDown));
        this.btnVolume.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.btnVolume_MouseLeftButtonUp));
        this.btnVolume.addEventListener("MouseMove", Silverlight.createDelegate(this, this.btnVolume_MouseMove));
        
        this.btnReplay.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnReplay_MouseEnter));
        this.btnReplay.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnReplay_MouseLeave));
        this.btnReplay.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnReplay_MouseLeftButtonDown));
        this.btnOtherMovie.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnOtherMovie_MouseEnter));
        this.btnOtherMovie.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnOtherMovie_MouseLeave));
        this.btnOtherMovie.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnOtherMovie_MouseLeftButtonDown));
        
        this.btnFullScreen.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.btnFullScreen_MouseEnter));
        this.btnFullScreen.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.btnFullScreen_MouseLeave));
        this.btnFullScreen.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.btnFullScreen_MouseLeftButtonDown));
        
        // ÀÏÈ¸¼º Á¢±Ù °´Ã¼ÀÌ¹Ç·Î addControlHandler() »ç¿ë
        this.addControlHandler("hideMovieInfo", "Completed", this.hideMovieInfo_Completed);
        this.addControlHandler("FullscreenAlert", "Completed", this.FullscreenAlert_Completed);
        
        if (this.disableMovieListPanel == false)
        {
            this.addControlHandler("panMovieList", "MouseEnter", this.panMovieList_MouseEnter);
            this.addControlHandler("panMovieList", "MouseLeave", this.panMovieList_MouseLeave);
            this.addControlHandler("thumb_01", "MouseEnter", this.thumb_01_MouseEnter);
            this.addControlHandler("thumb_01", "MouseLeave", this.thumb_01_MouseLeave);
            this.addControlHandler("thumb_01", "MouseLeftButtonDown", this.thumb_01_MouseLeftButtonDown);
            this.addControlHandler("thumb_02", "MouseEnter", this.thumb_02_MouseEnter);
            this.addControlHandler("thumb_02", "MouseLeave", this.thumb_02_MouseLeave);
            this.addControlHandler("thumb_02", "MouseLeftButtonDown", this.thumb_02_MouseLeftButtonDown);
            this.addControlHandler("thumb_03", "MouseEnter", this.thumb_03_MouseEnter);
            this.addControlHandler("thumb_03", "MouseLeave", this.thumb_03_MouseLeave);
            this.addControlHandler("thumb_03", "MouseLeftButtonDown", this.thumb_03_MouseLeftButtonDown);
            this.addControlHandler("thumb_04", "MouseEnter", this.thumb_04_MouseEnter);
            this.addControlHandler("thumb_04", "MouseLeave", this.thumb_04_MouseLeave);
            this.addControlHandler("thumb_04", "MouseLeftButtonDown", this.thumb_04_MouseLeftButtonDown);
        
            this.addControlHandler("arrow_left", "MouseEnter", this.arrow_left_MouseEnter);
            this.addControlHandler("arrow_left", "MouseLeave", this.arrow_left_MouseLeave);
            this.addControlHandler("arrow_left", "MouseLeftButtonDown", this.arrow_left_MouseLeftButtonDown);
            this.addControlHandler("arrow_right", "MouseEnter", this.arrow_right_MouseEnter);
            this.addControlHandler("arrow_right", "MouseLeave", this.arrow_right_MouseLeave);
            this.addControlHandler("arrow_right", "MouseLeftButtonDown", this.arrow_right_MouseLeftButtonDown);
        }
        
        if (this.disableScrapButton == false)
        {
            this.addControlHandler("btnScrap", "MouseLeftButtonDown", this.btnScrap_MouseLeftButtonDown);
        }
        
        this.addControlHandler("btnScrabCopy1", "MouseLeftButtonDown", this.btnScrabCopy1_MouseLeftButtonDown);
        this.addControlHandler("btnScrabCopy2", "MouseLeftButtonDown", this.btnScrabCopy2_MouseLeftButtonDown);
        this.addControlHandler("btnScrapClose", "MouseLeftButtonDown", this.btnScrapClose_MouseLeftButtonDown);
        this.addControlHandler("btnMessageConfirm", "MouseLeftButtonDown", this.btnMessageConfirm_MouseLeftButtonDown);
        
        this.control.content.onFullScreenChange = Silverlight.createDelegate(this, this.BrowserHost_FullScreenChange);

        // timer        
        this.timer.addEventListener("Completed", Silverlight.createDelegate(this, this.timer_Completed));
	},

	handleDownloadCompleted: function(sender, args)
	{
        this.Debug("Font download complete (handleDownloadCompleted)");
	    // TextBlock°ú ´Ù¿î·Î´õ ¿¬°á
	    this.downloader = sender;
	    this.traversal(this.root, 0);
	},
	
	// TextBlock Àç±Í Å½»ö, thx gongdo
    traversal: function(target, depth)
	{
		var typeName = target.toString();
		if (!depth)
		{
			depth = 0;
		}

		if (typeName == 'Canvas')
		{
			for(var i=0; i<target.children.count; ++i)
			{
				this.traversal(target.children.getItem(i), depth + 1);
			}
		}
		else if (typeName == 'TextBlock')
		{
			// ´Ù¿î·Î´õ ¼¼ÆÃ, Á¢µÎ¾î°¡ "txt"·Î ¸í¸íµÈ ÅØ½ºÆ® ÄÁÆ®·Ñ¸¸ ÆùÆ® ¼öÁ¤
			if (target.name.substr(0, 3) == "txt")
			{
			    target.setFontSource(this.downloader);
			}
		}
	},

    // µ¿¿µ»ó ´ëÇ¥ÀÌ¹ÌÁö ·Îµù ÄÝ¹é
    ThumbnailURLLoadComplete: function()
    {
		if (this.httpRequest0.readyState == 4)
        {
            if (this.httpRequest0.status == 200)
            {
                this.Debug("*ThumbnailURLLoadComplete");
                this.strThumbnailURL = this.httpRequest0.responseText.trim();
                this.imgCapture.source = this.strThumbnailURL;
                this.Debug("*ThumbnailURLLoadComplete complete");
            }
        }
    },
    
    // °Ô½Ã¹° Á¤º¸ xaml ·Îµù ÄÝ¹é
    ArticleXMLLoadComplete: function()
    {
        if (this.httpRequest1.readyState == 4)
        {
            if (this.httpRequest1.status == 200)
            {
                this.Debug("*ArticleXMLLoadComplete");
                var xmlDoc = this.httpRequest1.responseXML;
                var errorCodeList = xmlDoc.getElementsByTagName("frk_n4ErrorCode");
				if(errorCodeList[0] == null)
				{
					this.getControl("txtSubscription").text =  "Á¦   ¸ñ : <°Ô½Ã¹° Á¤º¸¸¦ °¡Á®¿ÀÁö ¸øÇß½À´Ï´Ù>";
					return;
				}
				else
				{
					var errorCode = errorCodeList[0].firstChild.nodeValue;
					if (errorCode != "0")
					{
						var errorMessageList = xmlDoc.getElementsByTagName("frk_strErrorText");
						var errorMessage = errorMessageList[0].firstChild.nodeValue;
						this.getControl("txtSubscription").text =  "Á¦   ¸ñ : <°Ô½Ã¹° Á¤º¸¸¦ °¡Á®¿ÀÁö ¸øÇß½À´Ï´Ù>";
						this.Debug("Error:" + errorMessage);
						return;
					}
					return;
				}
                var applyList = xmlDoc.getElementsByTagName("ApplyInfo");
                var apply = applyList[0];
                
                for (var i = 0; i < apply.childNodes.length; i++)
                {
                    var childNode = apply.childNodes[i];
                    this.Debug(childNode.nodeName);
                    
                    var err = false;
                    try
                    {
                        switch (childNode.nodeName)
                        {
                            case "strArticleTitle":
                            {
                                this.strArticleTitle = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            case "strNickName":
                            {
                                this.strNickName = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            case "strMovieFileURL":
                            {
                                this.strMovieFileURL = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            case "dateCreate":
                            {
                                this.dateCreate = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            case "strArticleURL":
                            {
                                this.strArticleURL = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            case "strChannelURL":
                            {
                                this.strChannelURL = XMLDecode(childNode.firstChild.nodeValue);
                                break;
                            }
                            default:
                            {
                                break;
                            }
                        }// switch
                    }
                    catch (e)
                    {
                        this.Debug("Error in RecommandXMLLoadComplete: " + e.description);
                        err = true;
                        break;
                    }
                }// for
                
                if (err == false)
                {
                    if (this.disableArticleInfoPanel == false)
                    {
                        this.panMovieInfo.visibility = "Visible";
                    }

                    this.getControl("txtSubscription").text =  "Á¦   ¸ñ : " + this.strArticleTitle;
                    this.getControl("txtAuthor").text =  "ÀÛ¼ºÀÚ : " + this.strNickName;
                    this.getControl("txtWrittenDate").text =  "ÀÛ¼ºÀÏ : " + this.dateCreate;
                }
                
                if (this.footerURL == "")
                {
                    this.scrabLink1 = '<a href="' + this.strArticleURL + '"><img width=320 height=240 border="0" style="border:2px solid #CECECE" src="' 
                        + this.strThumbnailURL + '"> </a>'; // </a> ¾Õ¿¡ °ø¹éÀ» ³Ö¾îÁà¾ß ¸¶Áö¸· ´Ü¾îÀÇ ÁÙ³Ñ±èÀÌ µÈ´Ù. ½Ç¹ö¶óÀÌÆ® ¹ö±×
                }
                else
                {
                    this.scrabLink1 = '<br><a href="' + this.strArticleURL + '"><img width=320 height=240 border="0" style="border:2px solid #CECECE" src="' 
                        + this.strThumbnailURL + '"><br><img width=324 height=30 border="0" src="' + this.footerURL + '"> </a>';
                }
                this.scrabLink2 = this.strArticleURL
                
                this.getControl("txtScrabLink1").text = this.scrabLink1;
                this.getControl("txtScrabLink2").text = this.scrabLink2;
                this.Debug("*ArticleXMLLoadComplete complete");
            }// if
        }// if
    },

    // ÃßÃµ¿µ»ó Á¤º¸ xml ÄÝ¹é
    RecommandXMLLoadComplete: function()
    {
        if (this.httpRequest2.readyState == 4)
        {
            if (this.httpRequest2.status == 200)
            {
                this.Debug("*RecommandXMLLoadComplete");
                var xmlDoc = this.httpRequest2.responseXML;
                var errorCodeList = xmlDoc.getElementsByTagName("frk_n4ErrorCode");
                var errorCode = errorCodeList[0].firstChild.nodeValue;
                if (errorCode != "0")
                {
                    var errorMessageList = xmlDoc.getElementsByTagName("frk_strErrorText");
                    var errorMessage = errorMessageList[0].firstChild.nodeValue;
                    alert(errorMessage);
                    return;
                }
                
                var applyList = xmlDoc.getElementsByTagName("ApplyInfo");
                this.recommand = new MovieList();
                
                for (var j = 0; j < applyList.length; j++)
                {
                    
                    var apply = applyList[j];
                    var strThumbnailURL = "";
                    var strArticleURL = "";
                    
                    for (var i = 0; i < apply.childNodes.length; i++)
                    {
                        var childNode = apply.childNodes[i];
                        var err = false;
                        try
                        {
                            switch (childNode.nodeName)
                            {
                                case "strThumbnailURL":
                                {
                                    strThumbnailURL = XMLDecode(childNode.firstChild.nodeValue);
                                    break;
                                }
                                case "strArticleURL":
                                {
                                    strArticleURL = XMLDecode(childNode.firstChild.nodeValue);
                                    break;
                                }
                                case "strArticleTitle":
                                {
                                    strArticleTitle = XMLDecode(childNode.firstChild.nodeValue);
                                    break;
                                }
                                default:
                                {
                                    break;
                                }
                            }// switch
                        }
                        catch (e)
                        {
                            this.Debug("Error in RecommandXMLLoadComplete: " + e.description);
                            err = true;
                            break;
                        }
                    }// for
                    
                    // ¿¹¿Ü°¡ ¹ß»ýÇÑ Ç×¸ñÀº Ãß°¡ ¾ÈÇÔ
                    if (err == false)
                    {
                        this.recommand.addMovie(strArticleTitle, strThumbnailURL, strArticleURL);
                        this.Debug("R(" + this.recommand.getLength() + ") = " + strArticleTitle);
                    }
                }// for
                
                this.recommand.index = 0;
                
                if (this.recommand.getLength() == 0)
                {
                    this.disableMovieListPanel = true;
                    this.getControl("panMovieList").visibility = "Collapsed";
                    this.Debug("disableMovieListPanel = " + this.disableMovieListPanel);
                }
                else
                {
                    this.setMovieList();
                }
                this.Debug("*RecommandXMLLoadComplete complete");
            }// if
        }// if
    },

    // µ¿¿µ»ó URL ÄÝ¹é
    MovieURLLoadComplete: function()
    {
        if (this.httpRequest3.readyState == 4)
        {
            if (this.httpRequest3.status == 200)
            {
                this.Debug("*MovieURLLoadComplete");
                this.strMovieFileURL = this.httpRequest3.responseText.trim();
                if (this.strMovieFileURL.lastIndexOf("ERROR") != -1)    // ¿¡·¯
                {
                    this.Debug("µ¿¿µ»ó ¿­±â ¿¡·¯: " + this.strMovieFileURL);
                    alert("µ¿¿µ»ó ¿­±â ¿¡·¯: " + this.strMovieFileURL);
                    return;
                }
                this.medScreen.autoPlay = true;
                this.medScreen.source = this.strMovieFileURL;
                this.playLock = false;
                this.Debug("*MovieURLLoadComplete complete");
            }
        }
    },
    
    setMovieList: function()
    {
        this.movThumb01 = this.recommand.getMovie();
        this.movThumb02 = this.recommand.getMovie();
        this.movThumb03 = this.recommand.getMovie();
        this.movThumb04 = this.recommand.getMovie();

        this.img_1.source = this.movThumb01.thumbnailURL;
        this.img_1_2.source = this.movThumb01.thumbnailURL;
        this.img_2.source = this.movThumb02.thumbnailURL;
        this.img_2_2.source = this.movThumb02.thumbnailURL;
        this.img_3.source = this.movThumb03.thumbnailURL;
        this.img_3_2.source = this.movThumb03.thumbnailURL;
        this.img_4.source = this.movThumb04.thumbnailURL;
        this.img_4_2.source = this.movThumb04.thumbnailURL;
    },
    
    // panMovieInfo: ¿µ»óÁ¤º¸ ÆÇ³Ú --------------------------------------------------------------------------------------------
    hideMovieInfo_Completed: function(sender, eventArgs)
	{
        this.panMovieInfo.visibility = "Collapsed";
	},
	
	// panFullscreenNotice: ÀüÃ¼È­¸é ¾Ë¸² ÆÇ³Ú --------------------------------------------------------------------------------
	FullscreenAlert_Completed: function(sender, eventArgs)
	{
        this.panFullscreenNotice.visibility = "Collapsed";
	},

    // panMovieList: ÃßÃµ¿µ»ó ÆÇ³Ú --------------------------------------------------------------------------------------------
    panMovieList_MouseEnter: function(sender, eventArgs)
	{
	    if (this.movieListLock == true) return;

	    this.getControl("showThumbnailPanel").Begin();
	},

    panMovieList_MouseLeave: function(sender, eventArgs)
	{
	    if (this.movieListLock == true) return;
	    
	    this.getControl("hideThumbnailPanel").Begin();
	},

    thumb_01_MouseEnter: function(sender, eventArgs)
	{
        this.getControl("txtTitle").text = this.movThumb01.title;
	    this.getControl("thumb_01_rollover").Begin();
	},

    thumb_01_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("thumb_01_rollout").Begin();
	},

    thumb_01_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    location = this.movThumb01.articleURL;
	},

    thumb_02_MouseEnter: function(sender, eventArgs)
	{
        this.getControl("txtTitle").text = this.movThumb02.title;
	    this.getControl("thumb_02_rollover").Begin();
	},

    thumb_02_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("thumb_02_rollout").Begin();
	},

    thumb_02_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    location = this.movThumb02.articleURL;
	},

    thumb_03_MouseEnter: function(sender, eventArgs)
	{
        this.getControl("txtTitle").text = this.movThumb03.title;
	    this.getControl("thumb_03_rollover").Begin();
	},

    thumb_03_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("thumb_03_rollout").Begin();
	},

    thumb_03_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    location = this.movThumb03.articleURL;
	},

    thumb_04_MouseEnter: function(sender, eventArgs)
	{
        this.getControl("txtTitle").text = this.movThumb04.title;
	    this.getControl("thumb_04_rollover").Begin();
	},

    thumb_04_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("thumb_04_rollout").Begin();
	},

    thumb_04_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    location = this.movThumb04.articleURL;
	},

    arrow_left_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnLeft_rollover").Begin();
	},

    arrow_left_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("btnLeft_rollover").Stop();
	},

    arrow_left_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.recommand.IncreaseIndex(-8);
	    this.setMovieList();
	},

    arrow_right_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnRight_rollover").Begin();
	},

    arrow_right_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("btnRight_rollover").Stop();
	},

    arrow_right_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    //this.recommand.IncreaseIndex(0);
	    this.setMovieList();
	},
	
	btnScrap_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    if (window.clipboardData) // IE 
        { 
            if (this.panScrab.visibility == "Visible")
            {
                this.panScrab.visibility = "Collapsed";
            }
            else
            {
                this.panScrab.visibility = "Visible";
            }
        }
        else
        {
            alert("ÆÛ°¡±â ±â´ÉÀº ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯¿¡¼­¸¸ Áö¿øµË´Ï´Ù.");
        }
	},

	btnScrabCopy1_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    var result = window.clipboardData.setData('Text', this.scrabLink1);
	    this.panMessage.visibility = "Visible";
	},
	
	btnScrabCopy2_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    var result = window.clipboardData.setData('Text', this.scrabLink2);
	    this.panMessage.visibility = "Visible";
	},
	
	btnScrapClose_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.panScrab.visibility = "Collapsed";
	},
	
	btnMessageConfirm_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.panMessage.visibility = "Collapsed";
	},
	
	// Ending Panel Buttons: Àç»ý Á¾·á ÈÄ º¸¿©Áö´Â È­¸éÀÇ ¹öÆ° -----------------------------------------------------------------
	btnReplay_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnReplay_rollover").Begin();
	},
	
	btnReplay_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("btnReplay_rollover").Stop();
	},
	
	btnReplay_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.getControl("showEndingPanel").Stop();
	    
	    // µ¿¿µ»ó Àç»ý
	    this.playMovie();
	},
	
	btnOtherMovie_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnOtherMovie_rollover").Begin();
	},
	
	btnOtherMovie_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("btnOtherMovie_rollover").Stop();
	},
	
	btnOtherMovie_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    window.open(this.strChannelURL, "movie_channel");
	    //location = this.strChannelURL;
	},
	
	// btnFullScreen: ÀüÃ¼È­¸é ------------------------------------------------------------------------------------------
	btnFullScreen_MouseEnter: function(sender, eventArgs)
	{
	    if (this.medScreen.currentState == "Playing")
	    {
	        this.getControl("btnFullScreen_rollover").Begin();
	    }
	},
	
	btnFullScreen_MouseLeave: function(sender, eventArgs)
	{
	    if (this.medScreen.currentState == "Playing")
	    {
	        this.getControl("btnFullScreen_rollover").Stop();
	    }
	},
	
	btnFullScreen_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    if (this.medScreen.currentState == "Playing")
	    {
    	    this.control.content.fullscreen = true;
    	}
	},
	
	BrowserHost_FullScreenChange: function(sender, eventArgs)
	{
	    var hostContent = sender.getHost().content;
	    
	    if (sender.getHost().content.fullscreen == true)    // ÀÏ¹ÝÈ­¸é -> ÀüÃ¼È­¸é
	    {
	        this.medScreen.Stretch = "Fill";
	        this.stretchScreen = true;
	        
	        this.medScreen["Canvas.Left"] = 0.0;
	        this.medScreen["Canvas.Top"] = 0.0;
	        this.medScreen.width = hostContent.actualWidth;
            this.medScreen.height = hostContent.actualHeight;
	        sender.width = hostContent.actualWidth;
            sender.height = hostContent.actualHeight;
            
            // È­¸é¿¡ ¸Â´Â ¿µ»óÀÌ¶ó¸é ÀüÃ¼È­¸é ¸ðµå¿¡¼­ Ã¤¿ì±â ±â´É È°¼ºÈ­
            if (this.fitScreen == true)
            {
                this.useStretch = true;
                this.medScreen.cursor = "Hand";
            }
            
            // Å¬¸®ÇÎ ¿µ¿ª »èÁ¦
            this.root.clip = null;
            
            this.getControl("panAdvertisement").visibility = "Collapsed";
            this.getControl("panMovieList").visibility = "Collapsed";
            this.getControl("panController").visibility = "Collapsed";
            this.ctlVolume.visibility = "Collapsed";
            this.panScrab.visibility = "Collapsed";
            this.panMessage.visibility = "Collapsed";
            
            // ÀüÃ¼È­¸é ¾Ë¸² ÆÇ³Ú
            this.Debug(this.panFullscreenNotice.width);
            this.panFullscreenNotice["Canvas.Left"] = (sender.width - this.panFullscreenNotice.width) / 2;
            this.panFullscreenNotice["Canvas.Top"] = (sender.height - this.panFullscreenNotice.height) / 2 - 100;
            this.panFullscreenNotice.visibility = "Visible";
            this.FullscreenAlert.begin();
            
            this.Debug("FullScreen = true");
	    }
	    else   // ÀüÃ¼È­¸é -> ÀÏ¹ÝÈ­¸é
	    {
	        if (this.stretchScreen == true)
	        {
	            this.medScreen.Stretch = "Fill";
	        }
	        else
	        {
	            this.medScreen.Stretch = "None";
	        }

	        this.medScreen["Canvas.Left"] = this.medScreenOriginLeft;
	        this.medScreen["Canvas.Top"] = this.medScreenOriginTop;
	        this.medScreen.width = this.medScreenOriginWidth;
            this.medScreen.height = this.medScreenOriginHeight;
	        sender.width = this.PageOriginWidth;
            sender.height = this.PageOriginHeight;

            // È­¸é¿¡ ¸Â´Â ¿µ»óÀÌ¶ó¸é ÀüÃ¼È­¸é ÇØÁ¦½Ã Ã¤¿ì±â ±â´É ºñÈ°¼ºÈ­
            if (this.fitScreen == true)
            {
                this.useStretch = false;
                this.medScreen.cursor = "Arrow";
            }

            // Å¬¸®ÇÎ ¿µ¿ª º¹¿ø
            this.root.clip = this.rootClip;

            this.getControl("panAdvertisement").visibility = "Visible";
            if (this.disableMovieListPanel == false)
            {
                this.getControl("panMovieList").visibility = "Visible";
            }
            this.getControl("panController").visibility = "Visible";
            
            this.panFullscreenNotice.visibility = "Collapsed";
            this.FullscreenAlert.stop();
            
            this.Debug("FullScreen = false");
	    }

        this.applyFitButtonStatus();
	},
	
	// Volume Control: º¼·ý ÄÁÆ®·Ñ --------------------------------------------------------------------------------------
	ctlVolume_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("hideVolumeControlTimer").Stop();
	    this.getControl("showVolumeControl").Begin();
	},
	
	ctlVolume_MouseLeave: function(sender, eventArgs) 
	{
	    this.getControl("hideVolumeControlTimer").Begin();
	},
	
	btnVolumeControl_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnVolumeControl_Over").Begin();
	},
	
	btnVolumeControl_MouseLeave: function(sender, eventArgs) 
	{
	    this.getControl("btnVolumeControl_Over").Stop();
	},
	
	btnVolumeControl_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    if (this.ctlVolume.visibility == "Collapsed")
	    {
        	this.ctlVolume.visibility = "Visible";
    		this.showVolumeControl.Begin();
	    }
	    else
	    {
    		this.hideVolumeControl.Begin();
	    }
	},
	
	hideVolumeControl_Completed: function(sender, eventArgs)
	{
		this.ctlVolume.visibility = "Collapsed";
	},
	
	panVolumebar_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    // 6.0 <= eventArgs.getPosition(this.ctlVolume).y <= 62.0
	    // 1.0 <=                  volume                 <= 0.0
	    var volume = 1.0 - (eventArgs.getPosition(this.ctlVolume).y - 6.0) / 56.0;
	    this.btnVolume["Canvas.Top"] = eventArgs.getPosition(this.ctlVolume).y - 5.0;
	    this.setVolume(volume);
	},
	
	btnVolume_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.btnVolume.captureMouse();
        
        this.btnVolumeMouseDown = true;
        
	    this.btnVolumeY = eventArgs.getPosition(this.ctlVolume).y - this.btnVolume["Canvas.Top"];
	},
	
	btnVolume_MouseLeftButtonUp: function(sender, eventArgs)
	{
	    if (this.btnVolumeMouseDown == false)
	    {
	        return;
	    }
	    
	    this.btnVolume.releaseMouseCapture();

        this.btnVolumeMouseDown = false;
	    
	    var volume = 1.0 - this.btnVolume["Canvas.Top"] / 56.0;
	    this.setVolume(volume);
	},
	
	btnVolume_MouseMove: function(sender, eventArgs)
	{
	    if (this.btnVolumeMouseDown == false)
	    {
	        return;
	    }
        
        var newTop = eventArgs.getPosition(this.ctlVolume).y - this.btnVolumeY;
        
	    // ¸ô¶ó ÇÏµåÄÚµù
	    // 0.0  <= medScreen.volume        <= 1.0
	    // 56.0 >= btnVolume.top           >= 0.0
	    // 1.0  <= rctVolumeProgress.width <= 57.0
        if (newTop < 0.0)
        {
            newTop = 0.0;
        }
        else if (newTop > 56.0)
        {
            newTop = 56.0;
        }
        
        this.btnVolume["Canvas.Top"] = newTop;
	},
	
	// º¼·ý °ªÀ¸·Î º¼·ý ¼³Á¤, ÄÁÆ®·Ñ ÁÂÇ¥µµ ¼öÁ¤
	setVolume: function(volume)
	{
	    this.medScreen.volume = volume;
	    this.Debug("Volume = " + volume);
	    
	    // ¸ô¶ó ÇÏµåÄÚµù
	    // 0.0  <= medScreen.volume        <= 1.0
	    // 56.0 >= btnVolume.top           >= 0.0
	    // 1.0  <= rctVolumeProgress.width <= 57.0
	    
	    this.rctVolumeProgress.width = (volume * 56.0) + 1.0;
	},
	
    // timer: Å¸ÀÌ¸Ó ½ºÅä¸®º¸µå -----------------------------------------------------------------------------------------
    // µ¿¿µ»ó Àç»ý ÁøÇà»óÅÂ¸¦ Ç¥½ÃÇÑ´Ù.
	timer_Completed: function(sender, eventArgs)
	{
        var strPosition = secondsToString(this.medScreen.position.seconds)
        
        this.txtPosition.text = strPosition;
        
        // ÇÁ·Î±×·¡½º °»½Å
        if (this.counter2 >= 3)
        {
            this.setProgressbar();
            this.counter2 = 0;
        }
        this.counter2++;
        
        // ÇÃ·¹ÀÌ¾î°¡ Àç»ýÁßÀÌ°Å³ª ÀÏ½ÃÁ¤Áö µÇ¾î ÀÖÀ» ¶§¿¡¸¸ Å¸ÀÌ¸Ó¸¦ Àç°¡µ¿ÇÑ´Ù.
		if (this.medScreen.currentState == PlayerState.Playing ||
		    this.medScreen.currentState == PlayerState.Paused)
		{
            this.timer.begin();
        }
	},
	
	setProgressbar: function()
	{
        var progress = this.progressWidth * this.medScreen.position.seconds / this.duration;
        this.rctProgress.width = progress;
        if (this.btnProgressMouseDown == false)
        {
            this.btnProgress["Canvas.Left"] = this.progressButtonBase + progress;
        }
	},

    // medScreen: ¹Ìµð¾î Àç»ý ÄÁÆ®·Ñ -----------------------------------------------------------------------------------------
	medScreen_MediaOpened: function(sender, eventArgs)
	{
        this.Debug("MediaOpened");
	    this.txtPosition.text = "00:00";
	    
        this.duration = this.medScreen.NaturalDuration.Seconds;
        var strDuration = secondsToString(this.duration);
        this.txtDuration.text = strDuration;
        
        this.openComplete = true;

        // Ã¤¿ì±â ¼³Á¤
        var naturalWidth = this.medScreen.naturalVideoWidth;
        var naturalHeight = this.medScreen.naturalVideoHeight;
        
        //if (naturalWidth == this.medScreen.width &&
        //    naturalHeight == this.medScreen.height)
        if (naturalWidth / this.medScreen.width > 0.9 &&
            naturalHeight / this.medScreen.height > 0.9)
        {
            this.fitScreen = true;      // È­¸é¿¡ ²À ¸ÂÀ¸¹Ç·Î
            this.useStretch = false;    // Ã¤¿ì±â »ç¿ë ¾ÈÇÔ (ÇÏÁö¸¸ ÀüÃ¼È­¸é¿¡¼­´Â »ç¿ëÇÔ)
            this.medScreen.cursor = "Arrow";
        }
        else
        {
            this.fitScreen = false;
            this.useStretch = true;
            this.medScreen.cursor = "Hand";
        }

        this.stretchScreen = false;     // Ã¤¿ì±â »óÅÂ
        this.medScreen.stretch = "None";

        this.applyFitButtonStatus();
        this.Debug("MediaOpened complete");
	},

	medScreen_DownloadProgressChanged: function(sender, eventArgs)
	{
	    if (this.counter1 >= 50 || this.medScreen.downloadProgress == 1.0)
	    {
	        this.downloadRate = this.medScreen.downloadProgress;
            
            this.rctDownload.width = this.progressWidth * this.downloadRate;
            this.counter1 = 0;
        }
        this.counter1++;
	},

	medScreen_BufferingProgressChanged: function(sender, eventArgs)
	{
		var progress = this.medScreen.bufferingProgress;
		
		this.txtBufferingProgress.text = Math.floor(progress * 100) + "%";
		this.rctBufferingProgress.width = this.bufferingWidth * progress;
	},
	
	// µ¿¿µ»ó Àç»ý »óÅÂ º¯È­¿¡ µû¸¥ Ã³¸®
	medScreen_CurrentStateChanged: function(sender, eventArgs)
	{
	    var state = this.medScreen.currentState;
	    
	    // Áßº¹ È£Ãâ ¹èÁ¦
	    if (state == this.playerState)
	    {
	        return;
	    }

        // ÀÌÀü »óÅÂ¿¡ µû¶ó
        switch (this.playerState)
        {
            case PlayerState.Playing:
            {
                this.btnFullScreen.cursor = "Arrow";
                break;
            }
            case PlayerState.Buffering:
            {
	            // ¹öÆÛ¸µ ÆÇ³Ú Á¦°Å
                this.panBuffering.visibility = "Collapsed";
                break;
            }
            default:
            {
                break;
            }
        }
        
	    this.playerState = state;
	    
	    this.Debug("State: " + state);
	    
	    // »õ·Î¿î »óÅÂ¿¡ µû¶ó
	    switch (state)
	    {
	        case PlayerState.Playing:   // "Playing":
	        {
	            // Àç»ý ´ë±â ÇØÁ¦
	            this.readyToPlay = false;
	            
                if (this.panMovieInfo.visibility == "Visible")
                {
                    this.getControl("hideMovieInfo").Begin();
                }
                if (this.imgCapture.visibility == "Visible")
                {
                    //this.getControl("imgCapture_out").Begin();
                    this.imgCapture.visibility = "Collapsed";
                }
	            this.btnPlay.visibility = "Collapsed";
	            this.btnPause.visibility = "Visible";
                this.btnFullScreen.cursor = "Hand";
                
                this.movieListLock = false;
        	    this.getControl("hideThumbnailPanel").Begin();

                this.timer.begin();
	            break;
	        }
	        case PlayerState.Buffering: // "Buffering":
	        {
	            // ¹öÆÛ¸µ ÆÇ³Ú
                this.panBuffering.visibility = "Visible";
	            break;
	        }
	        case PlayerState.Paused:    // "Paused":
	        {
                // Àç»ý ´ë±â Ã³¸®
	            if (this.readyToPlay == true)
	            {
	                this.medScreen.play();
	                if (this.firstStart == true)
	                {
		                this.getControl("show_ad").Begin();
		                this.firstStart = false;
		            }
	            }
	            if (this.control.content.fullscreen == true)
	            {
                    this.control.content.fullscreen = false;
                }

	            this.btnPlay.visibility = "Visible";
	            this.btnPause.visibility = "Collapsed";
	            break;
	        }
	        case PlayerState.Stopped:   // "Stopped":
	        {
   		        // Àç»ý ¹öÆ° º¸ÀÌ±â
	            this.btnPlay.visibility = "Visible";
	            this.btnPause.visibility = "Collapsed";
                
                // Àç»ý ´ë±â Ã³¸®
	            if (this.readyToPlay == true)
	            {
	                this.medScreen.play();
	                if (this.firstStart == true)
	                {
		                this.getControl("show_ad").Begin();
		                this.firstStart = false;
		            }
	            }
	            
                // ¸¶¿ì½º ·Ñ¿À¹ö ÇØÁ¦
                this.btnPlay_rollover.begin();
                this.btnPlay_rollover.stop();
                
                // ÀüÃ¼È­¸é ÇØÁ¦
                if (this.control.content.fullscreen == true)
                {
                    this.control.content.fullscreen = false;
                }
	            break;
	        }
	        case PlayerState.Opening:   // "Opening":
	        {
	            break;
	        }
	        case PlayerState.Closed:    // "Closed":
	        {
	            break;
	        }
	        default:
	        {
	            alert("State error. - " + state);
	            break;
	        }
	    }
	},

    medScreen_MouseLeftButtonDown: function(sender, eventArgs)
    {
        if (this.useStretch == false)
        {
            return;
        }
        
        if (this.stretchScreen == true)
        {
            this.stretchScreen = false;
            this.medScreen.stretch = "None";
            this.Debug("stretchScreen = false");
        }
        else
        {
            this.stretchScreen = true;
            this.medScreen.stretch = "Fill";
            this.Debug("stretchScreen = true");
        }

        this.applyFitButtonStatus();
    },

	medScreen_MediaEnded: function(sender, eventArgs)
	{
	    this.Debug("MediaEnded");
        // Àç»ý ÁßÁö
        this.medScreen.stop();
       
        // Àç»ý Á¾·á ¾Ö´Ï¸ÞÀÌ¼Ç
		this.getControl("showEndingPanel").Begin();
		this.getControl("show_ad").stop();
		this.imgCapture.visibility = "Visible";

        this.firstStart = true;
        
        // ÇÁ·Î±×·¡½º
        this.setProgressbar();
        
        if (this.disableMovieListPanel == false)
        {
            this.movieListLock = true;
	        this.getControl("showThumbnailPanel").Begin();
	    }
	    this.Debug("MediaEnded complete");
	},

	medScreen_MouseEnter: function(sender, eventArgs)
	{
	    this.medScreenMouseover = true;
	    this.applyFitButtonStatus();
    },
    
	medScreen_MouseLeave: function(sender, eventArgs)
	{
	    this.medScreenMouseover = false;
	    this.applyFitButtonStatus();
    },
    
    applyFitButtonStatus: function()
    {
        // if ´Ü°è°¡ ±í¾îÁöÁö ¾Êµµ·Ï return ³²¹ß
    
        // ¿µ»óÀÌ ¿ÀÇÂµÇÁö ¾Ê¾Ò´Ù¸é ¹«½Ã
        if (this.openComplete == false)
        {
            return;
        }
        
	    if (this.fitScreen == true || this.medScreen.getHost().content.fullscreen == true) 
	    {
            // È­¸é¿¡ ²À ¸Â´Â ¿µ»óÀÌ°Å³ª ÀüÃ¼È­¸éÀÌ¶ó¸é ¸ðµÎ ¼û±è
            this.btnFull.visibility = "Collapsed";
            this.btnFullBack.visibility = "Collapsed";
            return;
	    }
	    
        // È­¸é¿¡ ¸ÂÁö ¾Ê°í ÀÏ¹ÝÈ­¸éÀÌ¶ó¸é Ã¤¿ì±â³ª Ã¤¿ì±â ÇØÁ¦ ¹öÆ°À» Ç¥½ÃÇØ¾ß ÇÒÁö °áÁ¤ÇÑ´Ù.
        if (this.stretchScreen == false)
        {
            // Ã¤¿ì±â°¡ µÇ¾îÀÖÁö ¾ÊÀ¸¸é ¹«Á¶²« Ã¤¿ì±â ¹öÆ° Ç¥½Ã
            this.btnFull.visibility = "Visible";
            this.btnFullBack.visibility = "Collapsed";
            this.show_btnFullBack.Stop();
            return;
        }
        
        // Ã¤¿ì±â°¡ µÇ¾î ÀÖ°í
        if (this.medScreenMouseover == false)
        {
            // ¸¶¿ì½º°¡ ¿Ã¶ó°¡ ÀÖÁö ¾Ê´Ù¸é ¸ðµÎ ¼û±è
            this.btnFull.visibility = "Collapsed";
            this.btnFullBack.visibility = "Collapsed";
            return;
        }

        // ¸¶¿ì½º°¡ ¿Ã¶ó°¡ ÀÖÀ¸¸é
        if (this.btnFullBack.visibility == "Visible")
        {
            // Ã¤¿ì±â ÇØÁ¦ ¹öÆ°ÀÌ ÀÌ¹Ì Ç¥½ÃµÇ¾î ÀÖ´Ù¸é ÇÒ ÀÏ ¾ø´Ù.
            return;
        }

        // Ã¤¿ì±â ÇØÁ¦ ¹öÆ°ÀÌ Ç¥½ÃµÇ¾î ÀÖÁö ¾Ê´Ù¸é Ç¥½Ã
        this.btnFull.visibility = "Collapsed";
        this.btnFullBack.visibility = "Visible";
        this.show_btnFullBack.Begin();  // 0.5ÃÊ ÈÄ ³ªÅ¸³²
    },
    
    // canvasRoot: ÃÖ»óÀ§ Äµ¹ö½º -------------------------------------------------------------------------------------------------
	canvasRoot_MouseLeave: function(sender, eventArgs)
	{
		this.btnProgressMouseDown = false;
	},

	canvasRoot_KeyDown: function(sender, eventArgs)
	{
	    this.Debug("KeyDown: " + eventArgs.Key.toString());
	    switch (eventArgs.Key)
	    {
	        case 82: // Keypad Slash (/)
	        {
	            if (this.useDebugMode == false)
	            {
	                break;
	            }
	            
	            if (this.debugMode == true)
	            {
	                this.panDebug.visibility = "Collapsed";
	                this.debugMode = false;
	            }
	            else
	            {
	                this.debugEntering = true;
	                this.debugModePasswordIndex = 0;
	            }
	            break;
	        }
	        case 78: // Keypad Asterisk (*)
	        {
	            if (this.useDebugMode == false)
	            {
	                break;
	            }
	            
	            if (this.debugMode == true)
	            {
            	    var result = window.clipboardData.setData('Text', this.txtDebug.text);
            	    alert("µð¹ö±× ¸Þ½ÃÁö°¡ Å¬¸³º¸µå¿¡ ÀúÀåµÇ¾ú½À´Ï´Ù.");
	            }
            	break;
	        }
	        case 3: // Enter
	        {
	            if (this.panMessage.visibility == "Visible")        // ¸Þ½ÃÁö ¹Ú½º
	            {
	                this.panMessage.visibility = "Collapsed"; 
	            }
	            else if (this.panScrab.visibility == "Visible")     // ÆÛ°¡±â ÆÇ³Ú
	            {
	                this.panScrab.visibility = "Collapsed"; 
	            }
	            else
	            {
    	            // ÀüÃ¼È­¸é (ÀüÃ¼È­¸é¿¡¼­´Â Å° ÀÔ·Â ÀÌº¥Æ®°¡ ¹ß»ýÇÏÁö ¾ÊÀ¸¹Ç·Î º°´Ù¸¥ Á¶°Ç ¾øÀ½)
                    this.btnFullScreen_MouseLeftButtonDown(this.btnFullScreen, null);
                }
	            break;
	        }
	        case 8: // Esc
	        {
	            // Å»Ãâ ¿ì¼±¼øÀ§
	            if (this.panMessage.visibility == "Visible")        // ¸Þ½ÃÁö ¹Ú½º
	            {
	                this.panMessage.visibility = "Collapsed"; 
	            }
	            else if (this.panScrab.visibility == "Visible")     // ÆÛ°¡±â ÆÇ³Ú
	            {
	                this.panScrab.visibility = "Collapsed"; 
	            }
	            else if (this.ctlVolume.visibility == "Visible")    // º¼·ý ÄÁÆ®·Ñ
	            {
	                this.hideVolumeControl.Begin();
	            }
	            break;
	        }
	        case 9: // Space
	        {
	            // ¿ì¼±¼øÀ§
	            if (this.panMessage.visibility == "Visible")        // ¸Þ½ÃÁö ¹Ú½º
	            {
	                this.panMessage.visibility = "Collapsed"; 
	            }
	            else if (this.panScrab.visibility == "Visible")     // ÆÛ°¡±â ÆÇ³Ú
	            {
	                this.panScrab.visibility = "Collapsed"; 
	            }
	            else if (this.btnPlay.visibility == "Visible")           // Àç»ý ¹öÆ°
	            {
	                this.playMovie();
	            }
	            else if (this.btnPause.visibility == "Visible")     // ÀÏ½ÃÁ¤Áö ¹öÆ°
	            {
	                this.btnPause_MouseLeftButtonDown(this.btnPlay, null);
	            }
	            break;
	        }
	        default:
	        {
	            if (this.debugEntering == false)  // µð¹ö±× ¸ðµå ÁøÀÔÁßÀÌ ¾Æ´Ï¶ó¸é
	            {
	                break;
	            }
                if (this.debugModePassword[this.debugModePasswordIndex] != eventArgs.Key)   // ÀÔ·ÂÀÌ Æ²·È´Ù¸é
                {
                    this.debugEntering = false;
                    break;
                }
                this.debugModePasswordIndex++;
                if (this.debugModePasswordIndex < this.debugModePassword.length)    // ¾ÆÁ÷ ´õ ÀÔ·ÂÇØ¾ß ÇÑ´Ù¸é
                {
                    break;
                }
                
                // µð¹ö±× ¸ðµå ¿Â!
                this.panDebug.visibility = "Visible";
                this.debugMode = true;
                this.debugEntering = false;
	            break;
	        }
	    }
	},

    // btnProgress: Àç»ý ÇÁ·Î±×·¡½º¹ÙÀÇ ½½¶óÀÌ´õ ----------------------------------------------------------------------------------
	btnProgress_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    // Àç»ý, ÀÏ½ÃÁ¤Áö, ÁßÁö »óÅÂ¿¡¼­¸¸ ½½¶óÀÌ´õ ÀÌµ¿ °¡´É
	    if (this.playerState != PlayerState.Playing &&
	        this.playerState != PlayerState.Paused &&
	        this.playerState != PlayerState.Stopped)
	    {
	        return;
	    }
	    
        // Àç»ý ¿Ï·á ÆÇ³Ú Ä¡¿ì±â
	    this.getControl("showEndingPanel").Stop();

	    this.btnProgress.captureMouse();
	    
	    this.btnProgressMouseDown = true;
	    
	    this.btnProgressX = eventArgs.getPosition(this.panProcessbar).x - this.btnProgress["Canvas.Left"];
	},

	btnProgress_MouseLeftButtonUp: function(sender, eventArgs)
	{
	    if (this.btnProgressMouseDown == false)
	    {
	        return;
	    }
	    
	    this.btnProgress.releaseMouseCapture();

	    this.btnProgressMouseDown = false;
	    
	    var newPosition = this.duration * (this.btnProgress["Canvas.Left"] - this.progressButtonBase) / this.progressWidth;
        var timeSpan = this.medScreen.position;
        timeSpan.seconds = newPosition;
	    var state = this.medScreen.currentState;
	    
	    this.medScreen.pause();
	    this.medScreen.position = timeSpan;
        if (state == PlayerState.Playing)
        {
            this.medScreen.play();
        }
        else if (state == PlayerState.Stopped)
        {
            this.medScreen.pause();
        }
	},

	btnProgress_MouseMove: function(sender, eventArgs)
	{
	    if (this.btnProgressMouseDown == false)
	    {
	        return;
	    }
	    
        var newLeft = eventArgs.getPosition(this.panProcessbar).x - this.btnProgressX;
        
        // ÇÁ·Î±×·¡½º ¹öÆ°(½½¶óÀÌ´õ) ¹üÀ§ Á¦ÇÑ
        if (newLeft < this.progressButtonBase)
        {
            newLeft = this.progressButtonBase;
        }
        else if (newLeft > this.progressButtonBase + this.rctBackground.width)
        {
            newLeft = this.progressButtonBase + this.rctBackground.width;
        }
        
        this.btnProgress["Canvas.Left"] = newLeft;
	},
    
    // ÇÁ·Î±×·¡½º¹Ù¸¦ Á÷Á¢ Å¬¸¯
	rctBackground_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    // Àç»ý, ÀÏ½ÃÁ¤Áö, ÁßÁö »óÅÂ¿¡¼­¸¸ ÀÌµ¿ °¡´É
	    if (this.playerState != PlayerState.Playing &&
	        this.playerState != PlayerState.Paused &&
	        this.playerState != PlayerState.Stopped)
	    {
	        return;
	    }
	    
        // Àç»ý ¿Ï·á ÆÇ³Ú Ä¡¿ì±â
	    this.getControl("showEndingPanel").Stop();
	    
	    var newPosition = this.duration * (eventArgs.getPosition(this.panProcessbar).x - this.rctBackground["Canvas.Left"]) / this.progressWidth;
	    
	    if (newPosition < 0)
	    {
	        newPosition = 0;
	    }
	    else if (newPosition > this.duration)
	    {
	        newPosition = this.duration;
	    }
	    
        var timeSpan = this.medScreen.position;
        timeSpan.seconds = newPosition;
	    var state = this.medScreen.currentState;
	    
	    this.medScreen.pause();
	    this.medScreen.position = timeSpan;
        if (state == PlayerState.Playing)
        {
            this.medScreen.play();
        }
        else if (state == PlayerState.Stopped)
        {
            this.medScreen.pause();
        }

        // ÇÁ·Î±×·¡½º º¯°æ        
        var progress = this.progressWidth * this.medScreen.position.seconds / this.duration;
        this.rctProgress.width = progress;
        if (this.btnProgressMouseDown == false)
        {
            this.btnProgress["Canvas.Left"] = this.progressButtonBase + progress; // - (this.btnProgress.width / 2);
        }

    },
    
    // btnStart: ¹Ìµð¾î ¿ÀÇÂ½Ã ¹Ìµð¾î À§¿¡ ³ª¿À´Â ½ÃÀÛ ¹öÆ° -----------------------------------------------------------------------
	btnStart_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    this.playMovie();
	},
	
	btnStart_MouseEnter: function(sender, eventArgs)
	{
		this.getControl("btnStart_rollover").Begin();
	},

	btnStart_MouseLeave: function(sender, eventArgs)
	{
		this.getControl("btnStart_rollover").Stop();
	},

    // btnPlay: Àç»ý ¹öÆ° -----------------------------------------------------------------------------------------
	btnPlay_MouseLeftButtonDown: function(sender, eventArgs)
	{
        this.playMovie();
	},
	
	// µ¿¿µ»ó Àç»ý
	playMovie: function()
	{
	    if (this.playLock == true)  return;
	    
		// Àç»ý ¿Ï·á ÆÇ³Ú Ä¡¿ì±â
	    this.getControl("showEndingPanel").Stop();

	    // ÀÏ½ÃÁ¤Áö ¹öÆ° º¸ÀÌ±â
	    this.btnPlay.visibility = "Collapsed";
	    this.btnPause.visibility = "Visible";
	    
	    // ¹öÆÛ¸µ »óÅÂ È®ÀÎ
	    if (this.medScreen.currentState == "Buffering")
	    {
	        // ¹öÆÛ¸µ ÁßÀÌ¸é Àç»ý ´ë±â »óÅÂ·Î ÀüÈ¯
	        this.readyToPlay = true;
	    }
	    else
	    {
	        // µ¿¿µ»ó Àç»ý
            if (this.firstStart == true)
            {
                this.getControl("show_ad").Begin();
                this.firstStart = false;

                this.httpRequest3 = getXMLHttpRequest();
                var randQuery = "&rand=" + Math.floor(Math.random() * 10000000);
                sendRequest(this.httpRequest3, this.userContext.movieURL + randQuery, null, Silverlight.createDelegate(this, this.MovieURLLoadComplete), "GET");
                this.playLock = true;   // µ¿¿µ»ó Open µ¿¾ÈÀº Play,Pause,Stop À» Àá±Ù´Ù.
                
                // HTTP redirect °¡ Áö¿øµÇ¸é ÀÌ ºÎºÐÀ¸·Î ±³Ã¼
                //this.medScreen.autoPlay = false;
                //this.medScreen.source = this.userContext.movieURL;
            }
            else if (this.medScreen.currentState != PlayerState.Closed)
            {
		        this.medScreen.play();
            }
            else
            {
                // ¹«½Ã
            }
	    }
	},

	btnPlay_MouseEnter: function(sender, eventArgs)
	{
        this.btnPlay_rollover.begin();
	},

	btnPlay_MouseLeave: function(sender, eventArgs)
	{
        this.btnPlay_rollover.stop();
	},

    // btnPause: ÀÏ½ÃÁ¤Áö ¹öÆ° -----------------------------------------------------------------------------------------
	btnPause_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    if (this.playLock == true)  return;
	    
	    // Àç»ý ¹öÆ° º¸ÀÌ±â
	    this.btnPlay.visibility = "Visible";
	    this.btnPause.visibility = "Collapsed";
	    
	    this.readyToPlay = false;
	    
	    // µ¿¿µ»ó ÀÏ½ÃÁ¤Áö
		this.medScreen.pause();
	},

	btnPause_MouseEnter: function(sender, eventArgs)
	{
        this.btnPause_rollover.begin();
	},

	btnPause_MouseLeave: function(sender, eventArgs)
	{
        this.btnPause_rollover.stop();
	},

    // btnStop: ÁßÁö ¹öÆ° -----------------------------------------------------------------------------------------
	btnStop_MouseLeftButtonDown: function(sender, eventArgs)
	{
	    if (this.playLock == true)  return;
	    
        // Àç»ý ´ë±â ÇØÁ¦
	    this.readyToPlay = false;
	    
        // µ¿¿µ»ó ÁßÁö
   		this.medScreen.stop();
   		
        // ÇÁ·Î±×·¡½º ÃÊ±âÈ­
        this.rctProgress.width = 1;
        this.btnProgress["Canvas.Left"] = this.progressButtonBase;

        // ¸¶¿ì½º ·Ñ¿À¹ö ÇØÁ¦
        this.btnPlay_rollover.begin();
        this.btnPlay_rollover.stop();
	},
	
	btnStop_MouseEnter: function(sender, eventArgs)
	{
	    this.getControl("btnStop_rollover").Begin();
	},

	btnStop_MouseLeave: function(sender, eventArgs)
	{
	    this.getControl("btnStop_rollover").Stop();
	},

	// Debug: µð¹ö±ë¿ë ¸Þ½ÃÁö Ãâ·Â ÇÔ¼ö ----------------------------------------------------------------------------
	Debug: function(message)
	{
        if (this.useDebugMode == true)
        {
    	    this.txtDebug.text = message + "\r\n" + this.txtDebug.text;
    	}
	},
	
	// Utils: Ãà¾à ÇÔ¼ö --------------------------------------------------------------------------------------------
	getControl: function(name)
	{
	    return this.control.content.findName(name);
	},
	
	addControlHandler: function(name, event, handler)
	{
	    this.getControl(name).addEventListener(event, Silverlight.createDelegate(this, handler));
	}
}


function MediaPlayer()
{
	var _loc_ = location.href.split("?");
	
	this.ClientID			= null;
	this.n4Width			= 600;
	this.n4Height			= 448;
	this.strFileFullPath	= "";
	this.strStyle			= "margin:0;border-width:0;border-color:white;border-style:inset";
	this.strClassName		= null;
	
	this.MediaPlayer		= MediaPlayer;	
	
	this.Write = function ()
	{
		var thisStyle	= ( this.strStyle != null ) ? "style='" + this.strStyle + "'" : "";
		var thisClass	= ( this.strClassName != null ) ? "class='" + this.strClassName + "'" : "";
		var returnWrite = "";
		returnWrite +=  "<object classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6' width='" + this.n4Width + "' height='" + this.n4Height + "' id='" + this.ClientID + "' " + thisStyle + " " + thisClass + " standby='Loading Microsoft Windows Media Player components...'>";
		returnWrite +=  "<param name='url' value='" + this.strFileFullPath + "'>"; 
		//returnWrite +=  "<param name='SAMIFilename' value='test.smi'>";
		returnWrite +=  "<param name='ShowCaptioning' value='0'>";
		returnWrite +=  "<param name='AutoStart' value='0'>";
		returnWrite +=  "<param name='AutoRewind' value='0'>";
		returnWrite +=  "<param name='showcontrols' value='1'>";
		returnWrite +=  "<param name='AutoRestart' value='0'>";
		returnWrite +=  "<param name='ShowDisplay' value='0'>";
		returnWrite +=  "<param name='EnableContextMenu' value='0'>";
		returnWrite +=  "<param name='ShowPositionControls' value='0'>";
		returnWrite +=  "<param name='ShowStatusBar' value='0'>";
		returnWrite +=  "<!-- Hixie method -->";
		returnWrite +=  "<!--[if !IE]> <-->";
		returnWrite +=  "	<object type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' data='" + this.strFileFullPath + "' width='" + this.n4Width + "' height='" + this.n4Height + "' id='" + this.ClientID + "notIE' " + thisStyle + " " + thisClass + "></object>";
		returnWrite +=  "<!--> <![endif]-->";
		returnWrite +=  "</object>" ;
		return returnWrite;
	}
	this.LoadFile = function ( oidFile , wmpID , oidBoard , oidArticle )
	{
	
		var objAjax_File = new __AjaxRequest( '../../NxFile/Download/MovieAmlDownloader.aspx' );
		if( _loc_[1].toLowerCase().indexOf("knowledge/informationview") != -1 )	
		{
			objAjax_File = new __AjaxRequest( '../../NxFile/Plus/Download/MovieAmlDownloader.aspx' );		
		}
		
		objAjax_File.AddQueryString( 'oidFile',  oidFile );
		objAjax_File.AddQueryString( 'wmpID',  wmpID );
		objAjax_File.AddQueryString( 'oidBoard',  oidBoard );
		objAjax_File.AddQueryString( 'oidArticle',  oidArticle );
		objAjax_File.AddHandler( HandleLoadFile );
		objAjax_File.ExecuteAml();
	
	}
	this.versionCheck = function(ClientID)
	{
		try
		{
			if(document.getElementById(ClientID).versionInfo)
			{
				var mpVer = document.getElementById(ClientID).versionInfo.split(".");
				var mpVer = mpVer[0];
				if(parseInt(mpVer) < 9)
				{
					if(confirm("µ¿¿µ»óÀ» °¨»óÇÏ±â À§ÇØ¼­´Â Microsoft Window Media Player ¹öÀü9 ÀÌ»óÀÌ ¼³Ä¡ µÇ¾î¾ß ÇÕ´Ï´Ù.\n¼³Ä¡ ÇÏ½Ã°Ú½À´Ï±î?"))
					{
						window.open("http://download.microsoft.com/download/1/b/c/1bc0b1a3-c839-4b36-8f3c-19847ba09299/MPSetup.exe");
					}
				}
			}
		}
		catch(e)
		{
			if(confirm("µ¿¿µ»óÀ» °¨»óÇÏ±â À§ÇØ¼­´Â Microsoft Window Media Player ¹öÀü9 ÀÌ»óÀÌ ¼³Ä¡ µÇ¾î¾ß ÇÕ´Ï´Ù.\n¼³Ä¡ ÇÏ½Ã°Ú½À´Ï±î?"))
			{
				window.open("http://download.microsoft.com/download/1/b/c/1bc0b1a3-c839-4b36-8f3c-19847ba09299/MPSetup.exe");
			}
		}
	}
}

function getXMLHttpRequest() {
	if( window.ActiveXObject )
	{
		try { return new ActiveXObject( 'Msxml12.XMLHTTP' ); } 
		catch( e ) 
		{
			try { return new ActiveXObject( 'Microsoft.XMLHTTP' ); } 
			catch (e2) { return new XMLHttpRequest(); }	// IE 7.0 
		}
	} 
	else { return new XMLHttpRequest(); }
}

function HandleLoadFile( responseText, objReturn )//, aaa 
{
	var wmpID = objReturn.request.wmpID;
	if(NptBrowser.msie())
	{
		document.getElementById( wmpID ).url = unescape( objReturn.response.url );
	}
	else
	{	
		var paramArray = document.getElementById( wmpID ).getElementsByTagName("param");
		for (var j=0;j<paramArray.length;++j)
		{
			if(paramArray[j].name=="url")
			{
				paramArray[j].value = objReturn.response.url;
			}
		}
		document.getElementById( wmpID + "notIE" ).data = objReturn.response.url;
	}
}

function silverlightInstallLog ( param )
{
	var logTarget = new __AjaxRequest( '../../common/wiselog/addlog.aspx' );
	logTarget.AddQueryString( 'Silverlight',  param );
	logTarget.AddHandler( HandleSilverlightInstallLog );
	logTarget.ExecuteAml();
}

function HandleSilverlightInstallLog ()
{
	return false;
}

function checkInstallFunc() {
	if(Silverlight.isInstalled('1.0.21115'))
	{
		location.reload();
	}
}
