﻿function OpenWin(ismenu,width,height,top,left,url) {
	if (ismenu==1) {
		window.open(url);
	} else {
		window.open(url,"pop","width="+width+",height="+height+",top="+top+",left="+left+",titlebar=no,resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no");	
	}
}
function space_none(str) {
	var temp = "";
	string = '' + str;
	splitstring = str.split(" ");

	for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];

	return temp;
}
function bookmark(){
	window.external.AddFavorite('http://www.jsd.or.kr', '새시대 새진리 증산도')
}
function JS_viewObj(objhtml) { 
	document.write(objhtml); 
} 

function trim(s) {
	s = s.replace(/^\s*/,'').replace(/\s*$/, '');
	return s;
}
function getHttprequest(URL,M,Q) {
        var xmlhttp = null;
        if(window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open(M, URL, false);
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState==4 && xmlhttp.status == 200 && xmlhttp.statusText=='OK') {
                responseText = xmlhttp.responseText;
            }
        }
        xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        xmlhttp.send(Q);
        return responseText = xmlhttp.responseText;
}
function paramEscape(paramValue)
{
    return escape(paramValue);
}

function formData2QueryString(docForm)
{    
    var submitString = '';
    var formElement = '';
    var lastElementName = '';

    for(i = 0 ; i < docForm.elements.length ; i++) {
		formElement = docForm.elements[i];
		
		switch(formElement.type) {
		case 'text' :
		case 'select-one' :
		case 'hidden' :
		case 'password' :
		case 'textarea' :
			submitString += formElement.name + '=' + paramEscape(formElement.value) + '&';
			break;
		case 'radio' :     
			if(formElement.checked) {
				submitString += formElement.name + '=' + paramEscape(formElement.value) + '&';
			}
			break;
		case 'checkbox' :    
			if(formElement.checked) {
				if(formElement.name == lastElementName) {
					if(submitString.lastIndexOf('&') == submitString.length - 1) {
						submitString = submitString.substring(0, submitString.length - 1);
					}
					submitString += ',' + paramEscape(formElement.value);
				} else {
					submitString += form1.elements[i].name + '=' + paramEscape(formElement.value); 
				}
				submitString += '&';
				lastElementName = formElement.name;
			}
			break;  
        }                                                                                                                  
    }
    submitString = submitString.substring(0, submitString.length - 1);
    //document.all("result").value = submitString;
    return submitString;                                               
}

function xmlHttpPost(actionUrl, submitParameter)
{
    var xmlHttpRequest = false;
    
    //IE인경우
    if(window.ActiveXObject)
    {
        xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
    }
    else
    {
        xmlHttpRequest = new XMLHttpRequest();
        xmlHttpRequest .overrideMimeType('text/xml');
    }    
            
    xmlHttpRequest.open('POST', actionUrl, false);
    xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; text/xml');
    xmlHttpRequest.onreadystatechange = function() {
		if(xmlHttpRequest.readyState==4 && xmlHttpRequest.status == 200 && xmlHttpRequest.statusText=='OK') {
			responseText = xmlHttpRequest.responseText;
		}
    }
    xmlHttpRequest.send(submitParameter);    
    return responseText;                
}                                    

function getCookie( name ) {
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ) {
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}
function setCookie( name, value, expiredays ) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}

//공지팝업용 스크립트
var IE5=(document.getElementById && document.all)? true : false;
var W3C=(document.getElementById)? true: false;
var currIDb=null, currIDs=null, xoff=0, yoff=0; zctr=200; totz=0;
var shadowwidth = 4;

function closeWin(m,w) { 
	setCookie( m, "done" , 1);//1은 하루동안 새창을 열지 않게 합니다.
	nwin = w.style;
	w.visibility = 'hidden';
} 

function trackmouse(evt){
        if((currIDb!=null) && (currIDs!=null)){
                var x=(IE5)? event.clientX+document.body.scrollLeft : evt.pageX;
                var y=(IE5)? event.clientY+document.body.scrollTop : evt.pageY;
                        currIDb.style.left=x+xoff+'px';
                        currIDs.style.left=x+xoff+shadowwidth+'px';
                        currIDb.style.top=y+yoff+'px';
                        currIDs.style.top=y+yoff+shadowwidth+'px';
                return false;
        }
}

function stopdrag(){
        currIDb=null;
        currIDs=null;
        NS6bugfix();
}

function grab_id(evt){
        xoff=parseInt(this.IDb.style.left)-((IE5)? event.clientX+document.body.scrollLeft : evt.pageX);
        yoff=parseInt(this.IDb.style.top)-((IE5)? event.clientY+document.body.scrollTop : evt.pageY);
        currIDb=this.IDb;
        currIDs=this.IDs;
}

function NS6bugfix(){
        if(!IE5){
                self.resizeBy(0,1);
                self.resizeBy(0,-1);
        }
}

function incrzindex(){
        zctr=zctr+2;
        this.subb.style.zIndex=zctr;
        this.subs.style.zIndex=zctr-1;
}
function closeWin(x1,x2,m){
	if (m==1) {
		setCookie( "Notice", "done" , 1);//1은 하루동안 새창을 열지 않게 합니다.
	}	
	v1 = eval(x1+'.style');
	v2 = eval(x2+'.style');
	v1.display = 'none';
	v2.display = 'none';
}

function createPopup(id, title, width, height, x , y , isdraggable, boxcolor, barcolor, shadowcolor, text, textcolor, textptsize, textfamily ){
	if(W3C){
		zctr+=2;
		totz=zctr;
		var txt='';
		txt+='<div id="'+id+'_s" style="position:absolute; z-index: 200; left:'+(x+shadowwidth)+'px; top:'+(y+shadowwidth)+'px; width:'+width+'px; height:'+height+'px; background-color:'+shadowcolor+'; filter:alpha(opacity=50); visibility:visible"> </div>';
		txt+='<div id="'+id+'_b" style="z-index: 201;border:outset '+barcolor+' 2px; position:absolute; left:'+x+'px; top:'+y+'px; width:'+width+'px; overflow:hidden; height:'+height+'px; background-color:'+boxcolor+'; visibility:visible">';
		txt+='<div style="z-index: 202;width:'+width+'px; height:16px; background-color:'+barcolor+'; padding:0px; border:1px"><table cellpadding="0" cellspacing="0" border="0" width="'+(IE5? width-4 : width)+'"><tr><td width="'+(width-20)+'"><div id="'+id+'_h" style="z-index: 204; width:'+(width-20)+'px; height:14px; font: bold 12px Tahoma; cursor:move; color:'+textcolor+'"> '+title+'</div></td><td align="right"><img src="http://www.blueb.co.kr/SRC/javascript/image/close.gif" border="0" height="15" width="15" onclick="closeWin(\''+id+'_s\',\''+id+'_b\',0)"></td></tr></table></div>';
		txt+='<div id="'+id+'_ov" width:'+width+'px; style="z-index: 203; margin:5px; color:'+textcolor+'; font:'+textptsize+'pt '+textfamily+';">'+text;

		txt+='<table cellpadding="0" cellspacing="0" border="0" width="100%">';
		txt+='<tr><td align="right"><font size="2">[하루동안 열지 않기]<img src="http://www.jsd.or.kr/imgs/include/popup/1361101/close.jpg" border=0 width="69" height="18" align="absmiddle" onclick="closeWin(\''+id+'_s\',\''+id+'_b\',1)" /></font></td></tr>';
		txt+='</td></tr></table>';

		txt+='</div></div>';
		document.write(txt);
		this.IDh=document.getElementById(id+'_h');
		this.IDh.IDb=document.getElementById(id+'_b');
		this.IDh.IDs=document.getElementById(id+'_s');
		this.IDh.IDb.subs=this.IDh.IDs;
		this.IDh.IDb.subb=this.IDh.IDb;
		this.IDh.IDb.IDov=document.getElementById(id+'_ov');
		if(IE5){
				this.IDh.IDb.IDov.style.width=width-6;
				this.IDh.IDb.IDov.style.height=height-22;
				this.IDh.IDb.IDov.style.scrollbarBaseColor=boxcolor;
				this.IDh.IDb.IDov.style.overflow="auto";
		}
		else{
				this.IDh.IDs.style.MozOpacity=.5;
		}
		this.IDh.IDb.onmousedown=incrzindex;
		if(isdraggable){
				this.IDh.onmousedown=grab_id;
				this.IDh.onmouseup=stopdrag;
		}
	}
}

if(W3C)document.onmousemove=trackmouse;
if(!IE5 && W3C)window.onload=NS6bugfix;        


//공지팝업용 스크립트끝 -----------------------


/* ---------------------------------------------------------------------- */
