function setCookie( name, value, expiredays ){ 
        var todayDate = new Date(); 
        todayDate.setDate( todayDate.getDate() + expiredays ); 
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
} 
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 IsEnterKey() {
	var evt = event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if( charCode == 13 ) return true;
	return false;
}
function getRequestBody(sform) {
	var aParams = new Array();
	for(var i=0; i < sform.elements.length; i++){
		if(sform.elements[i].type=="radio"){
			if(sform.elements[i].checked==true){
				var sParam = encodeURIComponent(sform.elements[i].name);
				sParam += "=";
				sParam += encodeURIComponent(sform.elements[i].value);
				aParams.push(sParam);
			}
		}
		else{
			var sParam = encodeURIComponent(sform.elements[i].name);
			sParam += "=";
			sParam += encodeURIComponent(sform.elements[i].value);
			aParams.push(sParam);
		}
	}	
	return aParams.join("&");
}
function openAlert(msg) {
	Dialog.alert(msg, {width:250, okLabel: "È® ÀÎ", buttonClass:"bttn01", windowParameters: {className: "alphacube"}})	
}
function fnResizePopup(nWidth, nHeight) {
	var strAgent = navigator.userAgent.toLowerCase();
	var bIE = (strAgent.indexOf("msie") != -1);
	var bXP = (strAgent.indexOf("nt 5.1") != -1);
	var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	var bSafari = (strAgent.indexOf("konqueror") != -1 || strAgent.indexOf("safari") != -1);
	var bFirefox = (strAgent.indexOf("firefox")!= -1);
	//alert(nHeight + (bXP ? (bIE7 ? 40: 20) : 0));
	window.resizeTo(nWidth, nHeight + (bXP ? (bIE7 ? 40: 20) : 0));
}
function popimage(wintitle,imagesrc,winwidth,winheight){
	var winl = (screen.width-winwidth) / 2; 
	var wint = (screen.height-winheight) / 2;
    var look='width='+winwidth+',height='+winheight+',top='+wint+',left='+winl+',';

	popwin=window.open("","",look);
	popwin.document.open();
	popwin.document.write('<title>'+wintitle+'</title><meta http-equiv="imagetoolbar" content="no"><body topmargin=0 leftmargin=0><img style="cursor:hand;" onclick="self.close();" src="'+imagesrc+'" alt="Å¬¸¯ÇÏ¸é Ã¢À» ´Ý½À´Ï´Ù."></body>');
	popwin.document.close();
}

function bluring() {
 if(event.srcElement.tagName=="A" || event.srcElement.tagName=="IMG" || event.srcElement.tagName=="AREA")
  document.body.focus();
}
document.onfocusin=bluring;




// preview
function es_open_view(url){
	kk = window.open('','kk','width=500,height=500,scrollbars,resizable');
	kk.document.write("<body  topmargin=0 leftmargin=0 onLoad='window.resizeTo(document.all.kk.width+40,document.all.kk.height+85);'>");
	kk.document.write("<table width=100% height=100%><tr><td align=center><img id=kk src='" + url + "' style='cursor:hand;border:solid 1 #eeeeee;' onClick=self.close();></td></tr></table>");
	kk.document.write("</body>");
	kk.document.close();
	
}

function es_open_url(url,name,str){
	window.open(url,name,str);
}