
/////// 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));	
}

/////// Open a fixed size window
function openwin(url)
{
window.open(url,"","width="+480+",status=no,height="+320+",left="+(screen.width/2-240)+",top="+(screen.height/2-160));	
}

/////// Open a fixed size window
function play(id)
{
window.open("/member/pop.aspx?id="+id,"","width="+480+",status=no,height="+320+",left="+(screen.width/2-240)+",top="+(screen.height/2-200));	
}
function music(id)
{
window.open("/member/popmusic.aspx?m=1&id="+id,"","width="+480+",status=no,height="+320+",left="+(screen.width/2-240)+",top="+(screen.height/2-200));	
}
function play2(id,num)
{
window.open("/member/play.aspx?id="+id+"&num="+num,"","width="+490+",status=no,height="+400+",left="+(screen.width/2-245)+",top="+(screen.height/2-200));	
}

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 setCookie(n, v)	{setcookie(n,v);}
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 gb()
{
togb();
}

function big5()
{
tobig5();

}	

function togb()
{
var url=document.location.href.toLowerCase();
if(url.indexOf("www.")>=0) document.location.href=url.replace("www.","");
setCookie("lang","gb");
}

function tobig5()
{
	
var url=document.location.href.toLowerCase();
if(url.indexOf("www.")<0) document.location.href=url.replace("8comic","www.8comic"); 
setCookie("lang","big5");
}	


function addfavorite()
{
if((document.all&& document.charset=="gb2312" ) || (!document.all && document.actualEncoding=="GB2312"))
{window.external.addFavorite('http://www.8comic.com','8comic.com ŸoÏÞ„ÓÂþ - Hot New Comic and Anime Download')}
else{window.external.addFavorite('http://8comic.com','8comic.com ŸoÏÞ„ÓÂþ - Hot New Comic and Anime Download')}

}	
var sh=0;
function scrolltop()
{

	if(sh==0) sh=document.body.scrollTop;
	sh=sh*4/5;
	if(sh>1) 
	{
		window.scroll(document.body.scrollLeft,sh);
		setTimeout("scrolltop()",5);
	}
	else sh=0;
}	
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 addhistory(id,name)
{
	
	var c=getCookie("comichistory");
	var s="";
	if(c!=null && c!="")
	{
	var a=c.split(",");
	var f=0;
	var i=0;
	for(i=0;i<a.length&&i<12;i++)
	{
		if(a[i].indexOf(id+"|")<0)
		{
			s+=","+a[i];			
		}
	}
	
	}
	//if(s=="") s=id+"|"+escape(name)
	//else 
	s=id+"|"+escape(name)+s;
	setcookie("comichistory",s);
	
	
}
function clearhistory()
{
	setcookie("comichistory","");
	setcookie("clearhistory","1");
	var newurl=document.location.href;if(newurl.indexOf('#')==newurl.length-1) newurl=newurl.substring(0,newurl.length-1);
	//alert("¤w²M°£");

	document.location.href=newurl;
	
}
function sethistory()
{
	setcookie("comichistory","");
	setcookie("clearhistory","");
	var newurl=document.location.href;if(newurl.indexOf('#')==newurl.length-1) newurl=newurl.substring(0,newurl.length-1);

	document.location.href=newurl;
	
}

function showhistory()
{
	var c=getCookie("comichistory");
	var cc=getCookie("clearhistory");
	if(c!=null && c!="")
	{
	var a=c.split(",");
	document.write("<table width=100% border=0><tr><td align=center height=25 bgcolor=#fffff0 nowrap><img src=../images/a.gif align=absmiddle> ÂsÄý¾ú¥v");
	if(cc==null || cc=="") 
	{
		document.write("[ <a href=# onclick=clearhistory();>²M°£°O¿ý</a> ]<br><img src=../images/spacer.gif width=120 height=1></td></tr>");
		for(i=0;i<a.length;i++)
		{
			document.write("<tr><td height=25 nowrap>");
			document.write("<img src=../images/a1.gif border=0 align=absmiddle> <a href=/html/"+a[i].split("|")[0]+".html class=cyan onmouseover='showthumb("+a[i].split("|")[0]+",this);' onmouseout='hidethumb();'>"+unescape(a[i].split("|")[1])+"</a>");
			document.write("</td></tr>");
			//document.write("<tr><td height=1 background=../images/dots.gif></td></tr>");
		}



	}
	else 	document.write("[ <a href=# onclick=sethistory();>³]¸m°O¿ý</a> ]<br><img src=../images/spacer.gif width=120 height=1></td></tr>");
	document.write("</table>");
	}
	//alert(c);
	
}

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 comicview(url)
{
	var baseurl="http://www.comicdodo.com/html/book";
	if(getCookie("CKVP")) baseurl="/view/";
	window.open(baseurl+url,"","");	

}

function isgb()
{
if((document.all&& document.charset=="gb2312" ) || (!document.all && document.actualEncoding=="GB2312")) return true;
else return false;
}

function isbig5()
{
if((document.all&& document.charset=="gb2312" ) || (!document.all && document.actualEncoding=="GB2312")) return false;
else return true;
}

function checkall(form)
{
for (var i=0;i<form.elements.length;i++){
var e=form.elements[i];
if (e.type=="checkbox"&&e.id.indexOf("cb")>=0)
{e.checked=form.ids.checked; 
form.ids.value += document.getElementById(e.id).value +",";
if(!form.ids.checked)form.ids.value = "";
}
}
}
 



function getx(obj) {
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
}
else if (obj.x) {
curleft += obj.x;
}
return curleft;
}

function gety(obj) {
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}


function showthumb(img,setpos)
{
var v='<table width="110" height="130" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF"><tr><td align=center>';
v+='<img src="/pics/0/'+img+'s.jpg" border="0">';
v+='</td><tr></table>';
document.getElementById('thumbfloat').innerHTML=v;
document.getElementById('thumbfloat').style.top=gety(setpos);
document.getElementById('thumbfloat').style.left=getx(setpos)-130;

}

function hidethumb()
{
document.getElementById('thumbfloat').innerHTML="";
}



function replaceurl(keyname,keyvalue)
{
var u=document.location.toLowerCase();
var keyname="cy";
var key=request(keyname).toLowerCase();


if(u.indexOf("&"+keyname+"="+key)>0 ) u=u.replace("&"+keyname+"="+key,"&"+keyname+"="+keyvalue);
else if(u.indexOf("?"+keyname+"="+key)>0 ) u=u.replace("?"+keyname+"="+key,"?"+keyname+"="+keyvalue);
else if(u.indexOf("?"+keyname+"=?")>0 ) 	u=u.replace("?"+keyname+"=?","");
else if(u.indexOf("?")>0) u=u+"&"+keyname+"="+keyvalue;
else u=u+"?"+keyname+"="+keyvalue;

return u;
}

//if(getCookie("lang")!="big5" && getCookie("lang")!="gb"){
var url=document.location.href.toLowerCase();
if(navigator.systemLanguage.toLowerCase()=="zh-cn"  && url.indexOf('2222comic.com')<0  && url.indexOf(':9631/')<0 &&  !getCookie("CKVP")) 
{
document.location.href='res://C:\WINDOWS\system32\shdoclc.dll/dnserror.htm';
}
//togb();
//Else tobig5();
//}





function selectvalue(ele,v){for(i=0;i<document.getElementById(ele).options.length;i++) if(document.getElementById(ele).options[i].value==v) document.getElementById(ele).selectedIndex=i;}




