function move(url) { 
	location.href = url; 
}

function open_win(url, w, h) {
	var win = window.open(url,'','resizable=no,scrollbars=no,status=0,width='+w+',height='+h);
	//win.window.focus(); 
}

//»õÃ¢¶ç¿ì±â 
function open_win1(url, w, h, scroll) { 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var win = window.open(url,'','width='+w+',height='+h+',top=100,left=100,resizable=yes,scrollbars='+scroll); 
	//win.window.focus(); 
}

//»õÃ¢¶ç¿ì±â 
function open_win2(url, target, w, h, scroll) { 
	var win = window.open(url,target,'width='+w+',height='+h+',top=0,left=0,scrollbars='+scroll); 
	//win.window.focus(); 
}

function open_win3(url, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,resizable=no'
	win = window.open(url, '', winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function no_back(url) {
	window.location.replace(url);
}

function urlEncode(val) {
	return escape(encodeURIComponent(val));
}

function enter(callback) {
	var code = window.event.keyCode;
	if(code==13){
		callback();
	}
}

function imgWidthResize(limitSize, obj) {
	var w = obj.width;
	var h = obj.height;
	if(w>limitSize){
		obj.width = limitSize;
		obj.height = h*(limitSize/w);
	}
}

function imgHightResize(limitSize, obj) {
	var w = obj.width;
	var h = obj.height;
	if(h>limitSize){
		obj.height = limitSize;
		obj.width = w*(limitSize/h);
	}
}

function rPad(val, len, char) {
	var temp = "";
	if(val.length<len){
		for(var i=0;i<len-val.length;i++){
			temp += char;
		}
	}
	
	return val+temp;
}

function lPad(val, len, char) {
	var temp = "";
	if(val.length<len){
		for(var i=0;i<len-val.length;i++){
			temp += char;
		}
	}
	return temp+val;
}

function replaceAll(str, searchStr, replaceStr) {
	return str.split(searchStr).join(replaceStr);
}


function removeHttpStr(input) {
	if(input.value.indexOf("http://") != - 1) {
		input.value = input.value.replace("http://", "");
	}
}

function numberFormat(number, decimals, dec_point, thousands_sep) { 
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; 
    var d = dec_point == undefined ? "," : dec_point; 
    var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : ""; 
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; 
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); 
} 

function getAbsolutePageFullURL(sub) {
    var x = document.location.href;	
	var y = x.substr(0, x.indexOf("/",7)); // http:// ÀÌÈÄºÎÅÍ
    
    return y + sub;
}

// tab menu
function DisplayMenu(index) {
        for (i=1; i<=6; i++)
        if (index == i) {
        thisMenu = eval("menu" + index + ".style");
        thisMenu.display = "";
        } 
        else {
        otherMenu = eval("menu" + i + ".style"); 
        otherMenu.display = "none"; 
        }
 }

// layer view, hide 
function initViewChg(id, imgEl) {
	var id = document.getElementById(id);
	var imgEl = document.getElementById(imgEl);
	id.style.display = (id.style.display == 'block' ? 'none':'block'); 
	imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
	if (id.style.display == 'block') {
		imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
	}
}

// table tr list expand
var preNum;
var flag=1;
function changeLayer(sNum)
{
	if(sNum==preNum && flag==1){
		//alert('a');
		temp = eval("document.all."+sNum);
		if(temp){
			temp.style.display='none';
			flag=0;
		}
	}
	else if(sNum==preNum && flag==0){
		//alert('b');
		temp = eval("document.all."+sNum);
		if(temp){
			temp.style.display='';
			flag=1;
		}
	}
	else if(sNum!=preNum){
		//alert('c');
		temp = eval("document.all."+preNum);
		if(temp)
			temp.style.display='none';

		temp1 = eval("document.all."+sNum);
		if(temp1)
			temp1.style.display='';
		flag=1;


	}
	preNum=sNum;
}

// png
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 '';
}

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 + '" wmode="' + wmode + '">';
  	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 ecatalog() {
	window.open('http://livart.elogin.co.kr/EBOOKS/9/main.html', 'EBOOKS', 'width=1024,height=768,scrollbars=no');
}

$("*").keypress(function(e) {
	if(e.keyCode == 13 ) return false;
});
