var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
var loggedin = 0;
var zindex = 200;
var lastajaxdiv = [];
var lastajaxcontainer = [];


function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

function pop_rating(userid,type,prodid) {

var url = "http://www.findanamateur.com/cgi-bin/show_rating.pl?siteid=" + userid;

if (type && prodid) { url = url + "&type=" + type + "&productid=" + prodid; }

colWindow = window.open(url, null, "location=yes,toolbar=yes,menubar=no,status=no,scrollbars=yes,resizable=yes,width=620,height=535,dependent=yes", true);

if (colWindow.opener == null) colWindow.opener = self;



}



function send_ajax_form(ajaxform) {

var url = 'http://www.findanamateur.com/cgi-bin/newajaxform.pl';

var target = 'ajaxdiv';	

var pars = Form.serialize(ajaxform)

var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, evalScripts: true});









}













function set_movie_types(type,graphical) {

var cookie = Get_Cookie( 'types' );

var checktype = "," + type;




if (cookie) {
	if (cookie.match(checktype)) {	
	
									eval("var cookie2 = cookie.replace(/" + checktype + "/gi, '')");	cookie = cookie2;

					if (graphical > 0) {			eval("$('videotype_" + type + "_tick').src = '../../images/key/blackcheckbox.png';"); }															

					

										}

										
										
	else {
	
		 cookie = cookie + checktype; 

		if (graphical > 0) {		eval("$('videotype_" + type + "_tick').src = '../../images/key/blackcheckbox_on.png';"); }								
							
							}
		
		}
										



else if(!cookie)  { cookie=",avi,rm,wmv,dload,mpg,mov,ipod,ppm,q1,q2,q3";

	$('videotype_wmv_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_rm_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_avi_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_mpg_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_mov_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_ipod_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_dload_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_ppm_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_q1_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_q2_tick').src = '../../images/key/blackcheckbox_on.png';
	$('videotype_q3_tick').src = '../../images/key/blackcheckbox_on.png';
	//document.write("this is bollox" + cookie);

	 }

	
		

Delete_Cookie( 'types' );

Set_Cookie( 'types', cookie, 1, '\/' , '.findanamateur.com' )


// if ((type == 'ppm' || type == 'dload') && graphical > 0) { filter_types(); }


}










function switch_downloadable() {

var cookie = Get_Cookie( 'types' );

if (document.search.downloadable.checked == true) {

	if (!cookie.match("-wmv-")) { cookie = cookie + "-wmv-"; }
	if (!cookie.match("-avi-")) { cookie = cookie + "-avi-"; }
	if (!cookie.match("-mp4-")) { cookie = cookie + "-mp4-"; }
	if (!cookie.match("-mpeg-")) { cookie = cookie + "-mpeg-"; }
	if (!cookie.match("-mov-")) { cookie = cookie + "-mov-"; }
	if (!cookie.match("-rm-")) { cookie = cookie + "-rm-"; }
	if (!cookie.match("-dload-")) { cookie = cookie + "-dload-"; }

	document.search.type_wmv.checked = true;
	document.search.type_avi.checked = true;
	document.search.type_mp4.checked = true;
	document.search.type_mpeg.checked = true;
	document.search.type_mov.checked = true;
	document.search.type_rm.checked = true;
	}
	
else {
	 cookie2 = cookie.replace(/-wmv-/gi, ''); cookie = cookie2;
	 cookie2 = cookie.replace(/-avi-/gi, ''); cookie = cookie2;
	 cookie2 = cookie.replace(/-mp4-/gi, ''); cookie = cookie2;
	 cookie2 = cookie.replace(/-mpeg-/gi, ''); cookie = cookie2;
	 cookie2 = cookie.replace(/-mov-/gi, ''); cookie = cookie2;
	 cookie2 = cookie.replace(/-rm-/gi, ''); cookie = cookie2;
 	 cookie2 = cookie.replace(/-dload-/gi, ''); cookie = cookie2;

	document.search.type_wmv.checked = false;
	document.search.type_avi.checked = false;
	document.search.type_mp4.checked = false;
	document.search.type_mpeg.checked = false;
	document.search.type_mov.checked = false;
	document.search.type_rm.checked = false;

	}

Delete_Cookie( 'types' );

Set_Cookie( 'types', cookie, 1, '\/' , '.findanamateur.com' )




}









function quality() {

toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=";


var pars = '';
var target = 'ajaxdiv';	


toggle_ajaxdiv(350,200, '', pars, target);

var url = 'http://www.findanamateur.com/admin/quality_ratings.htm';

var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, evalScripts: true});

    settings = {
      tl: { radius: 10 },
      tr: { radius: 10 },
      bl: { radius: 10 },
      br: { radius: 10 },
      antiAlias: true,
      autoPad: false
    }

    var divajax = document.getElementById("ajaxcontainer");
    var cornersajax = new curvyCorners(settings, divajax);
    cornersajax.applyCornersToAll();  




}



function toggle_contactpanel(id) {

if (!id) { id = siteid; }

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=" + id;

			toggle_overlay();
			loadobjs('/css/newmessages.js');
			var url = 'http://www.findanamateur.com/cgi-bin/message_ajax.pl';
			var pars = 'famaction=compose&siteid=' + id;
			var target = 'ajaxdiv';	
			

			toggle_ajaxdiv(800,580, url, pars, target);

			return;


}


function book_meeting(type, site) {
ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=";

var today = new Date();
var offset = today.getTimezoneOffset() / 60;
offset = 0 - offset;

if (!type) { type = 'Escort'; }

if (!site) { site = siteid; }

//var sid = $F('siteid');

toggle_overlay();
			loadobjs('/css/meeting.js','/css/schedule.js','/css/validate/validation.js','/css/schedule.css');
			// var url = '/cgi-bin/bookit.pl';
			var url = '/cgi-bin/myschedule2.pl'

			var pars = 'offset=' + offset + '&siteid=' + site + '&type=' + type;
			var target = 'schedulediv';	
			
			//document.write("pars = " + pars);
			toggle_ajaxdiv(690,470, url, pars, target);


  

//curve_tabs();




}


function curve_tabs() {


  settings = {
      tl: { radius: 5 },
      tr: { radius: 5 },
      bl: { radius: false },
      br: { radius: false },
      antiAlias: true,
      autoPad: false
    }

   var etab = $('escorttab');
    var cornerscolumn = new curvyCorners(settings, etab);
    cornerscolumn.applyCornersToAll();    




}






function send_email() {


var subj = $F('subject');

if (!subj) { alert("You must enter a subject"); return false; }

var usr = $F('user');

if ($F('sendto') == "user" && !usr) { alert("You have chosen to email a user but not entered a username"); return false; }

if ($F('sendto') == "group" && $F('group') == "fanclub" && $F('fancount') == "0") { alert("There are no members in your fanclub to email"); return false; }

if ($F('sendto') == "group" && $F('group') == "customers" && $F('customercount') == "0") { alert("There are no users in your customer list to email"); return false; }

if ($F('sendto') == "group" && $F('group') == "all" && $F('allcount') == "0") { alert("There are no users in your customer list or fanclub to email"); return false; }

if ($F('sendto') == "group" && $F('grouptimeout') == "on") { alert("You have already sent a group message in the last 24 hours"); return false; }


//var mbody = tinyMCE.activeEditor.getContent({format : 'raw'});

//tinyMCE.activeEditor.save();


//var mcid = tinyMCE.selectedInstance.editorId();

//tinyMCE.execCommand('mceRemoveControl',false,mcid);

var mcid = "mailbody";

tinyMCE.execCommand('mceRemoveControl', false, mcid); 

tinyMCEmode = false;




var mbody = $F('mailbody');

var trimmbody = trimWhitespace(mbody);

if (trimmbody.length < 3) { alert("You must enter something in the message body"); return false; }



ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=";

var url = 'http://www.findanamateur.com/cgi-bin/message_ajax.pl';
var pars = Form.serialize('composemail')

var target = 'ajaxdiv';	

//document.write("pars =" + pars);

$('ajaxdiv').innerHTML = "<br><br><br><br><p align='center'><img border='0' src='http://www.findanamateur.com/images/key/waitiing.gif' width='31' height='31'></p><p align='center'><b><font face='Arial'>Sending........</font></b></p>";

var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});

//toggle_ajaxdiv(660,410, url, pars, target);


}


function trimWhitespace(value) {    
	var result = value.match(/^\s*(.*\S)\s*$/);    
	if (result !== null && result.length === 2)        return result[1];   
	 else        return value;
	 
	 };












function dominilogin() {


ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=";

var url = 'http://www.findanamateur.com/cgi-bin/admin/fam.pl';
var pars = Form.serialize('minilogin')

var target = 'ajaxdiv';	

var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});



}
















function sendmessage() {


toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=" + siteid;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = Form.serialize('contactme')

//var pars = $('contactme').serialize(true) 

var target = 'ajaxdiv';	

//var url = url + "?" + pars;

//window.open(url, null, "titlebar=yes,location=yes,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=410,height=410,dependent=yes", true);

//return;


//var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});

toggle_ajaxdiv(660,410, url, pars, target);


}




function toggle_search_rows() {

$$('tr.moviesearch').each(Element.toggle);

x = $F('moviesearchrows'); 

if (x == "on") { $('moviesearchrows').value = "off"; $('searchrowslink').innerHTML = "More Search Options"; 

																// $('searchrowsarrow').src="../../images/icons/droparrow3.png"; 
																}

else { $('moviesearchrows').value = "on"; $('searchrowslink').innerHTML = "Less Search Options";

																 // $('searchrowsarrow').src="../../images/icons/uparrow3.png";
																  }

}







function findPos(obj) {
	var curleft = curtop = 0;


if (obj.offsetParent) {

	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;

	} while (obj = obj.offsetParent);

return [curleft,curtop];
}



}
















var infovis = 0;

function showinfo(infobj,page,w,h,algn,leftshift,topshift) {

coord = findPos(infobj);

browserDims = document.viewport.getDimensions();

midpos = (browserDims.width)/2;

if (coord[0] > midpos && !algn) { algn = "left"; }

if (!w) {w = 350; }
if (!h) {h = 200; }




if (!algn || algn == "right") { arrow = "<img border='0' src='/images/menuicons/helparrow2.png' style='position: relative; left: -40px; top: -20px;  z-index: 9999'>";

								leftoffset = 90; topoffset = 35;
								 }

else if (algn == "left") { 
							moveright = parseInt(w) - 30; 
							arrow = "<img border='0' src='/images/menuicons/helparrowtop.png' style='position: relative; left: " + moveright + "px; top: -43px;  z-index: 9999'>"; 
							leftoffset = 0-(parseInt(w)); topoffset = 55;
							}

if (leftshift) { leftshift = 0 + leftshift; leftoffset = leftoffset + leftshift; }
if (topshift) {  topshift = 0 +  topshift; topoffset = topoffset + topshift; }

var test = document.getElementById('helpcontainer');

if (!test) { 




		Element.insert( $('menubar'), {  after: "<div id='helpcontainer' style='position: absolute;  z-index: 911; display: block'  > </div>"  }  );

			var divTag = $('helpcontainer');
			
			divTag.className ="helpcontainer";
			divTag.innerHTML = arrow + "<div id='helpinner'><p style='text-align: center'><br><b>Loading<br></b><br><img border='0' src='/images/key/waitiing.gif' width='31' height='31'></div>";

			$('helpcontainer').style.visibility = "visible"; 

			



				}


else { divTag = $('helpcontainer'); }



//------------------pull in help file
	if (page.match("/cgi-bin/")) { var url = page; }
	else {	var url = "/helpfiles/" + page; }
	
	var target = 'helpinner';	

	
	var myAjax = new Ajax.Updater(target, url,{method: 'get'});
	




//document.write ("w = " + w + " h = " + h);


el = $(infobj);
//se = $('helpcontainer');

Position.clone(el, divTag, { setWidth: false, offsetTop: topoffset, offsetLeft: leftoffset }); 





$('helpcontainer').style.width = w + "px";    $('helpinner').style.width = w + "px";    

$('helpcontainer').style.height = h + "px";   $('helpinner').style.height = h + "px"; 



infovis = 1;



$('helpcontainer').style.visibility = "visible"; 


}



function hideinfo() {

x = $('helpcontainer');

if (x) { $('helpcontainer').remove(); }

//$('helpcontainer').style.visibility = "hidden";

}


















function report_user() {


toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=" + siteid;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=contactform&contactid=-1&subject=Report Userid ' + siteid;
var target = 'ajaxdiv';	


toggle_ajaxdiv(660,410, url, pars, target);


}




function block_user(blockaction, blockid) {

if (!blockid) { blockid = siteid; }

toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=contactform&contactid=" + blockid;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=blockform&siteid=' + blockid + "&blockaction=" + blockaction;
var target = 'ajaxdiv';	


toggle_ajaxdiv(300,180, url, pars, target);


}

















function loadStars()
{
   star1 = new Image();
   star1.src = "/css/star1.gif";
   star2 = new Image();
   star2.src= "/css/star2.gif";
}





function toggle_feedbackpanel(type, itemid, sid) {

toggle_overlay();

if (sid > 0) { siteid = sid; }


ajaxformurl = "http://www.findanamateur.com/cgi-bin/ajaxform.pl?action=feedbackform&siteid=" + siteid;

var url = 'http://www.findanamateur.com/cgi-bin/rateit.pl';
var pars = 'famaction=showform&ajax=on&siteid=' + siteid;
var target = 'ajaxdiv';	

if (type && itemid) {

  pars = pars + "&" + type + "=" + itemid;

}

loadobjs('/css/5stars2.js','/css/datetimepicker.js');

toggle_ajaxdiv(565,490, url, pars, target);

//document.getElementById("ajaxcontainer").style.height = "430px"; 


//document.write("pars = " + pars);
}






function toggle_feedbacklist() {
toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=feedbacklist&siteid=" + siteid;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=feedbacklist&siteid=' + siteid;
var target = 'ajaxdiv';	

loadobjs('/css/5stars.js');


toggle_ajaxdiv(670,530, url, pars, target);


}





function toggle_downloadform(updateid,bundle) {

check_login();

if (loggedin == -1) { toggle_login(); return; }

toggle_overlay();

ajaxformurl = "	" + updateid;



var url = 'http://www.findanamateur.com/cgi-bin/newajaxform.pl';
var pars = 'action=downloadform&updateid=' + updateid;
var target = 'ajaxdiv';	

if (bundle == 1) {pars = pars + "&bundle=1"; }




toggle_ajaxdiv(400,230, url, pars, target);


}







function refresh_feedbacklist(tab) {

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=feedbacklist&siteid=" + siteid + "&tab=" + tab;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=feedbacklist&siteid=' + siteid + '&tab=' + tab;
var target = 'ajaxdiv';	

var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});



}




function toggle_favspanel() {

toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=favsform&siteid=" + siteid;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=favsform&siteid=' + siteid;
var target = 'ajaxdiv';	

toggle_ajaxdiv(300,200, url, pars, target);


}





function toggle_vidfavspanel(updateid) {

toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=favsform&siteid=" + updateid;

var url = 'http://www.findanamateur.com/cgi-bin/newajaxform.pl';
var pars = 'action=vidfavsform&updateid=' + updateid;
var target = 'ajaxdiv';	

toggle_ajaxdiv(260,150, url, pars, target);


}




function add_vidfavs() {

var url = 'http://www.findanamateur.com/cgi-bin/newajaxform.pl';
var pars = Form.serialize('vidfavs')

var target = 'ajaxdiv';	

var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});


}





function toggle_bookingform(type) {

toggle_overlay();

ajaxformurl = "http://findanamateur.com/cgi-bin/ajaxform.pl?action=bookingform&siteid=" + siteid + "&type=" + type;

var url = 'http://www.findanamateur.com/cgi-bin/ajaxform.pl';
var pars = 'action=bookingform&siteid=' + siteid + '&type=' + type;
var target = 'ajaxdiv';	




toggle_ajaxdiv(600,540, url, pars, target);


loadobjs('/css/datetimepicker.js','/css/booking.js');




}



function toggle_multibook(siteid, action) {

// document.write('multibook');

toggle_overlay();



if (action == "add") { var pars = 'famaction=add&siteid=' + siteid; }

var url = 'http://www.findanamateur.com/cgi-bin/multibook.pl';

var target = 'ajaxdiv';	

if (action == "display") { var pars = "famaction=display_list";
							var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});
							return; 
							 }


toggle_ajaxdiv(680,550, url, pars, target);




}


function multibook_remove(bookid) {

var url = 'http://www.findanamateur.com/cgi-bin/multibook.pl';

var target = 'ajaxdiv';	

 var pars = 'famaction=remove&bookid=' + bookid; 

var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});
}



function multibook_getform() {

var url = 'http://www.findanamateur.com/cgi-bin/multibook.pl';

var target = 'ajaxdiv';	

 var pars = 'famaction=bookform'; 

var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});

loadobjs('/css/datetimepicker.js','/css/multibooking.js');




}

function more_webcammers() {


if (webcamsearch == "on") { closeajax(); }

else { window.location.href = 'http://www.findanamateur.com/cgi-bin/membersearch2.pl?keywebcams=YES&onlinenow=yes&search=Search&webcamreport=3&sb=famusers.lastlogin-desc&title=Pre-Book%20Webcammers%20Online&page=1'; }



}


function check_booking() {

min = document.booking.minimum.value;

minx = parseInt(min);

dur = document.booking.duration.value;

durx = parseInt(dur);

if ( durx < minx || !durx) {alert("The minimum duration allowed is " + min + " mins."); 	return false; }

creditsoffered = document.booking.credits.value;

credoff = parseFloat(creditsoffered);

if (credoff <= 0 || !credoff) {alert("You must specify the number of Credits Offered"); return false; }


var bookform = document.booking;

var webcammethod = $RF(bookform, 'cammethod');


var booktype = document.booking.bookingtype.value;

if (!booktype.match(/phonechat/)) {

	if (!webcammethod || webcammethod == 0) {alert("You must specify MSN or Yahoo cams"); return false;  }
	
	}


var cookie = Get_Cookie( 'session' );

if (cookie) {var cookiesplit = cookie.split("|"); }

if (!cookie || cookiesplit[0] == -1 ) {alert("You must be logged in before you can book a show"); return false;  }

credoff = parseFloat(creditsoffered);
cred = parseFloat(cookiesplit[2]);

if (credoff > cred) {alert("You have insufficient credits"); return false; }






return true;
}



















function toggle_overlay() {

//------------------------------do overlay

var arrayPageSize = getpagedimension();

$('overlay2').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });


if (document.getElementById('menubar') == null) { var overlaytop = "10px"; }

else { var overlaytop = "80px"; }

over = $('overlay2');

var pagedims = getpagedimension();

 var styles = {
                position : 'absolute',
                top      : overlaytop,
                left     : '0px'
                
               
            };

 over.setStyle(styles);


over.style.visibility = "visible";


}

function close_ajax() {

over = document.getElementById("overlay2"); 

if (over != null && zindex <= 201) { over.style.visibility = "hidden"; }

document.getElementById(lastajaxdiv).innerHTML="";

ajaxcon = document.getElementById(lastajaxcontainer); 
ajaxcon.style.visibility = "hidden";

ajaxd = document.getElementById(lastajaxdiv);

zindex = zindex - 1;
}


function closeajax() {


if (document.getElementById("player") != null) { $('player').show(); }

over = document.getElementById("overlay2"); 

//if (over != null && zindex <= 201) { over.style.visibility = "hidden"; }

if (over != null ) { over.style.visibility = "hidden"; }

document.getElementById(lastajaxdiv).innerHTML="";

ajaxcon = document.getElementById(lastajaxcontainer); 
ajaxcon.style.visibility = "hidden";

ajaxd = document.getElementById(lastajaxdiv);

zindex = zindex - 1;
}





function toggle_ajaxdiv(width,height,url, pars, target, offsetleft, offsettop, nocorners) {

if (target == "ajaxdiv") { var container = "ajaxcontainer"; }

else { var container = target + "container"; }

test = $(target);

if (!test) {   

		var contdiv = document.createElement("div");
       
        contdiv.id = container;
        contdiv.style.visibility = "hidden";
		contdiv.className ="ajaxform";
		//contdiv.style.paddingLeft = "12px";
		//contdiv.style.textAlign = "center";
		contdiv.style.zIndex = zindex;
		

       
   		var innerdiv = document.createElement("div");
       innerdiv.id = target;
       innerdiv.style.width = "97%";
       innerdiv.style.height = "97%";
       
      // contdiv.insert(innerdiv);
      
      contdiv.innerHTML = "<div id='" + target + "' style='width: 97%; height: 97%; padding-left: 6px'></div>";
      
        document.body.appendChild(contdiv);

}


lastajaxdiv = target;
lastajaxcontainer = container;


pars = pars + "&width=" + width + "&height=" + height;

var browserDims = document.viewport.getDimensions();

var top  = (browserDims.height - height) / 2;
var left = (browserDims.width - width) / 2;


var browseroffs = document.viewport.getScrollOffsets(); 

top = top + browseroffs.top;

if (offsettop) { top = top + parseFloat(offsettop); }
if (offsetleft) { left = left + parseFloat(offsetleft); }


//var x = document.viewport.getWidth();

var cont = $(container);
 var styles = {
                position : 'absolute',
                top      : top + 'px',
                left     : left + 'px',
                width	 : width + 'px',
                height	 : height + 'px'
               
            };
 
            cont.setStyle(styles);




$(container).style.visibility = "visible";

Effect.Grow(container,{ duration: 0.6, direction: 'top-left' })

$(target).innerHTML = "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p align='center'><img border='0' src='../../css/lightbox/images/loading.gif'></p><p align='center'><b>LOADING..........</b></p>";


zindex = zindex + 1;

if (!url) { return; }




var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars, evalScripts: true});

if (!nocorners) {
    settings = {
      tl: { radius: 10 },
      tr: { radius: 10 },
      bl: { radius: 10 },
      br: { radius: 10 },
      antiAlias: true,
      autoPad: false
    }

    var divajax = document.getElementById(container);
    var cornersajax = new curvyCorners(settings, divajax);
    cornersajax.applyCornersToAll();  
}












}
















function growheight( maxheight) {

minheight = minheight + 15;

if (minheight > maxheight) {clearInterval (hinterval); 
				ajaxpage(ajaxformurl, 'ajaxdiv'); 

				return; }

div = document.getElementById("ajaxdiv"); 

div.style.height = minheight + "px";

div1 = document.getElementById("ajaxcontainer"); 

div1.style.height = minheight + "px";



//setTimeout("growheight(" + maxheight + "," + minheight + ")",1);


}



function growwidth( maxwidth, maxheight) {

minwidth = minwidth + 30;

if (minwidth > maxwidth) {clearInterval (winterval); 
				hinterval = setInterval ("growheight(" + maxheight + ")",1);

				 return; }

div = document.getElementById("ajaxdiv"); 

div.style.width = minwidth + "px";

div1 = document.getElementById("ajaxcontainer"); 

div1.style.width = minwidth + "px";


// document.write("minw = " + minwidth + "  max=" + maxwidth);



//setTimeout("growwidth(" + maxwidth + "," + minwidth + ")",1);


}





function popsample(file,nickname,title,type,bitrate) {


//nickname = unescape(nickname);
//title = unescape(title);
//type = unescape(type);
//bitrate = unescape(bitrate);

var url = "http://www.findanamateur.com/player/playertest9.htm?file=" + file + "&nickname=" + nickname + "&title=" + title + "&type=" + type + "&bitrate=" + bitrate;



// var url = "http://findanamateur.com/player/playertest10.htm?file=" + file;

//colWindow = window.open(url, null, "help=no,status=no,scrollbars=no,resizable=no,width=350,height=260,dependent=yes", true);

colWindow = window.open(url, null, "titlebar=no,location=no,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,width=410,height=410,dependent=yes", true);

if (colWindow.opener == null) colWindow.opener = self;



}


function pophelp(width,height,page) {

var url = "http://www.findanamateur.com/helpfiles/" + page;



colWindow = window.open(url, null, "titlebar=no,location=no,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",dependent=yes", true);

if (colWindow.opener == null) colWindow.opener = self;



}

function check_freeclips() {

count = Get_Cookie( 'freeclips' );

if (!count) { count = 0; }

else { count=parseInt(count); }

count = count + 1;
 Delete_Cookie( 'freeclips' );

Set_Cookie( 'freeclips', count, 1, '\/' , '.findanamateur.com' )

return count;

}









function popvideo(updateid) {

check_login();
if (loggedin == -1) {  toggle_login(); return; 

						//var freeclips = check_freeclips();

					  //if (freeclips > 4) { toggle_login(); return; }
	}





var url = "/cgi-bin/newmovie_preview3.pl?updateid=" + updateid;

colWindow = window.open(url, "popvid", "titlebar=no,location=no,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width=1020,height=625");

if (colWindow.opener == null) { colWindow.opener = self; }





}

function popppm(width,height,id) {

check_login();

if (loggedin == -1) { toggle_login(); return; }




url = "http://www.findanamateur.com/player/ppmplayer/PPMPlayer2.html?s=0&l=-1&updateid=" + id + "&moviename=" + id + "-" + id + ".flv";

width = parseInt(width) + 80;
height = parseInt(height) + 60;

if (width < 930) { width = 930; }

if (height < 630) { height = 630; }

//document.write("width " + width + "  height " + height);

colWindow = window.open(url, "popppm", "titlebar=no,location=no,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);

if (colWindow.opener == null) { colWindow.opener = self; }


}



function check_login() {

var cookie = Get_Cookie( 'session' );

if (cookie) {var cookiesplit = cookie.split("|"); }

if (!cookie || cookiesplit[0] == -1 ) {	loggedin = -1; return;	}

//-------------------now check session is valid

var session = cookiesplit[0] + "|" + cookiesplit[1] + "|" + cookiesplit[2] + "|" + cookiesplit[3];

var randomnumber=Math.floor(Math.random()*1000)

var urltest = window.location.href;

if (urltest.indexOf("dev.findanamateur") > 0) { var url = 'http://dev.findanamateur.com/cgi-bin/admin/check_session.pl?sessionid=' + session + '&rand=' + randomnumber; }

else { var url = 'http://www.findanamateur.com/cgi-bin/admin/check_session.pl?sessionid=' + session + '&rand=' + randomnumber; }



new Ajax.Request(url,  
 {     method:'get', 
	   
	    onSuccess: successfunc,
	    onFailure: failurefunc
	    
	      }); 
	    
	
    
}	    
	    
	    
	    
function successfunc(response) {

		var text = response.responseText;

		if (text.match("ok")) { loggedin = 0; }

		

			}	    
	    



function failurefunc() {

		return "Error. ajax failed";

		loggedin = -1; 


		}


















function toggle_login() {

toggle_overlay();

						url = "/cgi-bin/helpfiles/login.pl";
						pars = '';
						target = 'ajaxdiv';	
						toggle_ajaxdiv(470,400, url, pars, target);

						return;



}









function searchdiv(div) {

check = document.getElementById(div).style.display;

field = '';



if (div.search(/webcams/) > 0) {field = "keywebcams"; }
else if (div.search(/escort/) > 0) {field = "keyescort"; }
else if (div.search(/modelling/) > 0) {field = "keymodel"; }
else if (div.search(/physical/) > 0) {field = "keyphysical"; }
else if (div.search(/general/) > 0) {field = "keygeneral"; }
else if (div.search(/location/) > 0) {field = "keylocation"; }

//document.write("div = " + div + " field = " + field);



if (check == "none") {check = "block"; 
					 if (field) {	eval("document.membersearch." + field + ".checked = true;");    }
						}
	else {check = "none"; 
		 if (field) {	eval("document.membersearch." + field + ".checked = false;");    }

			}

document.getElementById(div).style.display = check;

document.getElementById('centerpanel').style.height = "1350px";


}














function changebust() {

chest = document.forms[0].chest.value;
cup = document.forms[0].cup.value;

document.forms[0].bust.value = chest + cup;


//document.getElementById('bustdiv').innerHTML="cup " + cup + " chest " + chest;


}




function read_results() {

document.getElementById('ajaxdiv').innerHTML = frames['results'].document.body.innerHTML;

}



function flashonline() {


$$(".flashonlinetext").each(function(elmt) { elmt.toggle(); });





}



function init_overs() {

clearInterval(flonline);
var flonline = setInterval ( "flashonline()", 600 ); 


var d = document.getElementsByClassName('download')

for (var i=0;i<d.length;i++) {
d[i].onmouseover = function()
	{
	if (!this.src) { this.toggleClassName('buttonover'); }

	id = this.id;

	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=download";


	showinfo(this,str,'240','80');



	};
d[i].onmouseout = function()
{
hideinfo();

if (!this.src) { this.toggleClassName('buttonover'); }

};
}



var d = document.getElementsByClassName('paypermin')



for (var i=0;i<d.length;i++) {
d[i].onmouseover = function()
	{
	
	if (!this.src) {
		this.toggleClassName('buttonover')
		}
	
	id = this.id;

	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=ppm";


	showinfo(this,str,'240','80');



	};
d[i].onmouseout = function()
{
hideinfo();
if (!this.src) {
	this.toggleClassName('buttonover')
	}
};
}





var d = document.getElementsByClassName('bundle')



for (var i=0;i<d.length;i++) {
d[i].onmouseover = function()
	{

	this.toggleClassName('buttonover')

	
	id = this.id;

	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=bundle";


	showinfo(this,str,'240','70');



	};
d[i].onmouseout = function()
{
hideinfo();

this.toggleClassName('buttonover')

};
}



var d = document.getElementsByClassName('star')

for (var i=0;i<d.length;i++) {
d[i].onmouseover = function()
	{
	
	id = this.id;

	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=rating";


	showinfo(this,str,'350','180');



	};
d[i].onmouseout = function()
{
hideinfo();
};
}

















var d = document.getElementsByClassName('starrating')

for (var i=0;i<d.length;i++) {
d[i].onmouseover = function()
	{
	
	id = this.id;

	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=rating";


	showinfo(this,str,'350','180');



	};
d[i].onmouseout = function()
{
hideinfo();
};
}



var d = document.getElementsByClassName('free')

for (var i=0;i<d.length;i++) { d[i].onmouseover = function()
	{
	
	this.toggleClassName('buttonover')

	};
d[i].onmouseout = function()
{
this.toggleClassName('buttonover')
};
}


var d = document.getElementsByClassName('yahoo');

for (var i=0;i<d.length;i++) {
	d[i].onmouseover = function()
		{	showinfo(this,'schedule/yahoo.htm','240','70','right',-37,-5);	};

d[i].onmouseout = function()
	{   hideinfo();  };
}

var d = document.getElementsByClassName('msn');

for (var i=0;i<d.length;i++) {
	d[i].onmouseover = function()
		{	showinfo(this,'schedule/msn.htm','240','70','right',-30,0);	};

d[i].onmouseout = function()
		{   hideinfo();  };
}


var d = document.getElementsByClassName('skype');

for (var i=0;i<d.length;i++) {
	d[i].onmouseover = function()
		{	showinfo(this,'schedule/skype.htm','240','70','right',-30,0);	};

d[i].onmouseout = function()
		{   hideinfo();  };
}


var d = document.getElementsByClassName('camppm');

for (var i=0;i<d.length;i++) {
	d[i].onmouseover = function()
		{	showinfo(this,'schedule/ppm.htm','250','130','',-30,0);	};

d[i].onmouseout = function()
		{   hideinfo();  };
}


var d = document.getElementsByClassName('camprebook');

for (var i=0;i<d.length;i++) {
	d[i].onmouseover = function()
		{	showinfo(this,'schedule/prebook.htm','300','160','',-30,0);	};

d[i].onmouseout = function()
		{   hideinfo();  };
}






var d = document.getElementsByClassName('innerbutton');

for (var i=0;i<d.length;i++) { d[i].onmouseover = function()
	{
	id = this.id;

	dl = id.indexOf("dl");

	if (dl >= 0) {
	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=download";
	showinfo(this,str,'240','80','right',50,0);
	}

	pp = id.indexOf("ppm");
	
	if (pp >= 0) {
	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=ppm";
	showinfo(this,str,'240','80','right',50,0);
	}
	
	zip = id.indexOf("zip");
	
	if (zip >= 0) {
	var str = "/cgi-bin/helpfiles/user_movietypes.pl?updateid=" + id + "&type=zip";
	showinfo(this,str,'240','80','right',50,0);
	}
	

	this.addClassName('buttonover');

	};
d[i].onmouseout = function()
{
	this.removeClassName('buttonover');

	hideinfo();

};
}


}






    //  getPageSize()
    //
   function getpagedimension() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}







function toggle_checkbox_light(boxname) {

x = $F(boxname);

if (x == "on") { $(boxname).value = "off"; eval("$('" + boxname + "_tick').src = '/images/key/chkboxoff2.png';"); }

else { $(boxname).value = "on";      eval("$('" + boxname + "_tick').src = '/images/key/chkboxon.png';"); 		

					}

}























