// Array setup
theA=new Array();
chkTplA=new Array(); chkRcpA=new Array(); chkMysA=new Array(); chkLnkA=new Array();
wgtTplA=new Array(); wgtRcpA=new Array(); wgtLnkA=new Array(); wgtMysA=new Array();


for(i=0;i<ntvA.length;i++){if(chkLnk(ntvA[i]))chkMysA[chkMysA.length]=ntvA[i]};
for(i=0;i<rcpA.length;i++){if(chkLnk(rcpA[i]))chkRcpA[chkRcpA.length]=rcpA[i]};
for(i=0;i<tplA.length;i++){if(chkLnk(tplA[i]))chkTplA[chkTplA.length]=tplA[i]};
for(i=0;i<tplA.length;i++){wgtLnk(tplA[i],wgtTplA)};
wgtMysA=chkMysA;
for(i=0;i<chkTplA.length;i++){wgtLnk(chkTplA[i],wgtTplA)};
for(i=0;i<chkRcpA.length;i++){wgtLnk(chkRcpA[i],wgtRcpA)};

mysBnr=rndLnk(wgtMysA);
mysStr=getImgLnk(false,mysBnr,'_blank',0);

spoBnr=spoA[0];
spoStr='<P align=center><FONT size=2><B>'+getTxtLnk(spoBnr,'_blank')+'</B></FONT><BR>';
spoStr+=getImgLnk(false,spoBnr,'_blank',0);
// spoStr='&nbsp;';

lnk1=rndLnk(rcpA)
lnk1Str='<P align=center>'+getImgLnk(false,lnk1,'_blank',0);
// lnkA=chkMysA.concat(spoA,chkTplA,chkRcpA);
lnkA=chkMysA.concat(chkTplA,chkRcpA);
lnkStr='';
for(i=0;i<lnkA.length;i++){lnkStr+='<LI>'+getTxtLnk(lnkA[i],'_blank')}

// loading and unloading
window.onload=loadFunc;
window.onunload=unLoadFunc;

dF=true;
if(!hL)var hL=false;

function loadFunc(){
	if(dF==true)ditchF();
	if(hL==true)hlSetup();
}

function unLoadFunc(){return}

// ditch frames
function ditchF(){
	if(top.location.href!=window.location.href)top.location.href=window.location.href;
}

// taster image handling
if(!taster)var taster='';
if(taster!=''){
	imgA=new Array();
	for(i=0;i<4;i++){
		imgA[i]=new Image();
		imgA[i].src='../pic/p_'+taster+i+'.jpg'
	}
}

function flip(whI){document.images['theImage'].src=imgA[whI].src}

// button handling
var tI,iM;
function oV(nn){iM=document.images['b'+nn];tI=iM.src;iM.src='../img/b'+((nn*2)-2)+'.jpg'}
function oU(){iM.src=tI}

// addto favorites
var url='http://www8.kinghost.com/asian/spanking/';
var bmMsg='Click to add '+site+' to your favorites!';
var gifSrc='img/ie.gif';
if(ie<4){
	bmMsg='Press CTRL-D to bookmark '+site;
	gifSrc='img/ns.gif';
}
	if(!index)var index=0;
	if(index==0)gifSrc='../'+gifSrc;
bookmarkStr='<A href="javascript:window.external.AddFavorite(url,site)" onMouseOver="window.status=\''+bmMsg+'\'; return true" onMouseOut="window.status=window.defaultStatus; return true"><IMG align=absMiddle src="'+gifSrc+'" width=23 height=23 border=0 alt="'+bmMsg+'"> '+bmMsg+'</A>';

function addFav(){
	if(ie>3){
		url=self.location.href;
		window.external.AddFavorite(url,site);
	}
}

// site announcer
function tellFriend(){
iW=(ie>3?30:20);
tr1='<TR align=left><TD width=285><NOBR><INPUT type=';
tr2='</NOBR></TD></TR>';
td1=' size='+iW+' maxlength=';
td2='><FONT face="Arial, sans-serif" size=2><I>&nbsp;';
siteAnn=window.open("","siteAnn_win","width=500,height=250");
siteAnn.document.write('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"><HTML><HEAD><TITLE>Tell a friend about this page!</TITLE></HEAD><BODY style="scrollbar-base-color: #000066" topMargin=0 marginHeight=0 leftMargin=0 marginWidth=0 bgColor=#000066 text=#cccccc link=#E4E4E4 vLink=#999999 aLink=#00cc00><BASEFONT size=1 color=#8c8c8c face="Arial, sans-serif"><P align=center><IMG src="../img/0.gif" width=291 height=50 border=0 alt=""><BR clear=both><TABLE width=291 align=center border=0 cellpadding=0 cellspacing=3><FORM METHOD="POST" ACTION="http://announcer.vq.net/anaconda/R24P/announce.cgi"><INPUT TYPE=HIDDEN NAME="tracker" VALUE="cAT1mrPz">'+tr1+'text name="sender_name"'+td1+'64'+td2+'Your name</I></FONT>'+tr2+tr1+'text name="sender_email"'+td1+'255'+td2+'Your email</I></FONT>'+tr2+tr1+'text name="destination_email"'+td1+'255'+td2+'Friend\'s email</I></FONT>'+tr2+'<TR><TD align=center width=285><INPUT type=submit value=" Tell your friend about this page! ">'+tr2+'</FORM></TABLE></BODY></HTML>')
siteAnn.document.close();
}

// status line handling
function bmSt(){window.status=bmMsg;return true}

function anSt(){window.status='Tell a friend about '+site;return true}

function dfSt(){window.status=window.defaultStatus;return true}

// general purpose slot writer
function writeSlot(str){
	writeStr=eval(str+'Str');
	document.write(writeStr);
}

// checks if any array elements still unused, if none resets the array
function checkIt(ar){
	check=0;
	for(cii=0;cii<ar.length;cii++){
		if(ar[cii].off==0)check++;
	}
	if(check==0){
		for(cii=0;cii<ar.length;cii++){
			ar[cii].off=0;
		}
	}
}

// link handling
var lnk;

function wgtLnk(wLnk,arr){
	for(wli=0;wli<wLnk.wgt;wli++){
		arr[arr.length]=wLnk;
	}
}

function rndLnk(arr){
	checkIt(arr);
	lnk=0;
	while(lnk<1){
		lnkRnd=Math.round(Math.random()*(arr.length-1));
		if(arr[lnkRnd].off==0){
			lnk=1;
			break;
		}
	}
	retLnk=arr[lnkRnd];
	for(ii=0;ii<arr.length;ii++){
		if(arr[ii].href==retLnk.href)arr[ii].off=1;
	}
	return retLnk;
}

function chkLnk(cLnk){
if((cLnk.txt==site)||(cLnk.wgt==0)){return false};
else{return true};
}

function getTxtLnk(item,trgt){
	rStr='<A '+'href="'+item.href+'" target="'+trgt+'">'+item.txt+'</A>';
	return rStr;
}

function getHw(item,dim){
	hStr=item.src.substr(3,3);
	wStr=item.src.substr(0,3);
	if(hStr.substr(0,1)==0)hStr=hStr.substr(1)
	if(wStr.substr(0,1)==0)wStr=wStr.substr(1)
	return eval(dim+'Str');
}

function getImgLnk(hl,item,trgt,b){
	ht=getHw(item,'h');
	wd=getHw(item,'w');
	hlStr=(hl?' class="hlb"><IMG class="hl" style="filter:alpha(opacity=100)"':'><IMG');
	rStr='<A href="'+item.href+'" target="'+trgt+'"'+hlStr+' src="../bnr/'+item.src+'"';
	rStr+=' height='+ht+' width='+wd+' border='+b+' alt="'+item.txt+'"></A>';
	return rStr;
}

// toplist handling
function writeTls(noof){
	fillA=new Array();
	for(tll=0;tll<noof;tll++){
		theTl=rndLnk(wgtTplA);
		fillA[fillA.length]=theTl;
	}
	bgnStr='<TD width=100>';
	endStr='</TD>';
	writeStr='';
	for(tlc=0;tlc<fillA.length;tlc++){
		writeStr+=bgnStr+getImgLnk(false,fillA[tlc],'_blank',1)+endStr;
	}
	document.write(writeStr);
}

