//(c) 1998-2000 billy m. all rights reserved.

//browser chk variables
var ie = (navigator.appName == "Microsoft Internet Explorer") ? 1 : 0;
var ns = (navigator.appName == "Netscape") ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Macintosh")== 1) ? 1 : 0;
var version = navigator.appVersion.substring(0,3);
var browser = navigator.appName;
var safe = ( (ie && version >= "4.0") || (ns && version >= "5.0") ) ? 1 : 0;

var expiration = new Date("December, 31, 2049");
expiration.setTime (expiration.getTime()+(24 * 60 * 60 * 1000 * 365));

// function for setting a cookie.
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) + 
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

// function for retrieving a cookie.
function getCookie(name)
{
	var cname = name + "=";               
	var dc = document.cookie;             

	if (dc.length > 0) 
	{
    	begin = dc.indexOf(cname);       
    	if (begin != -1) 
		{
			begin += cname.length;       
			end = dc.indexOf(";", begin);
	    	if (end == -1) end = dc.length;
			return unescape(dc.substring(begin, end));
		} 
	}
	return null;
}

// function for deleting a cookie.
function delCookie (name,path,domain) 
{
	if (getCookie(name)) 
	{
    	document.cookie = name + "=" + ((path == null) ? "" : "; path=" + path) +
    		((domain == null) ? "" : "; domain=" + domain) +
    		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function bpVisitCnt() {
	visits = getCookie('bpvisits');	
	if(visits !=null) {
		visits++;
		setCookie('bpvisits',visits, expiration);
	}
}

function arriba() {
 // don't exec on a Mac
 if (!mac) 
 { // dont exec on other browsers except main ones cuz i cant test others
	if ( (ie && version >= "4.0") || (ns && version >="3.0") )
	{	// if out of sync
		if(top==self) 
		{ 
			var newURL = "http://www.vortex4.net/~billyfl/billyflr.html";
			var tmpUrl = document.location.href;
			var indexUrl = tmpUrl.split('/');
			var myLoc = indexUrl[indexUrl.length-1];
			setCookie('bpMyLoc',myLoc, expiration);
			if ( (ie && version >= "4.0") || (ns && version >="3.0") ) location.replace(newURL);
			else location.href = newURL;
		}
	}
 }
}

function bkout() {
 // don't exec on a Mac
 if (!mac) 
 { // dont exec on other browsers except main ones cuz i cant test others
	if ( (ie || ns) && (version >= "4.0") )
	{	// if out of sync
		var newURL = "http://www.vortex4.net/~billyfl/billyfl.html";
		if(top != self) parent.location.href = newURL;
	}
 }
}

function msg(text) { window.status=text; }

function clearMsg() {	window.status=" "; }

function openWin(url,win,toolbar,loc,dirs,stat,menu,scroll,resize, w, h, l, t) 
{ window.open("http://"+url,win,"toolbar="+toolbar+",location="+loc+",directories="+dirs+",status="+stat+",menubar="+menu+",scrollbars="+scroll+",resizable="+resize+",width="+w+",height="+h+",left="+l+",top="+t+",dependent"); }

var pmenu ='<div id="menu" style="position:absolute;top:0;z-index:100;width:120;height:100;background:darkorange;padding:2 2;border:2 outset gray;font-family:Verdana;font-size:8pt;color:black;text-align:left;font-weight:normal;cursor:hand;visibility:hidden">';
pmenu +='<div title="Click to close menu" onClick="hmenu()" style="width:120;background:crimson;text-align:center;color:white" onMouseover="msg(\'Hide menu\');return true" onMouseout="clearMsg()"><img src="images/tinymrp.gif" width=20 height=16 border=0 alt="go stroke it" align="texttop"> PervMenu</div>',
pmenu +='<div onClick="hmenu();ranpage()" onMouseover="this.style.background=\'orange\'" onMouseout="this.style.background=\'transparent\'">Random page</div>',
pmenu +='<div><hr size=3 noshade></div>';
pmenu +='<div onClick="hmenu();openWin(\'www.sextoyfun.com/billypervtoys\',\'toys\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'600\',\'400\',\'5\',\'5\')" onMouseover="this.style.background=\'orange\';msg(\'SexToys\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">Get some lube</div>',
pmenu +='<div onClick="hmenu();openWin(\'www.gamelink.com/gl/selection.asp?src=gl&ref=bperv&selection=6\',\'toys\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'yes\',\'600\',\'400\',\'5\',\'5\')" onMouseover="this.style.background=\'orange\';msg(\'Videos\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">Get porno movies</div>',
pmenu +='<div><hr size=3 noshade></div>';
pmenu +='<div onClick="hmenu();goUrl(\'frameindx.html?frames=2&tabs=pimagesmenu&menu=handsfree\')" onMouseover="this.style.background=\'orange\';msg(\'Hands-free jerk off\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">Hands-free JO</div>',
pmenu +='<div onClick="hmenu();goUrl(\'acct.html\')" onMouseover="this.style.background=\'orange\';msg(\'Update / view your billy perv club profile\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">Update profile</div>',
pmenu +='<div onClick="hmenu();openWin(\'homepages.infoseek.com/~billyfl/sign_guestbook.html\',\'SignGuestbook\',\'no\',\'no\',\'no\',\'yes\',\'no\',\'yes\',\'yes\',\'580\',\'500\',\'90\',\'10\')" onMouseover="this.style.background=\'orange\';msg(\'Sign the guestbook\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">Sign Guestbook</div>',
pmenu +='<div onClick="hmenu();goUrl(\'musicplayer.html\')" onMouseover="this.style.background=\'orange\';msg(\'Open musicPlayer\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">musicPlayer</div>',
pmenu +='<div onClick="hmenu();goUrl(\'whatsnew.html\')" onMouseover="this.style.background=\'orange\';msg(\'What`s new/updated\');return true" onMouseout="clearMsg();this.style.background=\'transparent\'">What\'s new?</div>',
pmenu +='</div>';

function goUrl(where)
{
	if (parent.main) 
		parent.main.location.href=where; 
	else
		parent.location.href=where;
}

function drawmenu() 
{	document.write(pmenu); }

function menuState() {
	if (ie || ns) 
	{
		if (safe) 
		{
			if (menu.style.visibility=='hidden') 
			{
				menu.style.top=event.clientY+2;
				menu.style.left=event.clientX-120;
				menu.style.visibility = 'visible';
			}
			else 
				menu.style.visibility = 'hidden';
		}
		else 
		{
			if (parent.main) parent.main.location.href='http://www.vortex4.net/~billyfl/pervmenu_ns.html';
		}
	 }
}

function hmenu() 
{	menu.style.visibility='hidden'; }

function ranpage() {
	p = new Array(
	'perverted.html', 'frameindx.html?frames=2&tabs=pimagesmenu&menu=hidvideo',
	'frameindx.html?frames=2&tabs=pimagesmenu&menu=cartoon',
	'frameindx.html?frames=2&tabs=pimagesmenu&menu=code',
	'favsmain.html', 'frameindx.html?frames=2&tabs=pimagesmenu&menu=gamepreload',
	'pervmenu_ns.html', 'frameindx.html?frames=2&tabs=pimagesmenu&menu=handsfree',
	'ishegay.html','uwdrawerpics.html',
	'frameindx.html?frames=2&tabs=pimagesmenu&menu=hazard',
	'http://www.one-and-only.com/menu1.htm?AssociateID=46758', 'frameindx.html?frames=2&tabs=pimagesmenu&menu=songs');

	var rannum = parseInt(Math.random()*p.length);
	if ( isNaN(rannum)) rannum = 0;
	goUrl(p[rannum]);
}

function update(which, show) {
	which = (which == null) ? 0 : 1;
	if (!show) {
		if ( safe ) drawmenu(); //pmenu
		}

	var i=0, j, indx=0; //fix netshits <4.6 y2k noncompliance and 4.6 stupid fix
	(ie || (ns && parseFloat(version) >=4.6)) ? j=4 : j=2;
	if ((ns) && (parseFloat(version) >=4.6)) indx=1;
	var updated = document.lastModified;
	var myFormat;
	myFormat = ( (!ie) && (parseFloat(version) >=4.6) ) ?  updated.split(' ') : updated.split('/');

	document.write('<p><div align="right"><table border=0 cellpadding=0 cellspacing=0 width=80><tr><td align=center><font face="Verdana" size=1 color=black>');
	if (which) document.write('['+myFormat[indx]+'.'+myFormat[++indx]+'.'+myFormat[++indx].substring(i,j)+']<br>');
	document.write('<a href="http://www.vortex4.net/~billyfl/sitemap.html" target=main onMouseover="document.smap.src=\'http://www.vortex4.net/~billyfl/images/sitemap1.gif\';msg(\'Billy`s perv website Sitemap\');return true" onMouseout="document.smap.src=\'http://www.vortex4.net/~billyfl/images/sitemap.gif\';clearMsg()"><img name=smap src="http://www.vortex4.net/~billyfl/images/sitemap.gif" width=19 height=21 border=0 alt="Site map" align=middle></a><a href="http://www.vortex4.net/~billyfl/faq.html" target=main onMouseover="document.faq.src=\'http://www.vortex4.net/~billyfl/images/faq1.gif\';msg(\'Frequently Asked Questions\');return true" onMouseout="document.faq.src=\'http://www.vortex4.net/~billyfl/images/faq.gif\';clearMsg()"><img name=faq src="http://www.vortex4.net/~billyfl/images/faq.gif" width=19 height=21 border=0 alt="F.A.Q." align=middle></a></font></td></tr></table></div>');
}

function theDate(){
	months = new Array("January","February","March","April","May","June","July","August","September","October","November","<font color=red>Dec</font><font color=green>em</font><font color=red>ber</font>");
	days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","(TGIF!) Friday","Saturday");
	var tmp = new Date();
	document.write('<font face="Tahoma, Verdana, Arial" size=1>'+days[tmp.getDay()]+", "+months[tmp.getMonth()]+' '+tmp.getDate());
	if (!ns) document.write(', '+tmp.getYear());
	document.writeln('</font>');
}

var debug=0;
var params = new Array(); //holds the parsed querystrings

function getQstring() {
	var querystring = location.search;
	if (debug) alert("q: "+querystring);
	if (querystring.length > 1) // if there is a querysring
	{	// parse querystring, substring used to ignore '?' in querystring
	   	params = querystring.substring(1,querystring.length).split("&"); 
		if (debug) alert("params: "+params);
		return true;
	}
	return false;
}

function preload(img0, img1, img2, img3, img4, img5, img6, img7, img8, img9) 
{
	for (i=0; i< 10; i++)
	{
		eval('if(img'+i+' != null){ pic'+i+'= new Image(); pic'+i+'.src=img'+i+'; }');
	}
}
