/* cookie operation
-----------------------------------------------------------------------------------------------------------------*/

function class_cookielib(){
	this.getCookie = getCookie;
	this.setCookie = setCookie;
	this.removeCookie = removeCookie;
	 
	var expireDate = new Date();
	expireDate.setFullYear(expireDate.getFullYear()+1);
	expireStr = "expires=" + expireDate.toUTCString();

	function getCookie(name){
		var gc=name+"=";
		var Cookie=document.cookie;
		if (Cookie.length>0) {
			var start=Cookie.indexOf(gc);
			if (start!=-1) {
				start+=gc.length;
				terminus=Cookie.indexOf(";",start);
				if (terminus==-1) terminus=Cookie.length;
				return unescape(Cookie.substring(start,terminus));
			}
		}
		return '';
	}
	function setCookie() {
		var key = arguments[0];
		var val = arguments[1];
		var path = (typeof(arguments[2]) != 'undefined' ? arguments[2] : '/');
		
		var exp = (typeof(arguments[3]) != 'undefined'  ? arguments[3] : expireStr);
		var sc = key + "=" + escape(val) + "; path=" + path + "; " + exp;
		document.cookie = sc;
	}
	function removeCookie(key,path) {
		if(!path){
			path = '/';
		}
		var rc = key + "=; path=" + path + "; expires=Thu, 28 Jun 2001 00:00:00 UTC";
		document.cookie = rc;
	}
}
var cookieObj = new class_cookielib();

function onresize_handler(){
	if(document.layers){
		window.location.reload();
	}
}
window.onresize = onresize_handler;


/* window open
-----------------------------------------------------------------------------------------------------------------*/
function winOpen() {
	
	var url = (typeof(arguments[1]) != 'undefined'  ? arguments[0] : undefined );
	var target = (typeof(arguments[1]) != 'undefined'  ? arguments[1] : undefined );
	var width = (typeof(arguments[2]) != 'undefined'  ? arguments[2] : undefined );
	var height = (typeof(arguments[3]) != 'undefined'  ? arguments[3] : undefined );
	var toolbars = (typeof(arguments[4]) != 'undefined'  ? arguments[4] : 1);
	var scroll = (typeof(arguments[5]) != 'undefined'  ? arguments[5] : 1);
	var resize = (typeof(arguments[6]) != 'undefined'  ? arguments[6] : 1);
	//alert('toolbars'+toolbars);
	var setting = 'toolbar=' + toolbars + ',location=' + toolbars + ',directories=' + toolbars + ',status=' + toolbars + ',menubar=0,scrollbars=' + scroll + ',resizable=' + resize + ',width=' + width + ',height=' + height;
	newWin = window.open(url,target,setting)
	newWin.focus();
}


/* close button
-----------------------------------------------------------------------------------------------------------------*/
function closebutton(){
	document.write('<div class="mt10 alignR"><a href="javascript:window.close();"><img src="/resource/world/images/common/mark_close.gif" border="0" width="12" height="9" alt="" class="vam">close</a></div>');
}
