function LoginAlert(msg,div){
	document.getElementById(div).innerHTML=msg+" <a href='/member'><b>·Î±×ÀÎÇÏ±â</b></a>";
}

function DeleteWorkroomPortfolio(uidx,setidx){
	var params="uidx="+uidx+"&setidx="+setidx;
	new wdmX.xhr.Request('/model/DeleteWorkroomPort.php',params,delPortResult,'POST','view','Bloading');
}
function delPortResult(reqs){
	alert(reqs.responseText);
	window.location.reload();
}
function DeleteWorkroomThumb(image_id){
	var params="image_id="+image_id;
	new wdmX.xhr.Request('/model/DeleteWorkroomImage.php',params,delWorkroomResult,'POST','view','Bloading');
}
function delWorkroomResult(reqs){
	alert(reqs.responseText);
	window.location.reload();
}
function DeleteComment(tb,talk_idx,idx){
	var params="tb="+tb+"&talk_idx="+talk_idx+"&idx="+idx;
	//alert(params);
	new wdmX.xhr.Request('/model/DeleteComment.php',params,comSearchResult,'POST','view','Bloading');
}
function comment_ins(tb){
	var com_text=document.getElementById('commtext').value;
	var visit=document.getElementById('visitId').value;
	var talk_id=document.getElementById('talkId').value;
	var owner=document.getElementById('owner').value;

	if( com_text == "" )
	{
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		document.getElementById('commtext').focus();
		return;
	}

	var params="tb="+tb+"&comm="+com_text+"&visit="+visit+"&talk_id="+talk_id+"&owner="+owner;
	new wdmX.xhr.Request('/model/comment.php',params,comSearchResult,'POST','view','Bloading');
}
function comSearchResult(reqs){
	var comment="";
	comment=_$("comments");
	comment.innerHTML=reqs.responseText;
	document.getElementById('commtext').value="";
}
//±¹°¡°Ë»ö
function ukeySearch(){
	var keyword=document.getElementById('StrSearchKeyword').value;
	
	var params="keyword="+keyword;
	//alert(keyword);
	new wdmX.xhr.Request('/model/countryKeySearch.php',params,uKeySearchResult,'POST','view','Bloading');
}
function uKeySearchResult(reqs){
	var outDiv="";
	//alert(reqs.responseText);
	
	outDiv=_$("LayerSearchResult");
	outDiv.innerHTML=reqs.responseText;
	//innerHTMLJS('WdmIndividualSearch',reqs.responseText);
}
function uCountryIndiv(){
	var params="";
	//gfrm=params;
	new wdmX.xhr.Request('/model/Country_Popup.php',params,uresultOut,'POST','view','Bloading');
}

function ugetPaging(params){ 
	//gfrm=params;
	new wdmX.xhr.Request('/model/Country.GetPaging.php',params,uresultOut2,'POST','view','Bloading');
}
function uSearchSelect(db_designer_id,db_name_ko){
	document.getElementById('StrKCountry').value = db_name_ko;
	document.getElementById('StrKCountry_value').value = db_designer_id;

	_$('WdmCountrySearch').style.display="none";

}
function uresultOut(reqs){
	var outDiv="";
	//alert(reqs.responseText);
	
	outDiv=_$("WdmCountrySearch");
	outDiv.style.display="block";
	innerHTMLJS('WdmCountrySearch',reqs.responseText);

}
function uresultOut2(reqs){
	var outDiv="";
	outDiv=_$("LayerSearchResult");
	outDiv.innerHTML=reqs.responseText;
}
//»èÁ¦ ÀçÈ®ÀÎ ÀÎÅÍÆäÀÌ½º ·¹ÀÌ¾î
function TagInsert(idx,setid,section){
	//alert(idx+"=="+setid);
	//return false;

	var tagName=document.getElementById('TagName').value;
	if(tagName==""){
		alert('ÅÂ±×¸íÀÌ ÀÔ·ÂµÇÁö ¾Ê¾Ò½À´Ï´Ù.');
		document.getElementById('TagName').focus();
		return false;
	}else{
		var params="tagName="+tagName+"&idx="+idx+"&setid="+setid+"&section="+section;
		new wdmX.xhr.Request("/model/tag_ajax.php",params,tagInsResultOut,'POST','view','Bloading');
	
	}
}
function tagInsResultOut(reqs){
	document.getElementById('getTag').innerHTML=reqs.responseText;
	divnone('tagdiv');
}
function CommPopUp(idx,setid,sect){
	window.open("/model/popup_comm.html?sect="+sect+"&idx="+idx+"&set="+setid,"","width=420,height=430,toolbar=no,status=no,location=no,scrollbars=no,menubar=no,resizable=no,'',''");
}
function CommUserPopUp(idx){
	window.open("/model/mem.pop.view.php?idx="+idx,"","width=510,height=550,toolbar=no,status=no,location=no,scrollbars=no,menubar=no,resizable=no,'',''");
}
function DetailPopUp(idx,setid,sect){
	//alert(idx);
	
	panel.dialog_open("/model/popup_Detail.html?sect="+sect+"&idx="+idx+"&set="+setid, "800","","");

	//window.open("/model/popup_Detail.html?sect="+sect+"&idx="+idx+"&set="+setid,"","width=800,height=800,toolbar=no,status=no,location=no,scrollbars=yes,menubar=no,resizable=no,'',''");
}
function recomBtn(tb,idx,col){
	var params="tb="+tb+"&idx="+idx+"&col="+col;
	new wdmX.xhr.Request("/model/recomUp.php",params,recomResultOut,'POST','view','Bloading');
}
function recomResultOut(reqs){
	document.getElementById('recomCount').innerHTML=reqs.responseText;

	if(_$('recomCount2')!=null){
		document.getElementById('recomCount2').innerHTML=reqs.responseText;
	}
}
function cDiv(tb,column,idx,udiv,msg){
	var beDiv = document.getElementById(udiv);
	beDiv.style.display="block";
	beDiv.style.position = 'relative';
    var oDebug = document.getElementById('divDebug'+idx);

    if( oDebug == null )
    {
        var oContainer = document.createElement('div');
        var oControl = document.createElement('div');
        oDebug = document.createElement('div');

		oContainer.appendChild ( oDebug );
        oContainer.appendChild ( oControl );
       
        oControl.innerHTML = "<input type='button' value='¿¹' class='button' onClick=\"articleDel('"+tb+"','"+column+"',"+idx+")\"/> <input type='button' value='¾Æ´Ï¿À' class='button' onClick=\"divnone('"+udiv+"');\"/>";

        oDebug.id = 'divDebug'+idx;
        oDebug.style.overflow = 'auto';
        oDebug.style.width = '150px';
        oDebug.style.height = '30px';

        oContainer.style.position = 'absolute';
		oContainer.style.align ='center';
        oContainer.style.border = 'solid 3px #FF9900';
		oContainer.style.background="#ffffff";
		oContainer.style.padding="6px";
        oContainer.style.zIndex = '1';

        //oContainer.style.top = '0px';
        //oContainer.style.left = '0px';
		beDiv.style.background='#efefef';


        beDiv.appendChild( oContainer );
		oDebug.innerHTML += msg + "<br/>";
    }

    
    //oDebug.scrollTop = oDebug.scrollHeight;
}
function articleDel(tb,column,idx){
	var params="tb="+tb+"&idx="+idx+"&column="+column;
	//alert(params);
	new wdmX.xhr.Request("/wdmadmin/model/delete_article.php",params,articleResultOut,'POST','view','Bloading');
}
function articleResultOut(reqs){
	window.location.reload();
}
function divnone(div){
	document.getElementById(div).style.display="none";
}
function divActive(div){
	document.getElementById(div).style.display="block";
}

var msgCnt,msgDiv;
function DivMessageAlert(){
	msgCnt--;
	
	if(msgCnt==0){
		msgDiv.style.display="none";
	}else{
		setTimeout("DivMessageAlert()",1000);
	}
}
function Move(url)
{
	var wnd = (Move.arguments[1] ? Move.arguments[1] : self);
	var pmt = (Move.arguments[2] ? Move.arguments[2] : 0);

	if (pmt == 0) wnd.location.href = url;
	else if (pmt == 1) wnd.location.replace(url);
}
function messageAlert(msg)
{
	alert(msg);
	if (messageAlert.arguments[1]) Active(messageAlert.arguments[1]);
}
// ÄÁÆ®·Ñ(ctl)ÀÌ Æ÷Ä¿½º¸¦ °¡Áø´Ù.
function Active(ctl)
{
	ctl.focus();

	if (ctl.type.toLowerCase() == "text" || ctl.type.toLowerCase() == "textarea")
		if (ctl.value.length > 0) ctl.select();
}
// ÆäÀÌÁö¸¦ ¸®·ÎµåÇÑ´Ù.
// arguments[0] : ¸®·ÎµåÇÒ À©µµ¿ì
function ReloadWnd()
{
	var wnd = (ReloadWnd.arguments[0] ? ReloadWnd.arguments[0] : self);
	wnd.location.reload();
}
function xhtmlToLowerCase (ob) {
    var str = ob,
        tags = str.match(/<[^>]+>/g),
        prop, temp;
    if (!tags)
        return str;
    for (var i = 0; i < tags.length;i++) {
        temp = tags[i].replace(/\=([^\s\">]+)/g, "=\"$1\"");
        if (/^<(?:br|col|hr|img|input)/i.test(temp))
            temp = temp.replace(/>$/, " />");
        prop = temp.replace(/\=\"[^\"]+\"/g, "").split(/\s/);
        if (!prop)
            continue;
        for (var j = 0; j < prop.length; j++)
            temp = temp.replace(prop[j], prop[j].toLowerCase());
        str = str.replace(tags[i], temp);
    }
    return str;
};
function innerHTMLJS(obj,content) {
	
	obj = (typeof obj=='string') ? document.getElementById(obj) : obj;

	content = '<body>' + content.replace(/<\/?head>/gi, '')
				.replace(/<\/?html>/gi, '')
				.replace(/<body/gi, '<div')
				.replace(/<\/body/gi, '</div') + '</body>';

	obj.innerHTML = content;

	var scripts = obj.getElementsByTagName('script');

	if(scripts == false) return true; 
	for(var i=0; i<scripts.length; i++) {
		var scriptclone = document.createElement('script');
		if(scripts[i].attributes.length > 0) { 
			for(var j in scripts[i].attributes) {
				if(typeof(scripts[i].attributes[j]) != 'undefined'
					&& typeof(scripts[i].attributes[j].nodeName) != 'undefined'
					&& scripts[i].attributes[j].nodeValue != null
					&& scripts[i].attributes[j].nodeValue != '' )
				{
					scriptclone.setAttribute(scripts[i].attributes[j].nodeName, scripts[i].attributes[j].nodeValue);
				}
			}
		}
		scriptclone.text = scripts[i].text; 
		
		//if (navigator.userAgent.indexOf(\"Opera\")>0) { return; }
		//scripts[i].parentNode.replaceChild(scriptclone, scripts[i]);
	}
	return true;
}

// RollOver
function ImageOver(imgEL){
	imgEL.src = imgEL.src.replace("_off.gif", "_on.gif");
}

function ImageOut(imgEL){
	imgEL.src = imgEL.src.replace("_on.gif", "_off.gif");
}

/***************************************
* show util 
***************************************/
function showUtil()
{
    var bx = document.getElementById("vlink");
    if (bx.style.display == 'block') 
    {
        bx.style.display='none';
    }
    else
    {
        bx.style.display='block';
    }
}

function SwfsubNavi(){
    	var flashStr2 ="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
    	flashStr2 += "codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
    	flashStr2 += "width='902' height='72' align='middle' id='globalSwfNavi'>";
    	flashStr2 += "<param name='allowScriptAccess' value='sameDomain' />";
    	flashStr2 += "<param name='movie' value='/swfmodel/subNavi.swf' />";
    	flashStr2 += "<param name='quality' value='high' />";
		flashStr2 += "<param name='wmode' value='transparent' />";
    	flashStr2 += "<param name='bgcolor' value='#ffffff' />";
    	flashStr2 += "<embed src='/swfmodel/subNavi.swf' width='902' height='72' quality='high'";
    	flashStr2 += "bgcolor='#ffffff' name='globalSwfNavi' align='middle' wmode='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'";
    	flashStr2 += "pluginspage='http://www.macromedia.com/go/getflashplayer' flashvars='' />";
    	flashStr2 += "</object>";
    	document.write(flashStr2);
}

