﻿var firstLoad=false;$(document).ready(function(){AllWallpapersJS();firstLoad=true;$.historyInit(pageload)});function AllWallpapersJS(){$("div.SRFilter").find("input").focus(function(){if($(this).val()=="Keyword..."){$(this).val("")}}).blur(function(){if($(this).val()==""){$(this).val("Keyword...")}});$("div.SRFilter div.NButton a").click(function(){$(this).parent("div.NButton").parent("div.SRFilter").find("input").focus();var query=document.location.search.substring(1);var keywords=$(this).parent("div.NButton").parent("div.SRFilter").find("input");var type=$(this).parent("div.NButton").parent("div.SRFilter").find("select#filterByType");var sortBy=$(this).parent("div.NButton").parent("div.SRFilter").find("select#sortBy");var champ=$(this).parent("div.NButton").parent("div.SRFilter").find("select#filterByChamp");var queryStr=$(keywords).serialize()+"&"+$(type).serialize()+"&"+$(sortBy).serialize()+"&"+$(champ).serialize();LoadWallpapersJSJson("Ajaxpages/AllWallpapersList.aspx",queryStr+"&"+query)});attachPaging()}function pageload(num){var currNum=1;if(num){currNum=num}if(!firstLoad){PagingWallpapers($("div.CP a[filter="+currNum+"]"));$.scrollTo("div.WPContent",1000)}firstLoad=false}function attachPaging(){$("div.CP a").attr("rel","history");$("div.CP a").each(function(i){if($(this).attr("class")!="CPS"&&$(this).attr("class")!="CND"&&$(this).attr("class")!="Pdim"){$(this).attr("href","#"+$(this).attr("filter"))}});$("div.CP a").click(function(){if($(this).attr("class")!="CPS"&&$(this).attr("class")!="CND"&&$(this).attr("class")!="Pdim"){if($(this).attr("rel")=="history"){var hash=this.href;hash=hash.replace(/^.*#/,'');$.historyLoad(hash)}}})}function PagingWallpapers(Obj){try{var qstrparams=$(Obj).attr("qstrparams");var page=$(Obj).attr("filter")}catch(er){var qstrparams=document.location.search.substring(1);var hashArr=document.location.href.split('#');var page=hashArr[hashArr.length-1]}LoadWallpapersJSJson("AjaxPages/AllWallpapersList.aspx","page="+page+"&"+qstrparams);return false}function LoadWallpapersJSJson(PageUrl,QString){$("div#AllWallpapersDV").html("<img class='loading' src='images/loading.gif' />");$.post(PageUrl,QStrToJson(QString),function(data){$("b#wpCount").html(data.wpcount);$("div#AllWallpapersDV").html(data.wallpapersList);attachWallpaperPreview();attachPaging()},"json")}function CheckAlerts(){$.post('AjaxPages/FilGoalAlert.aspx',QStrToJson('AppID=2'),function(data){if(data.alertDetails!=""){var alertDetails=data.alertDetails.replace('\n','').replace('&lt;br/&gt;','');jAlert(alertDetails,'Desktop alert ...')}return false},"json")}
