jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};$(document).ready(function(){$('#link-contact').attr('href','mailto:contact@desey.net');var pointer=0;var window=1;var orderby="id";var nbitem=19;if((screen.height==1050)&&(screen.width==1680)){nbitemplus=5;$.post("/php/resolution.php",{nbitem:nbitem,orderby:orderby,nbitemplus:nbitemplus},function(data){$("#gallery #content .pagination").before(data)});nbitem+=5}if((screen.height==1080)&&(screen.width==1920)){nbitemplus=10;$.post("/php/resolution.php",{nbitem:nbitem,orderby:orderby,nbitemplus:nbitemplus},function(data){$("#gallery #content .pagination").before(data)});nbitem+=10}if((screen.height==1200)&&(screen.width==1920)){nbitemplus=16;$.post("/php/resolution.php",{nbitem:nbitem,orderby:orderby,nbitemplus:nbitemplus},function(data){$("#gallery #content .pagination").before(data)});nbitem+=16}$(".item .preview").live("click",function(){$(".item").css("z-index","1");$(this).parent(".item").css("z-index","300");$(".item-more").hide();var width=$("#gallery #content").width();var height=$("#gallery #content").height();var offsetItem=$(this).offset();var leftGal=offsetItem.left-45;var topGal=offsetItem.top-20;var maxLeft=leftGal+630;var maxTop=topGal+320;var left=5;var top=5;var i=0;while(maxLeft>width){left-=210;maxLeft-=210;i++}while(maxTop>height){top-=160;maxTop-=160}if((i==1)&&(width>840)){left-=210}if(width<630){left=0;if(leftGal==210){left-=210}}if(width>420){$(this).next().css({'opacity':'0','left':left,'top':top,'display':'block'});$(this).next().fadeTo("fast",1)}});$(".item-close").live("click",function(){$(this).parent(".item-more").fadeTo("fast",0,function(){$(this).css("display","none")})});$(".item .voteup, .item .votedown").live("click",function(){$(this).parents("h2").fadeTo("slow",0.5);var nameItem=$(this).parents(".item").find(".preview").attr("alt");var thisItemMore=$(this).parents(".item-more");if($(this).attr("class")=='voteup'){var valVote=1}else{var valVote=-1}$.cookie(nameItem,1,{expires:7});$.post("/php/vote.php",{nameItem:nameItem,valVote:valVote},function(data){thisItemMore.find("h2").fadeTo("fast",1);data=data.split("#");thisItemMore.find(".voteup, .votedown, .item-vote, h2 span").remove();thisItemMore.find("h2").append('<a class="voteupoff"><img src="/image/pixel.gif" alt=""/></a><a class="votedownoff"><img src="/image/pixel.gif" alt=""/></a>'+data[1]);thisItemMore.prepend(data[0])})});$("#item-site .voteup, #item-site .votedown").click(function(){$(this).parents("h2").fadeTo("slow",0.5);var nameItem=$(this).parents("h2").attr("id");if($(this).attr("class")=='voteup'){var valVote=1}else{var valVote=-1}$.cookie(nameItem,1,{expires:7});$.post("/php/vote.php",{nameItem:nameItem,valVote:valVote},function(data){$("#item-site").find("h2").fadeTo("fast",1);data=data.split("#");$("#item-site").find(".voteup, .votedown, .item-vote, h2 span").remove();$("#item-site").find("h2").append('<a class="voteupoff"><img src="/image/pixel.gif" alt=""/></a><a class="votedownoff"><img src="/image/pixel.gif" alt=""/></a>'+data[1]);$("#item-site").prepend(data[0])})});$(".pagination a").live("click",function(){$("html, body").animate({scrollTop:0},1000);window++;$(this).remove();pointer+=nbitem;$.post("/php/pagination.php",{pointer:pointer,orderby:orderby,nbitem:nbitem},function(data){$("#gallery #content").prepend('<p class="separate"></p>');$("#gallery #content").prepend(data);$(".loader").hide();var ind=nbitem-1;var intervalItem=setInterval(function(){$("#gallery #content .item:eq("+ind+")").show();ind--;if(ind<0){clearInterval(intervalItem)}},150);for(i=0;i<window;i++){if($(".pagination:eq("+i+")").find("a").length!=1){$(".pagination:eq("+i+")").html('<b>'+(i+1)+' <span>/</span> '+window+'</b>')}}});return false});$(".pagination a").live("mouseover",function(){$(this).find(".horiz").stop().animate({left:"58px",top:"66px",width:"90px",height:"24px"},400).css("backgroundImage","url(/image/bg-pagination.gif)");$(this).find(".verti").stop().animate({left:"91px",top:"33px",width:"24px",height:"90px"},400).css("backgroundImage","url(/image/bg-pagination.gif)")});$(".pagination a").live("mouseout",function(){$(this).find(".horiz").stop().animate({left:"70px",top:"72px",width:"66px",height:"12px"},400).css("background","#fff");$(this).find(".verti").stop().animate({left:"97px",top:"45px",width:"12px",height:"66px"},400).css("background","#fff")});$("#toprated").live("click",function(){$("html, body").animate({scrollTop:0},1000);$("#content .pagination a").remove();pointer=0;window=1;orderby="average";$(".loader").show();$.post("/php/pagination.php",{pointer:"0",orderby:orderby,nbitem:nbitem},function(data){$("#gallery #content *").remove();$("#gallery #content").prepend(data);$(".loader").hide();var ind=nbitem-1;var intervalItem=setInterval(function(){$("#gallery #content .item:eq("+ind+")").show();ind--;if(ind<0){clearInterval(intervalItem)}},150)});return false});$("#bt-submit, #bt-search").hover(function(){idDiv=$(this).attr("id").split("bt-");$("#"+idDiv[1]).stop().animate({left:"0"},900)});$("#submit-content, #search-content").hover(function(){idDiv=$(this).attr("id").split("-content")},function(){$("#"+idDiv[0]).stop().animate({left:"-455px"},900)});$("#form-submit").submit(function(){var v=new RegExp();v.compile("^http://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");if(v.test($("#input-site").attr("value"))){$("#input-site").css("color","green");$.post("/php/submit.php",{site:$("#input-site").attr("value")},function(){$("#input-submit").attr("value","Thank you")})}else{$("#input-site").css("color","red")}return false});$("#form-search").submit(function(){var val=$("#input-tag").attr("value");if(val==""){$("#input-tag").css("color","red")}else{return true}return false});var intervalLogo=setInterval(function(){$("#logo a").animate({width:"150px"},900);$("#logo span").animate({width:"0"},900);inl=0;if(inl==0){clearInterval(intervalLogo)}},3000);$("#logo").hover(function(){$(this).find("a").stop().animate({width:"258px"},900);$(this).find("span").stop().animate({width:"108px"},900)},function(){$(this).find("a").stop().animate({width:"150px"},900);$(this).find("span").stop().animate({width:"0"},900)});$('#infos').delay(5000).animate({height:0,width:0},900);$("#site .lk-title").hover(function(){$('#infos').animate({height:'150px',width:'620px'},900)},function(){$('#infos').delay(5000).animate({height:0,width:0},900)})});
