$(document).ready(function(){$('.im').hover(function(){var id=$(this).attr('id');var i=id.split('_');var ic=parseInt(i[1]);var win=$(this).width();var wid=Math.floor((win/ic))-2;var mar=Math.floor((win-(wid*(ic)))/(ic-1));var bi='',cl='';var ib=Math.ceil(ic/2);for(ia=1;ia<=ic;ia++){if(ia==ic){mar='0'};if(ia==ib){cl='class="sele" '}else{cl=''}bi+='<var id="h'+ia+'" '+cl+'style="width:'+wid+'px;margin-right:'+mar+'px"></var>'}$(this).attr('title','');$(this).prepend('<var class="hovi" rel="'+id+'">'+bi+'</var>');$('#'+id+' span.dur').fadeOut();z=setTimeout("rotate('"+id+"','"+i[0]+"','"+i[1]+"')",200);$('.hovi var').hover(function(){$('.hovi var').css({background:'#b3b3b3',height:'20px'});$(this).css({background:'#666'});if(typeof z!='undefined'){clearTimeout(z)}if(typeof timeout!='undefined'){clearTimeout(timeout)}var el=id;var im=i[0];var c=$('#'+el+' img').attr('src').split('-');var d=$('#'+el+' img').attr('src').split('/');var u=d[5]+'/'+d[6];var cn=c[c.length-1].split('.');var next=$(this).attr('id').substr(1);$('#'+el+' img').fadeTo(0,.95);$('#'+el+' img').attr('src','http://'+d[2]+'/FapDu/n/'+u+'/'+im+'-'+next+'.'+cn[1]).attr('id',el+'__'+next);$('#'+el+'__'+next).load(function(){$('#'+el+' img').fadeTo(0,1)})},function(){if(typeof z!='undefined'){clearTimeout(z)}if(typeof timeout!='undefined'){clearTimeout(timeout)}});$('.hovi').hover(function(){$(this).fadeTo(150,.9);$('.hovi var').css({height:'20px'});if(typeof z!='undefined'){clearTimeout(z)}if(typeof timeout!='undefined'){clearTimeout(timeout)}},function(){var el=$(this).attr('rel');var im=el.split('_');rotate(el,im[0],im[1]);$(this).fadeTo(150,.4)})},function(){var id=$(this).attr('id');$('#'+id+' span.dur').fadeIn();var i=id.split('_');var t=Math.ceil(i[1]/2);var c=$('#'+id+' img').attr('src').split('-');var d=$('#'+id+' img').attr('src').split('/');var u=d[5]+'/'+d[6];var cn=c[c.length-1].split('.');$('#'+id+' img').attr('src','http://'+d[2]+'/FapDu/n/'+u+'/'+i[0]+'-'+t+'.'+cn[1]);if(typeof timeout!='undefined'){clearTimeout(timeout)}clearTimeout(z);$('.hovi').remove()})});(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);function rotate(el,im,n){var c=$('#'+el+' img').attr('src').split('-');var d=$('#'+el+' img').attr('src').split('/');var u=d[5]+'/'+d[6];var cn=c[c.length-1].split('.');if(n>parseInt(cn[0])){var next=parseInt(cn[0])+1}else{var next=1}$('.hovi var').css({background:'#b3b3b3',height:'12px'});$('#h'+next).css({background:'#666',height:'16px'});$('#'+el+' img').attr('src','http://'+d[2]+'/FapDu/n/'+u+'/'+im+'-'+next+'.'+cn[1]);timeout=setTimeout("rotate('"+el+"','"+im+"','"+n+"')",900)}function rPop(a,b){for(i=1;i<b;i++){if($('#'+a+i).hasClass('show')){if(i==(b-1)){var c=1}else{var c=i+1}$('#'+a+i).removeClass('show').addClass('hide');$('#'+a+i+'-'+b).removeClass('sdot').addClass('dot')}}$('#'+a+c).removeClass('hide').addClass('show');$('#'+a+c+'-'+b).removeClass('dot').addClass('sdot');if($('#'+a+c+' img:first').attr('title').length>1){$('#'+a+c+' img:first').attr('src',$('#'+a+c+' img:first').attr('title'))}if($('#'+a+c+' img:last').attr('title').length>1){$('#'+a+c+' img:last').attr('src',$('#'+a+c+' img:last').attr('title'))}}
function submitComment(id,type,r)
{if(r>0 || r == 'a'){var ie=r;}else{var ie='';}var text=document.getElementById('commentTxt'+ie).value;$('#new-comment'+ie).prepend('<div class="l110" id="ajax"><img src="http://cdn-w.fapdu.com/FapDu/n/s/a.gif" alt="Loading..."></div>');if($.trim(text)!='')
{$.ajax({type:"GET",url:"/inc/ajax-request.php?type=5&id="+id+"&t="+type+"&r="+r,data:$('#commentform'+ie).serialize(),success:function(html)
{$('#commentTxt'+ie).val('');$('#ajax').remove();if(r>0 || r == 'a'){$("#commentform"+ie).remove()}$.scrollTo('#new-comment'+ie,1000);$("#new-comment"+ie).prepend(html);}});}else{alert('You must enter text in the comment area first.');$('#ajax').remove();}}
function regVerify(type)
{$.ajax({type:"GET",url:"http://fapdu.com/inc/verify-registration.php?type="+type,data:$('#register').serialize(),success:function(html)
{if(html==1)
{$('#userver').hide();$('#useryes').removeClass('verno').addClass('veryes');}
else if(html==2)
{$('#useryes').removeClass('veryes').addClass('verno')}
else if(html==3)
{$('#useryes').removeClass('veryes').addClass('verno')}
else if(html==4)
{$('#p1').removeClass('veryes').addClass('verno');}
else if(html==5)
{$('#p1ver,#p2ver').hide();$('#p1,#p2').removeClass('verno').addClass('veryes');}
else if(html==6)
{$('#p1,#p2').removeClass('veryes').addClass('verno');}}});return false;}
function fav(id,t)
{$.ajax({type:"GET",url:"/inc/ajax-request.php?type=2",data:"id="+id,success:function(html)
{$('.like').addClass('liked').removeClass('like');$('.lbut').addClass('lba').removeClass('lbut');}});}
function rfav(id)
{$.ajax({type:"GET",url:"/inc/ajax-request.php?type=4",data:"id="+id,success:function(html)
{$('.liked').addClass('like').removeClass('liked');$('.lba').addClass('lbut').removeClass('lba');}});}
function rotate2(el,im,n){var c=$('#'+el+' img').attr('src').split('-');var u=$('#'+el+' img').attr('src').split('/')[6];var cn=c[c.length-1].split('.');if(n>parseInt(cn[0])){var next=parseInt(cn[0])+1}else{var next=1}$('#'+el+' img').attr('src','http://cdn-w.fapdu.com/FapDu/n/g/'+u+'/s-'+im+'-'+next+'.'+cn[1]);timeout=setTimeout("rotate2('"+el+"','"+im+"','"+n+"')",750)}
(function($){$.fn.jStockTicker=function(b){if(typeof(b)=='undefined'){b={}}var c=$.extend({},$.fn.jStockTicker.defaults,b);var d=$(this);c.tickerID=d[0].id;$.fn.jStockTicker.settings[c.tickerID]={};var e=null;if(d.parent().get(0).className!='wrap'){e=d.wrap("<div class='wrap'></div>")}var f=null;if(d.parent().parent().get(0).className!='hs'){f=d.parent().wrap("<div class='hs'></div>")}var g=d[0].firstChild;var h;while(g){h=g.nextSibling;if(g.nodeType==3){d[0].removeChild(g)}g=h}var i=d.children().get(0).offsetWidth;$.fn.jStockTicker.settings[c.tickerID].shiftLeftAt=i;$.fn.jStockTicker.settings[c.tickerID].left=0;$.fn.jStockTicker.settings[c.tickerID].runid=null;d.width(2*screen.availWidth);function startTicker(){stopTicker();var a=$.fn.jStockTicker.settings[c.tickerID];a.left-=c.speed;if(a.left<=a.shiftLeftAt*-1){a.left=0;d.append(d.children().get(0));a.shiftLeftAt=d.children().get(0).offsetWidth}d.css('left',a.left+'px');a.runId=setTimeout(arguments.callee,c.interval);$.fn.jStockTicker.settings[c.tickerID]=a}function stopTicker(){var a=$.fn.jStockTicker.settings[c.tickerID];if(a.runId)clearTimeout(a.runId);a.runId=null;$.fn.jStockTicker.settings[c.tickerID]=a}function updateTicker(){stopTicker();startTicker()}d.hover(stopTicker,startTicker);startTicker()};$.fn.jStockTicker.settings={};$.fn.jStockTicker.defaults={tickerID:null,url:null,speed:1,interval:20}})(jQuery);
function go(l){window.location='http://fapdu.com/search/?s='+encodeURI(l);}
function emailVer(){$('#new-comment').prepend('<div class="l110" id="ajax"><img src="http://cdn-w.fapdu.com/FapDu/n/s/a.gif" alt="Loading..."></div>');$.ajax({type:"POST",url:"/inc/ajax-request.php?type=7",data:$('#eform').serialize(),success:function(html){$('#ajax').remove(); document.getElementById("email").value='';$("#new-comment").html(html);}});}
function subscribe(id){$.ajax({type:"GET",url:"/inc/ajax-request.php?type=11",data:"pid="+id,success:function(html){}})}
function at(i){if($('#pl a').length>0){$('#pl a').remove();$('#pl').hide()}else{$('#pl').show();$('#pl').html('<span id="load" class="pin">Loading...</span>');$('#pl').load('/inc/act.php?id='+i)}}function pa(vid,pid){$('#p'+pid+' span').hide();$('#p'+pid).append('<span id="s'+pid+'">Saving...</span>');$.get('/inc/ajax-request.php?type=10&vid='+vid+'&pid='+pid,function(d){var o=jQuery.parseJSON(d);if(o.w=='no'){$('#p'+pid).removeClass('pi-s').addClass('pi')}else{$('#p'+pid).removeClass('pi').addClass('pi-s')}$('#s'+pid).remove();$('#p'+pid+' span').show()})}function rn(){$('#adn span').hide();$('#anf').show();$('#plt').select()}function an(vid){$('#anf').hide();$('#adn').append('<span id="snew">Saving...</span>');$.get('/inc/ajax-request.php?type=9&vid='+vid+'&pl='+$('#plt').val(),function(d){var o=jQuery.parseJSON(d);if(o.w=='no'){$('#adn').html('error')}else{$('#adn').removeClass('pin').addClass('pi-s');$('#adn').html('<span>'+o.name+'</span>');$('#adn').attr('onclick','');$('#adn').attr('id','p'+o.rid)}$('#snew').remove();$('#p'+o.rid+' span').show()})}
$(document).ready(function(){if(!!$('#search').val()){$('.rcl').fadeIn()}$('.rcl').click(function(){$('#search').val('').focus();$('.ac').html('<span id="ga">search over 3 million videos</span>');$(this).fadeOut(50)});$('.ac').hover(function(){$('.ac').show()},function(){if(!$('input#search').is(":focus")){$('.ac').hide()}});$('#ga').html('search over 3 million videos');$('input#search').hover(function(){if(!$('#search').val()){$('.ac').fadeIn(50)}},function(){if(!$('input#search').is(":focus")){$('.ac').hide()}});$('input#search').focus(function(){$('.ac').fadeIn(50);if(!!$('#search').val()){var r=$.ajax({type:'GET',url:'/inc/auto.php',data:$('input#search').serialize(),success:function(a){$('.ac').html(a)}})}});$('input#search').blur(function(){setTimeout("$('.ac').fadeOut(100);",100);if(!!$('#search').val()){$('.rcl').fadeIn();}$('.ac a').removeClass('sel')});$('input#search').keyup(function(e){var k=(e.keyCode?e.keyCode:e.which);if(k!=40&&k!=38){var r=$.ajax({type:'GET',url:'/inc/auto.php',data:$('input#search').serialize(),success:function(a){$('.ac').html(a)}})}else if(k==40){$('.ac a').each(function(n){if($(this).hasClass('sel')){var t=n+1;$(this).removeClass('sel');if(t<$('.ac a').length){$('.ac a:eq('+t+')').addClass('sel');$('input#search').val($('.ac a:eq('+t+')').attr('title'))}else{$('.ac a:first').addClass('sel');$('input#search').val($('.ac a:first').attr('title'))}throw true;}});if($('.ac a.sel').length==0){$('.ac a:first').addClass('sel');$('input#search').val($('.ac a:first').attr('title'))}}else if(k==38){$('.ac a').each(function(n){if($(this).hasClass('sel')){var t=n-1;$(this).removeClass('sel');if(t>=0){$('.ac a:eq('+t+')').addClass('sel');$('input#search').val($('.ac a:eq('+t+')').attr('title'))}else{$('.ac a:last').addClass('sel');$('input#search').val($('.ac a:last').attr('title'))}throw true;}});if($('.ac a.sel').length==0){$('.ac a:last').addClass('sel');$('input#search').val($('.ac a:last').attr('title'))}}})});
function rb(b){$.ajax({type:"GET",url:"/inc/ajax-request.php?type=12",data:"id="+b,success:function(a){if(a=='1'){$('#rb').html('Reported.')}else{alert('You\'ve already reported this video')}}})}
function ut(b,c){$('#uf').hide();$('#ret').remove();$.ajax({type:"POST",url:"/inc/ajax-request.php?type=13&id="+b+"&pt="+c,data:$('#uf').serialize(),success:function(a){if(a=='1'){$('#usertags').append('<span id="ret"><b>Thanks for your help!</b></span>')}else{$('#usertags').append('<span id="ret"><b>Invalid tag or you\'re posting too fast.</b></span>');$('#uf').fadeIn()}}})}
function sf(e){var t=encodeURIComponent(document.title);var l=encodeURIComponent(window.location);switch($(e).attr('id')){case 'tw':var u='http://twitter.com/share?url='+l+'&via=PornVideoSearch&related=RandomPorn&text='+t+'+these+videos+are+hot';break;case 'de':var u='http://www.reddit.com/r/pornvids/submit?url='+l+'&title='+t;break;case 'su':var u='http://www.stumbleupon.com/submit?url='+l+'&title='+t;break;}window.open(u,'share fapdu','width=900,height=450');}
function ct(text,el){if($(el).val()==text){$(el).val('');}else if($(el).val()==''){$(el).val(text);}}
function af(i,t,p,e){$(e).html('saving...');$(e).load('http://fapdu.com/inc/ajax-request.php?type='+p+'&i='+i+'&t='+t,function(){$(e).attr('onclick','');});}
function fc(d,t,g){if($('#c'+d+' form').length==0){$('#c'+d).append('<form method="post" onsubmit="return false;" id="commentform'+d+'" class="l115"><textarea name="comment" id="commentTxt'+d+'" class="commentTxt"></textarea><input type="submit" value="submit" class="submit" onclick="submitComment(\''+g+'\','+t+','+d+');"><a style="float:left;margin:12px 15px;font-size:11px;display:inline;" onclick="$(\'#commentform'+d+',#new-comment'+d+'\').remove();">close</a></form>');$('#commentTxt'+d).focus();$('#z'+d).after('<div class="l100" id="new-comment'+d+'"></div>')}else{$('#c'+d+' form').remove()}}
function twl(p){var v=$('#twla').val();if($.trim(v)!=''){$('#twlf').fadeOut(0);$('#twl').prepend('<h3 class="l1" id="sav">&bull; saving...</h3>');$('#twlf').load('/inc/ajax-request.php?type=21&v='+encodeURIComponent(v)+'&p='+p,function(){$('#sav').remove();$('#twlf').fadeIn()})}}function twla(p,n){var n='why you like '+n;if($.trim($('#twla').val())==n){$('#twla').attr('value','');$('#twla').focus()}else if($.trim($('#twla').val())!=''){twl(p)}else{$('#twla').focus()}return false}
function tf(e,c,t){switch(t){case 1:var r='share/video?embed';var ct='';break;default:var r='share/photo?source';var ct='&clickthru='+t;break;}window.open('http://www.tumblr.com/'+r+'='+e+'&caption='+c+ct,'share fapdu','width=900,height=450');}function aw(w,h){if(w==665&&h==425){$('#b6').removeClass('b64').addClass('b64-s');$('#b5').removeClass('b53-s').addClass('b53');$('#hi').val(425);$('#wi').val(665)}else if(w==560&&h==346){$('#b6').removeClass('b64-s').addClass('b64');$('#b5').removeClass('b53').addClass('b53-s');$('#hi').val(346);$('#wi').val(560)}else{$('#b6').removeClass('b64-s').addClass('b64');$('#b5').removeClass('b53-s').addClass('b53')}var v=$('#et').val();var n=v.replace(/(\swidth=")\d+"/g,"$1"+parseInt(w)+'"').replace(/(\sheight=")\d+"/g,"$1"+parseInt(h)+'"');$('#et').val(n);$('#et').fadeTo(75,'.6');setTimeout("$('#et').fadeTo(75,'1.0');",75)}function bf(e){window.open('http://www.blogger.com/blog_this.pyra?t='+e+'&n=','share fapdu','width=900,height=450');}function iA(n,h){var l=h.length;for(var i=0;i<l;i++){if(h[i]==n)return true}return false}
(function(s,o,l,v,e,d){if(s[o]==null&&s[l+e]){s[o]="loading";s[l+e](d,l=function(){s[o]="complete";s[v+e](d,l,!1)},!1)}})(document,"readyState","add","remove","EventListener","DOMContentLoaded");(function(){var rts=document.createElement('script');rts.type='text/javascript';rts.async=true;rts.src=('https:'==document.location.protocol?'https://':'http://')+'streamate.doublepimp.com/Publishers/6207caf6fe.js?ver=async&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime();var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(rts,s)})();
function lc(id,type){var cs=parseInt($('#sc'+id).html())+1;$('#sc'+id).html(cs).css({color:'#090','border-color':'#090'});$.get('/inc/ajax-request.php?type=27&id='+id+'&t='+type);}function upvote(id,v){$('#v'+v).load('/inc/ajax-request.php?type=25&id='+id+'&vote='+v,function(){$('#v'+v).hide();$('#lm div').animate({width:'67px'},500);$('.dli').animate({height:'26px'});$('.lli').animate({height:'27px'});$('#v'+v).fadeIn();});}function a(){if($('#aj').length == 0){var h=(($(window).height()-24)/2)+$(window).scrollTop();var w=($(window).width()-24)/2;$('body').append('<div class="ajax" id="aj" style="position:absolute;padding:15px;background:#fff;border:3px solid #555;-webit-border-radius:3px;-moz-border-radius:3px;z-index:9999;border-radius:3px;"><img src="http://cdn-w.fapdu.com/FapDu/s/ajax.gif" style="float:left"></div>');$('#lda').fadeTo(200,.5);$('#aj').css({'left':w,'top':h});$('#aj').fadeIn(200);}}
