
function GetFlash(flashID, url, x, y) {
    var EmbedStr = "";
        EmbedStr = "<object name='" + flashID + "' type='application/x-shockwave-flash' data='" + url + "' width='" + x + "' height='" + y + "'>"
        EmbedStr += "<param name='allowScriptAccess' value='sameDomain' />";
        EmbedStr += "<param name='wmode' value='transparent' />"
        EmbedStr += "</object>"

    document.write(EmbedStr);
    return;
}


function ply_obj() {

			document.write("<OBJECT classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 codeBase=#Version=6,4,5,715 height=1 id=WMP64 width=1></OBJECT>");
			document.write("<OBJECT classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 codeBase=#Version=7,0,0,1954 height=1 id=WMP7 width=1></OBJECT>");
}


function objflv_play(ply_urls, x, y) {
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' width='" + x + "' height='" + y + "'>");
    document.write("	<param name='movie' value='/common/images/swf/flv_player.swf?mURL=" + ply_urls + "'>");
    document.write("	<param name='wmode' value='transparent'>");
    document.write("	<param name='AutoSize' value='false'>");
    document.write("	<param name='quality' value='high'>");
    document.write("	<embed src='/common/images/swf/flv_player.swf?mURL=" + ply_urls + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'  width='" + x + "' height='" + y + "' ></embed>");
    document.write("</object>");
}

function objflv_play2( ply_urls, x, y ){
	document.write("<embed src='http://player.longtailvideo.com/player.swf'");
	document.write("	height='" + y + "' width='" + x + "' allowfullscreen='true' dock='true'");
	document.write("	flashvars='&bandwidth=180&controlbar=over&controlbar.idlehide=true&file=" + ply_urls + "&plugins=viral-h&viral.pluginmode=FLASH ");
	document.write("    &skin=http://www.longtailvideo.com/files/skins/glow/5/glow.zip' />");
}


function objwav_play(ply_urls, x, y) {
    document.write("<OBJECT style='FILTER: gray(); WIDTH: " + x + "px; HEIGHT: " + y + "px' id=Player classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 width=" + x + " height=" + y + " type=audio/x-pn-realaudio-plugin 125>");
    document.write("  <PARAM NAME='URL' VALUE='" + ply_urls + "'>");
    document.write("  <PARAM NAME='rate' VALUE='1'>");
    document.write("  <PARAM NAME='balance' VALUE='0'>");
    document.write("  <PARAM NAME='currentPosition' VALUE='128.8933125'>");
    document.write("  <PARAM NAME='defaultFrame' VALUE=''>");
    document.write("  <PARAM NAME='playCount' VALUE='8'>");
    document.write("  <PARAM NAME='autoStart' VALUE='-1'>");
    document.write("  <PARAM NAME='currentMarker' VALUE='0'>");
    document.write("  <PARAM NAME='invokeURLs' VALUE='0'>");
    document.write("  <PARAM NAME='baseURL' VALUE=''>");
    document.write("  <PARAM NAME='volume' VALUE='100'>");
    document.write("  <PARAM NAME='mute' VALUE='0'>");
    document.write("  <PARAM NAME='uiMode' VALUE='full'>");
    document.write("  <PARAM NAME='stretchToFit' VALUE='0'>");
    document.write("  <PARAM NAME='windowlessVideo' VALUE='0'>");
    document.write("  <PARAM NAME='enabled' VALUE='-1'>");
    document.write("  <PARAM NAME='enableContextMenu' VALUE='-1'>");
    document.write("  <PARAM NAME='fullScreen' VALUE='0'>");
    document.write("  <PARAM NAME='SAMIStyle' VALUE=''>");
    document.write("  <PARAM NAME='SAMILang' VALUE=''>");
    document.write("  <PARAM NAME='SAMIFilename' VALUE=''>");
    document.write("  <PARAM NAME='captioningID' VALUE=''>");
    document.write("  <PARAM NAME='enableErrorDialogs' VALUE='0'>");
    document.write("  <PARAM NAME='_cx' VALUE='7938'>");
    document.write("  <PARAM NAME='_cy' VALUE='1191'>");
    document.write("</OBJECT>");
}

function wmv_players(purl,pw,ph) {

		if(-1 != navigator.userAgent.indexOf("MSIE")) 
		//익스플로
		{

			if (-1 != WB_WM.indexOf("7") || -1 != WB_WM.indexOf("8") || -1 != WB_WM.indexOf("9") ||  -1 != WB_WM.indexOf("10") || -1 != WB_WM.indexOf("11") || -1 != WB_WM.indexOf("12") ) {
				//IE 버전 7,8,9,10,11,12 일경우 실행
				document.write("<object id='test' classid='clsid:{6BF52A52-394A-11d3-B153-00C04F79FAA6}' width='"+pw+"' height='"+ph+"'> ");

			} else {
				//IE 버전 6 이하 일경우 실행
				document.write("<object id='test' classid='clsid:{22d6f312-b0f6-11d0-94ab-0080c74c7e95}' width='"+pw+"' height='"+ph+"'> ");
			}

		} else if(-1 != navigator.userAgent.indexOf("Firefox")) {
		//파이어 폭스
			document.write("<OBJECT style='FILTER:gray(); WIDTH: "+pw+"px; HEIGHT: "+ph+"px;' id='Player' type='application/x-ms-wmp'> ")
		
		} else {
		//그외
			document.write("<OBJECT style='FILTER:gray(); WIDTH: "+pw+"px; HEIGHT: "+ph+"px;' id='Player' type='application/x-ms-wmp'> ")
		}

			document.write("<PARAM NAME='URL' VALUE='"+purl+"'>");
			document.write("</OBJECT>");

}

function openAuth(ret) {
    wWidth = 360;
    wHight = 120;

    wX = (window.screen.width - wWidth) / 2;
    wY = (window.screen.height - wHight) / 2;
    // Request Page Call

    var w = window.open("/GPIN_ASP_Module/GPIN_SamplePage/GPIN_AuthRequest.asp?ret=" + ret, "gPinLoginWin", "directories=no,toolbar=no,left=" + wX + ",top=" + wY + ",width=" + wWidth + ",height=" + wHight);

}


function to_mail() {
    var frms = document.getElementById("frnt");
    //window.open("/kor/web/article/print.asp", "myprint", "height=550,width=700,status=no,toolbar=no,menubar=no,location=no, scrollbars=1");
    //frms.submit();
    var a = frms.hi_cont.value;
    a = a.replace(/\r\n$/, "");         // 엔터값 없애기
    a = a.replace(/<(?!br).*?>/ig, ''); // <BR> 빼고 HTML 없애기
    //a = a.replace(/<(?!img).*?>/ig, ''); // HTML 삭제
    //a = a.replace(/<(img).*?>/ig, '');  // 이미지 삭제

    a = assertMsg(600, a) + '...';      // 500 Byte 이후로 내용 자름
    //alert(a);
    frms.hi_cont.value = a;             // 정리된 내용 삽입

    window.open("/kor/web/article/mail.asp", "myprint", "height=550,width=700,status=no,toolbar=no,menubar=no,location=no, scrollbars=1");
    frms.action = "/kor/web/article/mail.asp";
    frms.target = "myprint";
    frms.submit();
}



function ento_mail() {
    var frms = document.getElementById("frnt");
    //window.open("/kor/web/article/print.asp", "myprint", "height=550,width=700,status=no,toolbar=no,menubar=no,location=no, scrollbars=1");
    //frms.submit();
    var a = frms.hi_cont.value;
    a = a.replace(/\r\n$/, "");         // 엔터값 없애기
    a = a.replace(/<(?!br).*?>/ig, ''); // <BR> 빼고 HTML 없애기
    //a = a.replace(/<(?!img).*?>/ig, ''); // HTML 삭제
    //a = a.replace(/<(img).*?>/ig, '');  // 이미지 삭제

    a = assertMsg(600, a) + '...';      // 500 Byte 이후로 내용 자름
    //alert(a);
    frms.hi_cont.value = a;             // 정리된 내용 삽입

    window.open("/en/web/article/mail.asp", "myprint", "height=550,width=700,status=no,toolbar=no,menubar=no,location=no, scrollbars=1");
    frms.action = "/en/web/article/mail.asp";
    frms.target = "myprint";
    frms.submit();
}



function assertMsg(intMax, objMsg) {
    var inc = 0;
    var nbytes = 0;
    var msg = "";

    var msglen = objMsg.length;

    for (i = 0; i < msglen; i++) {
        var ch = objMsg.charAt(i);

        if (escape(ch).length > 4) {
            inc = 2;
        }
        else if (ch == '\n') {
            if (objMsg.charAt(i - 1) != '\r') {
                inc = 1;
            }
        }
        else if (ch == '<' || ch == '>') {
            inc = 4;
        }
        else {
            inc = 1;
        }

        if ((nbytes + inc) > intMax) {
            break;
        }

        nbytes += inc;
        msg += ch;
    }
    return msg;
}

function go_twitter(title, view_idx) {

    var loc = document.URL;
    var url = "http://twitter.com/home?status=";
    var domurl = loc.split('?');

    title = title.replace(/&/g, "%26");
    title = title.replace(/ /g, "%20");

    loc = loc.replace(/&/g, "%26");
    loc = loc.replace(/#/g, "%23");
    loc = loc.replace(/ /g, "%20");

    url = url + title + " - " + domurl[0] + '?view_idx=' + view_idx;

    window.open(url, "", "");

}

function chkAjaBrowser() {
    var a, ua = navigator.userAgent;
    this.bw = {
        safari: ((a = ua.split('AppleWebKit/')[1]) ? a.split('(')[0] : 0) >= 124,
        konqueror: ((a = ua.split('Konqueror/')[1]) ? a.split(';')[0] : 0) >= 3.3,
        mozes: ((a = ua.split('Gecko/')[1]) ? a.split(" ")[0] : 0) >= 20011128,
        opera: (!!window.opera) && ((typeof XMLHttpRequest) == 'function'),
        msie: (!!window.ActiveXObject) ? (!!createHttpRequest()) : false
    }
    return (this.bw.safari || this.bw.konqueror || this.bw.mozes || this.bw.opera || this.bw.msie)
}

