var urlFromParent,xFromParent,xName,b_thumber=false;
function embedIt(f,U){if(U.indexOf("<")>-1||U.indexOf("rawdataserver.com")>-1){f.location.href=U;return;}
var L=U.length;var u=U.toLowerCase();
if(u.lastIndexOf('.mpg')==L-4||u.lastIndexOf('.avi')==L-4||u.lastIndexOf('.wmv')==L-4||u.lastIndexOf('.asf')==L-4||u.lastIndexOf('.mpeg')==L-5)u='<embed src="'+U+'" autostart=true autostart loop=true>';
else u='<img src="'+U+'">';
f.document.open("text/html","replace");
f.document.write(u);
f.document.close();
f.location.reload();
}
function mainResize(){
if(frames[0]&&frames[0].document.forms[0]){
var w=700;
if(navigator.userAgent.indexOf('MSIE')>-1)w=document.body.clientWidth;
else w=self.innerWidth;
frames[0].document.forms[0].tfURL.style.width=w-600;
}
}
function pGetCurrentURL(){return frames[0].getCurrentURL();}
function changeAd(f){
if(!f&&Math.random()<1)return;
var n=navigator.userAgent;
if(n.indexOf("Opera")<0&&n.indexOf("Safari")<0&&n.indexOf("MSIE")>-1){//||n.indexOf("Mozilla")>-1)
 try{parent.ad.document.open("text/html","replace");
 parent.ad.document.write("<html><body vlink=0000FF bgcolor=ffffdd><center><style>.adHeadline{font:bold 9pt Courier;}.adText{font-size:7pt;}</style><SCRIPT SRC=http://3.adbrite.com/mb/text_group.php?sid=28293&newwin=1></SCRIPT>");
 parent.ad.document.close();
 parent.ad.location.reload();
}catch(e){parent.ad.location.href="ad.html";}
}else parent.ad.location.href="ad.html";
}
function getURL(){var u=this.location.href,i=u.indexOf("u=");if(i>-1){u=u.substring(i+2);return u;}return "";}
function getX(){var u=this.location.href,i=u.indexOf("?x=");if(i>-1){u=u.substring(i+3,i+4);return u;}return "0";}
function getURLFromParent(){urlFromParent=parent.getURL();setTextField();}
function getXFromParent(){xFromParent=parent.getX();}
function nameWorkaround(){
getXFromParent();
if(xFromParent=='w')xName="WebGoggles";
else if(xFromParent==2)xName="AmIAnal";
else if(xFromParent==1)xName="AmIAsian";
else xName="AmINaked";
return xName;
}
function setTextField(){
if(this.document==null||this.document.forms[0]==null||this.document.forms[0].tfURL==null)setTimeout("setTextField()",500);
else this.document.forms[0].tfURL.value=urlFromParent;
}
function setLocationField(URL){document.forms[0].tfURL.value=URL;}
function getCurrentURL(){return this.document.forms[0].tfURL.value;}
function showDir(){
var URL=this.document.forms[0].tfURL.value,r=URL.match(/^(.*\/)/);
if(r==null){alert("The NAKEDBROWSER! cannot figure out how to extract\nthe directory information from this URL.");return;}
window.open(r[1],"","");
}
function first(){
var URL=this.document.forms[0].tfURL.value,r=URL.match(/^(.*\D)(\d+)(.*)/);
if(r==null||r.length<3){alert("The NAKEDBROWSER! cannot figure out how\nto go to the first pic in the series.");return;}
var a=r[2],z=r[3],b="",zeros_then_one=false;
if(a.length>1&&a.indexOf("1")==a.length-1){
var zeros=true;
for(var j=0;j<a.length-1;j++){if(a.charAt(j)!="0"){zeros=false;break;}}
zeros_then_one=zeros;
}
if(zeros_then_one)b="1";
else{
for(var i=0;i<a.length-1;i++)b+="0";
b+="1";
var t="The NAKEDBROWSER! will try to load the first picture in the series,\nhowever, the picture may not exist on this server.";
if(b.charAt(0)=="0")t+="\n\nOR it may not be named "+b+z+". If a picture does not appear,\nyou can click the  |<  button AGAIN to load 1"+z+". (No zero.)";
if(getCookie("nopop")!="true")alert(t);
}
setLocationField(r[1]+b+r[3]);goToPic(0,false);
}
function goToPic(goNum,dir){
var URL=this.document.forms[0].tfURL.value;
if(goNum==0){setPicWindowLocation(URL);return;}
var a,b,num;
if(URL=="")return;
var r=URL.match(/^(.*\D)(\d+)(.*)/);
if(r==null||r.length<3){alert("The NAKEDBROWSER! cannot figure out how\nto change this URL to go to the next picture.");return;}
a=r[1];num=r[2];b=r[3];
if(dir){
var y=URL.indexOf("://");y=URL.indexOf("/",y+3),search=a.substring(y),myResult=search.match(/^(.*\D)(\d+)(.*)/);
if(myResult==null||myResult.length<3){alert("The NAKEDBROWSER! cannot figure out how\nto change this URL to go to the next directory.");return;}
a=URL.substring(0,y)+myResult[1];num=myResult[2];b=myResult[3]+r[2]+r[3];
}
var numLenWithZero=(""+num).length,numLenNoZero=((num-0)+"").length,original_num=num;
num=(goNum-0)+(num-0);
if(num<0){
if(goNum<-1)goToPic(-1*original_num,dir);
else alert("The NAKEDBROWSER! will not go negative.");
return;
}
var num$=""+num;
while(numLenWithZero>num$.length)num$="0"+num$;
var newNumLenNoZero=((num$-0)+"").length;
if((getCookie("nopop")!="true")&&numLenNoZero>newNumLenNoZero){
alert("The NAKEDBROWSER! is adding a zero to the URL. So instead of this:\n\n"+a+num+b+"\n\nthe URL is now this:\n\n"+a+num$+b+"\n\nAdding the zero(s) may not be necessary. If no picture shows up next,\ndelete the zero(s) and click 'go'. Hopefully you'll get a picture. You know.");
}
var newURL=a+num$+b;
setPicWindowLocation(newURL);this.document.forms[0].tfURL.value=newURL;
}
function submitPic(){if(xFromParent=="w")xFromParent=0;setPicWindowLocation("http://rawdataserver.com/cgi-bin/a/ainon.cgi?from=browz&x="+xFromParent+"&ben="+this.document.forms[0].tfURL.value);}
function showZoom(){window.open("zoom.html?nakedurl="+this.document.forms[0].tfURL.value,"","");}
function series(){
//parent.document.location.href="http://geocities.com/ableiwas2/series.html?url="+this.document.forms[0].tfURL.value;
parent.document.location.href="http://rawdataserver.com/dude/series/series.html?url="+this.document.forms[0].tfURL.value;
}
function keepPic(){window.open("http://rawdataserver.com/cgi-bin/a/my.cgi?add="+document.forms[0].tfURL.value,"","height=205,width=515,location=no,resizable=yes,menubar=yes,personalbar=no,status=no,toolbar=no");}
function initThumber(){parent.b_thumber=true;parent.poppy.location.href="thumber_index.html";setCookie("thumber","yes");}
function closeThumber(){parent.changeAd();parent.b_thumber=false;var URL=parent.pGetCurrentURL();
if(URL=="")parent.poppy.document.write("");
else parent.poppy.location.href=URL;
setCookie("thumber","no");}
function uThumb(){parent.changeAd();initThumber();}
function setPicWindowLocation(URL){parent.changeAd();if(URL!=""){


if(parent.b_thumber){
parent.poppy.setPicWindowLocation(URL);
}else{


//if(getCookie("embedit")=="true")embedIt(parent.poppy,URL);else
parent.poppy.location.href=URL;


}
//if(parent.b_thumber)parent.poppy.setPicWindowLocation(URL);
//else parent.poppy.location.href=URL;


}}
function initThumberOrNot(){

if(document.cookie.indexOf("thumber=no")>-1);else initThumber();
//if(document.cookie.indexOf("thumber=yes")>-1)initThumber();

}
function getCookie(key){var c=document.cookie,a=c.indexOf(key+"=");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 cookie_expiration=new Date();cookie_expiration.setTime(cookie_expiration.getTime()+365*24*60*60*1000);document.cookie=key+"="+val+";expires="+cookie_expiration.toGMTString();}