



	function PineOpenWindow (url, name, features) 
	{ 
		window.open(url, name,features); 
	}

	function OpenNewWindow(mypage, myname, w, h, scroll)
	{
		var win= null;

		var winl = 0;
		var wint = 0;
		var settings;
	
		settings = 'height=' + h + ',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='resizable=yes';
	
		win = window.open (mypage, myname, settings);
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}


	function GetObj(id, d) 
	{
  
		var i,x;  
		
		if (!d) d = document;
		
		if (!(x = d[id]) && d.all) x = d.all[id]; 
		
		for (i = 0; !x&&i < d.forms.length; i++) x = d.forms[i][id];
		
		for(i= 0; !x&&d.layers&&i < d.layers.length;i++) x = GetObj(id, d.layers[i].document);
		
		if(!x && document.getElementById) x = document.getElementById(id); 
		
		return x;
	}  
	

	function IsInteger(intStr)
	{
		var intVal = parseInt(intStr, 10);

		if (isNaN(intVal))
			return false;
		else
			return true;
	}
	
	var Url = { 

	    // public method for url encoding 
    	encode : function (string) 
    	{ 
	       	return escape(this._utf8_encode(string)); 
    	}, 

	    // public method for url decoding 
    	decode : function (string) 
    	{ 
        	return this._utf8_decode(unescape(string)); 
	    }, 

    	// private method for UTF-8 encoding 
	    _utf8_encode : function (string) 
	    { 
	        string = string.replace(/\r\n/g,"\n"); 
    	    var utftext = ""; 

        	for (var n = 0; n < string.length; n++) 
        	{ 
	            var c = string.charCodeAt(n); 

    	        if (c < 128) 
    	        { 
	                utftext += String.fromCharCode(c); 
    	        } 
        	    else if((c > 127) && (c < 2048)) 
        	    { 
	                utftext += String.fromCharCode((c >> 6) | 192); 
    	            utftext += String.fromCharCode((c & 63) | 128); 
        	    } 
            	else 
            	{ 
	                utftext += String.fromCharCode((c >> 12) | 224); 
    	            utftext += String.fromCharCode(((c >> 6) & 63) | 128); 
        	        utftext += String.fromCharCode((c & 63) | 128); 
            	} 
	        } 

    	    return utftext; 
	    }, 

	    // private method for UTF-8 decoding 
    	_utf8_decode : function (utftext) 
    	{ 
        	var string = ""; 
	        var i = 0; 
    	    var c = c1 = c2 = 0; 

        	while ( i < utftext.length )  
        	{ 
	            c = utftext.charCodeAt(i); 

    	        if (c < 128) 
    	        { 
	                string += String.fromCharCode(c); 
    	            i++; 
        	    } 
            	else if((c > 191) && (c < 224)) 
            	{ 
	                c2 = utftext.charCodeAt(i+1); 
    	            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 
        	        i += 2; 
	            } 
    	        else 
    	        { 
        	        c2 = utftext.charCodeAt(i+1); 
            	    c3 = utftext.charCodeAt(i+2); 
                	string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 
	                i += 3; 
    	        } 

	        } 

    	    return string; 
	    } 

	} 

function  viewFlash(sURL, sName, sFeatures)
		{

			//ÇÃ·¡½Ã ActiveX ¿ÀºêÁ§Æ®¸¦ »Ñ·ÁÁÝ´Ï´Ù.
			var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
			var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000";
			var FLASHVER = "6,0,29,0";

			var sFeature;
			var sWidth		= "306px";
			var sHeight		= "473px";
			var pmBoolean	= "false";
			var sTempArray;
			var sParamTag;

			sFeature = sFeatures.split(/\s*,\s*/);
			for (var i=0; i< sFeature.length ; i++)
			{
				sTempArray = sFeature[i].split(/\s*=\s*/);
				if (sTempArray[0].toLowerCase() == "width"){
					//³ÐÀÌ
					sWidth = sTempArray[1];
				}else if (sTempArray[0].toLowerCase() == "height"){
					//³ôÀÌ
					sHeight = sTempArray[1];
				}else{
					//±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸®
					if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true")
					{
						pmBoolean = "true"
					}
					sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag;
				}
			}

			document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>");
			document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>");
			document.write("<PARAM NAME='wmode' VALUE='transparent'>");
			document.write(sParamTag);
			document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />")
			document.write("</OBJECT>");

		
		}


    /*
     * Move focus to next
     * - obj: current object
     * - toID: ID of object to focus 
     */
    function controlFocus(obj, toID) {
	    if (toID == null) return;
	    var maxLen = obj.getAttribute("maxlength"); 
	    if (obj.value.length >= maxLen) {
		    focusThis(toID);
	    }
    }

    /*
     * Focus the form
     * - id: ID of object to focus
     */
    function focusThis(id) {
	    document.getElementById(id).focus();
    }
    
    function enterAction(obj, action) {
	    if (action == null) return;
	    if( event.keyCode == 13 ) { action();}
  
    }
    
    function open_img(img_src) {
	    img_view = window.open("", "ImagePopup", "width=0, height=0, left=0, top=0, scrollbars=no, resizable=no");
	    img_view.document.write(
		    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n' + 
		    '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n' + 
		    '	<head>\n' + 
		    '		<title> :: View :: <\/title>\n' + 
		    '		<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n' + 
		    '		<meta http-equiv="Imagetoolbar" content="no" />\n' + 
		    '		<script type="text/javascript">\n' + 
		    '			function getWindowCleintHeight() {\n' + 
		    '				return (window.innerHeight != null) ? window.innerHeight : document.documentElement.clientHeight;\n' + 
		    '			}\n' + 
		    '			function getWindowCleintWidth() {\n' + 
		    '				return (window.innerWidth != null) ? window.innerWidth : document.documentElement.clientWidth;\n' + 
		    '			}\n' + 
		    '			function resize(img) {\n' + 
		    '				var imageWidth = img.width+5;\n' + 
		    '				var imageHeight = img.height+5;\n' +
		    '				var screenWidth = screen.availWidth;\n' + 
		    '				var screenHeight = screen.availHeight;\n' + 
		    '				var windowWidth = imageWidth;\n' + 
		    '				var windowHeight = imageHeight;\n' + 
		    '				var positionX = (screenWidth - imageWidth) / 2;\n' + 
		    '				var positionY = (screenHeight - imageHeight) / 2;\n' + 
		    '				if(imageWidth > screenWidth * 0.8) {\n' + 
		    '					windowWidth = screenWidth * 0.8;\n' + 
		    '					document.body.scroll ="yes";\n' + 
		    '					positionX = 0;\n' +
		    '				}\n' + 
		    '				if(imageHeight > screenHeight * 0.8 ) {\n' + 
		    '					windowHeight = screenHeight * 0.8;\n' + 
		    '					document.body.scroll ="yes";\n' + 
		    '					positionY = 0;\n' +
		    '				}\n' + 
            '               iWidth = windowWidth - getWindowCleintWidth();\n' + 
            '               iHeight = windowHeight - getWindowCleintHeight();\n' + 
            '               window.resizeBy(iWidth, iHeight);\n' + 
		    '				window.moveTo(positionX, positionY);\n' + 
		    '			}\n' + 
		    '		<\/script>\n' + 
		    '	<\/head>\n' + 
		    '	<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onkeydown="return false" style="margin: 0px; padding: 0;">\n' + 
		    '		<a href="javascript:window.close()"><img src="' + img_src + '" style="border: 0px; padding: 0; margin:0;" onload="resize(this)" /><\/a>\n' + 
		    '	<\/body>\n' + 
		    '<\/html>');

	    try { 
    	    img_view.document.close(); // ÆË¾÷Ã¢ÀÇ ¹®¼­¸¦ ´Ý´Â´Ù.
	    }
	    catch(e) { }
	    try { 
	        img_view.document.focus();// ÆË¾÷Ã¢ ¹®¼­¿¡ Æ÷Ä¿½º
	    }
	    catch(e) { }
    }    
    
     function open_move(mov_title, mov_src) {
        var url = "/Global/Viewer/Move.aspx";
            url += "?title=" + encodeURIComponent(mov_title);
            url += "&url=" + encodeURIComponent(mov_src);
        window.open(url, "MovePopup", "width=406, height=400, scrollbars=no, resizable=no");
     }
     
     function open_song(song_title, song_src) {
        var url = "/Global/Viewer/Song.aspx";
            url += "?title=" + encodeURIComponent(song_title);
            url += "&url=" + encodeURIComponent(song_src);
        window.open(url, "SongPopup", "width=342, height=160, scrollbars=no, resizable=no");
     }
     
     function open_down(frame, path, file) {
        var url = "/Global/Viewer/Download.aspx";
            url += "?path=" + path;
            url += "&fl=" + encodeURIComponent(file);
            frame.src = url;
     }

    
    function autoResizePopup() {
	    var winW, winH, sizeToW, sizeToH;
	    if ( parseInt(navigator.appVersion) > 3 ) {
		    if ( navigator.appName=="Netscape" ) {
			    winW = window.innerWidth;
			    winH = window.innerHeight;
		    }
		    if ( navigator.appName.indexOf("Microsoft") != -1 ) {
			    winW = document.body.scrollWidth;
			    winH = document.body.scrollHeight;
		    }
	    }
	    sizeToW = 0;
	    sizeToH = 0;
	    if ( winW > 1000 ) {
		    sizeToW = 1000 - document.body.clientWidth;
	    } else if ( Math.abs(document.body.clientWidth - winW ) > 3 ) {
		    sizeToW = winW - document.body.clientWidth;
	    }
	    if ( winH > 680 ) {
		    sizeToH = 680 - document.body.clientHeight;
	    } else if ( Math.abs(document.body.clientHeight - winH) > 4 ) {
		    sizeToH = winH - document.body.clientHeight;
	    }
	    if ( sizeToW != 0 || sizeToH != 0 )
		    window.resizeBy(sizeToW, sizeToH);
    }    
 
    function getCookie(name) { 
      var Found = false 
      var start, end 
      var i = 0 
     
      while(i <= document.cookie.length) { 
        start = i 
        end = start + name.length 
     
        if(document.cookie.substring(start, end) == name) { 
          Found = true 
          break 
        } 
        i++ 
      } 
     
      if(Found == true) { 
        start = end + 1 
        end = document.cookie.indexOf(";", start) 
          if(end < start) 
            end = document.cookie.length 
        return document.cookie.substring(start, end) 
      } 
      return "" 
    } 

    function setCookie( name, value, expiredays ) 
    { 
      var todayDate = new Date(); 
      todayDate.setDate( todayDate.getDate() + expiredays ); 
      document.cookie = name + "=" + escape( value ) + "; path=/; expires=" +     todayDate.toGMTString() + ";" 
    }    
