//ad display bug if no results
var picpane,index=0,data=[],nextPic,pixPerPage;
function init(){
picpane=parent.picpane;
var pause_time=getCookie("pausetime")-0;
if(isNaN(pause_time))pause_time=9;
document.forms[1].waitText.value=pause_time;
var ppp_index=getCookie("ppp")-0;
if(isNaN(ppp_index))ppp_index=0;
if(ppp_index>document.forms[1].ppp.length-1)ppp_index=0;
document.forms[1].ppp.selectedIndex=ppp_index;
pixPerPage=document.forms[1].ppp.options[ppp_index].value;
var srch=parent.location.href;
var n=srch.indexOf('?');
if(n>0){
srch=srch.substring(n+1);
while(1){var a=srch.indexOf("%20");if(a>-1){var sa=srch.substring(0,a);srch=sa+" "+srch.substring(a+3);}else break;}
search(srch);
}else parent.frames[1].location.href='http://rawdataserver.com/cgi-bin/a/find.cgi?fasthome=1';
}
function a(d){d.sort(new Function("return .5-Math.random()"));data=d;index=0;go(0);}
function writePics(){
var aawv="";
var adwidthv=0;
var ran=Math.random();
//aawh="<IFRAME FRAMEBORDER=0 WIDTH=728 HEIGHT=120 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad728x90.html></IFRAME>";
var ada="<IFRAME FRAMEBORDER=0 WIDTH=300 HEIGHT=240 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad.html></IFRAME>";
if(ran<1){
//adwidthv=160;aawv="<tt>&nbsp;advertisement</tt><br><IFRAME FRAMEBORDER=0 WIDTH=160 HEIGHT=620 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad160x600.html></IFRAME>";
var soich=document.forms[0].f.value;
if(soich.indexOf("'")>-1)soich='';
adwidthv=300;aawv="<IFRAME FRAMEBORDER=0 WIDTH=300 HEIGHT=270 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad300x250_AVN.html></IFRAME><br><br><IFRAME frameborder=0 marginwidth=0 marginheight=0 width=300 height=250 src='http://rawdataserver.com/cgi-bin/a/sda.cgi?s=w&w=300&q="+soich+"'></IFRAME><br><br>"+ada;
}
var rows,cols,width,adbit=0,html="<table>",frame_width=804;//user set?
if(navigator.userAgent.indexOf('MSIE')>-1)frame_width=document.body.clientWidth;else frame_width=self.innerWidth;
frame_width-=60;
frame_width-=adwidthv;
if(!frame_width)frame_width=702;
if(frame_width<420)frame_width=420;
else if(frame_width>3000)frame_width=3000;
var style="";
if(pixPerPage<2){rows=1;cols=1;width="";}
else if(pixPerPage<3){rows=1;cols=2;}
else if(pixPerPage<5){rows=2;cols=2;}
else if(pixPerPage<10){rows=3;cols=3;}
else if(pixPerPage<17){rows=4;cols=4;}
else{rows=17;cols=1;}
var footer='<br><tt> o <a href=http://webgoggles.com/ target=_top>home</a> o <a href=http://rawdataserver.com/cgi-bin/a/my.cgi target=_top>favorites</a> o <a href=http://aminaked.com/ target=_top>aminaked</a> o <a href=http://webgoggles.com/etc.html target=_top>info</a> o <a href=http://webgoggles.com/m/ target=_top>mobile</a> o</tt><br><br><font size=1 face=Arial>Photos reside on outside servers. Any copyrights held by photographers are totally still theirs.<br>If you want the link to your pic removed, <a href="mailto:webmaster@webgoggles.com">contact_us</a>.</font>';
 width=frame_width/cols;
 if(cols==1)width=0;
 var my_index=index;
for(var r=0;r<rows;r++){
 html+="<tr>";
 for(var c=0;c<cols;c++){
if(my_index>data.length-1)break;
var ihtml=getImageHTML(my_index++,width);
if(rows==17){
var adz="";
if(r==0)adz=getAd(0);
else if(r==1||r==5)adz=getAd(728);
else if(r==2||r==6)ihtml="<table><tr><td align=center>"+ihtml+"</td><td>"+getAd(120)+"</td></tr></table>";
else if(r==3||r==7)ihtml="<table><tr><td align=center>"+ihtml+"</td><td>"+getAd(160)+"</td></tr></table>";
else if(r==4){adz=getAd(300);adz="<table><tr><td>"+adz+"</td><td>"+adz+"</td></tr></table>";}
ihtml+="<br>"+adz;
}
html+="<td>"+ihtml+"</td>";
 }
html+="</tr>";
}
 var 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><head>"+style+"</head><body vlink=0000FF><center><tt>");
var numres="";
if(data.length>0){
numres=""+(index+1);
var topindex=index+(pixPerPage-0);
if(topindex>data.length)topindex=data.length;
if(pixPerPage>1&&topindex!=index+1)numres+="-"+topindex;
numres+=" of "+data.length+" results<br>";
}else numres="<br><br><br>Sorry, no results<br><br><br><br>";
picpane.document.write("<font color=FF0000 size=+2><b>"+numres+"</b></font>");
html+="</table>";
if(rows!=17)html="<table width=99%><tr><td valign=top align=center>"+html+"</td><td valign=top>"+aawv+"</td></tr></table>";
picpane.document.write(html+footer+next_pic+"</tt></center></body></html>");
picpane.document.close();
if(navigator.userAgent.indexOf("MSIE")>-1)picpane.location.reload();
picpane.scrollTo(0,0);//FF
}
function getAd(w){
var h=0;
if(w==728)h=90;
else if(w==300)h=250;
else if(w==120||w==160)h=600;
else return "<IFRAME SCROLLING=NO FRAMEBORDER=0 WIDTH=99% HEIGHT=50 MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad2.html></IFRAME>";
return "<IFRAME FRAMEBORDER=0 WIDTH="+w+" HEIGHT="+h+" MARGINWIDTH=0 MARGINHEIGHT=0 SRC=/wg/fast/firefoxad"+w+"x"+h+"_BLA.html SCROLLING=NO></IFRAME><br><br>";
}
function getImageHTML(i,width){
var p=data[i];var width_text="";
if(width>0)width_text=" width="+width;
return "<a href=\"http://NAKEDBROWSER.com/?x=w&u="+p+"\" target=_blank onclick='parent.viewer.setFocus()'>"+
"<img src=\""+p+"\""+width_text+" title='click to see more' border=0></a>"+
"<br><tt><a href='javascript:parent.viewer.keepPic("+i+")'>keep this pic</a></tt><br><br>";
}
function setPixPerPage(i,n){pixPerPage=n;writePics();setCookie("ppp",i);}
function go(n){
reset_pause=1;index=getIndex(n);
writePics();
var pause_time_box=document.forms[1].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*pixPerPage;
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[1].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[1].btSlide.value=="slideshow")return false;return true;}
function getPause(){
var p=document.forms[1].waitText.value;var q=p-0;
if(isNaN(q)||q<1)q=1;
setCookie("pausetime",q);
return q;
}
function pauseShow(){document.forms[1].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 setFocus(){document.forms[1].btNext.focus();}
function search(q){
while(1){var a=q.indexOf("+");if(a>-1){var sa=q.substring(0,a);q=sa+" "+q.substring(a+1);}else break;}
document.forms[0].f.value=q;
if(q!="")parent.borg.document.location.href="http://rawdataserver.com/cgi-bin/a/find.cgi?pb="+q;
setFocus();
}

//unused
function noFast(){parent.document.location.href="http://rawdataserver.com/cgi-bin/a/find.cgi?fastmode=2";}