

function WindowOpen(page,w,h,s,r)
	{
		var win=null;
		// ÇÁ·¹ÀÓÀÌ Á¸Àç ÇÒ °æ¿ì
		// parent.window.screenLeft ½ÄÀ¸·Î
		// document.body.offsetWidth, document.body.offsetHeight µµ Ã¢ÀÇ Å©±â¿¡ ¸Â°Ô º¯°æ °¡´É
		var x=window.screenLeft;
		var y=window.screenTop;
		var l=10;//x+((document.body.offsetWidth-w)/3);
		var t=10;//y+((document.body.offsetHeight-h)/3);
		var settings='';
		
		settings ='width='+w+'px,';
		settings +='height='+h+'px,';
		settings +='top='+t+'px,';
		settings +='left='+l+'px,';
		settings +='scrollbars='+(s ? s : 0)+',';
		settings +='resizable='+(r ? r : 0)+',';
		settings +='status=0';
		
		var windows=window.open(page,'',settings);
		windows.focus();
	}


	function move(url, target)
	{
		if(target) {
			topMove(0,0);
			target.location.href = url;
		} else {
			topMove(0,0);
			location.href = url;
		}
	}
	function topMove(x,y) { 
		try{parent.window.scroll(x,y); } catch(e) {window.scroll(x,y); }
		
	}

	function resizeFrame(id)
	{
		// width fix
		var nWidth= 566, nDefWidth =566,nDefHeight=384;
		
		try {
			var oBody   = document.frames(id).document.body;
			var oFrame  = document.all(id);
			
			//if (nWidth) oFrame.style.width = nWidth;
			//else oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);
			oFrame.style.width = nWidth;
			oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
			
			if (oFrame.style.height == "0px" || oFrame.style.width == "0px") {
				oFrame.style.width = nDefWidth;
				oFrame.style.height = nDefHeight;
				window.status = 'iframe resizing fail.';
			} else { window.status = ''; }
		} catch(e) {
			//window.status = 'Error: ' + e.number + '; ' + e.description;
		}
		return;
	}
	
	function adjustIFrameSize (iframeWindow) {
		if (iframeWindow.document.height) {
			var iframeElement = document.getElementById(iframeWindow.name);
			iframeElement.style.height = iframeWindow.document.height + 'px';
			iframeElement.style.width = '566px';//iframeWindow.document.width + 'px';
		} else if (document.all) {
			var iframeElement = document.all[iframeWindow.name];
			if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') {
				iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
				iframeElement.style.width = '566px';// = iframeWindow.document.documentElement.scrollWidth /*+ 5*/ + 'px';
			} else {
				iframeElement.style.height = iframeWindow.document.body.scrollHeight + 5 + 'px';
				iframeElement.style.width = '566px';// = iframeWindow.document.body.scrollWidth /*+ 5*/ + 'px';
			}
		}
	}

	function adjustIFrameSize2 (iframeWindow) {
		if (iframeWindow.document.height) {
			var iframeElement = document.getElementById(iframeWindow.name);
			iframeElement.style.height = iframeWindow.document.height + 'px';
			iframeElement.style.width = iframeWindow.document.width + 'px';
		} else if (document.all) {
			var iframeElement = document.all[iframeWindow.name];
			if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') {
				iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
				iframeElement.style.width =   iframeWindow.document.documentElement.scrollWidth /*+ 5*/ + 'px';
			} else {
				iframeElement.style.height = iframeWindow.document.body.scrollHeight + 5 + 'px';
				iframeElement.style.width =   iframeWindow.document.body.scrollWidth /*+ 5*/ + 'px';
			}
		}
	}

function getDateOfExpire(year,day,hour,minute,second) {
    var today = new Date();
    var exprs = new Date();
    exprs.setTime( today.getTime()
                  +1000*60*60*24*365*year
                  +1000*60*60*24    *day
                  +1000*60*60       *hour
                  +1000*60          *minute
                  +1000             *second );
    return exprs;
}

/*
    String name, value
    Date expires
    String path, domain
    Boolean secure

    optional: expires,path,domain,secure
*/
function setCookie(name,value,expires,path,domain,secure) {
    document.cookie =   name + '=' + escape(value)         + ';'
        + ((expires) ? ' expires=' + expires.toGMTString() + ';' : '')
        + ((path)    ? ' path='    + path                  + ';' : '')
        + ((domain)  ? ' domain='  + domain                + ';' : '')
        + ((secure)  ? ' secure'                           + ';' : '');
}

// Returns a string or false
function getCookie(name) {
    var srch = name + '=';
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(srch);
        if (offset != -1) {
            offset += srch.length;
            end = document.cookie.indexOf(';', offset);
            if (end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(offset, end));
        } else return false;
    } else return false;
}

// optional: path,domain
function deleteCookie(name,path,domain) {
    if (getCookie(name))
        document.cookie = name                 + '=;'
            + ' expires=Thu, 01-Jan-70 00:00:01 GMT;'
            + ((path)   ? ' path='    + path    + ';' : '')
            + ((domain) ? ' domain='  + domain  + ';' : '');
}	