function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goMenu(Val,Sel)
{
	Sel.value = '';
	if (Val) location=Val;

}

function fnResizePopup(nWidth, nHeight)
{
	var strAgent = navigator.userAgent.toLowerCase();
	var bIE = (strAgent.indexOf("msie") != -1);
	var bXP = (strAgent.indexOf("nt 5.1") != -1);
	var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	var bSafari = (strAgent.indexOf("konqueror") != -1 || strAgent.indexOf("safari") != -1);
	var bFirefox = (strAgent.indexOf("firefox")!= -1);
	window.resizeTo(nWidth, nHeight + (bXP ? (bIE7 ? 40: 20) : 0));
}
//ÆË¾÷ - Áß¾ÓÀ§Ä¡
function PopWindow(url,target,intWidth,intHeight) {
	var posX = (screen.availWidth/2)-(intWidth/2);
	var posY = (screen.availHeight/2)-(intHeight/2);

	var winoption = "width="+intWidth+",height="+intHeight+",left="+posX+",top="+posY +",scrollbars=no,status=no,resizable=0";
	window.open(url, target, winoption);
	return;
}
/*
function Win_pop(newwin,w,h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,status=no,menu=no';
win = window.open(newwin, "new1", winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
*/
// ÆäÀÌÁö focus blur
function bluring(){
	if (event.srcElement!=null) {
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
}
document.onfocusin=bluring;

/* ÇÃ·¡½Ã */
function ObjFlash(src, width, height, param, addParam) {
	param = param || "";
	addParam = addParam || "";
	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
//	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='bgcolor' value='#000000' />");
	document.writeln("	<param name='menu' value='false' />");
	document.writeln("	<param name='wmode' value='opaque' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='opaque' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
	document.writeln("</object>");
}

function ObjFlash_Tr(src, width, height, param, addParam) {//ÇÃ·¡½Ã Åõ¸í Ã³¸®
	param = param || "";
	addParam = addParam || "";
	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='bgcolor' value='#000000' />");
	document.writeln("	<param name='menu' value='true' />");
	document.writeln("	<param name='wmode' value='transparent' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='transparent' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
	document.writeln("</object>");
}

function ObjFlash_ID(src, id, width, height, param, addParam) {//ÇÃ·¡½Ã Åõ¸í Ã³¸®
	param = param || "";
	addParam = addParam || "";
	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\">");
	document.writeln("	<param name=\"movie\" value=\"" + src + "\">");
	document.writeln("	<param name=\"flashVars\" value=\"" + param + "\">");
	document.writeln("  <param name='allowScriptAccess' value='always' />");
	document.writeln("	<param name='quality' value='high' />");
	document.writeln("	<param name='scale' value='noscale' />");
	document.writeln("	<param name='salign' value='lt' />");
	document.writeln("	<param name='bgcolor' value='#000000' />");
	document.writeln("	<param name='menu' value='true' />");
	document.writeln("	<param name='wmode' value='transparent' />");
	document.writeln("	<embed  bgcolor='#000000' wmode='transparent' src=\"" + src + "?" + param + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\"></embed>");
	document.writeln("</object>");
}

function ShowhidenLayer(LayName) {
	obj = document.getElementById(LayName);
	// ÆîÄ¡±â
  if (obj.style.display == "none") {
      obj.style.display = "block";
  }
  else if (obj.style.display == "block") {
      obj.style.display = "none";
  }
}

function ShownLayer(LayName) {
	obj = document.getElementById(LayName);
	obj.style.display = "none";
	// ÆîÄ¡±â
  if (obj.style.display == "none") {
      obj.style.display = "block";
  }
  else if (obj.style.display == "block") {
      obj.style.display = "none";
  }
}

function HideLayer(LayName) {
	obj = document.getElementById(LayName);
  // ¼û±â±â
  obj.style.display = "none";
}


function getIEVersion(){
var agent  = navigator.userAgent;
var appver = navigator.appVersion;
var msie   = appver.indexOf("MSIE");
if(msie!=-1 && agent.indexOf("Win") != -1){
	return parseFloat(appver.substring(msie+4));
}
return -1;
}

function openRssLink(aEvent){
	var oLinker = aEvent ? aEvent : window.event;
	window.open(oLinker.innerHTML);
}

function copyRssLink(objLink){
	if(getIEVersion() > 0){
		document.getElementById(objLink).createTextRange().execCommand('copy');
		alert(document.getElementById(objLink).title + " RSS ÁÖ¼Ò°¡ º¹»ç µÇ¾ú½À´Ï´Ù.");
	}
	else{
		var str = document.getElementById(objLink).value;
		prompt("Ctrl+C¸¦ ´­·¯ º¹»çÇÏ¼¼¿ä.", str);
	} 
}

function copyRssLinkInfo(objLink, layerName){
	var oEvent;
	if(getIEVersion() > 0){
		document.getElementById(objLink).createTextRange().execCommand('copy');
		if(document.getElementById('RssMsg_pop'))	HideLayer('RssMsg_pop');
		if(document.getElementById('RssMsg_recom'))	HideLayer('RssMsg_recom');
		if(document.getElementById('RssMsg_best'))	HideLayer('RssMsg_best');
		RssMsgShow(layerName);
	}
	else{
		var str = document.getElementById(objLink).value;
		var presult = prompt("Ctrl+C¸¦ ´­·¯ º¹»çÇÏ¼¼¿ä.", str);

	    if(presult == document.getElementById(objLink).value ) {
			RssMsgShow(layerName);
		}
	} 
}


function RssMsgShow(layerName){
	if(document.getElementById('RssMsg_pop'))	HideLayer('RssMsg_pop');
	if(document.getElementById('RssMsg_recom'))	HideLayer('RssMsg_recom');
	if(document.getElementById('RssMsg_best'))	HideLayer('RssMsg_best');
	ShownLayer(layerName);	
}


function RssMsgClose(layerName){
	HideLayer(layerName);
}

// CSS ¹è°æÀÌ¹ÌÁö ³ªÅ¸³ªÁö ¾Ê´Â Çö»óÀ» ¹æÁö
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function setPng24(obj) 
{
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}
var wiseLog = {
	
	logUrl: "/common/qtv/TargetWiseLog.asp",

	setWiseLog: function(strLogParam){
		var param;
		param = "LogSection=" + strLogParam;
		
		new Ajax.Request(this.logUrl, {
			method: 'get',
			asynchronous: true,
			contentType: 'application/x-www-form-urlencoded',
			encoding: 'euc-kr',
			parameters: param,
			onSuccess: function(xmlHttp){
				
			}.bind(this)
		});
	}
}
