image1 = new Image();
image1.src = "/images/yes.png";

image2 = new Image();
image2.src = "/images/no.png";

var links = [
             "http://www.adultfriendfinder.com/go/g1217743-ppc",
             "http://cluster.adultadworld.com/redir/default.aspx?s=21788&c=2409",
             "http://www.amigos.com/search/g1217743-pmem?ip=auto",
             "http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t1&psprogram=REVS&pstool=31_2",
		"http://millionairemate.com/search/g1217743-pmem?ip=auto&show_city=1",
//"http://www.gameshowporn.com","http://www.hqcamgirls.com","http://www.fapjunky.com",   "http://sexier.com/services/directlinkhandler.ashx?WID=125249468925&LinkID=1078&promocode=BCODEL0000021_00000"
             ];
var banners = Array(
	{html:'<iframe style="vertical-align: middle;" height="260" src="http://banners.adultfriendfinder.com/piclist?lang=english&background_color=%23fffaf5&border_color=193441&js_select=1&link_color=800000&models=0&movie=0&pic_border_color=193441&pic_border_width=1&pid=g1217743-ppc&rollover_header_color=%23d6c0bf&rows=1&show_join link=0&text_color=%23000000&title_color=800000&iframe=1" scrolling="no" width="740" frameborder="0"></iframe>',width:260,height:740},
	{html:'<iframe src="http://banners.adultfriendfinder.com/go/page/iframe_cm_17857?lang=english&pid=g1217743-ppc" align="middle" frameborder="no" width="728" height="90"></iframe>',width:728,height:90},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/piclist?pid=g1217743-ppc&display=flash_design_06&width=750&photo=2&banner_title=Sexy%20People%20in%20%5BLOC%5D%20are%20Looking%20to%20Hook%20Up%20Now%21&overlay_text=Looking%20to%20hook%20up%21&page=video&filter_show_sex=2&text_color=%23000000&link_color=%233366CC&background_color=transparent&overlay_color=%23E8E8E8&overlay_text_color=%23000000&photo_frame_color=%23CC0000&photo_frame_text_color=%23FFFFFF&bar_bg=%23000000&bar_text=%23FFFFFF&button_bg=%23CC0000&button_text=%23FFFFFF&thumb=portrait&iframe=1&lang=english" width="160" height="600" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no" allowtransparency="true"></iframe>',width:160,height:600},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/piclist?pid=g1217743-ppc&display=flash_design_05&width=750&photo=2&banner_title=Sexy%20People%20in%20%5BLOC%5D%20are%20Looking%20to%20Hook%20Up%20Now%21&overlay_text=Looking%20to%20hook%20up%21&text_color=%23000000&link_color=%233366CC&background_color=transparent&overlay_color=%23E8E8E8&overlay_text_color=%23000000&photo_frame_color=%23CC0000&photo_frame_text_color=%23FFFFFF&bar_bg=%23000000&bar_text=%23FFFFFF&button_bg=%23CC0000&button_text=%23FFFFFF&thumb=thumb&page=search&target=_blank&iframe=1&lang=english" width="728" height="90" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no" allowtransparency="true"></iframe>',width:728,height:90},
	 {html:'<a href="http://join.hookup.com/track/MTAwNjgyLjE5LjEuMS4wLjEwMDAwNjEuMC4wLjA" target="_blank"><img src="http://affiliates.hookup.com/banners/1000061_name.gif?clickTAG=http://join.hookup.com/track/MTAwNjgyLjE5LjEuMS4wLjEwMDAwNjEuMC4wLjA"  border=0></a>',width:728,height:90},
	 {html:'<embed src="http://affiliates.hookup.com/banners/1000128_name.swf?clickTAG=http://join.hookup.com/track/MTAwNjgyLjE5LjEuMS4wLjEwMDAxMjguMC4wLjA" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="160" height="600"></embed>',height:600,width:600},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/go/page/js_social_media?width=180&height=600&find_sex=2&looking_for_person=1&photo=1&page=search&pid=g1217743-ppc&skip_lpo=1&iframe=1&popunder_off=1&no_click=1" width="180" height="600" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',width:180,height:600},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/p/flash_banner.cgi?pid=g1217743-ppc&no_click=1&sSiteName=ffadult&Banner_ID=19" align="middle" frameborder="no" width="748" height="110"></iframe>',width:748,height:110},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/p/flash_banner.cgi?pid=g1217743-ppc&no_click=1&sSiteName=ffadult&Banner_ID=5" align="middle" frameborder="no" width="580" height="285"></iframe>',width:580,height:285},
	 {html:'<iframe src="http://banners.adultfriendfinder.com/p/flash_banner.cgi?pid=g1217743-ppc&no_click=1&sSiteName=ffadult&Banner_ID=1" align="middle" frameborder="no" width="140" height="620"></iframe>',width:140,height:620},
	 {html:'<a href="http://www.amateurmatch.com/?from_gmap=1&ainfo=Mjc1OTR8NnwxNDg5&atcc=Mjc1OTR8NnwxNDg5&skin=6" target="_blank"><img border="0" src="http://iframe.amateurmatch.com/geoip_banner/gmap_301.php?gmap=true&niche=teen&endAge=25&num=5&size=160"></a>',width:160,height:600},
	{html:'<a href="http://www.amateurmatch.com/?from_gmap=1&ainfo=Mjc1OTR8NnwxNDg5&atcc=Mjc1OTR8NnwxNDg5&skin=6" target="_blank"><img border="0" src="http://iframe.amateurmatch.com/geoip_banner/gmap_301.php?gmap=true&niche=teen&endAge=25&num=7&size=728"></a>',width:728,height:90},
	{html:'<iframe id="geobanner" src="http://geobanner.millionairemate.com/go/page/iframe_geobanner_160x600?pid=g1217743-pmem&numpins=10&find_sex=2&looking_for_person=1&age=18-35&photo=1&thumb=portrait&varname=simple&page=registration&banner_title_preset=1" width="160" height="600" frameborder="0" marginheight="0" marginwidth="0" align="middle" scrolling="no"></iframe>',width:160,height:600},
	{html:'<iframe src="http://live-cams-1.livejasmin.com/int/?t_id=nilzzz_01&psid=nilzzz&pstour=t3&psprogram=REVS&site=jsm" scrolling="no" align="MIDDLE" width="640" height="150" frameborder="No" marginHeight="0" marginWidth="0"></iframe>',height:150,width:600},
	{html:"<a title='Free live sex chat' href='http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t3&psprogram=PPS&pstool=1_39475' target='_blank'><img alt='Free live chat feeds' src='http://static.awempire.com/ban/120x600/120x600_146.gif' border='0' ></a>",height:150,width:600},
	{html:"<a title='Free live sex chat' href='http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t3&psprogram=PPS&pstool=1_39539' target='_blank'><img alt='Free live chat feeds' src='http://static.awempire.com/ban/728x90/728x90_214.gif' border='0' ></a>",height:90,width:728},
	{html:"<a title='Join for free' href='http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t3&psprogram=PPS&pstool=1_15607' target='_blank'><img alt='No credit Card needed' src='http://static.awempire.com/ban/624x80/624x80_1.gif' border='0' ></a>",height:80,width:624},
	{html:'<a target="_blank" href="http://sexier.com/services/directlinkhandler.ashx?WID=125249468925&LinkID=1080&promocode=BCODE97769H73_00000&cid=8&queryid=1"><img src="/images/sexier_banner_160_600.jpg" border="0"></a>',height:600,width:160},
	{html:'<a href="http://click.dtiserv2.com/Click2/1407001-407-us7661" target="_blank"><img src="http://affiliate.dtiserv.com/image/sakuralive_en/1354053_b.gif" border="0"></a>',height:600,width:120},
	{html:'<a href="http://click.dtiserv2.com/Click2/1407001-407-us7661" target="_blank"><img src="http://affiliate.dtiserv.com/image/sakuralive_en/728x90_sl_2.gif" border="0"></a>',height:90,width:728},
	{html:'<a href="http://click.dtiserv2.com/Click2/1407001-407-us7661" target="_blank"><img src="http://affiliate.dtiserv.com/image/sakuralive_en/160x600_sl_3.jpg" border="0"></a>',height:600,width:160},
	{html:'<a href="http://click.dtiserv2.com/Click2/1407001-407-us7661" target="_blank"><img src="http://affiliate.dtiserv.com/image/sakuralive_en/120x600_sl_1.gif" border="0"></a>',height:600,width:120},
	{html:'<a href="http://click.dtiserv2.com/Click2/1407001-407-us7661" target="_blank"><img src="http://affiliate.dtiserv.com/image/law/1407001_b.jpg" border="0"></a>',height:600,width:160},
	{html:'<a title="Free live sex chat" href="http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t1&psprogram=PPS&pstool=1_16083" target="_blank"><img alt="Free live chat feeds" src="http://static.awempire.com/ban/160x600/160x600_15.gif" border="0" ></a>',height:600,width:160},
	{html:'<a title="Free live sex chat" href="http://www.livejasmin.com/listpage.php?psid=nilzzz&pstour=t1&psprogram=PPS&pstool=1_16083" target="_blank"><img alt="Free live chat feeds" src="http://static.awempire.com/ban/160x600/160x600_7.gif" border="0" ></a>',height:600,width:160},
	{html:'<IFRAME SRC="http://ifa.camads.net/dif/?cid=160x530&mta=348149&tid=623699&camseqid=348" allowtransparency=true width="160" height="530" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></IFRAME>',width:160,height:530}
); 	
 /*{html:'',height:90,width:728}*/
function postIt(data,onSuccess){
	$.ajax({
	   type: "POST",
	   url: ajax_file,
	   data: data,
	   cache:false,
	timeout:15000,
	error : function(xhr, textStatus, errorThrown ) {
     		if (textStatus == 'timeout') {
      		 $.ajax(this);
      		 return;
     		}
	  },

	   success: function(m){
			var msg = $.parseJSON(m);
			if(typeof onSuccess == 'function'){
				onSuccess(msg.msg);
			}
			if(	msg.callback ){
				eval(msg.callback);
			}
			else{
				ajaxError(msg.error);
			}
	   }
	});
}
function resendVerification(uid,email){
	var a = new Object();
	a['user_id']=uid;
	a['email']=email;
	var data = "action=resendVerification&json="+JSON.stringify(a);
	postIt(data,{});
}
function resetPassword(email){
	var a = new Object();
	a['email_reset']=email;
	var data = "action=resetPassword&json="+JSON.stringify(a);
	postIt(data,{});
}
function loadAjax(url,data){
	if(typeof data != 'undefined')
		loadAjaxData(url,data)
	else 
		loadAjaxData(url,'is_ajax=true');
}
function loadStylesheet(href){
	var domain = window.location.origin;
	for(var i in document.styleSheets){
		if(document.styleSheets[i].href == domain + href)
			return false;
	}
	var style   = document.createElement("link");
	style.type  = "text/css";
	style.rel	= "stylesheet";
	style.href   = href;
	document.getElementsByTagName('head')[0].appendChild(style);
	
}
function loadScript(url,callback){
	 var head = document.getElementsByTagName("head")[0];
     var script = document.createElement("script");
     script.src = url;

     // Attach handlers for all browsers
     var done = false;
     script.onload = script.onreadystatechange = function()
     {
             if( !done && ( !this.readyState 
                                     || this.readyState == "loaded" 
                                     || this.readyState == "complete") )
             {
                     done = true;
                     if(typeof callback =='function')
                    	 callback();

                     // Handle memory leak in IE
                     script.onload = script.onreadystatechange = null;
                     head.removeChild( script );
             }
     };

     head.appendChild(script);
}
 function loadAjaxData(url,data){
 	$.ajax({
 		type:"POST",
 		cache:false,
 		url:url,
 		timeout:15000,
 		data:data,
 		success:function(response){
 			if(response){
 				var js = $.parseJSON(response);
 				
 				if(js.styles){
 					for(var i in js.styles){
 						loadStylesheet(js.styles[i]);
 					}
 				}
 				if(js.html)
 					$("#pixcont").html(js.html);
 				if(js.scripts){
 					for(var i in js.scripts){
 						loadScript(js.scripts[i],null); 				
 					}
 				}
 				if(js.callback)
 					eval(js.callback);
 				
 				$(window).scrollTop($("#mages_cont").offset().top);
 			}
 		},
 		complete:function(response){
			$("#greyshade,#loading").hide();
		},
        error : function(xhr, textStatus, errorThrown ) {
                if (textStatus == 'timeout') {
                 $.ajax(this);
                 return;
                }
          }

 	});
 }
 function reloadAjax(){
 	$(window).trigger('hashchange');
 }
$(function(){
	$("#social_top").hover(function(){	
			$("#social_top").animate({width:225,height:160},500).children().not("#shareSection").show();
			},function(){$("#social_top").animate({width:50,height:7},500).children().not("#shareSection").hide();}
	);
	$(window).bind("ajaxSend",function(e){
		$("#greyshade,#loading").show();
	});
	$(window).bind("ajaxStop",function(e){
		$("#greyshade,#loading").hide();
	});
	//handle 
	if(window.location.hash.length){
		var page = window.location.hash.replace("#!","");
		loadAjax(page);
	}
	//bind to onhashchange
	$(window).bind("hashchange",function(e){
		var loc = "/"+window.location.hash.replace(/^#*!\/*/,"");
		loadAjax(loc);
		 _gaq.push(["_trackPageview",loc]);
	});
	//update like button, stumbleupon, addthis
	
	
		// handle links
	 $("a.ajax_link").live("click",function(e){
		var orhs = window.location.hash;
		e.preventDefault(); 
		window.location.hash = "!"+$(this).attr("href"); 
		if(orhs == "#!"+$(this).attr("href")){
			$(window).trigger('hashchange');
		}
		return false;
	 });


	// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("a.bookmark_button").attr("rel") != ""){ // don't overwrite the rel attrib if already set
			$("a.bookmark_button").attr("rel","sidebar");
		}
	}

	$("a.bookmark_button").click(function(e){
		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
	var bookmarkUrl = this.href;
	var bookmarkTitle = this.title;
 
	if (window.sidebar) { // For Mozilla Firefox Bookmark
		window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
	} else if(  navigator.appName =="Microsoft Internet Explorer") { // For IE Favorite
		window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
	} else if(window.opera) { // For Opera Browsers
		$("a.jQueryBookmark").attr("href",bookmarkUrl);
		$("a.jQueryBookmark").attr("title",bookmarkTitle);
		$("a.jQueryBookmark").attr("rel","sidebar");
	} else { // for other browsers which does not support
		 alert('Press Ctrl+D to bookmark!');
		 return false;
	}

	});

	$('#clearimages').click(function(){$('#pixcont').empty();});
	$('div#loading').fadeOut();
	if($("#d18").length){
		$('div#all').css("display","none");
		$('div#d18').fadeIn();
		$('div#yes').mouseenter(function(){		 
			 $('div#d18').css("background-image","url(/images/yes.png)");
			 }).mouseout(function(){
				 $('div#d18').css("background-image","url(/images/18.png)");
			 }).click(function(){
				 yes(); 
			});

		$('div#no').mouseenter(function(){ 
			 $('div#d18').css("background-image","url(/images/no.png)");
		}).mouseout(function(){
			$('div#d18').css("background-image","url(/images/18.png)");
		}).click(function(){window.location.href="http://www.google.com";});
	}

	$('#greyshade').click(function(){    
		recentHide();
	});
	$('.close').click(function(){    
		recentHide();
	});
	$('#recent-button').click(function(){
		$("#pixcont").load("recent.php");
	});
});
function recentShow(){
    $('#greyshade').css('display','block');
    $('#recentDiv').fadeIn();
}
function recentHide(){
    $('#greyshade').css('display','none');
    $('#recentDiv').fadeOut("fast");
}
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
	return getCookieVal (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break;
	}
	return null;
}
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
	var count = GetCookie('count');
	if(count == null) {
		return 0;
	}
	else {
		return count;
   }
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function returned(){
	if(amt()>=1){
		yes();
		}
	else{}
}
var inter_m = '';
function yes(){
	var count = GetCookie('count');
	if(count==null){count=1;}
	var newcount = parseInt(count) + 1;
	DeleteCookie('count')
	SetCookie('count',newcount,exp)
	$('div#m18').fadeOut("slow");
	$('div#loading').fadeOut();
	$('div#all').fadeIn("slow");
	$('div#menu1').fadeIn();
	$('div#bottomspace').fadeIn("slow");
	$('div#shouts').fadeIn();
	$('div#pix').fadeIn();
	if($("#rateboobs").length>0) $("#rateboobs").fadeIn();
	if($("#showboobs").length>0) $("#showboobs").fadeIn();
	if($("#uploadboobs").length>0) $("#uploadboobs").fadeIn();
	if($("#chat").length>0){ $("#chat").fadeIn();}
	inter_m = setInterval(load_M,2000);
}

function load_M(){
	if($(".ad-block").height()>0&&$(".ad-block").width()>0){
		clearInterval(inter_m);
		$(".ad-block,.ad-block2").adManager({availableAds:banners});
	}
}

window.onbeforeunload= function(){
	//window.open('http://www.hqcamgirls.com','_blank');
	window.open('http://cluster.adultadworld.com/redir/default.aspx?s=21788&c=2409','_blank');
}

$(function(){

	$(".leave_comment").live("click",function(){
		var id = $(this).attr("rel");
		var box = "<div id='text_div_"+id+"' rel='"+id+"'><label>Name:</label><input name='name_message' type='text' /><br/><label>Message:</label><textarea id='text_message'></textarea></div>";
		$(box).dialog({
			modal:true,
			title:"Leave a Comment",
			resizable:true,
			buttons:{
				"Submit":function(){
					commentSub($(this).find('[name=name_message]').val(),$(this).find('#text_message').val(),$(this).attr("rel"));
					closeDialog();
				},
				"Cancel":function(){
					closeDialog();
				}
			}
		});
	});
	$(".show_comments").live("click",function(){
		var show = $(this).val();
		switch(show){
			case "View Comments":
				$(this).parent().find(".comment").show();
				$(this).val("Hide Comments");
				break;
			case "Hide Comments":
				$(this).parent().find(".comment").hide();
				$(this).val("View Comments");
				break;
		}
		
		
	});

});

