var ga_url=location.href.replace(/^http:\/\/.*?\//i,"/");if(ga_pl){ga_url+=ga_url.indexOf("?")>-1?"&":"?";ga_url+="hl="+ga_pl}var _gaq=_gaq||[];function track_click_out(){try{_gaq.push(["my_tracker._trackEvent","ad","click","0"])}catch(a){}return true}_gaq.push(function(){_gat.createTracker(ga_acct,"my_tracker");_gat.createTracker("UA-2551200-33","fp_tracker")});
_gaq.push(["my_tracker._setAccount",ga_acct],["fp_tracker._setAccount","UA-2551200-33"],["_setDomainName",".madthumbs.com"],["my_tracker._setAllowLinker",true],["my_tracker._setAllowHash",false],["my_tracker._setCustomVar",4,"Role",ga_user_role,2]);
_gaq.push(function(){var a=_gat._getTrackerByName("my_tracker"),c=a._getVisitorCustomVar(1),b=a._getVisitorCustomVar(5);if(!c||b&&ga_source&&b!=ga_source)_gaq.push(["my_tracker._setCustomVar",1,"FirstTime",ga_time,1],["my_tracker._setCustomVar",2,"FirstCampaign",ga_campaign,1],["my_tracker._setCustomVar",3,"LastMilestone","0",1],["my_tracker._setCustomVar",5,"FirstSource",ga_source,1]);else{b=parseInt(a._getVisitorCustomVar(3));if(b<10){a=b;b=0}else{a=Math.floor(b/10);b=b%10}var d=ga_time-c,e=[[86400,
1],[259200,2],[604800,3],[1209600,4],[2592E3,5]],f=ga_is_mobile?b:a;c=f;for(var g=0,h=0;h<e.length;++h){var i=e[h];if(d>i[0]&&f<i[1]){c=i[1];g=Math.floor(i[0]/86400)}else if(d<=i[0])break}d="/goal/repeat/";if(!document.referrer){d="/goal/loyalty/";_gaq.push(["my_tracker._trackPageview","/goal/hook/bookmark"])}if(g)_gaq.push(["my_tracker._setCustomVar",3,"LastMilestone",ga_is_mobile?a*10+c:c*10+b,1],["my_tracker._trackPageview",d+"day_"+g])}});_gaq.push(["my_tracker._trackPageview",ga_url]);
(function(){var a=document.createElement("script");a.type="text/javascript";a.async=true;a.src="http://www.google-analytics.com/ga.js";var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c)})();
var mt_main={warning:{init:function(){is_network()?createCookie("warned","1",360):$("#warning").overlay({top:300,fixed:false,mask:{color:"#000",loadSpeed:0,opacity:1},closeOnClick:false,closeOnEsc:false,load:true,zIndex:1E4});$("#enterlink").click(function(){createCookie("warned","1",360);$("#warning").overlay().close();return false})}},mobile_redirect:{init:function(a){a=a.match(/videos/i)?"http://mobile.madthumbs.com/"+a:a.match(/categories/i)?"http://mobile.madthumbs.com"+a.replace(/categories/,
""):"";if(navigator.userAgent.match(/iphone/i))location.replace(a);else if(navigator.userAgent.match(/ipod/i))location.replace(a);else if(navigator.userAgent.match(/android/i))location.replace(a);else if(navigator.userAgent.match(/sgh/i))location.replace(a);else if(navigator.userAgent.match(/sonyericsson/i))location.replace(a);else if(navigator.userAgent.match(/psp/i))location.replace(a);else if(navigator.userAgent.match(/mot/i))location.replace(a);else if(navigator.userAgent.match(/htc/i))location.replace(a);
else if(navigator.userAgent.match(/lg/i))location.replace(a);else if(navigator.userAgent.match(/opera mini/i))location.replace(a);else if(navigator.userAgent.match(/blackberry/i))location.replace(a);else if(navigator.userAgent.match(/nokia/i))location.replace(a);else if(navigator.userAgent.match(/palm/i))location.replace(a);else if(navigator.userAgent.match(/ipaq/i))location.replace(a);else navigator.userAgent.match(/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|treo)/i)&&
!navigator.userAgent.match(/ipad/i)&&location.replace(a)}},admin:{init:function(){var a;$("a.admin_icon, a.admin_link").live("mouseenter",function(){var c=false;$(this).overlay({target:"#overlay",fixed:false,mask:{color:"#333333",loadSpeed:600,opacity:0.75,zIndex:"9997"},zIndex:"9998",onBeforeLoad:function(){var b=this.getOverlay().find(".formWrap");a=this.getTrigger().attr("href");b.load(a,function(){var d=$("#admin_form");$("#close").show();$("#category").change(function(){var e=$(this).find("option:selected").val();
$(':input[value="'+e+'"]').attr("checked","checked")});d.hasClass("user_upload")&&d.find(":input").not(".override").attr("disabled","disabled");d.submit(function(){var e=$(this).find(":input:not(#generate_form :input)").serialize();$.ajax({type:"POST",url:a,data:e,error:function(){$("#message").html('<span class="error fr">Save error!</span>')},success:function(f){f=$(f).find("#message").html();var g=f.length?'<span class="green fr">'+f+"</span>":'<span class="error fr">Save error. Please try again.</span>';
$("#message").html(g);if(f!=null&&f.length==0)c=true}});return false})});$("#html5Player").removeAttr("controls");typeof $f()!="undefined"&&$f().stop().close()},onLoad:function(){var b=this;$("#save_close").live("click",function(){c||setTimeout(function(){b.close()},600)});$("#generate").click(function(d){var e=$("#generate_form").find(':input:not(:text[value=""])').serialize();$this=$(this);$this.css("cursor","wait").attr("disabled","disabled");$.ajax({type:"GET",url:"/admin/refresh/autogenerate",
dataType:"json",data:e,error:function(f,g,h){alert("Sorry, the form could not be submitted. "+g+": "+h);$this.css("cursor","default").removeAttr("disabled")},success:function(f){$this.css("cursor","default").removeAttr("disabled");f.title&&$("#title").val(f.title);f.description&&$("#description").val(f.description)}});d.preventDefault();return false})},onBeforeClose:function(){$("#html5Player").attr("controls","controls")}})})},init_overlay:function(a,c){$.getScript("http://cache.madthumbs.com/madthumbs/js/jquery.autocomplete.min.js",
function(){$("#sponsor","#admin_form").autocomplete(a);$("#partner","#admin_form").autocomplete(c);$(".tagAutocomplete","#admin_form").autocomplete("/admin/refresh/suggestCategory",{minChars:2,cacheLength:1})});$.getScript("http://cache.madthumbs.com/madthumbs/js/datepicker.min.js",function(){$(".datepicker","#admin_form").datepicker()});$(".lastOfTags").live("click",function(){$(this).parents(".longer:eq(0)").find(".categories:not(.secondary)").toggle()});$(".tagAutocomplete").live("result",function(b,
d){var e=$(this);if(d&&d.length>=2){b=e.parents(".longer:eq(0)");var f=b.find(".listOfTags"),g=f.find(".removableTag").filter(function(){return $(this).text()==d[0]});if(g.length>0){g.css("color","red").stop().animate({opacity:1},3E3,function(){g.css("color","")});e.val("");return}var h="";if(f.find("a").length>0)h=", ";else b.find(".secondary").show();f.append("<span><i>"+h+'</i><a class="removableTag" href="#">'+d[0]+'</a><input type="hidden" name="tags[]" value="'+d[1]+'"/></span>');e.val("");
b.find(".saveVidChanges, .approveVid").addClass("red")}else e.css({color:"red"}).stop().animate({opacity:1},3E3,function(){e.css({color:""})}).select();e.flushCache()});$(".tagAutocomplete").live("keydown",function(b){var d=$(this);if(b.keyCode=="13"||b.keyCode=="10"){d.val().replace(/^\s+|\s+$/g,"")!=""&&d.search();return b.preventDefault()}});$("a.removableTag").live("click",function(b){var d=$(this),e=d.parents("span:eq(0)"),f=d.parents(".listOfTags:eq(0)");d=d.parents(".videoReview:eq(0)");e.remove();
e=f.find("span");if(e.length==1)e.find("i").remove();else e.length==0&&d.find(".secondary").hide();d.find(".saveVidChanges, .approveVid").addClass("red");return b.preventDefault()});$("#status").live("change",function(){var b=$(this),d=b.children("option").filter(":selected");b.siblings("input[type=text]").hide();d.val()=="PAYABLE"&&$("#cash_amount").show().focus();d.val()=="UNPAYABLE"&&$("#c4p_reason").show().focus()});$('input[name="watermark_position"]',"#admin_form").live("change",function(){$(this).is(":checked")&&
$("#reencode").attr("checked","checked")});$("#reencode").live("change",function(){$(this).is(":checked")||$('input[name="watermark_position"]:checked',"#admin_form").removeAttr("checked")});$(".edit_user","#admin_form").live("click",function(){$(this).parent(".admin_override").find(":hidden").show().find("input.override").focus().change(function(){var b=$(this);if(b.val()=="yes"){b.parents("form").find(":input:disabled").removeAttr("disabled").end().find(".admin_override").empty();$("#save_close").removeAttr("disabled");
$(".listOfTags span").each(function(){var d=$(this).find("u");d.replaceWith('<a class="removableTag" href="#">'+d.text()+"</a>")})}})});$("#banned","#admin_form").live("change",function(){$(this).parents("form").find("input[type=submit], #save_close").removeAttr("disabled");$(this).is(":checked")?$("#dmca_div").show():$("#dmca_div").hide()});$("#banned_reason","#admin_form").focus(function(){$("#banned").attr("checked","checked").change()})}},star_rating:{init:function(a){$("input[type=radio].star").rating({callback:function(c){$.ajax({type:"POST",
url:a+"/"+c/2,data:null})}});$("a","#thumb_rating").click(function(){$this=$(this);var c=$this.attr("href");$.ajax({type:"POST",url:c,data:null,success:function(){$this.addClass("hover").siblings().removeClass("hover")}});return false})}},player_page:{init:function(){$("#locker_add_link, #locker_remove_link").live("click",function(){var a=$(this);$(this).parents("span:first").load(a.attr("href"));return false});$("button","#flag").click(function(){var a=$("#flag_reason").find("option:selected").val()+
"&c="+escape($("#flag_comment").val());a=$(this).val()+a;$.ajax({type:"POST",url:a,data:null,success:function(){$(".flaglink","#playerInfo").empty().html('Flagged!<span class="flagged"></span>').removeAttr("href");$("#flag").slideUp()}});return false});$('input[name="seekonstart"]',"#embed").change(function(){var a="&t="+$(this).val();$("#embed_code").text(function(c,b){return b.replace(/(id%3D\d*)(%26t%3D\d*)?/gi,"$1"+escape(a))})});$("#embed_code, #link_code").mouseup(function(){$(this).select()});
$("#video_description").hide();banned&&$("#playerInfo").html('<div class="s bot removed"><br/>This video has been removed.</div>');$(".first a, .flaglink","#playerInfo").click(function(){var a=$(this).attr("href");$(a).slideToggle(function(){a=="#embed"&&$(a).is(":visible")&&$(a).children("textarea").select()});return false});$(".toggle","#ad_popup").click(function(){$("#ad_popup").stop(true).slideUp()});$("a","#share").click(function(a){switch($(this).attr("id")){case "twitter":window.open("http://twitter.com/share?url="+
encodeURIComponent(window.location)+"&via=MadThumbsTube&related=realitykings:THE%20TOP%2028%20HD%20PORN%20SITES%20ON%20THE%20WEB!!!%206000%2B%20VIDEOS&text="+escape(vid_title),"Twitter","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=450,width=550");break;case "facebook":window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(window.location)+"&t="+escape(vid_title),"Facebook","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=440,width=620");
break;case "reddit":window.open("http://reddit.com/submit?url="+encodeURIComponent(window.location)+"&title="+escape(vid_title),"Reddit","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=740,width=860");break;default:break}return a.preventDefault()})}},flowplayer:{init:function(a,c,b,d,e){if(typeof mainCat=="undefined")mainCat="hot";var f=location.hash.split("t=")[1],g=function(i){var l=h.getPlugin("thumb_scroll");i?l.css({display:"block"}).animate({opacity:1,
top:"50%"},500):l.animate({opacity:0,top:"150%"},500)},h=$f("thePlayer",{src:a,version:[9,115],expressInstall:null,wmode:"opaque",cachebusting:false},{onError:function(i,l){try{_gaq.push(["fp_tracker._trackEvent","Errors",i+l,h.getClip().url,h.getTime()])}catch(p){}},onBeforeLoad:function(){if(e){$("#thePlayer, #playerCont").css({height:"520px"});$("#pop_wrap").css({bottom:"40px"})}},onLoad:function(){if(!banned)if(e){var i=h.getControls();h.loadPlugin("deep_tags","http://cache.tgpsitecentral.com/madthumbs/js/flowplayer/plugins/flowplayer.deeptags-3.2.6-dev3.swf",
{duration:vid_duration,urlBase:"http://www.madthumbs.com",id:vid_id},function(){$("#thePlayer").append('<img src="http://cache.tgpsitecentral.com/madthumbs/images/deep_tags.png" class="deep_tag_logo png_fix" alt="" title="DeepTags&trade; - Patent Pending"/>');i.animate({bottom:16},250,function(){$("#ad_popup").slideDown(250).delay(4E3).slideUp(250,function(){$("#pop_wrap").remove()})})})}else $("#ad_popup").slideDown(250).delay(4E3).slideUp(250,function(){$("#pop_wrap").remove()})},onBeforeFullscreen:function(){if(banned)return false},
onFullscreenExit:function(){g();h.isPaused()&&h.play();e&&h.getControls().animate({bottom:16},500)},onBeforeResume:function(){if(banned)return false},screen:{width:640,height:480,top:0},plugins:{thumb_scroll:{category:mainCat,xmlPath:b,url:"http://cache.tgpsitecentral.com/madthumbs/js/flowplayer/plugins/flowplayer.thumbscroller-3.2.6-dev3.swf",top:"150%",zIndex:1},controls:{tooltips:{scrubberImage:d},autoHide:{enabled:false}}},clip:{url:c,duration:vid_duration,onBegin:function(){g()},onMetaData:function(i){i=
i.metaData.keyframes.times||[];var l=Math.floor(vid_duration/i.length);if(l>2||i.length==0)try{_gaq.push(["fp_tracker._trackEvent","Keyframes",vid_id,l+" seconds apart"])}catch(p){}},onStart:function(){f&&h.seek(f);if(banned){h.stop();this.getControls().hide()}},onPause:function(){g(1)},onBeforeSeek:function(){h.isPaused()&&h.resume()},onBeforeFinish:function(){h.isFullscreen()&&h.toggleFullscreen();g(1)},onResume:function(){g()},onStop:function(){g(1)}}})}},profile_page:{init:function(){var a=$.browser.msie&&
$.browser.version==6,c=location.hash?location.hash:"#recently_viewed_tab",b=$("#tabs").tabs({selected:null,cache:true,spinner:"Loading&hellip;",ajaxOptions:{cache:false,error:function(d,e,f,g){$(g.hash).html('<div class="cont"><p class="bodytext"><br/><span class="error">Error retrieving data. Please try refreshing the page.</span></p></div>')}},load:function(d,e){$(".pagination a",e.panel).live("click",function(){$(e.panel).load(this.href,function(){$(".scrub_box",$(this)).one("mouseenter",function(){a||
initScrubber($(this),{speed:400,numImages:50})})});return false});$("#programs_form").validate({errorPlacement:function(f,g){f.insertBefore($(g).prev("input"))},errorElement:"span",meta:"validate",submitHandler:function(f){$form=$(f);formSubmit($form,$form.attr("action"),function(){$form.find(".green").text("Changes saved").show()})}})}}).bind({tabsload:function(d,e){d=$(e.panel);d.attr("id")=="programs"&&$("#clear_ads").change(function(){$(this).is(":checked")?$(this).parent("label").siblings("fieldset.sponsor").find("input[type=text]:not([name*=linkurl])").val(""):
b.tabs("load",e.index)});$(".scrub_box",d).one("mouseenter",function(){a||initScrubber($(this),{speed:400,numImages:50})})},tabsselect:function(d,e){if(String(location).match(/profile/i))location.hash=$(e.panel).attr("id")+"_tab"}});b.tabs("select",c.split("_tab")[0]);String(location).match(/profile/i)&&$(".biglink a").not(":last").click(function(){var d=$(this).attr("href");$(this).addClass("active");c=d.substr(d.lastIndexOf("#"));b.tabs("select",c);b.tabs("load",b.tabs("option","selected"));return false});
$("#resend").click(function(){$.post("/users/email_request/",function(){$("#confirm_email").html("<p>Instructions for verifying your email address have been sent to "+email+".</p>")});return false});$("#profile_form").validate({errorPlacement:function(d){d.insertBefore($("input[type=submit]","#profile_form"))},rules:{email:{required:true,email:true},number:{required:true,phoneUS:true}},messages:{email:"Please enter a valid email address",number:"Please enter your mobile #"},submitHandler:function(d){formSubmit($(d),
"/users/update",function(){})}});$(".formToggle","#member_box").click(function(){var d=$(this).attr("href");$("ul, input[type=submit]",d).slideToggle();return false})}}};jQuery.fn.swap=function(a){a=jQuery(a)[0];var c=this[0],b=c.parentNode.insertBefore(document.createTextNode(""),c);a.parentNode.insertBefore(c,a);b.parentNode.insertBefore(a,b);b.parentNode.removeChild(b);return this};
jQuery.validator.addMethod("phoneUS",function(a,c){a=a.replace(/\s+/g,"");return this.optional(c)||a.length>9&&a.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number.");
var validateAjaxForms=function(a){$("#forgot","#overlay_form").validate({rules:{email:{required:true,email:true}},messages:{email:"Please enter a valid email address"},submitHandler:function(c){formSubmit($(c),"/users/login",function(){location.reload()})}});$("#login_overlay","#overlay_form").validate({rules:{username:{required:true,minlength:1},password:{required:true,minlength:1}},messages:{username:{required:"Please enter a username",minlength:"Please enter a username"},password:{required:"Please provide a password",
minlength:"Please enter a username"}},submitHandler:function(c){formSubmit($(c),"/users/login",function(){var b=a.attr("href").split("?page=")[1];location.href=typeof b!="undefined"?"/"+b:String(location).split("?")[0].replace(location.hash,"")})}});$("#signup_overlay","#overlay_form").validate({ignore:".premium",rules:{username:{required:true},password:{required:true},email:{required:true,email:true}},messages:{username:{required:"Please enter a username"},password:{required:"Please provide a password"},
email:"Please enter a valid email address"},submitHandler:function(c){formSubmit($(c),"/users/register",function(){var b=a.attr("href").split("?page=")[1];location.href=typeof b!="undefined"?"/"+b:String(location).split("?")[0].replace(location.hash,"")})}})};
$(function(){function a(){$("iframe:not(#hd_iframe, #hd_videos)").each(function(){$(this).attr("src",function(e,f){return f})});window.clearTimeout(b)}var c=$.browser.msie&&$.browser.version==6;$(".scrub_box").one("mouseenter",function(){c||initScrubber($(this),{speed:400,numImages:50})});$('form:not("#sitesearch") input:first').focus();if(!readCookie("nonSocial")){$("#social_bookmark").show(function(){createCookie("nonSocial","nonSocial",0)});$("a.close","#social_bookmark").click(function(){$("#social_bookmark").remove();
return false})}$("a","#category_list").click(function(){var e=$(this).parents(".category_click").attr("id");if(e!="")document.cookie="tag_click="+e+"; path=/; domain=madthumbs.com"});var b=window.setTimeout(a,12E4);$("#anext, #aprev").click(function(){var e=$("#login_overlay"),f=$("#forgot");e.swap(f).toggle("slow",function(){$(this).find("input:first").focus()});f.toggle("slow",function(){$(this).find("input:first").focus()})});$("#searchButton").click(function(){var e=$("#sitesearch");$("#searchInput").val()!=
"Search MadThumbs"&&e.submit();return false});$("a.login","#user, #comments, #locker_link, #recent, #member_box").overlay({close:".close",top:300,fixed:false,target:"#overlay_form",mask:{color:"#333333",loadSpeed:200,opacity:0.75,zIndex:"9997"},zIndex:"9998",onBeforeLoad:function(){$("#html5Player").removeAttr("controls");typeof $f()!="undefined"&&$f().stop().close()},onLoad:function(){var e=this.getTrigger();$("#signup_overlay","#overlay_form").hide();$("#loginscroll","#overlay_form").show().find("input[type=text]:first").focus();
validateAjaxForms(e)},onBeforeClose:function(){$("#html5Player").attr("controls","controls")}});$("a.signup","#user, #get_access, #comments").overlay({close:"#close",top:300,fixed:false,target:"#overlay_form",mask:{color:"#333333",loadSpeed:200,opacity:0.75,zIndex:"9997"},zIndex:"9998",onBeforeLoad:function(){$("#html5Player").removeAttr("controls");typeof $f()!="undefined"&&$f().stop().close()},onLoad:function(){var e=this.getTrigger();$("#loginscroll","#overlay_form").hide();$("#signup_overlay",
"#overlay_form").show().find("input[type=text]:first").focus();validateAjaxForms(e)},onBeforeClose:function(){$("#html5Player").attr("controls","controls")}});$(".login_toggle","#overlay_form").click(function(){$("#signup_overlay, #loginscroll").toggle("slow",function(){$(this).find("input:first").focus()});return false});$("#register_link, #login_link").click(function(){$("#register, #login_form").slideToggle(function(){$(this).find("input:first").focus()});return false});$("a.forgot","#login_form, #password_form").click(function(){$("#password_form, #login_form").slideToggle(function(){$(this).find("input:first").focus()});
return false});$("#register").validate({rules:{username:{required:true,minlength:1},password:{required:true,minlength:1},email:{required:true,email:true}},messages:{username:{required:"Please enter a username",minlength:"Please enter a username"},password:{required:"Please provide a password",minlength:"Please provide a password"},email:"Please enter a valid email address"},submitHandler:function(e){e.submit(e.serialize())}});$("#login_form").validate({rules:{username:{required:function(e){$(e).is(":visible")},
minlength:1},password:{required:function(e){$(e).is(":visible")},minlength:1}},messages:{username:{required:"Please enter a username",minlength:"Please enter a username"},password:{required:"Please provide a password",minlength:"Please enter a username"}},submitHandler:function(e){e.submit(e.serialize())}});$("#password_form").validate({rules:{email:{required:true,email:true}},messages:{email:"Please enter a valid email address"},submitHandler:function(e){e.submit(e.serialize())}});$("#terms_form").validate({errorPlacement:function(e,
f){f.attr("name")=="agree"?e.insertBefore(f):e.insertAfter(f)},rules:{agree:{required:true},paypal:{required:true,email:true},paypal_confirm:{required:true,equalTo:"#paypal"},email:{required:true,email:true}},messages:{agree:{required:"You must agree to the terms"},paypal:"Please enter a valid email address",paypal_confirm:{required:"Please re-enter your PayPal email",equalTo:"Email addresses must match"},email:"Please enter a valid email address"}});var d;$("#searchInput").blur(function(){setTimeout(function(){$("#suggestions").fadeOut(100)},
250)}).keyup(function(e){var f=$("#autoSuggestionsList").children("li.chosen").find("a");clearTimeout(d);if(f.length)if(e.keyCode==13)location=f.attr("href");[27,33,34,37,38,39,40,46].indexOf(e.keyCode)==-1&&lookup($(this).val())}).keydown(function(e){var f=$("#autoSuggestionsList");switch(e.keyCode){case 38:$("#autoSuggestionsList").children().length&&$("#suggestions").fadeIn(100);var g=function(){if(indx>0){f.children("li").eq(indx-=1).addClass("chosen").siblings().removeClass("chosen");$("#searchInput").val(f.children("li.chosen").find("a").text());
d=setTimeout(g,150)}else{indx=-1;f.children("li:first").removeClass("chosen");$("#searchInput").val(lastSearch);clearTimeout(d)}};g();break;case 40:$("#autoSuggestionsList").children().length&&$("#suggestions").fadeIn(100);var h=function(){if(indx<f.children().length-1){f.children("li").eq(indx+=1).addClass("chosen").siblings().removeClass("chosen");$("#searchInput").val(f.children("li.chosen").find("a").text());d=setTimeout(h,150)}};clearTimeout(d);h();break;case 27:$(this).blur();$("#suggestions").fadeOut(100);
$("#autoSuggestionsList").empty();break;case 37:f.children("li").removeClass("chosen");$("#suggestions").fadeOut(100);break;case 39:f.children("li").removeClass("chosen");$("#suggestions").fadeOut(100);break;case 8:f.children("li").removeClass("chosen");break;case 32:f.children("li").removeClass("chosen");break}})});var indx=-1,lastSearch="",failedSearch="";
function lookup(a){if(a.length<3)$("#suggestions").fadeOut(100);else{if(failedSearch.length>2)if(failedSearch==a.substr(0,failedSearch.length)){$("#suggestions").fadeOut(100);return}window.clearTimeout($.timeoutID);lastSearch=a;$.timeoutID=window.setTimeout(doSearch,250,a)}}
function doSearch(){inputString=lastSearch;$.post("index.php/suggest/",{ss:inputString},function(a){indx=-1;if(a.toString()=="false"){$("#suggestions").fadeOut(100);failedSearch=lastSearch}else if(a.length>0){$("#autoSuggestionsList").empty();var c;$.each(a,function(b){c=b%2?"odd":"even";if(typeof a[b]==="string")$("#autoSuggestionsList").append('<li class="'+c+'"><a title="'+a[b]+'" href="/categories/'+a[b]+'">'+a[b]+"</a></li>");else a[b].length>3?$("#autoSuggestionsList").append('<li class="'+
c+' model_result"><a title="'+a[b][2]+'" href="/pornstar/'+a[b][0]+"/"+a[b][3]+'">'+a[b][1]+'</a><span class="smaller fr">Pornstar</span></li>'):$("#autoSuggestionsList").append('<li class="'+c+'"><a title="'+a[b][2]+'" href="/search?q='+a[b][0]+'">'+a[b][1]+"</a></li>")});$("#suggestions").fadeIn(100)}else{$("#suggestions").fadeOut(100);failedSearch=inputString}},"json")}function fill(a){$("#searchInput").val(a)}
if(!Array.indexOf)Array.prototype.indexOf=function(a){for(var c=0;c<this.length;c++)if(this[c]==a)return c;return-1};
function formSubmit(a,c,b,d){var e=a.find(".err");if(!e.length){e=$("<p></p>").addClass("err");a.append(e)}e.hide();var f=a.serialize();$.ajax({type:"POST",url:c,async:false,data:f,cache:false,error:function(g,h,i){d&&typeof d=="function"?d.call():alert("Sorry, the form could not be submitted. "+h+": "+i)},success:function(g){if(g){e.html(g).show();setTimeout(function(){e.slideUp()},4E3);a.find("input.txt:first").focus()}else typeof b=="string"?e.html(b).show():b.call()}});return false}
function sec_to_min(a){var c=parseInt(a,10);a="";var b=Math.floor(c/3600);c%=3600;var d=Math.floor(c/60);c=Math.floor(c%60);if(b>0)a+=b+":";if(d<10)a+="0";a+=d+":";if(c<10)a+="0";a+=c;return a}
function initScrubber(a,c){c=c||{};var b=$(".scrub_thumb",a),d=b.parent("a"),e=b.attr("longdesc"),f=b.attr("src"),g=d.attr("rev")/c.numImages,h=$(".sprite_loader",a),i=$(".timewrap",a),l=$(".timebox",a),p=$(".arrow",a),t=$(".timeline",a),x=$(".timedot",t),y=true,q=false,r=0,m,u,v,s,k=0,B=function(){!q&&!h.is(":visible")&&h.fadeIn("fast").delay(1E3).fadeOut("fast")},D=function(j){l.is(":hidden")&&z();r=Math.floor(g*k);u=(j.pageX-i.offset().left)/(i.width()/c.numImages);k=Math.round(u);if(k<1)k=1;m=
(k-1)*117;d.attr("rel",r);b.css("top","-"+m+"px");$("a",l).text(sec_to_min(g*u));j=Math.floor(j.pageX-i.offset().left);if(j<1)j=1;if(j>156)j=156;C(j)},C=function(j){$(".arrow, .timedot, .timebox",i).each(function(){var n=$(this),o=j-Math.floor(n.outerWidth()/2),A=i.outerWidth()-n.outerWidth();if(o<0)o=0;if(o>A)o=A;n.css("left",o+"px")})},z=function(){l.show();p.show();x.show();t.css("background","#f90");$(".thumb_container",a).css("border-color","#f90")},E=function(){l.hide();p.hide();x.hide();t.css("background",
"#333");$(".thumb_container",a).css("border-color","#333")},F=function(){if(q){r=Math.floor(g*k);window.clearInterval(s);y=true;s=window.setInterval(function(){k+=5;if(k<1)k=0;if(k>49)k=0;m=k*117;d.attr("rel",r);b.css("top","-"+m+"px")},400)}},w=function(){v=window.setTimeout(B,400);b.attr("src",e).load(function(){h.clearQueue().fadeOut("fast");window.clearTimeout(v);q=true;a.unbind("mouseenter",w);b.mouseover(F).trigger("mouseover");i.bind({mouseover:function(){y=false;z();window.clearInterval(s)},
mouseleave:E,mousemove:D})}).each(function(){if($.browser.msie)if(this.complete||this.readyState===4){q=true;$(this).load()}})};a.hover(w,function(){b.unbind("load").css("top","0").attr("src",f);d.removeAttr("rel");h.clearQueue().fadeOut("fast");window.clearTimeout(v);window.clearInterval(s);a.mouseenter(w);k=m=0;i.unbind("mouseover, mouseleave, mousemove")}).mouseenter();$("a.fastlink",a).click(function(){$(this).attr("href",function(j,n){return n+"?#t="+d.attr("rel")})});$(".thumb_click",a).click(function(){var j=
$(this).parents(".thumbbox").attr("id");if(j!="")document.cookie="thumb_click="+j.split("thumb_")[1]+"; path=/; domain=madthumbs.com"})}function createCookie(a,c,b){if(b){var d=new Date;d.setTime(d.getTime()+b*24*60*60*1E3);b="; expires="+d.toGMTString()}else b="";document.cookie=a+"="+c+b+"; path=/"}
function readCookie(a){a=a+"=";for(var c=document.cookie.split(";"),b=0;b<c.length;b++){for(var d=c[b];d.charAt(0)===" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return d.substring(a.length,d.length)}return null}function clicker(a){createCookie("warned","1",360);return true}
function is_network(){if(location.href.match(/#nowarn/))return true;if(document.referrer&&document.referrer.length>0){var a=document.referrer,c=[];c[0]=/sublime/;c[1]=/madt/;c[2]=/cowlist/;c[3]=/teeniefiles/;c[4]=/purextc/;c[5]=/88by88/;c[6]=/bigtits/;c[7]=/madteenies/;c[8]=/treasurethumbs/;c[9]=/youporn/;c[10]=/fling/;c[11]=/tube/;if(a.match(/google|yahoo|msn|ask\.com|aol|live|altvista|yandex|baidu|netscape|alltheweb|lycos|mamma/i))return false;var b;for(b=0;b<c.length;b++)if(a.match(c[b]))return true;
return true}return false};

