/*
-----------------------------------------------------------------------------------
	COPYRIGHT ¨Ï 2002 ¿ÀÄÉÀÌÅ¸¿î - OKTOWN All Rights Reserved 
-----------------------------------------------------------------------------------
	System Name : OneClickHomepage 1.2
	Subsystem Name : Include > JS 
	Outline of Program : È¨°ü¸®&È¨ÆäÀÌÁö °øÅëÀûÀ¸·Î ¾²´Â ÀÚ¹Ù½ºÅ©¸³Æ®
	Programmed Date : 2002/03/04
	Updated Date : 2002/03/19
    Programmer : Jung Sawyer, Byun Won
	Program ID : Total.js
-----------------------------------------------------------------------------------
*/
//========== ¹Ì¸®º¸±â ±×¸² ¹Ù²Ù±â =======
//previewImage.jsµµ ²À °°ÀÌ ÀÖ¾î¾ßÇÑ´ç.
function setImage(ImgObj,Img,ImgSize,ImgIdx,Idx,theFlag){
	if(theFlag == "banner"){
		eval(ImgObj+".style.backgroundImage='url(" +Img+")'");
		eval(ImgIdx+".value="+Idx);
		//aa.style.backgroundImage = "url(ÀÌ¹ÌÁö°æ·Î)";
	}else{
		eval("document."+ImgObj+".src='"+Img+"'");
		eval("changeImage("+ImgSize+",'"+ImgObj+"')");
		if(theFlag == "pS"){
			eval(ImgIdx + '.value="url(' + Img + ')"');
		} else {
			eval(ImgIdx+".value="+Idx);
		}
	}
	//alert(eval(ImgIdx+".value"));
}

//========== »ö»ó °í¸£±â Ã¢ ¶ç¿ì±â ========
function paletteChang(theColor, theObj, theDiv){
	var theUrl
	theUrl = "/Include/ASP/Palette/palette.asp"
	if(theColor || theObj || theDiv){
		theUrl = "/Include/ASP/Palette/palette.asp?sColor=" + replace(theColor,'#','') + "&fd=" + theObj + "&cDiv=" + theDiv;
	}
	/*if(theColor && theObj && theDiv){
		theUrl += "?";
		theUrl += (theColor)?"sColor=" + theColor : '';
		theUrl += (theColor && theObj)?"&fd=" + theObj:"fd=" + theObj;
	}*/
	openWindow(theUrl,"Palette","width=300,height=440","modalDialog");
}

//========== »ö»óÄÚµå ÁöÁ¤ÇÏ±â ========
function setColor(theColor, theObj, theDiv){
	eval(theObj + '.value = "' + theColor + '";');
	eval(theDiv + '.style.backgroundColor = "' + theColor + '";');
}

//========== »ö»ó ¾ø¾Ö±â ========
function removeColor(theForm, theObj){
	eval(theForm + '.value = "";');
	eval(theObj + '.style.backgroundColor = "";');
}

//========== select ¿¡¼­ ¼±ÅÃµÈ°Å »ö±òº¯°æÇÏ±â ========
function selectChange(s){
	for (var i=0; i<s.options.length; i++){
		if (s.options[i].selected && s.options[s.selectedIndex].value != ""){
			s.options[i].style.color='#ffffff';
			s.options[i].style.backgroundColor='#000000';
		}
		else{
			s.options[i].style.color='#000000';
			s.options[i].style.backgroundColor='#ffffff';
		}
	}
}

//========== Ã¢À¸·Î ±×¸²¶ç¿ì±â ========
function viewImage(theSrc){
	var varObj
	url="/Mall/Include/view.html?src="+theSrc
	varObj = (parent.dialogArguments)?parent.dialogArguments.window:window;
	varObj.open(url,"view","width=200,height=200,scrollbars=yes");
}

function ModalDialogAttr(){
	var arg, i;
	arg = ModalDialogAttr.arguments;
	i = 0;
	with(this){
		//open °ú DialogÀÇ ¼Ó¼ºÀÌ¸§ÀÌ °°Àº °Í
		Astatus = arg[++i];
		Aresizable = arg[++i];
		//open °ú DialogÀÇ ¼Ó¼ºÀÌ¸§ÀÌ ´Ù¸¥ °Í
		Awidth = arg[i];
		Aheight = arg[++i];
		Ascrollbars = arg[++i];
		//Dialog ¿¡¸¸ ÀÖ´Â °Í
		AdialogLeft = arg[++i];
		AdialogTop = arg[++i];
		Acenter = arg[++i];
		AdialogHide = arg[++i];
		Aedge = arg[++i];
		Ahelp = arg[++i];
		Aunadorned = arg[++i];
		//open ¿¡¸¸ ÀÖ´Â °Í
		Atoolbar = arg[++i];
		Alocation = arg[++i];
		Adirectories = arg[++i];
		Amenubar = arg[++i];	
	}
}
function openWindow(theUrl, theName, theAttr, theFlag){
	if(theFlag == 'openWindow'){
		window.open(theUrl, theName, theAttr);
	} else if(window.dialogArguments || parent.dialogArguments || theFlag == 'modalDialog'){
		var chAttr, arrayAttr, sAttr, i, theObj;
		chAttr = '';
		theAttr = theAttr.split(" ").join("");
		arrayAttr = theAttr.split(',');
		theObj = new ModalDialogAttr();
		for(i = 0 ; i < arrayAttr.length ; i++){
			sAttr = arrayAttr[i].split('=');
			eval('theObj.A' + sAttr[0].toLowerCase() + ' = sAttr[1];');
		}
		chAttr += (theObj.Awidth)?'dialogWidth: ' + theObj.Awidth + 'px;':'';
		chAttr += (theObj.Aheight)?'dialogHeight: ' + (parseInt(theObj.Aheight) + 20) + 'px;':'';
		chAttr += (theObj.AdialogLeft)?'dialogLeft: ' + theObj.AdialogLeft + 'px;':'';
		chAttr += (theObj.AdialogTop)?'dialogTop: ' + theObj.AdialogTop + 'px;':'';
		chAttr += (theObj.Acenter)?'center: ' + theObj.Acenter + ';':'center: no;';
		chAttr += (theObj.AdialogHide)?'dialogHide: ' + theObj.AdialogHide + ';':'dialogHide: no;';
		chAttr += (theObj.Aedge)?'edge: ' + theObj.Aedge + ';':'edge: raised;';
		chAttr += (theObj.Ahelp)?'help: ' + theObj.Ahelp + ';':'help: no;';
		chAttr += (theObj.Aresizable)?'resizable: ' + theObj.Aresizable + ';':'resizable: no;';
		chAttr += (theObj.Ascrollbars)?'scroll: ' + theObj.Ascrollbars + ';':'scroll: no;';
		chAttr += (theObj.Astatus)?'status: ' + theObj.Astatus + ';':'status: no;';
		chAttr += (theObj.Aunadorned)?theObj.Aunadorned + ';':'unadorned: no;';
		//alert(chAttr);
		window.showModalDialog(theUrl, window, chAttr);
	} else {
		window.open(theUrl, theName, theAttr);
	}
}

//========== QuerySting°ª ¹Þ±â ========
function requestQueryString(theName){
	var qString,qNValue,i,theValue;
	qString = location.search.toString();
	qString = qString.substring(1,qString.length);
	qString = qString.split("&");
	for(i = 0; i < qString.length; i++){
		qNValue = qString[i].split("=");
		if(qNValue[0] == theName){
			theValue = qNValue[1];
			break;
		}
	}
	return theValue;
}

//========== ¼ýÀÚÀÎÁö È®ÀÎ ========
function checkNum(theObj, theValue){
	var num, i;
	num = "0123456789";
	for(i = 0 ; i<theValue.length ; i++){
		if(num.indexOf(theValue.charAt(i)) == -1){
			alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À...!");
			theObj.focus();
			return false;
		}
	}
	return true;
}

//¹®ÀÚ ¹Ù²Ù±â
function replace(str, orgStr, chStr){
	var reStr = "";
	for(var i = 0; i < str.length; i++){
		reStr += (str.charAt(i) == orgStr)?chStr:str.charAt(i);
	}
	return reStr;
}

//ÀÌ¹ÌÁö º¯È¯
function chImg(imgObj, imgSrc){
	if(imgObj == "[object]"){
		if(imgObj.filters.blendTrans){
			imgObj.filters.blendTrans.stop();
			imgObj.filters.blendTrans.apply();
			imgObj.src = imgSrc;
			imgObj.filters.blendTrans.play();
		} else {
			imgObj.src = imgSrc;
		}
	} else {
		if(eval('document.' + imgObj + '.filters.blendTrans')){
			eval('document.' + imgObj + '.filters.blendTrans.stop()');
			eval('document.' + imgObj + '.filters.blendTrans.apply()');
			eval('document.' + imgObj + '.src = "' + imgSrc + '"');
			eval('document.' + imgObj + '.filters.blendTrans.play()');
		} else {
			eval('document.' + imgObj + '.src = "' + imgSrc + '"');
		}
	}
}

//========== ÀÏ¹Ý function ==========
function goHref(linkUrl,target){
	target = (target)?target+'.':'';
	//alert(linkUrl);
	eval(target + "location.href = linkUrl;");
}

function makeBlank(str){
	var reStr = "";
	for(var i = 0; i < str.length; i++){
		reStr += (str.charAt(i) == " ")?"&nbsp;":str.charAt(i);
	}
	return reStr;
}

//*** ¹öÆ°Å×µÎ¸®»ö º¯°æÇÏ±â ***
function chBut(obj,col1,col2,col3){
	if(obj.style){
		obj.style.borderLeftColor = col1;
		obj.style.borderTopColor = col1;
		obj.style.borderRightColor = col2;
		obj.style.borderBottomColor = col2;
		obj.style.backgroundColor = col3;
	}
}

function ovrBut(obj){
	if(obj.style){
		obj.style.borderLeftColor = '#99FF33';
		obj.style.borderTopColor = '#99FF33';
		obj.style.borderRightColor = '#336600';
		obj.style.borderBottomColor ='#336600';
		obj.style.backgroundColor = '#66CC00';
	}
}

function oriBut(obj){
	if(obj.style){
		obj.style.borderLeftColor = '#e0e0e0';
		obj.style.borderTopColor = '#e0e0e0';
		obj.style.borderRightColor = '#e0e0e0';
		obj.style.borderBottomColor = '#e0e0e0';
		obj.style.backgroundColor = '#e0e0e0';
	}
}

//*** Default ¹öÆ° ¸¸µé±â ***
function makeButton(theName, theUrl, theID, theAttr){
	var varMB, clickValue, addTag;
	//clickValue = (theID.substring(0,5) == "submit")?theUrl:"goHref('" + theUrl + "')";
	theID += "";
	if (theID.substring(0,6) == "submit"){
		clickValue = theUrl;
		addTag = '<input type="image" src="/Images/icon_sure.gif" width="24" height="19" border="0" align="absmiddle" onFocus="this.blur();">';
	} else if (theID.substring(0,5) == "image"){
		clickValue = "goHref('" + replace(theUrl,"'","\\'") + "')";
		addTag = '<img src="/Images/icon_sure.gif" width="24" height="19" border="0" align="absmiddle">';
	} else if (theID.substring(0,6) == "script"){
		clickValue = theUrl;
		addTag = '';
	} else if (theID.substring(0,7) == "iscript"){
		clickValue = theUrl;
		addTag = '<img src="/Images/icon_sure.gif" width="24" height="19" border="0" align="absmiddle">';
	} else {
		clickValue = "goHref('" + replace(theUrl,"'","\\'") + "')";
		addTag = '';
	}
	varMB = '' + 
	'				<span class="but_d1" onClick="' + clickValue + '">\n' +
	'					<span class="but_d2" onMouseDown="chBut(this,\'#EEEEEE\',\'#EEEEEE\',\'#D5D5D5\');" onMouseUp="chBut(this,\'#FFFFFF\',\'#BFBFBF\',\'#DEDEDE\');" onMouseOut="chBut(this,\'#FFFFFF\',\'#BFBFBF\',\'#DEDEDE\');" ' + theAttr +'>\n' +
	'					' + addTag + '&nbsp;&nbsp;\n' + makeBlank(theName) + '\n' +
	'					&nbsp;&nbsp;\n' +
	'					</span>\n' +
	'				</span>\n'

	document.write(varMB);
}


<!--
function MM_findObj(n, d) { //v3.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); 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 getCookieVal (offset) {  
        var endstr = document.cookie.indexOf (";", offset);  
        if (endstr == -1)    
                endstr = document.cookie.length;  
        return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
        var arg = name + "=";  
        var alen = arg.length;  
        var clen = document.cookie.length;  
        var i = 0;  
        while (i < clen) {    
        var j = i + alen;    
        if (document.cookie.substring(i, j) == arg)      
                return getCookieVal (j);    
                i = document.cookie.indexOf(" ", i) + 1;    
                if (i == 0) break;   
        }  
        return null;
}

function SetCookie (name, value) {  
        var argv = SetCookie.arguments;  
        var argc = SetCookie.arguments.length;  
        var expires = (argc > 2) ? argv[2] : null;  
        var path = (argc > 3) ? argv[3] : null;  
        var domain = (argc > 4) ? argv[4] : null;  
        var secure = (argc > 5) ? argv[5] : false;  
        document.cookie = name + "=" + escape (value) + 
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
        ((path == null) ? "" : ("; path=" + path)) +  
        ((domain == null) ? "" : ("; domain=" + domain)) +    
        ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {  
        var exp = new Date();  
        exp.setTime (exp.getTime() - 1);  
        var cval = GetCookie (name);  
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

