
/////// Open a specify size window
function openw(url,w,h)
{
window.open(url,"","width="+w+",height="+h+",left="+(screen.width/2-w/2)+",top="+(screen.height/2-h/2));	
}

function opens(url,w,h)
{
window.open(url,"","scrollbars=yes,status=no,width="+w+",height="+h+",left="+(screen.width/2-w/2)+",top="+(screen.height/2-h/2));	
}

function info(userid)
{
if(userid>10000)
{
window.open("/member/info.aspx?userid="+userid,"","width=500,height=320,left="+(screen.width/2-240)+",top="+(screen.height/2-160));
}
}

/////// Open a fixed size window
function openwin(url)
{
opens(url,750,500)
}


function move(x,y)
{
window.resizeTo(x,y);
window.moveTo((screen.width-x)/2,(screen.height-y)/2);
}

function reloadwin()
{
var newurl=opener.document.location.href;if(newurl.indexOf('#')==newurl.length-1) newurl=newurl.substring(0,newurl.length-1);opener.document.location.href=newurl;
}


function addfavourite()
{
window.external.addFavorite('http://www.4maple.com','4Maple.com MapleStory Database');
}	
	
function getCookie(Name)
{
	return getcookie(Name)
}	
function getcookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { 
offset = document.cookie.indexOf(search)
if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1)end = document.cookie.length;
return unescape(document.cookie.substring(offset, end))
}}}


function request(queryStringName)
{var returnValue="";
var URLString=new String(document.location);
var serachLocation=-1;
var queryStringLength=queryStringName.length;
do{serachLocation=URLString.indexOf(queryStringName+"\=");
if (serachLocation!=-1){if ((URLString.charAt(serachLocation-1)=='?') || (URLString.charAt(serachLocation-1)=='&'))
{URLString=URLString.substr(serachLocation);break;}URLString=URLString.substr(serachLocation+queryStringLength+1);}}
while (serachLocation!=-1)
if (serachLocation!=-1)
{var seperatorLocation=URLString.indexOf("&");
if (seperatorLocation==-1){returnValue=URLString.substr(queryStringLength+1);}
else{returnValue=URLString.substring(queryStringLength+1,seperatorLocation);} }
return returnValue;}

function setcookie(n, v)	{
var expiredays=365;
var expire_date = new Date();
expire_date.setDate(expire_date.getDate() + expiredays );
document.cookie = n + "=" + escape( v ) + "; expires=" + expire_date.toGMTString() + "; path=/";
}

function poptop()
{
if(top.location.href.toLowerCase().indexOf("4maple.com")<0 || top.location.href==document.location.href) 
{
document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td height="38" valign="top" background="/images/popbg.gif"><a href="http://www.4maple.com" target="_blank"><img src="/images/logo1.gif" width="160" height="30" hspace="4" border="0"></a></td>');
document.write('<th align="right" background="/images/popbg.gif"><a href="#" onClick="javascript:window.close();"><font color="#FFFFFF">[ Close Window ]</font></a> &nbsp;</th>');
document.write('</tr></table>');
google_ad_client = "pub-5194445442233087";
google_ad_slot = "3750652956";
google_ad_width = 728;
google_ad_height = 90;
//document.write('<table width=100% align=center ><tr><td align=center><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></td></tr></table>');


}

}


function popad()
{


google_ad_client = "pub-5194445442233087";
google_ad_slot = "9771227643";
google_ad_width = 468;
google_ad_height = 60;

document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');

}


function popbottom()
{

google_ad_client = "pub-5194445442233087";
google_ad_slot = "3750652956";
google_ad_width = 728;
google_ad_height = 90;
//document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');

if(top.location.href.toLowerCase().indexOf("4maple.com")<0 || top.location.href==document.location.href) 
{
document.write('<table width="100%" border="0" cellspacing="6" cellpadding="3"><tr><th height="30" align="center" bgcolor="eeeeee"><input name="" type="button" value="Close Window" onClick="javascript:window.close();"></th></tr></table>');
}
for(i=0;i<100;i++) if(parent.document.getElementById('ifr'+i)) parent.document.getElementById('ifr'+i).height=1;
if(parent.document.getElementById('ifr'+request('target'))) 
parent.document.getElementById('ifr'+request('target')).height=document.body.scrollHeight;

var t=request("target");
var arr=document.links;
for(i=0;i<arr.length;i++){if(arr[i].href.indexOf("?")>0) arr[i].href+="&target="+t;else arr[i].href+="?target="+t;}
}


var sh=0;
function scrolltop()
{

	if(sh==0) sh=document.body.scrollTop;
	sh=sh*2/5;
	if(sh>1) 
	{
		window.scroll(document.body.scrollLeft,sh);
		setTimeout("scrolltop()",10);
	}
	else sh=0;
}