
// Delete Error Message
function HideError(){
	return true;
}
window.onerror = HideError;


// Netscape 4.x Reload Bug Patch
function reloadPage(init){
	if(init==true) with(navigator){
		if((appName=="Netscape")&&(parseInt(appVersion)==4)){
			document.pgW=innerWidth;
			document.pgH=innerHeight;
			window.onresize=reloadPage;
		}
	}else if(innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}

reloadPage(true);



// images PreLoad
function PreLoad() {
	var d = document;
	if(d.images){
		if(!d.My_IMG) d.My_IMG = new Array();
		var i , j = d.My_IMG.length , a = PreLoad.arguments;
		for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){
			d.My_IMG[j] = new Image;
			d.My_IMG[j++].src = a[i];
		}
	}
}





// Get Object
function GetObj(n, d) {
	var p,i,x;
	if(!d) d = document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x = d.all[n];
	for(i=0; !x&&i<d.forms.length; i++) x = d.forms[i][n];
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) x = GetObj(n,d.layers[i].document);
	if(!x && document.getElementById) x = document.getElementById(n);
	return x;
}



// Swap image
function ChgIMG() {
	var i , j = 0 , x , a = ChgIMG.arguments;
	document.My_sr = new Array;
	for(i=0; i<(a.length-2); i+=3) if ((x=GetObj(a[i]))!=null){
		document.My_sr[j++] = x;
		if(!x.oSrc) x.oSrc = x.src;
		x.src = a[i+2];
	}
}

// Reset image
function ResetIMG() {
	var i , x , a = document.My_sr;
	for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) x.src = x.oSrc;
}



// Sub Window Open
function WinOpen(URL,WN,F) {
	if(sbwin_closed(window.WN)){
		newwin = window.open(URL,WN,F);
		newwin.focus();
	}else{
		newwin.location.href = URL;
		newwin.focus();
	}
}

function sbwin_closed(winVar) {
	var ua = navigator.userAgent;
	if( !!winVar ){
		if( gck || ( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) ) return winVar.closed;
		else return typeof winVar.document != 'object';
	}else return true;
}

// Pop Up Window
function PopUpWindow(URL,Wname,Wwidth,Wheight){
	window.open(URL,Wname,"width="+Wwidth+",height="+Wheight+",scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=yes,top=0,left=0")
}


// Get Cookie
function GetCookie(NAME)
{
	str = NAME + '=';
	val = null;
	c = document.cookie + ';';
	p = c.indexOf(str);
	if (p != -1)
	{
		p_st = p + str.length;
		p_ed = c.indexOf(';', p_st);
		val = unescape(c.substring(p_st, p_ed));
	}
	return val;
}


// Set Cookie
function SetCookie(NAME, VALUE, EXP, PATH, DOMAIN)
{
	c = NAME + '=' + escape(VALUE) + ';';
	if ( EXP > 0 )
	{
		dt = new Date();
		dt.setTime(dt.getTime()+(EXP * 1000));
		c = c + ' expires=' + dt.toGMTString() + ';';
	}
	if ( PATH != '' )
	{
		c = c + ' path=' + PATH + ';';
	}
	if ( DOMAIN != '' )
	{
		c = c + ' domain=' + DOMAIN + ';';
	}
	document.cookie = c;
}


