/********************************************************
    Codes for Inserting Flash Object
	@author Han Sanghun (http://hangunsworld.com, hanguns@gmail.com)
	@created 2008-07-25
	@last modified 2008-08-06
********************************************************/
/**
 * Returns the tags of a Flash object.
 *
 * @param path SWF Path of the Flash file.
 * @param width Width of the Flash object.
 * @param height Height of the Flash object.
 * @param flashvars FlalshVars parameter to be sent to the Flash object.
 * @param idname ID and name properties of the Flash object.
 * @param saccess Script access control.
 * @param wmode Tranparency setting.
 * @param fullscreen Fullscreen access control.
 *
 * @return String of Flash object tag.
 */
function getSwfString(path, width, height, flashvars, idname, saccess, wmode, fullscreen){

	// Initializes the flashvars parameter.
	if(flashvars == undefined){
		flashvars = "";
	}
	// Initializes the ID and name of the Flash object.
	if(idname == undefined){
		idname = "";
	}

	// Initializes the script access control.
	if(saccess != "never" && saccess != "always"){
		saccess = "sameDomain";
	}

	// Initializes the transparency.
	if(wmode != "transparent" && wmode != "opaque"){
		wmode = "transparent";
	}

	// Initializes the fullscreen access control.
	if(fullscreen==true || fullscreen=="true" || fullscreen==1 || fullscreen=="1" || fullscreen=="yes"){
		fullscreen = "true";
	}else{
		fullscreen = "false";
	}
	var str = '';
	str = '<object id="' + idname + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	str += 'width="' + width + '" height="' + height + '">';
  	str += '<param name="movie" value="' + path + '" />';
  	str += '<!-- The following object tag is for browsers other than IE. Hide this tag with IECC, in case of IE. -->';
  	str += '<!--[if !IE]>-->';
  	str += '<object name="' + idname + '" type="application/x-shockwave-flash"';
	str += ' data="' + path + '" width="' + width + '" height="' + height +'">';
    str += '<!--<![endif]-->';
	str += '<param name="FlashVars" value="' + flashvars + '" />';
    str += '<param name="quality" value="high" />';
	str += '<param name="allowFullscreen" value="' + fullscreen + '" />';
    str += '<param name="wmode" value="' + wmode + '" />';
	str += '<param name="allowScriptAccess" value="' + saccess + '" />';
    str += '<param name="swfversion" value="10.0.2.54" />';
    str += '<!--[if !IE]>-->';
  	str += '</object>';
  	str += '<!--<![endif]-->';
	str += '</object>';

	return str;

}

/**
 * Inserts a Flash object in the current position.
 *
 * @param path SWF Path of the Flash file.
 * @param width Width of the Flash object.
 * @param height Height of the Flash object.
 * @param flashvars FlalshVars parameter to be sent to the Flash object.
 * @param idname ID and name properties of the Flash object.
 * @param saccess Script access control.
 * @param wmode Tranparency setting.
 * @param fullscreen Fullscreen access control.
 */
function printSwf(path, width, height, flashvars, idname, saccess, wmode, fullscreen){

	var str = getSwfString(path, width, height, flashvars, idname, saccess, wmode, fullscreen);
	document.write(str);

}

/**
 * Inserts a Flash object in the specified DIV layer.
 *
 * @param layerid ID of the layer in which the Flash object inserted.
 * @param path SWF Path of the Flash file.
 * @param width Width of the Flash object.
 * @param height Height of the Flash object.
 * @param flashvars FlalshVars parameter to be sent to the Flash object.
 * @param idname ID and name properties of the Flash object.
 * @param saccess Script access control.
 * @param wmode Tranparency setting.
 * @param fullscreen Fullscreen access control.
 */
function printSwfLayer(layerid, path, width, height, flashvars, idname, saccess, wmode, fullscreen){

	var str = getSwfString(path, width, height, flashvars, idname, saccess, wmode, fullscreen);
	var theLayer = document.getElementById(layerid);
	theLayer.innerHTML = str;

}



/**
 * Inserts a Flash object after the specific time.
 *
 * @param delay Delayed time (Millisecond)
 * @param layerid ID of the layer in which the Flash object inserted.
 * @param path SWF Path of the Flash file.
 * @param width Width of the Flash object.
 * @param height Height of the Flash object.
 * @param flashvars FlalshVars parameter to be sent to the Flash object.
 * @param idname ID and name properties of the Flash object.
 * @param saccess Script access control.
 * @param wmode Tranparency setting.
 * @param fullscreen Fullscreen access control.
 */
function printSwfDelay(delay, layerid, path, width, height, flashvars, idname, saccess, wmode, fullscreen){

	var expression = "insertFlashObjectLayer(";
	expression += "'" + layerid + "'";
	expression += ", '" + path + "'";
	expression += ", '" + width + "'";
	expression += ", '" + height + "'";
	expression += ", '" + flashvars + "'";
	expression += ", '" + idname + "'";
	expression += ", '" + saccess + "'";
	expression += ", '" + wmode + "'";
	expression += ", '" + fullscreen + "'";
	expression += ");";

	setTimeout(expression, delay);

}
/********************************************************
    Codes for Inserting Flash Object
********************************************************/
//



function getPageId() {
//	var depth1 = "3";
//	var depth2 = "3";
//	var depth3 = "1";
	//return depth1 + "_" + depth2 + "_" + depth3 + "_" + depth4;
	return d1 + "_" + d2 + "_" + d3 + "_" + d4;
}


function getObj(swfId) {
	return document.getElementById(swfId);
}

function setFlashHeight( swfId , height ) {
	var swfObj = getObj(swfId);
	swfObj.height = height;
}

function setFlashWidth( swfId , width ) {
	var swfObj = getObj(swfId);
	swfObj.width = width;
}

function changeFlvUrl(swfId, url){
	var swfObj = getObj(swfId);
	swfObj.changeFlvUrl(url);
}


function openServiceSearch() {
	 var obj = getObj("fsearchs");
	 if( obj ) {
	 	obj.width = 957;
	 	obj.height = 870;
	 }
}



function closeServiceSearch() {
	var obj = getObj("fsearchs");
	 if( obj ) {
	 	obj.width = 1;
	 	obj.height = 1;
	 }
}

function flashLog(str) {
	var flashGNB = getObj("flashgnb");
	if(flashGNB) {
		flashGNB.flashLog("flashLog : " + str);
	}
}



function setLocation( _menuName , _url , _targetWin ) {

	var separator = "****";
	var arrURL = _url.split(separator);
	var arrMenuName = _menuName.split(separator);
	var arrTargetWin = _targetWin.split(separator);
	var DELIMITER = " - ";

	var url;
	var target;
	var menuName;

	var i;
	var length = arrURL.length;
	var htmlString = "";

	for( i = 0 ; i < length ; i++ ) {

//		url			= locationData.url[i];
//		menuName	= locationData.menuName[i];
//		targetWin	= locationData.targetWin[i];

		url			= arrURL[i];
		menuName	= arrMenuName[i];
		targetWin	= arrTargetWin[i];

		if(i>10) {
			htmlString = "error";
			break;
		}
		if( !menuName ) { break; }

//		htmlString += '<a href="' + url + '" target="' + targetWin + '">' + menuName + '</a>' + DELIMITER;
		htmlString += '<a href="javascript:XecureNavigate(\'' + url + '\' , ' + '\'' + targetWin + '\')"' + '>' + menuName + '</a>' + DELIMITER;

	}
	htmlString = htmlString.substr( 0 , htmlString.length - DELIMITER.length);

	flashLog("htmlString = " + htmlString);
}




function chkLogin() {
	return false;
}




// FAQ  Layer Popup ½ÇÇà ÇÔ¼ö

function faqLypop(){
    var returnUrl = getReturnUrl();
    returnUrl = returnUrl.substr(0, returnUrl.indexOf("."));
    var isFaqPage = returnUrl.indexOf("/wbiz/page/customer/faq/board_list") != -1;
    var faqSearchWord = $("input[name='faqSearchWord']").val();

    if (!faqSearchWord){
    	faqSearchWord = ''; //°Ë»ö¾î ¾øÀ» °æ¿ì ''Ã³¸®ÇÔ
    } else {
    	//°Ë»ö¾î Á¸Àç½Ã
    	//alert("value : " + faqSearchWord);

    	while (faqSearchWord.indexOf(" ") > -1) {					//°ø¹éº¯°æ('%20')
    	    faqSearchWord = faqSearchWord.replace(/ /, "%20");
		}
	    while (faqSearchWord.indexOf("\/") > -1) {
	        faqSearchWord = faqSearchWord.replace(/\//, "%2F");	//'/'º¯°æ('%2F')
		}
    }
//    alert("returnUrl : " + returnUrl);
    if (!isFaqPage){
	    popLayer(530,
	            {load:{url: ("/wbiz/layer/customer/faq_lypop.do?url=" + returnUrl + "&faqSearchWord=" + faqSearchWord)}},
	            "",
	            "901",
	            "",
	            "902");
    } else {//FAQ ÆäÀÌÁö ÀÏ°æ¿ì Äü¸Þ´º-ÀÚÁÖÃ£´Â Áú¹® ½ÇÇà ¾ÈµÇµµ·Ï Ã³¸®ÇÔ
    	alert("ÇöÀç ÆäÀÌÁö°¡ ÀÚÁÖÃ£´Â Áú¹® ÀÔ´Ï´Ù.");
    }
}
