/* flash re write */
function IE_HtmlRewrite(objParent) {
/*
	if (window.ActiveXObject && objParent) {
		objParent.innerHTML = objParent.innerHTML;
	}
*/
}

/****   ################### DESIGN CENTER  ####################  ****/ 

// Flicker Bug Fix (IE6)
try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

// flashWrite(颇老版肺, 啊肺, 技肺, 酒捞叼, 硅版祸, 函荐, 扩档快葛靛)
function flashWrite(url,w,h,id,bg,vars,win){
	// 敲贰矫 内靛 沥狼
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	// 敲贰矫 内靛 免仿
	document.write(flashStr);
}

/* toggle */
function initToggle(toggleContainer) {
	triggers = toggleContainer.getElementsByTagName("a");
	
	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1]) {
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);
			triggers.item(i).subjectEl = document.getElementById("faq-"+triggers.item(i).href.split("#")[1]);
		}

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
//		triggers.item(i).subjectEl.style.background = "none";

		
		triggers.item(i).onclick = function () {
			if(toggleContainer.current == null) {
				if(triggers.item(0).targetEl.style.display == "block") {
					triggers.item(0).targetEl.style.display = "none";
					triggers.item(0).subjectEl.style.fontWeight = "normal";
//					triggers.item(0).subjectEl.style.background = "none";
				}
				
			}
			if (toggleContainer.current == this) {
				this.targetEl.style.display = "none";
				this.subjectEl.style.fontWeight = "normal";
//				this.subjectEl.style.background = "#fff";
				
				
				toggleContainer.current = null;
			} else {
				if (toggleContainer.current) {
					toggleContainer.current.targetEl.style.display = "none";
					toggleContainer.current.subjectEl.style.fontWeight = "normal";
//					toggleContainer.current.subjectEl.style.background = "#fff";
					
				}
				toggleContainer.current = this;
				this.targetEl.style.display = "block";
				this.subjectEl.style.fontWeight = "bold";
//				this.subjectEl.style.background = "none";

			}
			
			return false;
		}
	}
	triggers.item(0).targetEl.style.display = "block";
	triggers.item(0).subjectEl.style.fontWeight = "bold";
//	triggers.item(0).subjectEl.style.background = "none";
}
// toggle - FAQ2
function initToggle2(toggleContainer) {
	triggers = toggleContainer.getElementsByTagName("a");
	
	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1]) {
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);
			triggers.item(i).subjectEl = document.getElementById("faq-"+triggers.item(i).href.split("#")[1]);
		}

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
//		triggers.item(i).subjectEl.style.background = "none";

		
		triggers.item(i).onclick = function () {
			if(toggleContainer.current == null) {
				if(triggers.item(0).targetEl.style.display == "block") {
					triggers.item(0).targetEl.style.display = "none";
					triggers.item(0).subjectEl.style.fontWeight = "normal";
//					triggers.item(0).subjectEl.style.background = "none";
				}
				
			}
			if (toggleContainer.current == this) {
				this.targetEl.style.display = "none";
				this.subjectEl.style.fontWeight = "normal";
//				this.subjectEl.style.background = "#fff";
				
				
				toggleContainer.current = null;
			} else {
				if (toggleContainer.current) {
					toggleContainer.current.targetEl.style.display = "none";
					toggleContainer.current.subjectEl.style.fontWeight = "normal";
//					toggleContainer.current.subjectEl.style.background = "#fff";
					
				}
				toggleContainer.current = this;
				this.targetEl.style.display = "block";
				this.subjectEl.style.fontWeight = "bold";
//				this.subjectEl.style.background = "none";

			}
			
			return false;
		}
	}
	triggers.item(0).targetEl.style.display = "none";
//	triggers.item(0).subjectEl.style.fontWeight = "bold";
//	triggers.item(0).subjectEl.style.background = "none";
}

// 哭率皋春 div width 炼沥
function openmenu(){
document.getElementById('secondaryBlock').style.width='378'+"px";
}
function closemenu(){
document.getElementById('secondaryBlock').style.width='302'+"px";
}

// Footer Relation Site
function layerShow(layerId) {
	document.getElementById(layerId).style.display = "block";
}
function layerHide(layerId) {
	document.getElementById(layerId).style.display = "none";
}
function layerToggle(layerId) {
	if (document.getElementById(layerId).style.display == "block"){
		layerHide(layerId);
	}  else {
		layerShow(layerId);
	}
}

/****   ################### WINDOW CONTROL  ####################  ****/ 
function openURL(url, feature) {
  try   {
	if (feature != null) 	{
		window.open(url, '', feature).focus();
	}
	else {
		window.open(url);
	}
  }
  catch (e) {
	  alert('泅犁 荤捞飘狼 扑诀阑 倾侩栏肺 汲沥秦林寂具父 捞侩捞 啊瓷钦聪促. ');
  }
}
function openWindow(url, id, w, h, s) {
	var _id = id ? id : '_new';
	var _options;
	if (w && h) 	{  var _options = "width="+w+",height="+h;  if (s) _options += ",scrollbars=yes";  }
	if (_options != null)
	{
		window.open(url,_id,_options).focus();
	}
	else {
		window.open(url,_id).focus();
	}
}

function goMove(url, target) {
	return (target == '_blank' || target == '_new') ?  openURL(url)  :  document.location.href=url;
}

function moveURL(url) {
	top.document.location.replace(url);
}

/****   ################### SEARCH KEYWORD  ####################  ****/ 
function search_enter(str) {
	if (event.keyCode == 13) {

		var query = document.getElementById("Query").value;

		if(query == "") {
			query = str ? str : "QOOK";
		}

		var searchDomain = "http://dns.paran.com";
		var url = searchDomain+"/search/index.php?ss=mgmain^dnsearch^imgsearch1&Query="+query;

		window.open(url).focus();

		event.returnValue = false;
		event.cancelBubble = true;
	}else{
		return false;
	}
}
function goSearch(str) {
		/*
				http://search.megapass.net/search/index.php?ss=motop^mtsearch^iqry&Query=kt		//- 烹钦
				http://search.megapass.net/psite/index.php?ss=motop^mtpsite^iqry&Query=kt		//- 荤捞飘
				http://search.megapass.net/pwebpage/index.php?ss=motop^mtpwebpage^iqry&Query=kt	//- 昆其捞瘤
				http://search.megapass.net/pblog/index.php?ss=motop^mtpblog^iqry&Query=kt		//- 喉肺弊
				http://search.megapass.net/pnews/index.php?ss=motop^mtpnews^iqry&Query=kt		//- 春胶
				http://search.megapass.net/plocal/index.php?ss=motop^mtplocal^iqry&Query=kt		//- 傈拳锅龋
				http://search.megapass.net/pimg/index.php?ss=motop^mtpimg^iqry&Query=kt			//- 捞固瘤
		*/

			var search = window.open("http://internet.qook.co.kr/blank.html","search");
			var frm = document.mega_search;
			var query = frm.Query.value;
			if(query == "") {
				query = str ? str : "QOOK";
				frm.Query.value = query;
			}
			var searchDomain = "http://dns.paran.com";
			var url = searchDomain+"/search/index.php?Query="+query+"&ss=mgmain^dnsearch^imgsearch1";
			frm.action = url;
			frm.target = "search";
			frm.submit();
}

function str_replace(str, str1, str2) {
    var val = '';
    for (var i=0; i<str.length; i++) {
        if (str.substring(i, i+1)==str1) {
            val += str2;
        }else {
            val += str.substring(i, i+1);
        }
    }
    return val;
}

function clearText(id) {
	document.getElementById(id).value='';
}
/* 皋牢 虐况靛 八祸 包访(付魔) */


// GNB Search keyword Selectbox
var KTSearch = function() {
}

KTSearch.prototype.layerAction = function(el) {
	var obj = el.parentNode.childNodes[2];
	obj.style.display = (obj.style.display == "none") ? "block" : "none";	
}

KTSearch.prototype.selectAction = function(el) {
	var obj = el.parentNode.parentNode;
	obj.parentNode.getElementsByTagName("SPAN")[0].innerText = el.innerText;
	obj.style.display = (obj.style.display == "none") ? "block" : "none";
	document.getElementById("ss").value = el.getAttribute("value");
}

var ktsearch = new KTSearch();


/****   ################### Flash Controler ####################  ****/ 
function callExternalInterface(str) {
	var _param = str;//荤侩磊啊 急琶茄 林家
	//敲贰矫 窃荐 龋免
	//"present_event" <-- 敲贰矫 ID 
	//sendAdress <-- 敲贰矫 窃荐捞抚
	thisMovie("present_event").sendAdress(_param);
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else {
		return document[movieName];
	}
}

// LNB Method
function lnb(){

	try	{
		var obj = lnbIndex.split('::');
		var lnbid = (0 < obj.length) ? obj[0] : 'productinfor';
		var lda = (1 < obj.length) ? obj[1] : 0;
		var ldb = (2 < obj.length) ? obj[2] : 0;
		var ldc = (3 < obj.length) ? obj[3] : 0;
	}
	catch(e)  {
		var lnbid = (0 < arguments.length) ? arguments[0] : 'productinfor';
		var lda = (1 < arguments.length) ? arguments[1] : 0;
		var ldb = (2 < arguments.length) ? arguments[2] : 0;
		var ldc = (3 < arguments.length) ? arguments[3] : 0;
	}

	// flashWrite(颇老版肺, 啊肺, 技肺, 酒捞叼, 硅版祸, 函荐, 扩档快葛靛)
	flashWrite("/flash/lnb_"+lnbid+".swf",'378px','758px',"familynavi","#ffffff","xmlURL=/flash/xml/lnb_"+lnbid+".xml&amp;TwoDepth="+lda+"&amp;ThreeDepth="+ldb+"&amp;FourDepth="+ldc,"transparent");
}



