var topmsg='';var X="",WORD="Naked",host_num=Math.floor(Math.random()*3),picpane,index=0,data=[],nextPic;
function init(){
var u=window.location.href;
if(u.indexOf("/dude2/fast")>-1){X=2;WORD="Anal";}
else if(u.indexOf("/dude1/fast")>-1){X=1;WORD="Asian";}

//if(X>0)topmsg='';

picpane=parent.picpane;
setHost(host_num);
setFocus();
var pause_time=getCookie("pausetime")-0;
if(isNaN(pause_time))pause_time=9;
document.forms[0].waitText.value=pause_time;
}
function a(d){d.sort(new Function("return .5-Math.random()"));data=d;index=0;go(0);}
function vote(n){
go(1);
setFocus();
var frm=parent.frames['vote'].document.forms[0];
if(!frm)return;
frm.fvote.value=frm.fvote.value+data[index]+n+" ";
if(frm.fvote.value.length>1000)frm.submit();
}
function go(n){
reset_pause=1;
index=getIndex(n);
writePics();
var pause_time_box=document.forms[0].waitText.value-0;
if(isNaN(pause_time_box))pause_time_box=9;
var pause_time_cookie=getCookie("pausetime")-0;
if(pause_time_box!=pause_time_cookie)setCookie("pausetime",pause_time_box);
}
function getIndex(n){
n=index+n;
if(n>data.length)n=0;
else if(n<0)n=data.length-1;
return n;
}
var reset_pause=0;
function slideshow(){
if(slideshowIsRunning()){
pauseShow();
reset_pause=0;
}else{
document.forms[0].btSlide.value="pause";
goSlideshow();
}
}
function goSlideshow(){
if(slideshowIsRunning()){
if(reset_pause>0)reset_pause=0;
else go(1);
setTimeout("goSlideshow()",getPause()*1000);
}
}
function slideshowIsRunning(){if(document.forms[0].btSlide.value=="slideshow")return false;return true;}
function getPause(){
var p=document.forms[0].waitText.value;var q=p-0;
if(isNaN(q)||q<1)q=1;
setCookie("pausetime",q);
return q;
}
function pauseShow(){document.forms[0].btSlide.value="slideshow";}
function getCookie(key){
var c=document.cookie;
var a=c.indexOf(key+"="); //buggish?
if(a<0)return "";
a+=key.length+1;
var b=c.indexOf(";",a);
if(b<=a)return c.substring(a);
return c.substring(a,b);
}
function setCookie(key,val){
if(getCookie(key)==val)return;
var d=new Date();var p=Date.parse(d);
d.setTime(p+365*24*60*60*1000);
var u=d.toUTCString();
document.cookie=key+"="+val+";expires="+u;
}
function keepPic(n){
setFocus();
window.open("http://rawdataserver.com/cgi-bin/a/my.cgi?add="+data[n],"","height=205,width=515,location=no,resizable=yes,menubar=yes,personalbar=no,status=no,toolbar=no");
//window.focus();
}
function setHost(n){host_num=n;parent.borg.document.location.href=""+n+".html";}
function setFocus(){document.forms[0].btNext.focus();}
function getSidebar(){
var html = "<pre>  <b>AmI"+WORD+".com\nAmI"+WORD+"OrNot.com</b>\n\nPrevious votes\nfor this picture:\n\n\n\n\n   FAST MODE\n\n\n\n\n<label for=k><b><font color=FF0000>  Collect your\n   favorites</font>\n< <a href='javascript:parent.viewer.keepPic("+index+")' id=k>keep this pic</a> </b></label>"
+'\n\n\n<form action=http://webgoggles.com/ target=_blank> <input type=text name=f style="width:76px;height:19px;font-size:11px;font-family:arial;"><input type=submit value=search style="width:44px;height:22px;font-size:11px;font-family:arial;">'
+'\n\n\no <a href=http://rawdataserver.com/cgi-bin/a/my.cgi target=_top>favorites</a>'
+'\no <a href=http://aminaked.com/store/ target=_blank>adult shop</a>'
+'\no <a href=http://aminaked.com/poker/ target=_top>poker game</a>'
+'\no <a href=http://AmI'+WORD+'.com/etc.html target=_blank>info & links</a>'
+'\no <a href=http://AmI'+WORD+'.com/m target=_top>mobile version</a>'
+'\n\n\nYou may find that\n"Am I '+WORD+'?" has\nlittle to do with\n...never mind.\n\nEnjoy,\n\nThe Team';
return html+"</pre></form>";
}
function getAd(){
var adtype="A";
var ran=Math.random();
if(ran<.5)adtype="B";
return "<IFRAME FRAMEBORDER=0 WIDTH=300 HEIGHT=999 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=ad"+adtype+".html SCROLLING=NO></IFRAME>";
}
function writePics(){
var nb_link="http://NAKEDBROWSER.com/?x="+X+"&u="+data[index];

//var BGCOLOR="000000",TEXTCOLOR="FF0000",LINKCOLOR="FF0000",SIDEBAR_BG="ff8c00";
var BGCOLOR="DDDDD0",TEXTCOLOR="000000",LINKCOLOR="0000EE",SIDEBAR_BG="FFFFFF";

var html="<html><body bgcolor="+BGCOLOR+" text="+TEXTCOLOR+" link="+LINKCOLOR+" vlink="+LINKCOLOR+" alink="+LINKCOLOR+">"+
"<table><tr><td valign=top>"+"<font face=arial><center>"+"<form>"+topmsg+"<small><br></small><b><font size=+1>vote:"
+"&nbsp;&nbsp;<a href='javascript:parent.viewer.vote(0);'><input type=radio name=vote onclick='parent.viewer.vote(0)'>Yes</a>"
+"&nbsp;&nbsp;<a href='javascript:parent.viewer.vote(1)'><input type=radio name=vote onclick='parent.viewer.vote(1)'>No</a>"
+"&nbsp;&nbsp;<a href='javascript:parent.viewer.vote(2)'><input type=radio name=vote onclick='parent.viewer.vote(2)'>Eh</a>"
+"&nbsp;&nbsp;<a href='javascript:parent.viewer.vote(3)'><input type=radio name=vote onclick='parent.viewer.vote(3)'>Trash it</a>"
+"</font></b></form>"+
"<a href=\""+nb_link+"\" target=_blank onclick='parent.viewer.setFocus()'>"+
"<img src=\""+data[index]+"\" border=0></a>"+
"<br><b><font color=FF0000>This pic may work in our <a href='"+nb_link+"' target=_blank>NAKEDBROWSER!</a> See more!</font></b>"+
"<br><font size=1>Photos reside on outside servers. Any copyrights held by photographers are totally still theirs. If you want the link to your pic removed, <a href=mailto:webmaster@AmI"+WORD+".com>contact_us</a>.</font>"+
"<br><form target=_blank action='http://rawdataserver.com/cgi-bin/a/ainon.cgi'>please enter your own pic or movie link (.jpg .gif .mpg) to help keep things interesting. thanks.<br><input type=hidden name=x value="+X+"><input type=text name=ben size=59><input type=submit value=add></form></center></font></td><td bgcolor="+SIDEBAR_BG+" valign=top>"+getSidebar()+"</td><td valign=top align=center>"+getAd()+
"</td></tr></table>";
var my_index=index,next_pic="";
if(++my_index<data.length){
next_pic="<script>loadNextPic();function loadNextPic(){var can_stop=true;for(var j=0;j<document.images.length;j++){if(!document.images[j].complete){can_stop=false;break;}}if(can_stop){var im=new Image();im.src='"+data[my_index]+"';}else setTimeout('loadNextPic()',1000);}</script>";
}
picpane.document.open("text/html","replace");
picpane.document.write(html+next_pic+"</body></html>");
picpane.document.close();
if(navigator.userAgent.indexOf("MSIE")>-1)picpane.location.reload();
}

//the following is no longer used
function noFast(){parent.document.location.href="http://rawdataserver.com/cgi-bin/a/ainon.cgi?x="+X+"&fastmode=2";}