var state_desc=new Array();var state_duplicate=new Array();var t=new Array();var state_viewed=new Array();var xmlHttpRead=new Array();var xmlHttpSave=new Array();var xmlHttpInteresting=new Array();function GetXmlHttpObject(){xmlHttpObject=null;try{xmlHttpObject=new XMLHttpRequest();}catch(e){try{xmlHttpObject=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){xmlHttpObject=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttpObject;}
function toggle_desc(id){if(document.getElementById){id_desc="desc_"+ id;id_item="item_"+ id;id_read_unread="read_unread_footer_"+ id;id_simple="simple_"+ id;if(document.getElementById(id_read_unread)){state_read=document.getElementById(id_read_unread).innerHTML;}else{state_read="";}
if(state_desc[id]=='block'){state_desc[id]='none';if(state_read=="Mark Unread"){document.getElementById(id_item).style.backgroundColor="#E0E0E0";}else{}}else{state_desc[id]='block';document.getElementById(id_item).style.backgroundColor="#FFFFFF";}
if(document.getElementById(id_simple)){document.getElementById(id_simple).style.display=state_desc[id];simple=1;}else{simple=0;}
if(state_desc[id]=="block"){repoResult=reposition(0,id);position=repoResult[0];duration=repoResult[1];$("#desc_"+ id).width($("#main").width()- 16);if(position==1){$("#desc_"+ id).slideDown(duration,"linear",function(){repoResult=reposition(1,id);position=repoResult[0];if(position==1){$(id).find("img").each(function(){$(this).load(function(){repoResult=reposition(1,id);position=repoResult[0];});var t=setTimeout(function(){$(this).unbind('load')},3000);});}});}else{$("#desc_"+ id).slideDown(duration,"linear");}}else{repoResult=reposition(2,id);duration=repoResult[1];$("#desc_"+ id).slideUp(duration,"linear",function(){$(id).find("img").each(function(){$(this).unbind('load');});});}
noThumbs=$("#items_and_nav").data("noThumbs");psetting=$("#items_and_nav").data("preview");changeMainWidth(psetting,simple,noThumbs,0);}}
function reposition(action,id){id_item="item_"+ id;position=0;if(document.getElementById(id_item)){window_position=window.pageYOffset;item_initial_position=document.getElementById(id_item).offsetTop+ document.getElementById("main").offsetTop;item_current_position=item_initial_position- window_position;window_height=window.innerHeight;if(action==0){item_height=$("#item_"+ id).height()+ $("#desc_"+ id).height()+ 26;}else{item_height=$("#item_"+ id).height()+ 16;}
bottom_position=window_height- item_current_position- item_height;if(item_height<200){animationDuration=100;}else if(item_height<300){animationDuration=150;}else if(item_height<400){animationDuration=200;}else if(item_height<500){animationDuration=250;}else{animationDuration=300;}
if(action==2){if(item_current_position<0){$("html,body").animate({scrollTop:item_initial_position},animationDuration);}}else{if(item_current_position<0||item_height>window_height){$("html,body").animate({scrollTop:item_initial_position},animationDuration);}else{if(bottom_position<0){if(user_agent.match(/iphone/i)){if(user_agent.match(/iphone os 3/i)||user_agent.match(/iphone os 2/i)||user_agent.match(/iphone os 1/i)){bottom_position=window_height- item_initial_position- item_height;}}
$("html,body").animate({scrollTop:window_position- bottom_position},animationDuration);}
position=1;}}}
var returnArray=new Array(2);returnArray[0]=position;returnArray[1]=animationDuration;return returnArray;}
function titleExpand(event,id,viewed,footer){id_small="small_"+ id;id_item="item_"+ id;id_desc="desc_"+ id;id_title="title_"+ id;id_preview="preview_"+ id;id_view="view_"+ id;id_footer="footer_"+ id;id_story="collapse_story_"+ id;id_int="collapse_int_"+ id;id_share="collapse_share_"+ id;if(event.target){var evt=event.target.id;var evtParent=event.target.parentNode.id;}else{var evt=event.srcElement.id;var evtParent=event.srcElement.parentNode.id;}
if((evt==""&&(evtParent==id_item||evtParent==id_title||evtParent==id_view||evtParent==id_preview||evtParent==id_footer))||(evt==id_item&&footer==0)||evt==id_small||evt==id_preview||(evt==id_footer&&evtParent==id_desc)||(evtParent==id_footer&&(evt==id_story||evt==id_int||evt==id_share))){toggle_desc(id);}}
function toggle_duplicate(id){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{var id_array=new Array();id_array[0]=id;}
for(idx in id_array){id_dup="duplicate_"+ id_array[idx];if(state_duplicate[id_array[idx]]=='block'){state_duplicate[id_array[idx]]='none';}else{state_duplicate[id_array[idx]]='block';}
if(document.getElementById){document.getElementById(id_dup).style.display=state_duplicate[id_array[idx]];}else if(document.all){eval("document.all."+ id_dup+".style.display = "+ state_duplicate[id_array[idx]]);}else if(document.layers){document.layers[id_dup].visibility=state_duplicate[id_array[idx]];}}}
function viewed(id){if(document.getElementById){id_title="title_"+ id;if(document.getElementById(id_title).style.color!="#808080"){document.getElementById(id_title).style.color="purple";}
state_viewed[id]=1;}}
function changeSave(id,fid,viewed){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
id_small="small_"+ id_first;id_save="save_"+ id_first;id_title="title_"+ id_first;id_read_unread="read_unread_"+ id_first;id_feed="feed_"+ id_first;id_desc="desc_"+ id_first;id_interesting="interesting_"+ id_first;id_not_interesting="not_interesting_"+ id_first;document.getElementById(id_save).src="/themes/feedsanywhere/starred-interesting.png";document.getElementById(id_interesting).src="/themes/feedsanywhere/interesting-green-29x29.png";document.getElementById(id_not_interesting).src="/themes/feedsanywhere/not_interesting-29x29.png";if(fid=="saved"){if(viewed==1){document.getElementById(id_title).style.color="purple";}else{document.getElementById(id_title).style.color="blue";}
document.getElementById(id_small).style.color="black";if(document.getElementById(id_read_unread)){document.getElementById(id_read_unread).style.color="blue";}
document.getElementById(id_save).style.color="blue";document.getElementById(id_feed).style.color="blue";document.getElementById(id_desc).style.color="black";}else{document.getElementById(id_title).style.color="gray";document.getElementById(id_small).style.color="gray";if(document.getElementById(id_read_unread)){document.getElementById(id_read_unread).style.color="gray";}
if(fid>0){}else{document.getElementById(id_feed).style.color="gray";}
document.getElementById(id_desc).style.color="gray";$("#"+ id_read_unread).addClass("saved");$("#full_"+ id_first).addClass("saved");$("#share-"+ id_first).addClass("saved");$("#read_unread_footer_"+ id_first).addClass("saved");$("#sim_"+ id_first).addClass("saved");markRead=0;$(".mark").each(function(){if($(this).html()=="Mark Read"&&!$(this).hasClass("saved")){markRead=1;return false;}});if(markRead==0){$("#menu_page_read").hide();if($("#menu_page_unread").is(":visible")||$("#menu_all_read").is(":visible")){}else{$("#menu_read_group").hide();}}}}
function changeRemove(id,fid,viewed,interesting){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
id_small="small_"+ id_first;id_save="save_"+ id_first;id_title="title_"+ id_first;id_read_unread="read_unread_"+ id_first;id_feed="feed_"+ id_first;id_desc="desc_"+ id_first;if(interesting==1){document.getElementById(id_save).src="/themes/feedsanywhere/star-interesting.png";}else{document.getElementById(id_save).src="/themes/feedsanywhere/star-not-interesting.png";}
if(fid!="saved"){if(viewed==1){document.getElementById(id_title).style.color="purple";}else{document.getElementById(id_title).style.color="blue";}
document.getElementById(id_small).style.color="black";if(document.getElementById(id_read_unread)){document.getElementById(id_read_unread).style.color="blue";}
document.getElementById(id_save).style.color="blue";if(fid>0){}else{document.getElementById(id_feed).style.color="blue";}
document.getElementById(id_desc).style.color="black";$("#read_unread_"+ id_first).removeClass("saved");$("#full_"+ id_first).removeClass("saved");$("#share-"+ id_first).removeClass("saved");$("#read_unread_footer_"+ id_first).removeClass("saved");$("#sim_"+ id_first).removeClass("saved");}else{$("#items_and_nav").data("preload","");}}
function save(id,fid,page,viewed,readUnread){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
id_save="save_"+ id_first;if(document.getElementById){state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(state_viewed[id_first]==1){viewed=state_viewed[id_first];}
if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"){if(fid=="similar"||fid>0){$("#items_and_nav").data("preload","");}
if(flag=="starred-interesting.png"){interesting=1;changeRemove(id,fid,viewed,interesting);}else{interesting=0;changeRemove(id,fid,viewed,interesting);}
var url="/ajax_remove?id="+ id_first;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});id_read_unread="read_unread_footer_"+ id_first;if(document.getElementById(id_read_unread).innerHTML=="Mark Read"){numUnreadDuplicate=changeRead(id,0,0);if(fid!="interesting"&&fid!="all"&&fid!="popular"){num_unread=$("#feed-title-"+ fid).data("num_unread");if(num_unread!="unknown"&&num_unread!=null){feedName=$("#feed-title-"+ fid).html();feedName=feedName.replace(" ("+ num_unread+")","");num_unread--;$("#feed-title-"+ fid).data("num_unread",num_unread);if(num_unread==0){$("#feed-title-"+ fid).html(feedName);}else{feedHeading=feedName+" ("+ num_unread+")";$("#feed-title-"+ fid).html(feedHeading);}
if(fid=="saved"){if(num_unread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else{$("#main-menu-saved").html("Show Saved ("+ num_unread+")");$("#menu_saved").html("Show Saved ("+ num_unread+")");}}else if(fid=="category"){catNum="";c=0;while(document.getElementById("menu-cat-c"+ c)&&catNum==""){if($("#menu-cat-c"+ c).html().match(feedName)){catNum="c"+ c;}
c++;}
if(num_unread==0){$("#main-menu-"+ catNum).removeClass("bold");$("#main-menu-"+ catNum).html(feedName);$("#menu-cat-"+ catNum).html(feedName);}else{$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(feedHeading);$("#menu-cat-"+ catNum).html(feedHeading);}}}}
if(fid!="saved"){savedUnread=$("#menu_saved").html();savedUnread=savedUnread.replace("Show Saved (","");savedUnread=savedUnread.replace(")","");if(savedUnread=="1000+"){}else{savedUnread=parseInt(savedUnread)- 1;if(savedUnread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else{$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ savedUnread+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ savedUnread+")");}}}}}else{if(readUnread==1){if(fid=="interesting"||fid=="all"||fid=="popular"||fid=="category"){$("#items_and_nav").data("preload","");}}else{if(fid=="similar"||fid>0){$("#items_and_nav").data("preload","");}}
if(flag=="star-interesting.png"){interesting=1;}else if(flag=="star-not-interesting.png"){interesting=0;}else{interesting=2;}
state_read=$("#read_unread_footer_"+ id_first).html();changeSave(id,fid,viewed);var url="/ajax_save?id="+ id_first;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});if(fid=="interesting"||fid=="all"||fid=="popular"){num_unread=$("#feed-title-"+ fid).data("num_unread");if(num_unread!="unknown"&&num_unread!=null){feedName=$("#feed-title-"+ fid).html();feedName=feedName.replace(" ("+ num_unread+")","");num_unread--;$("#feed-title-"+ fid).data("num_unread",num_unread);if(num_unread==0){$("#feed-title-"+ fid).html(feedName);}else{feedHeading=feedName+" ("+ num_unread+")";$("#feed-title-"+ fid).html(feedHeading);}
if(fid=="interesting"&&document.getElementById("menu_interesting")){if(num_unread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(num_unread>0){$("#main-menu-interesting").html("Show Interesting ("+ num_unread+")");$("#menu_interesting").html("Show Interesting ("+ num_unread+")");}}else if(fid=="all"){if(num_unread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(num_unread>0){$("#main-menu-all").html("Show All ("+ num_unread+")");$("#menu_all").html("Show All ("+ num_unread+")");}}else if(fid=="popular"){if(num_unread==0){$("#main-menu-popular").removeClass("bold");$("#main-menu-popular").html("Show Popular");$("#menu_popular").removeClass("bold");$("#menu_popular").html("Show Popular");}else if(num_unread>0){$("#main-menu-popular").html("Show Popular ("+ num_unread+")");$("#menu_popular").html("Show Popular ("+ num_unread+")");}}}}
if(state_read=="Mark Read"){if(fid!="saved"){savedUnread=$("#menu_saved").html();savedUnread=savedUnread.replace("Show Saved (","");savedUnread=savedUnread.replace(")","");if(savedUnread=="1000+"){}else{savedUnread=parseInt(savedUnread)+ 1;if(savedUnread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else if(savedUnread>0){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ savedUnread+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ savedUnread+")");}}}
if(interesting==1&&fid!="interesting"&&fid!="saved"&&document.getElementById("menu_interesting")){intUnread=$("#menu_interesting").html();intUnread=intUnread.replace("Show Interesting (","");intUnread=intUnread.replace(")","");if(intUnread=="1000+"){}else{intUnread=parseInt(intUnread)- 1;if(intUnread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(intUnread>0){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ intUnread+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ intUnread+")");}}}
if(fid!="all"&&fid!="saved"){allUnread=$("#menu_all").html();allUnread=allUnread.replace("Show All (","");allUnread=allUnread.replace(")","");if(allUnread=="1000+"){}else{allUnread=parseInt(allUnread)- 1;if(allUnread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(allUnread>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All ("+ allUnread+")");$("#menu_all").addClass("bold");$("#menu_all").html("Show All ("+ allUnread+")");}}}}}}else{if(fid=="saved"){var url="/remove?id="+ id_first+"&fid="+ fid+"&page="+ page;document.location.href=url;}else{var url="/save?id="+ id_first+"&fid="+ fid+"&page="+ page;document.location.href=url;}}}
function changeNotInteresting(id_first){id_interesting="interesting_"+ id_first;id_not_interesting="not_interesting_"+ id_first;id_save="save_"+ id_first;document.getElementById(id_interesting).src="/themes/feedsanywhere/interesting-29x29.png";document.getElementById(id_not_interesting).src="/themes/feedsanywhere/not_interesting-red-29x29.png";state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-not-interesting.png";}else if(flag=="star-interesting.png"||flag=="star-neutral.png"){document.getElementById(id_save).src="/themes/feedsanywhere/star-not-interesting.png";}}
function changeInteresting(id_first){id_interesting="interesting_"+ id_first;id_not_interesting="not_interesting_"+ id_first;id_save="save_"+ id_first;document.getElementById(id_interesting).src="/themes/feedsanywhere/interesting-green-29x29.png";document.getElementById(id_not_interesting).src="/themes/feedsanywhere/not_interesting-29x29.png";state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-not-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-interesting.png";}else if(flag=="star-not-interesting.png"||flag=="star-neutral.png"){document.getElementById(id_save).src="/themes/feedsanywhere/star-interesting.png";}}
function notInteresting(id,page,auto,fid){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
if(document.getElementById){id_save="save_"+ id_first;state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedItem=1;intItem=0;}else{savedItem=0;if(fid!="interesting"&&flag=="star-interesting.png"){intItem=1;}else{intItem=0;}}}
changeNotInteresting(id_first);var url="/ajax_not_interesting?id="+ id_first;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});id_read_unread="read_unread_footer_"+ id_first;if(document.getElementById(id_read_unread).innerHTML=="Mark Read"){numUnreadDuplicate=changeRead(id,0,0);var url="/ajax_read?r="+ id;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}
changeReadOnChange(id_first,0,result);});num_unread=$("#feed-title-"+ fid).data("num_unread");if(num_unread!="unknown"&&num_unread!=null){feedName=$("#feed-title-"+ fid).html();feedName=feedName.replace(" ("+ num_unread+")","");num_unread--;$("#feed-title-"+ fid).data("num_unread",num_unread);if(num_unread==0){$("#feed-title-"+ fid).html(feedName);}else{feedHeading=feedName+" ("+ num_unread+")";$("#feed-title-"+ fid).html(feedHeading);}
if(fid=="saved"){if(num_unread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else if(num_unread>0){$("#main-menu-saved").html("Show Saved ("+ num_unread+")");$("#menu_saved").html("Show Saved ("+ num_unread+")");}}else if(fid=="interesting"&&document.getElementById("menu_interesting")){if(num_unread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(num_unread>0){$("#main-menu-interesting").html("Show Interesting ("+ num_unread+")");$("#menu_interesting").html("Show Interesting ("+ num_unread+")");}}else if(fid=="all"){if(num_unread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(num_unread>0){$("#main-menu-all").html("Show All ("+ num_unread+")");$("#menu_all").html("Show All ("+ num_unread+")");}}else if(fid=="popular"){if(num_unread==0){$("#main-menu-popular").removeClass("bold");$("#main-menu-popular").html("Show Popular");$("#menu_popular").removeClass("bold");$("#menu_popular").html("Show Popular");}else if(num_unread>0){$("#main-menu-popular").html("Show Popular ("+ num_unread+")");$("#menu_popular").html("Show Popular ("+ num_unread+")");}}else if(fid=="category"){catNum="";c=0;while(document.getElementById("menu-cat-c"+ c)&&catNum==""){if($("#menu-cat-c"+ c).html().match(feedName)){catNum="c"+ c;}
c++;}
if(num_unread==0){$("#main-menu-"+ catNum).removeClass("bold");$("#main-menu-"+ catNum).html(feedName);$("#menu-cat-"+ catNum).html(feedName);}else{$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(feedHeading);$("#menu-cat-"+ catNum).html(feedHeading);}}}
if(fid!="all"&&fid!="saved"&&savedItem==0){allUnread=$("#menu_all").html();allUnread=allUnread.replace("Show All (","");allUnread=allUnread.replace(")","");if(allUnread=="1000+"){}else{allUnread=parseInt(allUnread)- 1;if(allUnread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(allUnread>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All ("+ allUnread+")");$("#menu_all").addClass("bold");$("#menu_all").html("Show All ("+ allUnread+")");}}}
if(savedItem==1){savedUnread=$("#menu_saved").html();savedUnread=savedUnread.replace("Show Saved (","");savedUnread=savedUnread.replace(")","");if(savedUnread=="1000+"){}else{savedUnread=parseInt(savedUnread)- 1;if(savedUnread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else if(savedUnread>0){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ savedUnread+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ savedUnread+")");}}}
if(intItem==1&&savedItem==0&&document.getElementById("menu_interesting")){intUnread=$("#menu_interesting").html();intUnread=intUnread.replace("Show Interesting (","");intUnread=intUnread.replace(")","");if(intUnread=="1000+"){}else{intUnread=parseInt(intUnread)- 1;if(intUnread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(intUnread>0){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ intUnread+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ intUnread+")");}}}}}else{var url="/not_interesting?id="+ id+"&page="+ page;document.location.href=url;}}
function Interesting(id,page,auto,feed_num){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
if(document.getElementById){id_save="save_"+ id_first;state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedItem=1;intItem=0;}else{savedItem=0;if(fid!="interesting"&&(flag=="star-not-interesting.png"||flag=="star-neutral.png")){intItem=1;}else{intItem=0;}}}else{intItem=0;savedItem=0;}
changeInteresting(id_first);var url="/ajax_interesting?id="+ id_first;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});if(intItem==1&&savedItem==0&&document.getElementById("menu_interesting")){intUnread=$("#menu_interesting").html();intUnread=intUnread.replace("Show Interesting (","");intUnread=intUnread.replace(")","");if(intUnread=="1000+"){}else{intUnread=parseInt(intUnread)- 1;if(intUnread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(intUnread>0){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ intUnread+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ intUnread+")");}}}
if(document.getElementById("subscribe_title")){if(document.getElementById("subscribe_title").innerHTML=="Subscribe"){if(auto==1){autoAddFeed(feed_num);}else if(auto==2){var r=confirm("Do you want to subscribe to this feed?");if(r==true){autoAddFeed(feed_num);}}}}else if(auto==1){autoAddFeed(feed_num);}}else{var url="/interesting?id="+ id+"&page="+ page;document.location.href=url;}}
function changeUnread(id,page_read,read_status){if(id.match("_")){var id_array=id.split('_');}else{var id_array=new Array();id_array[0]=id;}
id_first=id_array[0];idCount=0;numUnread=0;for(idx in id_array){id_read_unread="read_unread_"+ id_array[idx];id_read_unread_footer="read_unread_footer_"+ id_array[idx];id_title="title_"+ id_array[idx];id_item="item_"+ id_array[idx];if(document.getElementById(id_title)){document.getElementById(id_title).style.fontWeight="bold";if(page_read==0&&idCount>0){numUnread++;}}
if(document.getElementById(id_read_unread)){document.getElementById(id_read_unread).innerHTML="Mark Read";}
if(document.getElementById(id_read_unread_footer)){document.getElementById(id_read_unread_footer).innerHTML="Mark Read";}
if(document.getElementById(id_item)){document.getElementById(id_item).style.backgroundColor="#FFFFFF";}
idCount++;}
$("#menu_read_group").show();$("#menu_page_read").show();markUnread=0;$(".mark").each(function(){if($(this).html()=="Mark Unread"&&!$(this).hasClass("saved")){markUnread=1;return false;}});if(markUnread==0){$("#menu_page_unread").hide();}
imgSrc=$("#gotowebsite_"+ id_first).attr('src');if(imgSrc!="/themes/feedsanywhere/gotowebsite.png"){resizeThumbnail(id_first);}
return numUnread;}
function changeRead(id,page_read,read_status){if(id.match("_")){var id_array=id.split('_');}else{var id_array=new Array();id_array[0]=id;}
id_first=id_array[0];idCount=0;numUnread=0;for(idx in id_array){id_read_unread="read_unread_"+ id_array[idx];id_read_unread_footer="read_unread_footer_"+ id_array[idx];id_title="title_"+ id_array[idx];id_item="item_"+ id_array[idx];if(document.getElementById(id_title)){document.getElementById(id_title).style.fontWeight="normal";if(page_read==0&&idCount>0){numUnread--;}}
if(document.getElementById(id_read_unread)){document.getElementById(id_read_unread).innerHTML="Mark Unread";}
if(document.getElementById(id_read_unread_footer)){document.getElementById(id_read_unread_footer).innerHTML="Mark Unread";}
if(document.getElementById(id_item)){if(state_desc[id]=='block'||page_read>0){document.getElementById(id_item).style.backgroundColor="#E7E7E7";}else{document.getElementById(id_item).style.backgroundColor="#E0E0E0";}}
idCount++;}
$("#menu_read_group").show();$("#menu_page_unread").show();markRead=0;$(".mark").each(function(){if($(this).html()=="Mark Read"&&!$(this).hasClass("saved")){markRead=1;return false;}});if(markRead==0||page_read==1){$("#menu_page_read").hide();}
imgSrc=$("#gotowebsite_"+ id_first).attr('src');if(imgSrc!="/themes/feedsanywhere/gotowebsite.png"){resizeThumbnail(id_first);}
return numUnread;}
function changeReadOnChange(id_first,page_read,result){id_read_unread="read_unread_"+ id_first;id_read_unread_footer="read_unread_footer_"+ id_first;id_title="title_"+ id_first;if((result>1||result==0)&&result!=""){alert("The item could not be marked read. Please check your connection and try again later.");document.getElementById(id_title).style.fontWeight="bold";document.getElementById(id_read_unread).innerHTML="Mark Read";document.getElementById(id_read_unread_footer).innerHTML="Mark Read";$("#menu_read_group").show();$("#menu_page_read").show();markUnread=0;$(".mark").each(function(){if($(this).html()=="Mark Unread"&&!$(this).hasClass("saved")){markUnread=1;return false;}});if(markUnread==0){$("#menu_page_unread").hide();}}}
function read_unread(id,fid,page,read_status,page_read){if(id!=""){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{var id_array=new Array();id_array[0]=id;id_first=id;}
allCount=0;savedCount=0;intCount=0;id_read_unread="read_unread_footer_"+ id_first;if(document.getElementById){num_unread=$("#feed-title-"+ fid).data("num_unread");if(num_unread!="unknown"&&num_unread!=null){feedName=$("#feed-title-"+ fid).html();feedName=feedName.replace(" ("+ num_unread+")","");}
if(page_read==0){state_read=document.getElementById(id_read_unread).innerHTML;id_save="save_"+ id_first;state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(state_read=="Mark Read"){if(num_unread!="unknown"&&num_unread!=null){num_unread--;}
if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedCount--;}else{allCount--;if(flag=="star-interesting.png"){intCount--;}}}}else{if(num_unread!="unknown"&&num_unread!=null){num_unread++;}
if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedCount++;}else{allCount++;if(flag=="star-interesting.png"){intCount++;}}}}}else if(page_read==1){state_read="Mark Read";id="";for(idx in id_array){id_read="read_unread_footer_"+ id_array[idx];id_duplicate="duplicate_"+ id_array[idx];if(!id.match(id_array[idx])){if(document.getElementById(id_read)){if(fid=="saved"){flag="";}else{id_save="save_"+ id_array[idx];state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);}
if(document.getElementById(id_read).innerHTML=="Mark Read"&&flag!="starred-interesting.png"&&flag!="starred-not-interesting.png"&&flag!="starred.png"){markEntryRead=1;if(id_first==0){id_first=id_array[idx];}
if(id==""){id=id_array[idx];}else{id+="_"+ id_array[idx];}
if(num_unread!="unknown"&&num_unread!=null){num_unread--;}
if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedCount--;}else{allCount--;if(flag=="star-interesting.png"){intCount--;}}}}else if(id_first==id_array[idx]){markEntryRead=0;id_first=0;}}else if(document.getElementById(id_duplicate)){if(markEntryRead==1){id+="_"+ id_array[idx];}}}}}else{state_read="Mark Unread";id="";for(idx in id_array){id_read="read_unread_footer_"+ id_array[idx];if(!id.match(id_array[idx])){if(document.getElementById(id_read)){if(fid=="saved"){flag="";}else{id_save="save_"+ id_array[idx];state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);}
if(document.getElementById(id_read).innerHTML=="Mark Unread"&&flag!="starred-interesting.png"&&flag!="starred-not-interesting.png"&&flag!="starred.png"){if(id_first==0){id_first=id_array[idx];}
if(id==""){id=id_array[idx];}else{id+="_"+ id_array[idx];}
if(num_unread!="unknown"&&num_unread!=null){num_unread++;}
if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedCount++;}else{allCount++;if(flag=="star-interesting.png"){intCount++;}}}}else if(id_first==id_array[idx]){id_first=0;}}}}}
if(state_read=="Mark Read"&&id!=""){numUnreadDuplicate=changeRead(id,page_read,read_status);if(read_status==3){$("#items_and_nav").data("mark_page_read",id);}else{if(read_status==2){var url="/ajax_read_google?r="+ id+"&fid="+ fid;}else{var url="/ajax_read?r="+ id;}
addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});}}else if(id!=""){numUnreadDuplicate=changeUnread(id,page_read,read_status);if(read_status==3){$("#items_and_nav").data("mark_page_read",id);}else{if(read_status==2){var url="/ajax_unread_google?ur="+ id;}else{var url="/ajax_unread?ur="+ id;}
addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});}}else{numUnreadDuplicate=0;}
if(numUnreadDuplicate!=0){if(num_unread!="unknown"&&num_unread!=null){num_unread=parseInt(num_unread)+ numUnreadDuplicate;}
if(fid!="saved"){if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedCount=parseInt(savedCount)+ numUnreadDuplicate;}else{allCount=parseInt(allCount)+ numUnreadDuplicate;if(flag=="star-interesting.png"){intCount=parseInt(intCount)+ numUnreadDuplicate;}}}}
if(num_unread!="unknown"&&num_unread!=null){$("#feed-title-"+ fid).data("num_unread",num_unread);if(num_unread==0){$("#feed-title-"+ fid).html(feedName);}else{feedHeading=feedName+" ("+ num_unread+")";$("#feed-title-"+ fid).html(feedHeading);}
if(fid=="saved"){if(num_unread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else{if(num_unread>0&&state_read=="Mark Unread"){$("#main-menu-saved").addClass("bold");$("#menu_saved").addClass("bold");}
$("#main-menu-saved").html("Show Saved ("+ num_unread+")");$("#menu_saved").html("Show Saved ("+ num_unread+")");}}else if(fid=="interesting"&&document.getElementById("menu_interesting")){if(num_unread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(num_unread>0){if(state_read=="Mark Unread"){$("#main-menu-interesting").addClass("bold");$("#menu_interesting").addClass("bold");}
$("#main-menu-interesting").html("Show Interesting ("+ num_unread+")");$("#menu_interesting").html("Show Interesting ("+ num_unread+")");}}else if(fid=="all"){if(num_unread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(num_unread>0){if(state_read=="Mark Unread"){$("#main-menu-all").addClass("bold");$("#menu_all").addClass("bold");}
$("#main-menu-all").html("Show All ("+ num_unread+")");$("#menu_all").html("Show All ("+ num_unread+")");}}else if(fid=="popular"){if(num_unread==0){$("#main-menu-popular").removeClass("bold");$("#main-menu-popular").html("Show Popular");$("#menu_popular").removeClass("bold");$("#menu_popular").html("Show Popular");}else if(num_unread>0){if(state_read=="Mark Unread"){$("#main-menu-popular").addClass("bold");$("#menu_popular").addClass("bold");}
$("#main-menu-popular").html("Show Popular ("+ num_unread+")");$("#menu_popular").html("Show Popular ("+ num_unread+")");}}else if(fid=="category"){catNum="";c=0;while(document.getElementById("menu-cat-c"+ c)&&catNum==""){if($("#menu-cat-c"+ c).html().match(feedName)){catNum="c"+ c;}
c++;}
if(num_unread==0){$("#main-menu-"+ catNum).removeClass("bold");$("#main-menu-"+ catNum).html(feedName);$("#menu-cat-"+ catNum).html(feedName);}else if(num_unread>0){$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(feedHeading);$("#menu-cat-"+ catNum).html(feedHeading);}}}
if(allCount!=0&&fid!="all"){allUnread=$("#menu_all").html();allUnread=allUnread.replace("Show All (","");allUnread=allUnread.replace(")","");if(allUnread=="1000+"){}else{allUnread=parseInt(allUnread)+ allCount;if(allUnread==0){$("#main-menu-all").removeClass("bold");$("#main-menu-all").html("Show All");$("#menu_all").removeClass("bold");$("#menu_all").html("Show All");}else if(allUnread>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All ("+ allUnread+")");$("#menu_all").addClass("bold");$("#menu_all").html("Show All ("+ allUnread+")");}}}
if(savedCount!=0&&fid!="saved"){savedUnread=$("#menu_saved").html();savedUnread=savedUnread.replace("Show Saved (","");savedUnread=savedUnread.replace(")","");if(savedUnread=="1000+"){}else{savedUnread=parseInt(savedUnread)+ savedCount;if(savedUnread==0){$("#main-menu-saved").removeClass("bold");$("#main-menu-saved").html("Show Saved");$("#menu_saved").removeClass("bold");$("#menu_saved").html("Show Saved");}else if(savedUnread>0){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ savedUnread+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ savedUnread+")");}}}
if(intCount!=0&&fid!="interesting"&&document.getElementById("menu_interesting")){intUnread=$("#menu_interesting").html();intUnread=intUnread.replace("Show Interesting (","");intUnread=intUnread.replace(")","");if(intUnread=="1000+"){}else{intUnread=parseInt(intUnread)+ intCount;if(intUnread==0){$("#main-menu-interesting").removeClass("bold");$("#main-menu-interesting").html("Show Interesting");$("#menu_interesting").removeClass("bold");$("#menu_interesting").html("Show Interesting");}else if(intUnread>0){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ intUnread+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ intUnread+")");}}}}else{if(read_status==1){var url="/mark_unread?ur="+ id+"&fid="+ fid+"&page="+ page;}else{var url="/mark_read?r="+ id+"&fid="+ fid+"&page="+ page;}
document.location.href=url;}}}
function getEntry(id){if(id.match("_")){var id_array=id.split('_');id=id_array[0];}
if(typeof(localStorage)=='undefined'){entryData=$("#main").data(id);}else{entryData=localStorage.getItem(id);}
var entryObj=new Array();if(entryData==""||entryData==undefined){}else{entryObj=jQuery.parseJSON(entryData);}
return entryObj;}
function saveEntry(id,entryObj){if(id.match("_")){var id_array=id.split('_');id=id_array[0];}
entryJSON=JSON.stringify(entryObj);if(entryJSON.substr(0,1)=="["){entryJSON=entryJSON.slice(1,-1);}
entryJSON=entryJSON.replace("\"update\":\"\"","");if(entryJSON=="{}"){if(typeof(localStorage)=='undefined'){$("#main").removeData(id);}else{localStorage.removeItem(id);}}else{if(typeof(localStorage)=='undefined'){$("#main").data(id,entryJSON);}else{try{localStorage.setItem(id,entryJSON);}catch(e){alert(e);}}}}
function addToEntry(id,url){entryObj=getEntry(id);if(entryObj.update==undefined||entryObj.update==""){entryObj.push({"update":url});}else{entryMatch=entryObj.update.replace("?","\\?");if(entryObj.update.match(entryMatch)){}else{entryObj.update+=";"+ url;}}
saveEntry(id,entryObj);}
function removeFromEntry(id,url){if(id.match("_")){var id_array=id.split('_');id=id_array[0];}
entryObj=getEntry(id);if(entryObj.update==undefined||entryObj.update==""){}else{urlMatch=url.replace("?","\\?");if(entryObj.update.match(urlMatch)){urlList="";urls=entryObj.update.split(";");for(u in urls){if(urls[u]==url){}else{if(urlList==""){urlList=urls[u];}else{urlList+=";"+ urls[u];}}}
entryObj.update=urlList;}
saveEntry(id,entryObj);}}
function getQueue(){if(typeof(localStorage)=='undefined'){queue=$("#main").data("queue");}else{queue=localStorage.getItem("queue");}
return queue;}
function saveQueue(queue){if(typeof(localStorage)=='undefined'){$("#main").data("queue",queue);}else{try{localStorage.setItem("queue",queue);}catch(e){alert(e);}}}
function addToQueue(url){queue=getQueue();if(queue==undefined||queue==""){queue=url;}else{urlMatch=url.replace("?","\\?");if(queue.match(urlMatch)){}else{queue+=";"+ url;}}
saveQueue(queue);}
function removeFromQueue(url){queue=getQueue();if(queue==undefined||queue==""){}else{urlMatch=url.replace("?","\\?");if(queue.match(urlMatch)){urlList=queue.split(";");queue="";for(u in urlList){if(urlList[u]==url){}else{if(queue==""){queue=urlList[u];}else{queue+=";"+ urlList[u];}}}}
saveQueue(queue);}}
function processQueue(){queue=getQueue();if(queue==undefined||queue==""){}else{urlList=queue.split(";");for(u in urlList){incrementAjaxCounter();$.get(urlList[u],function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});}}}
function toggle_feed_descriptions(find_feed_desc){if(document.getElementById){if(document.getElementById("menu_feed_descriptions").innerHTML=="Show Feed Descriptions"){var e=document.getElementsByName("find_feed_description");for(var i=0;i<e.length;i++){e[i].style.display="inline";}
var e=document.getElementsByTagName("span");for(var i=0;i<e.length;i++){e[i].style.display="inline";}
document.getElementById("menu_feed_descriptions").innerHTML="Hide Feed Descriptions";var url="/ajax_show_feed_descriptions";$.get(url);}else{var e=document.getElementsByName("find_feed_description");for(var i=0;i<e.length;i++){e[i].style.display="none";}
var e=document.getElementsByTagName("span");for(var i=0;i<e.length;i++){e[i].style.display="none";}
document.getElementById("menu_feed_descriptions").innerHTML="Show Feed Descriptions";var url="/ajax_hide_feed_descriptions";$.get(url);}}else{if(find_feed_desc==1){url="/show_feed_descriptions";}else{url="/hide_feed_descriptions";}
document.location.href=url;}}
function goToWebsite(id,v,m,f,i,mark_as_read){if(id.match("_")){var id_array=id.split('_');id_first=id_array[0];}else{id_first=id;}
id_read="read_unread_footer_"+ id_first;if(document.getElementById(id_read).innerHTML=="Mark Read"){m=0;}else if(document.getElementById(id_read).innerHTML=="Mark Unread"){m=1;}
id_title="title_"+ id_first;if(document.getElementById(id_title).style.color=="#808080"){v=0;}else if(document.getElementById(id_title).style.color=="purple"){v=1;}
if(v!=1){viewed(id_first);}
if(document.getElementById){if(mark_as_read==1&&m==0){pageUrl=location.href.split("/");feedId=pageUrl[4].split("#");fid=feedId[0];read_unread(id,fid,0,3,0);}
var url="/ajax_go?id="+ id_first+"&v="+ v+"&m="+ m+"&f="+ f+"&i="+ i+"&mr="+ mark_as_read;addToQueue(url);$.get(url,function(result){if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});}else{url="/go?id="+ id_first+"&v="+ v+"&m="+ m+"&f="+ f+"&i="+ i;document.location.href=url;}}
function highlightItem(id,op){if(state_desc[id]!='block'){if(document.getElementById){id_item="item_"+ id;id_read_unread="read_unread_footer_"+ id;if(document.getElementById(id_read_unread)){state_read=document.getElementById(id_read_unread).innerHTML;}else{state_read="";}
if(op==1){if(state_read=="Mark Unread"){document.getElementById(id_item).style.backgroundColor="#E0E0E0";}else{document.getElementById(id_item).style.backgroundColor="#F6F6F6";}}else{if(state_read=="Mark Unread"){document.getElementById(id_item).style.backgroundColor="#E7E7E7";}else{document.getElementById(id_item).style.backgroundColor="#FFFFFF";}}}}}
function addFeed(interesting,not_interesting){if(result!=0){if(interesting!=""){if(interesting.match("_")){var int_array2=interesting.split("_");for(idx in int_array2){id_save="save_"+ int_array2[idx];id_interesting="interesting_"+ int_array2[idx];if(document.getElementById(id_save)){state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-not-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-interesting.png";}else{document.getElementById(id_save).src="/themes/feedsanywhere/star-interesting.png";}}
if(document.getElementById(id_interesting)){document.getElementById(id_interesting).src="/themes/feedsanywhere/interesting-green-29x29.png";}}}else{id_save="save_"+ interesting;id_interesting="interesting_"+ interesting;if(document.getElementById(id_save)){state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-not-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-interesting.png";}else{document.getElementById(id_save).src="/themes/feedsanywhere/star-interesting.png";}}
if(document.getElementById(id_interesting)){document.getElementById(id_interesting).src="/themes/feedsanywhere/interesting-green-29x29.png";}}}
if(not_interesting!=""){if(not_interesting.match("_")){var int_array2=not_interesting.split("_");for(idx in int_array2){id_save="save_"+ int_array2[idx];id_not_interesting="not_interesting_"+ int_array2[idx];if(document.getElementById(id_save)){state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-not-interesting.png";}else{document.getElementById(id_save).src="/themes/feedsanywhere/star-not-interesting.png";}}
if(document.getElementById(id_not_interesting)){document.getElementById(id_not_interesting).src="/themes/feedsanywhere/not_interesting-red-29x29.png";}}}else{id_save="save_"+ not_interesting;id_not_interesting="not_interesting_"+ not_interesting;if(document.getElementById(id_save)){state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-interesting.png"){document.getElementById(id_save).src="/themes/feedsanywhere/starred-not-interesting.png";}else{document.getElementById(id_save).src="/themes/feedsanywhere/star-not-interesting.png";}}
if(document.getElementById(id_not_interesting)){document.getElementById(id_not_interesting).src="/themes/feedsanywhere/not_interesting-red-29x29.png";}}}}}
function addDeleteFeed(fid,page,act){if(fid>0){if(document.getElementById){if(document.getElementById("subscribe_menu").innerHTML=="Subscribe"){document.getElementById("subscribe_menu").innerHTML="Unsubscribe";if(document.getElementById("subscribe_title")){document.getElementById("subscribe_title").innerHTML="Unsubscribe";}
var url="/ajax_add_feed?fid="+ fid;addToQueue(url);$.get(url,function(result){if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);addFeed(entry.interesting,entry.not_interesting);removeFromQueue(entry.url);}});$("#add_to_category").show();}else{document.getElementById("subscribe_menu").innerHTML="Subscribe";if(document.getElementById("subscribe_title")){document.getElementById("subscribe_title").innerHTML="Subscribe";}
var url="/ajax_delete_feed?fid="+ fid;addToQueue(url);$.get(url,function(result){if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});$("#add_to_category").hide();}}else{if(act==1){url="/add_feed?fid="+ fid+"&page="+ page;}else{url="/delete_feed?fid="+ fid+"&page="+ page;}
document.location.href=url;}}}
function checkStatus(fid){if(fid>0||fid=="interesting"||fid=="all"||fid=="saved"||fid=="popular"){if(document.getElementById){var url="/ajax_check_status?fid="+ fid;$.get(url,function(result){if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);addFeed(entry.interesting,entry.not_interesting);}});}}}
function autoAddFeed(fid){if(document.getElementById){if(document.getElementById("subscribe_menu")){if(document.getElementById("subscribe_menu").innerHTML=="Subscribe"){document.getElementById("subscribe_menu").innerHTML="Unsubscribe";if(document.getElementById("subscribe_title").innerHTML=="Subscribe"){document.getElementById("subscribe_title").innerHTML="Unsubscribe";}}}
var url="/ajax_add_feed?fid="+ fid;addToQueue(url);$.get(url,function(result){if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);addFeed(entry.interesting,entry.not_interesting);removeFromQueue(entry.url);}});}}
function changeWidth(psetting,simple,noThumbs,windowResize){sbw=$(window).width();if(windowResize==1){if($("#main").data("sbw")==sbw){windowResize=0;}else{$("#main").data("sbw",sbw);}}
if(sbw<550){$("#menu_header").removeClass("menu-header-inline");$("#menu_header").addClass("menu-header-block");$("#menu_logo").removeClass("menu-logo-inline");$("#menu_logo").addClass("menu-logo-block");}else{$("#menu_header").removeClass("menu-header-block");$("#menu_header").addClass("menu-header-inline");$("#menu_logo").removeClass("menu-logo-block");$("#menu_logo").addClass("menu-logo-inline");}
changeMainWidth(psetting,simple,noThumbs,windowResize);if(document.getElementById("home-login-box")){$("#home-main-image").css("margin-top",0);if($("#image-and-login").width()>500){$("#home-login-box").css("margin-top",0);$("#home-login-box").css("margin-right",0);image_width=$("#image-and-login").outerWidth()- $("#home-login-box").outerWidth()- 24;if(image_width>494){image_width=494;}
$("#home-main-image").width(image_width);$("#home-login-box").css("float","right");loginMarginTop=($("#image-and-login").height()- $("#home-login-box").outerHeight())/2;if(loginMarginTop<0||loginMarginTop>50){loginMarginTop=0;}
if(loginMarginTop==0){imageMarginTop=($("#home-login-box").outerHeight()- $("#home-main-image").outerHeight())/2;$("#home-main-image").css("margin-top",imageMarginTop);}
$("#home-login-box").css("margin-top",loginMarginTop);loginMarginRight=($("#image-and-login").outerWidth()- image_width- $("#home-login-box").outerWidth()- 24)/3;$("#home-login-box").css("margin-right",loginMarginRight);}else{image_width=$("#image-and-login").width()- 24;$("#home-main-image").width(image_width);$("#home-login-box").css("margin-top",0);$("#home-login-box").css("float","left");loginWidth=$("#home-login-box").width()+ 16;$("#home-login-box").css("float","none");$("#home-login-box").css("margin-left","auto");$("#home-login-box").css("margin-right","auto");$("#home-login-box").width(loginWidth);}}}
function changeMainWidth(psetting,simple,noThumbs,windowResize){sbw=$(window).width();if(sbw>500){$("#main").css("border-left-style","solid");$("#main").css("border-right-style","solid");if(windowResize==1){mainWidth=$("#main").data("width");}else{mainWidth=$("#main").width();}
maxLimit=sbw- 16;if(mainWidth>maxLimit){$("#main").width(maxLimit);}else if(windowResize==1){$("#main").width(mainWidth);}
$(".ui-resizable-e").css("right","-5px");$(".ui-resizable-e").css("width","7px");$(".ui-resizable-w").css("left","-5px");$(".ui-resizable-w").css("width","7px");}else{$("#main").width("100%");$("#main").css("border-left-style","none");$("#main").css("border-right-style","none");$(".ui-resizable-e").css("right","0px");$(".ui-resizable-e").css("width","2px");$(".ui-resizable-w").css("left","0px");$(".ui-resizable-w").css("width","2px");}
if(psetting<2){preview(psetting,simple);}
if(noThumbs!=1){resizeThumbnails();}}
function displayAds(){sbw=$(window).width();if(sbw>800){if(document.getElementById("ad_mobile")){document.getElementById("ad_mobile").style.display="none";}
if(document.getElementById("middle")){document.getElementById("middle").style.borderRightColor="gray";document.getElementById("middle").style.borderRightWidth="1px";document.getElementById("middle").style.borderRightStyle="solid";document.getElementById("middle").style.marginRight="168px";}
if(document.getElementById("ad_sidebar")){document.getElementById("ad_sidebar").style.display="block";}}else{if(document.getElementById("ad_sidebar")){document.getElementById("ad_sidebar").style.display="none";}
if(document.getElementById("ad_sidebar2")){document.getElementById("ad_sidebar2").style.display="none";document.getElementById("ad_sidebar2").src="";}
if(document.getElementById("middle")){document.getElementById("middle").style.borderRightWidth="0";document.getElementById("middle").style.marginRight="0";}
if(document.getElementById("ad_mobile")){if($("#ad_mobile").html()!="<!-- google_afm -->"){document.getElementById("ad_mobile").style.display="block";firstDisplay=$("#ad_mobile").data("load");if(firstDisplay!=0&&firstDisplay!=1){$("#ad_mobile").data("load",1);}}}}}
function displayBottomAds(){sbw=$(window).width();footerPosition=document.getElementById("footer").offsetTop;if(sbw>800&&footerPosition>1500){if(document.getElementById("ad_sidebar2")){if(document.getElementById("ad_sidebar2").style.display!="block"){document.getElementById("ad_sidebar2").style.display="block";document.getElementById("ad_sidebar2").style.position="absolute";sidebarLeft=$(window).width()- 168;document.getElementById("ad_sidebar2").style.left=sidebarLeft+"px";document.getElementById("ad_sidebar2").style.height="608px";document.getElementById("ad_sidebar2").src="/ad_sidebar_google.html";}
sidebarTop=document.getElementById("footer").offsetTop- 608;document.getElementById("ad_sidebar2").style.top=sidebarTop+"px";}}else{if(document.getElementById("ad_sidebar2")){document.getElementById("ad_sidebar2").style.display="none";document.getElementById("ad_sidebar2").src="";}}}
function preview(setting,simple){sidebar_width=0;min_screen_width=750;mainWidth=$("#main").width();if(setting==1&&mainWidth>min_screen_width){var maxLength=(mainWidth- sidebar_width)/11;if(document.getElementsByName("preview_div")&&document.getElementsByName("preview_title")&&document.getElementsByName("preview")){var d=document.getElementsByName("preview_div");var t=document.getElementsByName("preview_title");var p=document.getElementsByName("preview");for(var i=0;i<d.length;i++){txt=t[i].innerHTML;long=txt.length- 63;if(long<maxLength){if(d[i]&&p[i]){d[i].style.paddingLeft="0px";d[i].style.overflow="hidden";d[i].style.whiteSpace="nowrap";p[i].style.display="inline";}}}}}else if(setting>1){}else{if(document.getElementsByName("preview_div")){var d=document.getElementsByName("preview_div");var p=document.getElementsByName("preview");for(var i=0;i<d.length;i++){if(d[i]&&p[i]){if(simple==1){d[i].style.paddingLeft="0px";}else if(document.getElementById("fa_login")){d[i].style.paddingLeft="0px";}else{d[i].style.paddingLeft="30px";}
d[i].style.overflow="visible";d[i].style.whiteSpace="normal";p[i].style.display="none";}}}}}
function undiscover(gid,page,qstr){if(document.getElementById("discover_icon")&&document.getElementById("discover_link")){prevIcon=document.getElementById("discover_icon").src;if(prevIcon.match("undiscover")){document.getElementById("discover_icon").src="/themes/feedsanywhere/discover.png";document.getElementById("discover_link").title="Only show items from subscribed feeds";var url="/ajax_discover";disc=1;}else{document.getElementById("discover_icon").src="/themes/feedsanywhere/undiscover.png";document.getElementById("discover_link").title="Discover similar items from unsubscribed feeds";var url="/ajax_undiscover";disc=0;}
$.get(url);if(document.getElementById("items_and_nav")){item_position=$("#items_and_nav").offset();window_height=$(window).height();item_height=$("#items_and_nav").height();bottom_position=window_height- item_position.top- item_height- 17;if(bottom_position>0){midH=item_height/2+ item_position.top- 8;}else{midH=window_height/2- 8;}
sbw=$(window).width();midW=sbw/2- 8;$("#items_and_nav").fadeTo(300,0.3);$.loading(true,{img:'/loading.gif',align:{top:midH,left:midW}});var url="/ajax_items?discover="+ disc+"&"+ qstr+"&sbw="+ sbw;$.get(url,function(result){itemsStatus(qstr,result,0);});user_agent=navigator.userAgent;if(user_agent.match(/iphone/i)||user_agent.match(/blackberry/i)||user_agent.match(/android/i)||user_agent.match(/webos/i)||user_agent.match(/windows phone os/i)){window.scrollTo(0,1);}else{window.scrollTo(0,0);}}else{var url="/feed/similar/"+ gid+"?page="+ page;document.location.href=url;}}else{var url="/undiscover?fid=similar&gid="+ gid+"&page="+ page;document.location.href=url;}}
function resizeThumbnails(){$(".desc_body").each(function(){imgEntryId=$(this).attr('id');imgSrc=$("#gotowebsite_"+ imgEntryId).attr('src');if(imgSrc!="/themes/feedsanywhere/gotowebsite.png"){resizeThumbnail(imgEntryId);}});}
function resizeThumbnail(imgEntryId){$("#container_"+ imgEntryId).css("top","0px");maxWidth=56;maxHeight=$("#view_"+ imgEntryId).height();if(maxHeight>maxWidth){maxHeight=maxWidth;}
user_agent=navigator.userAgent;containerMarginTop=$("#container_"+ imgEntryId).css("margin-top");if(containerMarginTop=="-4px"||containerMarginTop=="-6px"){if(maxHeight>48){if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")||user_agent.match("Safari")){$("#container_"+ imgEntryId).css("margin-top","-1px");}else{$("#container_"+ imgEntryId).css("margin-top","0");}}else{maxHeight+=8;if(maxHeight>maxWidth){maxHeight=maxWidth;}}}else if(maxHeight<49){imgWidth=$("#gotowebsite_"+ imgEntryId).width();imgHeight=$("#gotowebsite_"+ imgEntryId).height();if(imgWidth>maxHeight&&imgHeight>maxHeight){maxHeight+=8;if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")){$("#container_"+ imgEntryId).css("margin-top","-6px");}else{$("#container_"+ imgEntryId).css("margin-top","-4px");}}}
$("#container_"+ imgEntryId).height(maxHeight);$("#container_"+ imgEntryId).width(maxHeight);imgWidth=$("#gotowebsite_"+ imgEntryId).width();imgHeight=$("#gotowebsite_"+ imgEntryId).height();if(imgHeight<maxHeight&&!(imgWidth==32&&imgHeight==32)){$("#container_"+ imgEntryId).height(imgHeight);$("#container_"+ imgEntryId).width(imgHeight);}
if(imgWidth>imgHeight){$("#gotowebsite_"+ imgEntryId).css("max-height",maxHeight);newWidth=Math.round(imgWidth/imgHeight*maxHeight);$("#gotowebsite_"+ imgEntryId).css("max-width",newWidth);newPosition=Math.round(0-((newWidth- maxHeight)/2));if(newPosition<maxHeight){$("#gotowebsite_"+ imgEntryId).css("left",newPosition);}}else if(imgHeight>imgWidth){$("#gotowebsite_"+ imgEntryId).css("max-width",maxWidth);newHeight=Math.round(imgHeight/imgWidth*maxWidth);$("#gotowebsite_"+ imgEntryId).css("max-height",newHeight);newPosition=Math.round(0-((newHeight- maxWidth)/2));$("#gotowebsite_"+ imgEntryId).css("top",newPosition);}}
function touchThumbnail(imgEntryId,touchIcon){var newTouch=new Image();$(newTouch).data("entryId",imgEntryId);$(newTouch).attr("src",touchIcon).load(function(){var imgHeight=newTouch.height;var imgWidth=newTouch.width;firstImg=$(this).attr('src');imgEntryId=$(this).data("entryId");if(imgHeight<30||imgWidth<30){$("#gotowebsite_"+ imgEntryId).attr("src","/themes/feedsanywhere/gotowebsite.png");}else{maxHeight=$("#view_"+ imgEntryId).height();if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(maxHeight<49&&imgWidth>maxHeight&&imgHeight>maxHeight){maxHeight+=8;if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")){$("#container_"+ imgEntryId).css("margin-top","-6px");}else{$("#container_"+ imgEntryId).css("margin-top","-4px");}}else{if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")){$("#container_"+ imgEntryId).css("margin-top","-1px");}else{$("#container_"+ imgEntryId).css("margin-top","0");}}
$("#container_"+ imgEntryId).height(maxHeight);$("#container_"+ imgEntryId).width(maxHeight);$("#container_"+ imgEntryId).css("margin-right","6px");if(maxHeight<32){$("#container_"+ imgEntryId).css("top","0px");}
if(imgWidth>imgHeight){$("#gotowebsite_"+ imgEntryId).css("max-height",maxHeight);newWidth=Math.round(imgWidth/imgHeight*maxHeight);$("#gotowebsite_"+ imgEntryId).css("max-width",newWidth);if(maxHeight<32){newPosition=0;}else{newPosition=Math.round(0-((newWidth- maxHeight)/2));}
if(newPosition<maxHeight){$("#gotowebsite_"+ imgEntryId).css("left",newPosition);}}else if(imgHeight>imgWidth){$("#gotowebsite_"+ imgEntryId).css("max-width",maxWidth);newHeight=Math.round(imgHeight/imgWidth*maxWidth);$("#gotowebsite_"+ imgEntryId).css("max-height",newHeight);if(maxHeight<32){newPosition=0;}else{newPosition=Math.round(0-((newHeight- maxWidth)/2));}
$("#gotowebsite_"+ imgEntryId).css("top",newPosition);}
$("#gotowebsite_"+ imgEntryId).attr("src",touchIcon);resizeThumbnail(imgEntryId);}});}
function showThumbnails(){maxWidth=56;user_agent=navigator.userAgent;$(".desc_body").each(function(){imgEntryId=$(this).attr('id');$("#container_"+ imgEntryId).css("margin-top","0");$("#container_"+ imgEntryId).css("margin-right","0");$("#container_"+ imgEntryId).height("32px");$("#container_"+ imgEntryId).width("32px");$("#gotowebsite_"+ imgEntryId).css("left","0");$("#gotowebsite_"+ imgEntryId).css("top","0");if($(this).html().match("<img ")){firstImg=$(this).find("img").attr('src');var skipImages=new Array();skipImages[0]="http://api.tweetmeme.com/imagebutton.gif";skipImages[1]="http://ads.pheedo.com/img.phdo";skipImages[2]="http://feedads.g.doubleclick.net/";skipImages[3]="http://feeds.feedburner.com/";skipImages[4]="http://5.mshcdn.com/wp-content/themes/v7/img/share-buttons/stumbleupon.png";skipImages[5]="semiaccurate.com/openx/www/delivery/";skipImages[6]="_ad\.";if(firstImg!=undefined){useImage=1;for(s in skipImages){if(firstImg.match(skipImages[s])){useImage=0;break;}}
if(useImage==1){var newImg=new Image();$(newImg).data("entryId",imgEntryId);$(newImg).attr("src",firstImg).load(function(){var imgHeight=newImg.height;var imgWidth=newImg.width;firstImg=$(this).attr('src');imgEntryId=$(this).data("entryId");if(imgHeight<30||imgWidth<30){if(document.getElementById("feed_"+ imgEntryId)){feedAddress=$("#feed_"+ imgEntryId).attr("href").split("/");feedId=feedAddress[2];}else{pageUrl=location.href.split("/");feedId=pageUrl[4].split("#");feedId=feedId[0];}
touchIcon=$("#items_and_nav").data("touch_"+ feedId);if(touchIcon!=""&&touchIcon!=undefined){touchThumbnail(imgEntryId,touchIcon);}else{$("#gotowebsite_"+ imgEntryId).attr("src","/themes/feedsanywhere/gotowebsite.png");}}else{maxHeight=$("#view_"+ imgEntryId).height();if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(maxHeight<49&&imgWidth>maxHeight&&imgHeight>maxHeight){maxHeight+=8;if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")){$("#container_"+ imgEntryId).css("margin-top","-6px");}else{$("#container_"+ imgEntryId).css("margin-top","-4px");}}else{if(user_agent.match("iPhone")||user_agent.match("BlackBerry")||user_agent.match("Android")||user_agent.match("WebOS")||user_agent.match("Windows Phone OS")){$("#container_"+ imgEntryId).css("margin-top","-1px");}else{$("#container_"+ imgEntryId).css("margin-top","0");}}
$("#container_"+ imgEntryId).height(maxHeight);$("#container_"+ imgEntryId).width(maxHeight);$("#container_"+ imgEntryId).css("margin-right","6px");if(maxHeight<32){$("#container_"+ imgEntryId).css("top","0px");}
if(imgWidth>imgHeight){$("#gotowebsite_"+ imgEntryId).css("max-height",maxHeight);newWidth=Math.round(imgWidth/imgHeight*maxHeight);$("#gotowebsite_"+ imgEntryId).css("max-width",newWidth);if(maxHeight<32){newPosition=0;}else{newPosition=Math.round(0-((newWidth- maxHeight)/2));}
if(newPosition<maxHeight){$("#gotowebsite_"+ imgEntryId).css("left",newPosition);}}else if(imgHeight>imgWidth){$("#gotowebsite_"+ imgEntryId).css("max-width",maxWidth);newHeight=Math.round(imgHeight/imgWidth*maxWidth);$("#gotowebsite_"+ imgEntryId).css("max-height",newHeight);if(maxHeight<32){newPosition=0;}else{newPosition=Math.round(0-((newHeight- maxWidth)/2));}
$("#gotowebsite_"+ imgEntryId).css("top",newPosition);}
$("#gotowebsite_"+ imgEntryId).attr("src",firstImg);resizeThumbnail(imgEntryId);}});}else{if(document.getElementById("feed_"+ imgEntryId)){feedAddress=$("#feed_"+ imgEntryId).attr("href").split("/");feedId=feedAddress[2];}else{pageUrl=location.href.split("/");feedId=pageUrl[4].split("#");feedId=feedId[0];}
touchIcon=$("#items_and_nav").data("touch_"+ feedId);if(touchIcon!=""&&touchIcon!=undefined){touchThumbnail(imgEntryId,touchIcon);}}}}else{if(document.getElementById("feed_"+ imgEntryId)){feedAddress=$("#feed_"+ imgEntryId).attr("href").split("/");feedId=feedAddress[2];}else{pageUrl=location.href.split("/");feedId=pageUrl[4].split("#");feedId=feedId[0];}
touchIcon=$("#items_and_nav").data("touch_"+ feedId);if(touchIcon!=""&&touchIcon!=undefined){touchThumbnail(imgEntryId,touchIcon);}}});}
function simpleGotowebsite(imgEntryId){maxWidth=32;maxHeight=$("#view_"+ imgEntryId).height();if(maxHeight>maxWidth){maxHeight=maxWidth;}
if(maxHeight<32){maxHeight+=8;}
$("#container_"+ imgEntryId).height(maxHeight);$("#container_"+ imgEntryId).width(maxHeight);viewHeight=$("#view_"+ imgEntryId).height()+ 8;if(viewHeight<=25){$("#container_"+ imgEntryId).css("top","-4px");}else{topValue=(viewHeight- maxHeight)/2- 4;$("#container_"+ imgEntryId).css("top",topValue);$("#save_"+ imgEntryId).css("margin-top",topValue);}}
function decreaseFont(){$("#decrease-font").addClass("transparent");fontSize=parseInt($("body").css("font-size"));fontSize--;$("body").css("font-size",fontSize);noThumbs=$("#items_and_nav").data("noThumbs");if(noThumbs==0){resizeThumbnails();}
if(window.localStorage){localStorage.setItem("fontSize",fontSize);}
setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#decrease-font").removeClass("transparent");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
function increaseFont(){$("#increase-font").addClass("transparent");fontSize=parseInt($("body").css("font-size"));fontSize++;$("body").css("font-size",fontSize);noThumbs=$("#items_and_nav").data("noThumbs");if(noThumbs==0){resizeThumbnails();}
if(window.localStorage){localStorage.setItem("fontSize",fontSize);}
setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#increase-font").removeClass("transparent");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
function itemsStatus(qstr,newItems,nextDirect){$.loading(false);$("#items_and_nav").fadeTo(0,1.0);newItems=newItems.split("|*_|");if(nextDirect==1){itemsAndNav=newItems[3]+ newItems[5].toString();}else{itemsAndNav=newItems[3]+ newItems[4].toString();}
$("#items_and_nav").html(itemsAndNav);ids=$("#items_and_nav").data("mark_page_read");if(ids!=""&&ids!=undefined){var url="/ajax_read?r="+ ids;addToQueue(url);incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();if(result!=0){var entry=new Array();entry=jQuery.parseJSON(result);removeFromQueue(entry.url);}});$("#items_and_nav").data("mark_page_read","");}
if(newItems[1]<2){preview(newItems[1],newItems[2]);}
markPageRead=newItems[7];markPageRead=markPageRead.split(",");entry_ids=markPageRead[0];feed_id=markPageRead[1];nav=markPageRead[2];readUnread=markPageRead[3];num_unread=markPageRead[4];page_unread=markPageRead[5];numItemsDisplayed=markPageRead[6];hideUnread=markPageRead[7];int1000=markPageRead[8];all1000=markPageRead[9];discover=markPageRead[10];catName=markPageRead[11];preload=markPageRead[12];simple=markPageRead[13];noThumbs=markPageRead[14];pageMarkableRead=markPageRead[15];touchIcons=markPageRead[16];disableGestures=markPageRead[17];feedView=markPageRead[18];adjustForFontSize();if((simple!=2||newItems[1]==2)&&noThumbs!=1){if(touchIcons!=""){touchIcon=touchIcons.split("@@@");for(t in touchIcon){touchDetail=touchIcon[t].split("|");$("#items_and_nav").data("touch_"+ touchDetail[0],touchDetail[1]);}}
showThumbnails();}
$(".desc_body").each(function(){entryId=$(this).attr('id');$("#item_"+ entryId).click(function(event){itemId=$(this).attr('id').split("_");titleExpand(event,itemId[1],1,0);});document.getElementById("item_"+ entryId).ontouchstart=function(){this.onmouseover=null;this.onmouseout=null;}
document.getElementById("item_"+ entryId).onmouseover=function(){itemId=$(this).attr('id').split("_");highlightItem(itemId[1],1);}
document.getElementById("item_"+ entryId).onmouseout=function(){itemId=$(this).attr('id').split("_");highlightItem(itemId[1],0);}
if(simple==1){imgSrc=$("#gotowebsite_"+ entryId).attr('src');if(imgSrc=="/themes/feedsanywhere/gotowebsite.png"){simpleGotowebsite(entryId);}}
if(disableGestures!=1){$("#item_"+ entryId).bind("swipeone",function(event,obj){xDistance=obj.delta[0].lastX;yDistance=obj.delta[0].lastY;entryId=event.target.id.replace(/^item_/,'');if(xDistance<-90&&yDistance<90&&yDistance>-90){if(feedView==1||feedView==2){}else{swipeLimit=$(window).width()- 40+ xDistance;if(swipeLimit>0){toggle_desc(entryId);}else{$("#weblink_"+ entryId).click();target=$("#weblink_"+ entryId).attr("target");url=$("#weblink_"+ entryId).attr("href");if(target=="_blank"){window.open(url);}else{document.location.href=url;}}}}else if(xDistance>90&&yDistance<90&&yDistance>-90){$("#read_unread_footer_"+ entryId).click();}});}});if(disableGestures!=1){$("#main").bind("pinchopen",function(event,obj){increaseFont();});$("#main").bind("pinchclose",function(event,obj){decreaseFont();});}
formatDescriptions();if($("#items_and_nav").data("preload")=="fetching"){$("#items_and_nav").data("preload","cancel");}else if($("#items_and_nav").data("preload")!="cancel"){$("#items_and_nav").data("preload","");}
page_num=1;qstr_array=qstr.split("&");for(q in qstr_array){if(qstr_array[q].match("page=")){next_array=qstr_array[q].split('=');page_num=parseInt(next_array[1]);break;}}
if(hideUnread==1){num_unread="unknown";}else{if((readUnread==1||nextDirect==1)&&preload==1){num_unread_old=$("#feed-title-"+ feed_id).data("num_unread");}else if(num_unread>0||num_unread=="1000+"){$("#feed-title-"+ feed_id).html(newItems[6]);if(catName!=""){catDisplay=catName+" ("+ num_unread+")";catNum="";c=0;while(document.getElementById("menu-cat-c"+ c)&&catNum==""){if($("#menu-cat-c"+ c).html().match(catName)){catNum="c"+ c;}
c++;}
$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(catDisplay);$("#menu-cat-"+ catNum).html(catDisplay);}}}
if(num_unread>=0){next_unread="&num_unread="+ num_unread;if((readUnread==1||nextDirect==1)&&preload==1){}else{$("#feed-title-"+ feed_id).data("num_unread",num_unread);}}else if(num_unread=="1000+"){if(window.sessionStorage){check1000=sessionStorage.getItem("check1000-"+ feed_id);}else{check1000=$("#feed-title-"+ feed_id).data("check1000");}
if(!check1000||check1000==""||check1000==0){if(window.sessionStorage){sessionStorage.setItem("check1000-"+ feed_id,10);}else{$("#feed-title-"+ feed_id).data("check1000",10);}
next_unread="";}else{check1000--;if(window.sessionStorage){sessionStorage.setItem("check1000-"+ feed_id,check1000);}else{$("#feed-title-"+ feed_id).data("check1000",check1000);}
next_unread="&num_unread=1001";}
$("#feed-title-"+ feed_id).data("num_unread","unknown");}else{if(hideUnread==1){next_unread="";}else{next_unread="&num_unread=1001";}
$("#feed-title-"+ feed_id).data("num_unread","unknown");}
currentTime=new Date().getTime();if(next_unread!=""&&currentTime>$("#items_and_nav").data("new_unread")){next_unread="";}
if(newItems[8]!=""){$.post("/ajax_similar",{s:newItems[8],page:page_num,discover:discover,hide_unread:hideUnread,read_unread:readUnread,feed_id:feed_id},function(result){if(result!=""){similarItems=result.split("|*_|");for(entry in similarItems){itemEntry=similarItems[entry].split("%%%");entryID=itemEntry[0];similarIcon=itemEntry[1];similar=itemEntry[2];$("#sim_icon_"+ entryID).html(similarIcon);$("#similar_"+ entryID).html(similar);}}});}
var hash=location.hash;page=(hash.replace(/^#/,'')||1);if(page_num!=page){$("#items_and_nav").data("hash",1);window.location.hash=page_num;}
qstrTemp="";qstr_array=qstr.split("&");for(q in qstr_array){if(qstr_array[q].match("read_unread=")||qstr_array[q].match("feed_view=")||qstr_array[q].match("skip=")){}else{if(qstrTemp==""){qstrTemp=qstr_array[q];}else{qstrTemp+="&"+ qstr_array[q];}}}
qstr=qstrTemp;qstr_read=qstr+"&skip="+ entry_ids;showReadGroup=3;if(pageMarkableRead>0){$("#menu_read_group").show();$("#menu_page_read").show();}else{$("#menu_page_read").hide();showReadGroup--;}
$("#mark_page_read").unbind('click');if(nav==1&&entry_ids!=""){$("#mark_page_read").click(function(){read_unread(entry_ids,feed_id,page_num,3,1);navigation(qstr_read,2);return false;});}else if(entry_ids!=""){$("#mark_page_read").click(function(){read_unread(entry_ids,feed_id,page_num,0,1);return false;});}
if(num_unread==page_unread){$("#menu_all_read").hide();showReadGroup--;}else{$("#menu_read_group").show();$("#menu_all_read").show();}
$("#mark_page_unread").unbind('click');$("#mark_page_unread").click(function(){read_unread(entry_ids,feed_id,page_num,1,2);return false;});if(readUnread==0||page_unread==numItemsDisplayed){$("#menu_page_unread").hide();showReadGroup--;}else{$("#menu_read_group").show();$("#menu_page_unread").show();}
if(showReadGroup==0){$("#menu_read_group").hide();}
if(readUnread==1){pageNext=page_num+ 1;if(qstr.match("page=")){qstrTemp=qstr.replace("page="+ page_num,"page="+ pageNext);}else{qstrTemp=qstr+"&page=2";}
if($("#items_and_nav").data("preload")==""){$("#items_and_nav").data("preload","fetching");url="/ajax_items?"+ qstrTemp+"&sbw="+ sbw+"&preload=1"+ next_unread;waitForServer(url,qstrTemp,"preload",0,0,readUnread);}}else if(nav==1&&entry_ids!=""){if($("#items_and_nav").data("preload")==""){$("#items_and_nav").data("preload","fetching");url="/ajax_items?"+ qstr_read+"&sbw="+ sbw+"&preload=1"+ next_unread;waitForServer(url,qstr_read,"preload",0,0,readUnread);}}else{$("#items_and_nav").data("preload","");}
changeWidth(newItems[1],simple,noThumbs);$("#items_and_nav").data("preview",newItems[1]);if(hideUnread==0&&(nextDirect==2||currentTime>$("#items_and_nav").data("new_unread"))){unreadTime=new Date().getTime()+ 600000;$("#items_and_nav").data("new_unread",unreadTime);if(feed_id=="interesting"&&(num_unread>0||num_unread=="1000+")&&document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ num_unread+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ num_unread+")");if(all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");getUnreadCount(0,1,0,1,'');}else{getUnreadCount(0,1,1,1,'');}}else if(feed_id=="saved"&&(num_unread>0||num_unread=="1000+")){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ num_unread+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ num_unread+")");if(int1000>0&&all1000>0){if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");}
$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");getUnreadCount(0,0,0,1,'');}else if(int1000>0){if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");}
getUnreadCount(0,0,1,1,'');}else if(all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){getUnreadCount(1,0,0,1,'');}else{getUnreadCount(0,0,0,1,'');}}else{if(document.getElementById("menu_interesting")){getUnreadCount(1,0,1,1,'');}else{getUnreadCount(0,0,1,1,'');}}}else if(feed_id=="all"&&(num_unread>0||num_unread=="1000+")){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All ("+ num_unread+")");$("#menu_all").addClass("bold");$("#menu_all").html("Show All ("+ num_unread+")");if(int1000>0){if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,0,1,'');}else{getUnreadCount(0,1,0,1,'');}}else{if(document.getElementById("menu_interesting")){getUnreadCount(1,1,0,1,'');}else{getUnreadCount(0,1,0,1,'');}}}else if(feed_id=="popular"&&(num_unread>0||num_unread=="1000+")){$("#main-menu-popular").addClass("bold");$("#main-menu-popular").html("Show Popular ("+ num_unread+")");$("#menu_popular").addClass("bold");$("#menu_popular").html("Show Popular ("+ num_unread+")");if(int1000>0&&all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,2,0,'');}else{getUnreadCount(0,1,2,0,'');}}else if(int1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,1,0,'');}else{getUnreadCount(0,1,1,0,'');}}else if(all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){getUnreadCount(1,1,2,0,'');}else{getUnreadCount(0,1,2,0,'');}}else{if(document.getElementById("menu_interesting")){getUnreadCount(1,1,1,0,'');}else{getUnreadCount(0,1,1,0,'');}}}else if(feed_id=="category"&&(num_unread>0||num_unread=="1000+")){if(int1000>0&&all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,2,1,catName);}else{getUnreadCount(0,1,2,1,catName);}}else if(int1000>0){if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,1,1,catName);}else{getUnreadCount(0,1,1,1,catName);}}else if(all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){getUnreadCount(1,1,2,1,catName);}else{getUnreadCount(0,1,2,1,catName);}}else{if(document.getElementById("menu_interesting")){getUnreadCount(1,1,1,1,catName);}else{getUnreadCount(0,1,1,1,catName);}}}else{if(int1000>0&&all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,2,1,'');}else{getUnreadCount(0,1,2,1,'');}}else if(int1000>0){if(document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");getUnreadCount(2,1,1,1,'');}else{getUnreadCount(0,1,1,1,'');}}else if(all1000>0){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");if(document.getElementById("menu_interesting")){getUnreadCount(1,1,2,1,'');}else{getUnreadCount(0,1,2,1,'');}}else{if(document.getElementById("menu_interesting")){getUnreadCount(1,1,1,1,'');}else{getUnreadCount(0,1,1,1,'');}}}}}
function selectAll(){var x=document.getElementById("new_user");for(var i=0;i<x.length;i++){x.elements[i].checked=true;}}
function selectNone(){var x=document.getElementById("new_user");for(var i=0;i<x.length;i++){x.elements[i].checked=false;}}
function getUnreadCountStatus(interesting,saved,all,popular,category){if(xmlHttpUnread.readyState==4||xmlHttpUnread.readyState=="complete"){var result=xmlHttpUnread.responseText;if(result.match("|")){var unread_array=result.split("|");if(interesting==1&&document.getElementById("menu_interesting")&&(unread_array[0]>0||unread_array[0]=="1000+")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting ("+ unread_array[0]+")");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting ("+ unread_array[0]+")");$("#feed-title-interesting").html("Interesting ("+ unread_array[0]+")");}else if(interesting==2&&document.getElementById("menu_interesting")){$("#main-menu-interesting").addClass("bold");$("#main-menu-interesting").html("Show Interesting (1000+)");$("#menu_interesting").addClass("bold");$("#menu_interesting").html("Show Interesting (1000+)");}
if(saved==1&&document.getElementById("menu_saved")&&(unread_array[1]>0||unread_array[1]=="1000+")){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved ("+ unread_array[1]+")");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved ("+ unread_array[1]+")");$("#feed-title-saved").html("Saved ("+ unread_array[1]+")");}else if(saved==2&&document.getElementById("menu_saved")){$("#main-menu-saved").addClass("bold");$("#main-menu-saved").html("Show Saved (1000+)");$("#menu_saved").addClass("bold");$("#menu_saved").html("Show Saved (1000+)");}
if(all==1&&document.getElementById("menu_all")&&(unread_array[2]>0||unread_array[2]=="1000+")){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All ("+ unread_array[2]+")");$("#menu_all").addClass("bold");$("#menu_all").html("Show All ("+ unread_array[2]+")");$("#feed-title-all").html("All Feeds ("+ unread_array[2]+")");}else if(all==2&&document.getElementById("menu_all")){$("#main-menu-all").addClass("bold");$("#main-menu-all").html("Show All (1000+)");$("#menu_all").addClass("bold");$("#menu_all").html("Show All (1000+)");}
if(category==1&&document.getElementById("menu_category")&&(unread_array[4]>0||unread_array[4]=="1000+")){$("#menu_category").addClass("bold");document.getElementById("menu_category").innerHTML="Show Category ("+ unread_array[4]+")";cat_unreads=unread_array[5];if(result.match("-*-")){var cat_array=cat_unreads.split('***');for(cat in cat_array){var subscribed_array=cat_array[cat].split('-*-');catNum=subscribed_array[0];catName=subscribed_array[1];catUnread=subscribed_array[2];catDisplay=catName+" ("+ catUnread+")";if(document.getElementById("feed-"+ catNum)){$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(catDisplay);$("#feed-"+ catNum).addClass("bold");$("#feed-"+ catNum).html(catDisplay);}
$("#main-menu-"+ catNum).addClass("bold");$("#main-menu-"+ catNum).html(catDisplay);$("#menu-cat-"+ catNum).html(catDisplay);}}}
if(popular==1&&document.getElementById("menu_popular")&&(unread_array[3]>0||unread_array[3]=="1000+")){$("#main-menu-popular").addClass("bold");$("#main-menu-popular").html("Show Popular ("+ unread_array[3]+")");$("#menu_popular").addClass("bold");document.getElementById("menu_popular").innerHTML="Show Popular ("+ unread_array[3]+")";$("#feed-title-popular").html("Popular ("+ unread_array[3]+")");}}}}
function getUnreadCount(interesting,saved,all,popular,currentCategory){xmlHttpUnread=GetXmlHttpObject();if(xmlHttpUnread!=null){if(document.getElementById("menu_category")){category=1;}else{category=0;}
if(currentCategory!=""){num_unread=$("#feed-title-category").data("num_unread");if(num_unread=="unknown"){num_unread=1001;}
var url="/ajax_get_unread_count?i="+ interesting+"&s="+ saved+"&a="+ all+"&p="+ popular+"&c="+ category+"&nc="+ currentCategory+"&num_unread="+ num_unread;}else{var url="/ajax_get_unread_count?i="+ interesting+"&s="+ saved+"&a="+ all+"&p="+ popular+"&c="+ category;}
xmlHttpUnread.open("GET",url,true);xmlHttpUnread.onreadystatechange=function(){getUnreadCountStatus(interesting,saved,all,popular,category)};xmlHttpUnread.send(null);}}
function navigation(qstr,nextPage){qstr=qstr.replace(/&search_text=.*/,"");qstr_array=qstr.split("&");for(q in qstr_array){if(qstr_array[q].match("feed_id=")){next_array=qstr_array[q].split('=');fid=next_array[1];break;}}
if(nextPage==3){nextDirect=2;}else{nextDirect=0;}
if(nextPage==1){markRead=0;m=0;$(".mark").each(function(){m++;if($(this).html()=="Mark Read"&&!$(this).hasClass("saved")){markRead=1;return false;}});if(markRead==0&&m>0){qstrTemp="";qstr_array=qstr.split("&");for(q in qstr_array){if(qstr_array[q].match("page=")){next_array=qstr_array[q].split('=');page_num=parseInt(next_array[1]);if(page_num>1){page_num-=1;}
qstr_array[q]="page="+ page_num;}
if(qstrTemp==""){qstrTemp=qstr_array[q];}else{qstrTemp+="&"+ qstr_array[q];}}
qstr=qstrTemp;}else if(markRead==1){if(fid=="interesting"||fid=="all"||fid=="saved"||fid=="popular"){markRead=0;nextDirect=1;$(".mark").each(function(){if($(this).html()=="Mark Unread"){markRead=1;nextDirect=0;return false;}});if(nextDirect==1){$(".mark").each(function(){if($(this).hasClass("saved")){markRead=1;nextDirect=0;return false;}});}
if(nextDirect==0){if($("#items_and_nav").data("preload")=="fetching"){$("#items_and_nav").data("preload","cancel");}else{$("#items_and_nav").data("preload","");}}}}}
user_agent=navigator.userAgent;if(user_agent.match(/iphone/i)||user_agent.match(/blackberry/i)||user_agent.match(/android/i)||user_agent.match(/webos/i)||user_agent.match(/windows phone os/i)){window.scrollTo(0,1);}else{window.scrollTo(0,0);}
item_position=$("#items_and_nav").offset();window_height=$(window).height();item_height=$("#items_and_nav").height();bottom_position=window_height- item_position.top- item_height- 17;if(bottom_position>0){midH=item_height/2+ item_position.top- 8;}else{if(user_agent.match("iPhone")){midH=window_height/2+ 9;}else{midH=window_height/2- 8;}}
sbw=$(window).width();midW=sbw/2- 8;if(document.getElementById("items_and_nav")){currentTime=new Date().getTime();if(document.getElementById("search-text1")){searchText=$("#search-text1").val();}else if(document.getElementById("search-text2")){searchText=$("#search-text2").val();}else{searchText="";}
if(searchText!=""){qstr=qstr+"&search_text="+ searchText;}
if(((nextPage==1&&markRead==0)||nextPage==2)&&$("#items_and_nav").data("preload")!=""&&$("#items_and_nav").data("preload")!="cancel"&&currentTime<$("#items_and_nav").data("expiration")){$("#items_and_nav").fadeTo(300,0.3);if($("#items_and_nav").data("preload")!="fetching"){$.loading(true,{img:'/loading.gif',align:{top:midH,left:midW}});var t=setTimeout(function(){itemsStatus(qstr,$("#items_and_nav").data("preload"),nextDirect)},300);}else{$.loading(true,{img:'/loading.gif',align:{top:midH,left:midW}});waitForPreload(qstr,nextDirect,0);}}else{$("#items_and_nav").fadeTo(300,0.3);$.loading(true,{img:'/loading.gif',align:{top:midH,left:midW}});if(nextPage!=2||fid=="similar"||fid>0){qstrTemp="";qstr_array=qstr.split("&");for(q in qstr_array){if(qstr_array[q].match("skip=")){}else{if(qstrTemp==""){qstrTemp=qstr_array[q];}else{qstrTemp+="&"+ qstr_array[q];}}}
qstr=qstrTemp;}
skipCount=0;if(nextPage==2&&(fid=="similar"||fid>0)){ids=$("#items_and_nav").data("mark_page_read");if(ids!=""&&ids!=undefined){if(ids.match("_")){var id_array=ids.split('_');id_first=id_array[0];}else{var id_array=new Array();id_array[0]=ids;id_first=ids;}
id="";for(idx in id_array){id_read="read_unread_footer_"+ id_array[idx];id_duplicate="duplicate_"+ id_array[idx];if(!id.match(id_array[idx])){if(document.getElementById(id_read)){id_save="save_"+ id_array[idx];state_save=document.getElementById(id_save).src;position=state_save.lastIndexOf("/")+ 1;flag=state_save.slice(position);if(flag=="starred-interesting.png"||flag=="starred-not-interesting.png"||flag=="starred.png"){savedEntry=1;}else{savedEntry=0;skipCount++;if(id==""){id=id_array[idx];}else{id+="_"+ id_array[idx];}}}else if(document.getElementById(id_duplicate)){if(savedEntry==0){id+="_"+ id_array[idx];}}}}}
qstr+="&skip="+ id;}
num_unread=$("#feed-title-"+ fid).data("num_unread");if(num_unread=="unknown"||num_unread==null){var url="/ajax_items?"+ qstr+"&sbw="+ sbw;}else{num_unread=parseInt(num_unread)+ skipCount;var url="/ajax_items?"+ qstr+"&sbw="+ sbw+"&num_unread="+ num_unread;}
waitForServer(url,qstr,"new",0,nextDirect,0);$("#updating-feed").hide();user_agent=navigator.userAgent;if(user_agent.match(/iphone/i)||user_agent.match(/blackberry/i)||user_agent.match(/android/i)||user_agent.match(/webos/i)||user_agent.match(/windows phone os/i)){window.scrollTo(0,1);}else{window.scrollTo(0,0);}}}else{var url="/feeds.php?"+ qstr;document.location.href=url;}}
function waitForPreload(qstr,nextDirect,count){if(count>100&&!qstr.match("read_unread=1")){ids=$("#items_and_nav").data("mark_page_read");if(ids!=""&&ids!=undefined){var url="/ajax_read?r="+ ids;addToQueue(url);$("#items_and_nav").data("mark_page_read","");}
$.loading(false);$("#items_and_nav").fadeTo(0,1.0);$("#items_and_nav").html("<div class=\"item-top\">The FeedsAnywhere server could not be reached. Please check your connection and <a href=\"javascript:history.go(0)\">press here to reload</a> the page.</div>");}else{var t=setTimeout(function(){if($("#items_and_nav").data("preload")!="fetching"){itemsStatus(qstr,$("#items_and_nav").data("preload"),nextDirect);}else{count++;waitForPreload(qstr,nextDirect,count);}},300);}}
function waitForServer(url,qstr,type,count,nextDirect,readUnread){openRequests=$("#main").data("ajax");if(openRequests==0||openRequests==undefined){queue=getQueue();if(queue==undefined||queue==""){}else{processQueue();}}
if(readUnread==1){openRequests=0;}else{openRequests=$("#main").data("ajax");}
if(openRequests>0&&count<20){var t=setTimeout(function(){count++;waitForServer(url,qstr,type,count,nextDirect);},300);}else{if(type=="preload"){$.get(url,function(result){if($("#items_and_nav").data("preload")!="cancel"){$("#items_and_nav").data("preload",result);preloadTime=new Date().getTime()+ 3600000;$("#items_and_nav").data("expiration",preloadTime);}else{$("#items_and_nav").data("preload","");}});}else{$.ajax({url:url,success:function(result){itemsStatus(qstr,result,nextDirect)},error:function(){ids=$("#items_and_nav").data("mark_page_read");if(ids!=""&&ids!=undefined){var url="/ajax_read?r="+ ids;addToQueue(url);$("#items_and_nav").data("mark_page_read","");}
$.loading(false);$("#items_and_nav").fadeTo(0,1.0);$("#items_and_nav").html("<div class=\"item-top\">The FeedsAnywhere server could not be reached. Please check your connection and <a href=\"javascript:history.go(0)\">press here to reload</a> the page.</div>");},timeout:120000});}}}
function waitUntilDone(count){openRequests=$("#main").data("ajax");if(openRequests=="0"||openRequests==""||openRequests==undefined||count>10){}else{var t=setTimeout(function(){count++;waitUntilDone(count);},300);}}
function selectFeed(){xmlHttpSelectFeed=GetXmlHttpObject();if(xmlHttpSelectFeed!=null){var url="/ajax_select_feed";$.get(url,function(result){if(result.match("|")){var feed_array=result.split('|*_|');for(feed in feed_array){var subscribed_array=feed_array[feed].split('|');subscribedFeed=subscribed_array[0];subscribedUnread=subscribed_array[1];feedName=$("#feed-"+ subscribedFeed).html();feedDisplay=feedName+" ("+ subscribedUnread+")";$("#feed-"+ subscribedFeed).addClass("bold");$("#feed-"+ subscribedFeed).html(feedDisplay);}}
if(document.getElementById("menu_interesting")){getUnreadCount(1,1,1,1,'');}else{getUnreadCount(0,1,1,1,'');}});}}
function showReadUnread(qstr,readUnread){$("#items_and_nav").data("preload","");qstrNew=qstr+"&read_unread="+ readUnread;navigation(qstrNew,0);}
function changeView(qstr,feedView){$("#items_and_nav").data("preload","");qstrNew=qstr+"&feed_view="+ feedView;navigation(qstrNew,0);}
function preloadImages(){if(document.images){preload_image1=new Image(32,32);preload_image1.src="/themes/feedsanywhere/star-interesting.png";preload_image2=new Image(32,32);preload_image2.src="/themes/feedsanywhere/star-neutral.png";preload_image3=new Image(32,32);preload_image3.src="/themes/feedsanywhere/star-not-interesting.png";preload_image4=new Image(32,32);preload_image4.src="/themes/feedsanywhere/starred-interesting.png";preload_image5=new Image(32,32);preload_image5.src="/themes/feedsanywhere/starred-not-interesting.png";preload_image7=new Image(14,14);preload_image7.src="/themes/feedsanywhere/discover.png";preload_image8=new Image(14,14);preload_image8.src="/themes/feedsanywhere/undiscover.png";preload_image9=new Image(29,29);preload_image9.src="/themes/feedsanywhere/interesting-29x29.png";preload_image10=new Image(29,29);preload_image10.src="/themes/feedsanywhere/not_interesting-29x29.png";preload_image11=new Image(29,29);preload_image11.src="/themes/feedsanywhere/interesting-green-29x29.png";preload_image12=new Image(29,29);preload_image12.src="/themes/feedsanywhere/not_interesting-red-29x29.png";preload_image13=new Image(16,16);preload_image13.src="/loading.gif";preload_image14=new Image(22,22);preload_image14.src="/themes/feedsanywhere/configure-blue.png";}}
function sortDate(qstr){qstrNew=qstr+"&sort_type=0";$("#items_and_nav").data("preload","");navigation(qstrNew,0);$("#score-check").hide();$("#oldest-check").hide();$("#date-check").show();}
function sortOldest(qstr){qstrNew=qstr+"&sort_type=2";$("#items_and_nav").data("preload","");navigation(qstrNew,0);$("#score-check").hide();$("#date-check").hide();$("#oldest-check").show();}
function sortScore(qstr){qstrNew=qstr+"&sort_type=1";$("#items_and_nav").data("preload","");navigation(qstrNew,0);$("#date-check").hide();$("#oldest-check").hide();$("#score-check").show();}
function sortRelevance(qstr,relevance){qstrNew=qstr+"&sort_relevance="+ relevance;$("#items_and_nav").data("preload","");navigation(qstrNew,0);if(relevance==1){$("#relevance-check").hide();$("#relevance-check").data("check",0);$("#sort-date").removeClass("settings-gray");$("#sort-oldest").removeClass("settings-gray");$("#sort-score").removeClass("settings-gray");}else{$("#relevance-check").show();$("#relevance-check").data("check",1);$("#sort-date").addClass("settings-gray");$("#sort-oldest").addClass("settings-gray");$("#sort-score").addClass("settings-gray");}}
function enablePreview(simple,user_id,qstr){$("#items_and_nav").data("preload","");if($("#preview-check").is(":visible")){$("#preview-check").hide();if(user_id==0){navigation(qstr+"&preview=0",0);}else{preview(0,simple);url="/ajax_preview?preview=0";$.get(url);}}else{$("#preview-check").show();if(user_id==0){navigation(qstr+"&preview=1",0);}else{preview(1,simple);url="/ajax_preview?preview=1";$.get(url);}}
$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
function searchMenuAdjustments(searchText){if(searchText!=""){$("#sort-relevance").show();if($("#relevance-check").data("check")==1){$("#sort-date").addClass("settings-gray");$("#sort-oldest").addClass("settings-gray");$("#sort-score").addClass("settings-gray");}}else{$("#sort-relevance").hide();$("#sort-date").removeClass("settings-gray");$("#sort-oldest").removeClass("settings-gray");$("#sort-score").removeClass("settings-gray");}}
function settingsMenu(qstr,simple,user_id){if(isTouchSupported()){$("#sort-date").bind("touchstart",function(event,obj){if($("#date-check").is(":visible")){}else{$("#sort-date").addClass("settings-highlight");sortDate(qstr);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#sort-date").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-oldest").bind("touchstart",function(event,obj){if($("#oldest-check").is(":visible")){}else{$("#sort-oldest").addClass("settings-highlight");sortOldest(qstr);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#sort-oldest").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-score").bind("touchstart",function(event,obj){if($("#score-check").is(":visible")){}else{$("#sort-score").addClass("settings-highlight");sortScore(qstr);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#sort-score").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-relevance").bind("touchstart",function(event,obj){$("#sort-relevance").addClass("settings-highlight");if($("#relevance-check").is(":visible")){sortRelevance(qstr,1);}else{sortRelevance(qstr,0);}
setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#sort-relevance").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");return false;});$("#show-card").bind("touchstart",function(event,obj){if($("#card-check").is(":visible")){}else{$("#show-card").addClass("settings-highlight");$("#card-check").show();$("#title-check").hide();$("#combined-check").hide();$("#simple-view").addClass("settings-gray");$("#enable-preview").addClass("settings-gray");$("#enable-preview").unbind('click');changeView(qstr,2);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#show-card").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-title").bind("touchstart",function(event,obj){if($("#title-check").is(":visible")){}else{$("#show-title").addClass("settings-highlight");$("#card-check").hide();$("#combined-check").hide();$("#title-check").show();$("#simple-view").removeClass("settings-gray");$("#enable-preview").removeClass("settings-gray");$("#enable-preview").click(function(){enablePreview(simple,user_id,qstr);return false;});changeView(qstr,0);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#show-title").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-combined").bind("touchstart",function(event,obj){if($("#combined-check").is(":visible")){}else{$("#show-combined").addClass("settings-highlight");$("#card-check").hide();$("#title-check").hide();$("#combined-check").show();$("#simple-view").addClass("settings-gray");$("#enable-preview").addClass("settings-gray");$("#enable-preview").unbind('click');changeView(qstr,1);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#show-combined").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#simple-view").bind("touchstart",function(event,obj){$("#simple-view").addClass("settings-highlight");if($("#simple-check").is(":visible")){$("#simple-check").hide();changeSimple(qstr,0);}else{$("#simple-check").show();changeSimple(qstr,1);}
setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#simple-view").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");return false;});$("#show-unread").bind("touchstart",function(event,obj){if($("#unread-check").is(":visible")){}else{$("#show-unread").addClass("settings-highlight");$("#read-unread-check").hide();$("#unread-check").show();showReadUnread(qstr,0);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#show-unread").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-read-unread").bind("touchstart",function(event,obj){if($("#read-unread-check").is(":visible")){}else{$("#show-read-unread").addClass("settings-highlight");$("#unread-check").hide();$("#read-unread-check").show();showReadUnread(qstr,1);setTimeout(function(){$("#subnav").slideUp("fast",function(){$("#show-read-unread").removeClass("settings-highlight");});},200);$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});}
$("#sort-date").click(function(){if($("#date-check").is(":visible")){}else{sortDate(qstr);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-oldest").click(function(){if($("#oldest-check").is(":visible")){}else{sortOldest(qstr);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-score").click(function(){if($("#score-check").is(":visible")){}else{sortScore(qstr);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#sort-relevance").click(function(){if($("#relevance-check").is(":visible")){sortRelevance(qstr,1);}else{sortRelevance(qstr,0);}
$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");return false;});$("#show-card").click(function(){if($("#card-check").is(":visible")){}else{$("#card-check").show();$("#title-check").hide();$("#combined-check").hide();$("#simple-view").addClass("settings-gray");$("#enable-preview").addClass("settings-gray");$("#enable-preview").unbind('click');changeView(qstr,2);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-title").click(function(){if($("#title-check").is(":visible")){}else{$("#card-check").hide();$("#combined-check").hide();$("#title-check").show();$("#simple-view").removeClass("settings-gray");$("#enable-preview").removeClass("settings-gray");$("#enable-preview").click(function(){enablePreview(simple,user_id,qstr);return false;});changeView(qstr,0);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-combined").click(function(){if($("#combined-check").is(":visible")){}else{$("#card-check").hide();$("#title-check").hide();$("#combined-check").show();$("#simple-view").addClass("settings-gray");$("#enable-preview").addClass("settings-gray");$("#enable-preview").unbind('click');changeView(qstr,1);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#simple-view").click(function(){if($("#simple-check").is(":visible")){$("#simple-check").hide();changeSimple(qstr,0);}else{$("#simple-check").show();changeSimple(qstr,1);}
$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");return false;});$("#show-unread").click(function(){if($("#unread-check").is(":visible")){}else{$("#read-unread-check").hide();$("#unread-check").show();showReadUnread(qstr,0);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$("#show-read-unread").click(function(){if($("#read-unread-check").is(":visible")){}else{$("#unread-check").hide();$("#read-unread-check").show();showReadUnread(qstr,1);$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}
return false;});$(".settings-links").hover(function(){if($(this).is(".settings-gray")){}else{$(this).addClass("settings-highlight");}},function(){$(this).removeClass("settings-highlight");});$("#feed-settings").click(function(){if($(this).parent().find("ul.subnav").is(":visible")){$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");}else{headingTop=document.getElementById("feed-heading").offsetTop;headingHeight=document.getElementById("feed-heading").offsetHeight;menuTop=document.getElementById("feed-settings").offsetTop;headingBottom=headingTop+ headingHeight;subnavTop=headingBottom- menuTop- 8;sbw=$(window).width();subnavWidth=$("#subnav").width();rightSpace=sbw- $("#main").width();subnavLeft=sbw- rightSpace- subnavWidth- 16;$("#subnav").css("left",subnavLeft);subnavTop+="px";$("#subnav").css("top",subnavTop);$("#subnav").slideDown("fast").show();$("#feed-settings").attr("src","/themes/feedsanywhere/configure-blue.png");$("#subnav").hover(function(){},function(){$("#subnav").slideUp("fast");$("#feed-settings").attr("src","/themes/feedsanywhere/configure-black.png");});t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById("subnav").offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById("subnav").offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(itemHeight>windowHeight){window.scrollTo(0,itemOffsetTop- 4);}else if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 4);}},200);}});menuIconAlign();}
function menuIconAlign(){searchHeight=document.getElementById("search-box").offsetHeight;shiftIcon=(searchHeight- 22)/2- 2;$("#feed-settings").css("margin-top",shiftIcon);}
function adjustForFontSize(){fontSize=parseFloat($("body").css("font-size"));if(fontSize<13||fontSize>15){shiftMarginTop=fontSize- 14;$(".gotowebsite").css("margin-top",shiftMarginTop);shiftMarginSimple=fontSize- 14- 2;$(".gotowebsite-simple").css("margin-top",shiftMarginSimple);}else{$(".gotowebsite").css("margin-top",0);$(".gotowebsite-simple").css("margin-top","-2px");}}
function changeSimple(qstr,simple){$("#items_and_nav").data("preload","");qstrNew=qstr+"&simple_view="+ simple;navigation(qstrNew,0);}
function editFeedMenu(){$(".settings-links").hover(function(){if($(this).is(".settings-gray")){}else{$(this).addClass("settings-highlight");}},function(){$(this).removeClass("settings-highlight");});$(".edit-feed").hover(function(){},function(){$(this).slideUp("fast");fid=this.id.replace("feed-","").replace("-menu","");$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");});if(isTouchSupported()){$(".edit-feed").find("li").each(function(){$(this).bind("touchstart",function(event,obj){$(this).addClass("settings-highlight",function(){setTimeout(function(){$(this).removeClass("settings-highlight");},200);});});});}}
function changeSubscription(fid){if(fid>0){subscribeAction=$("#feed-"+ fid+"-unsub").html();if(subscribeAction=="Subscribe"){$("#feed-"+ fid+"-unsub").html("Unsubscribe");url="/ajax_add_feed?fid="+ fid;}else{$("#feed-"+ fid+"-unsub").html("Subscribe");url="/ajax_delete_feed?fid="+ fid;}
incrementAjaxCounter();$.get(url,function(result){decrementAjaxCounter();});}}
function changeCategory(fid){if(fid>0){if(document.getElementById("#feed-"+ fid+"-menu")&&document.getElementById("#feed-"+ fid+"-button")){$("#feed-"+ fid+"-menu").slideUp("fast");$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");}
fontSize=$("body").css("font-size");$(".settings-options").css("font-size",fontSize);$("#category-form").data("fid",fid);numCategories=$("#category-form").data("num-categories");if(numCategories>0){$("#category-form").dialog('open');dWidth=$("#cat-menu").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#cat-menu").width(inputWidth);$("#category-form").dialog('option','position','left');}else if(dWidth<314){dWidth=314;inputWidth=dWidth- 28;$("#cat-menu").width(inputWidth);}
$("#category-form").dialog('option','width',dWidth);if($("#category-form").data("categories-"+ fid)){catList=$("#category-form").data("categories-"+ fid);if(catList!=""&&catList!=undefined){if(catList>=0){$("#cat-"+ catList+"-check").show();}else if(catList.match(",").toString()){catList=catList.split(",");for(catNum in catList){$("#cat-"+ catList[catNum]+"-check").show();}}}}else{catList="";}}else{newCategory();}}}
function categoryToggle(cid,catNum){fid=$("#category-form").data("fid");if(fid>0){if($("#cat-"+ catNum+"-check").is(":visible")){catAction="remove";}else{catAction="add";}
if(catAction=="add"){$("#cat-"+ catNum+"-check").show();feedCategoryList=$("#category-form").data("categories-"+ fid);if(feedCategoryList==""){feedCategoryList=catNum+'';}else{feedCategoryList=feedCategoryList+","+ catNum;}
$("#category-form").data("categories-"+ fid,feedCategoryList);}else{$("#cat-"+ catNum+"-check").hide();feedCategoryList=$("#category-form").data("categories-"+ fid);if(feedCategoryList!=""&&feedCategoryList!=undefined){if(feedCategoryList>=0){feedCategoryList="";}else if(feedCategoryList.match(",").toString()){catNum1=","+ catNum;feedCategoryList=feedCategoryList.replace(catNum1,"");catNum2=catNum+",";feedCategoryList=feedCategoryList.replace(catNum2,"");}
$("#category-form").data("categories-"+ fid,feedCategoryList);}}
$.post("/ajax_toggle_category",{fid:fid,cid:cid,action:catAction});}}
function newCategory(){fid=$("#category-form").data("fid");$("#category-form").dialog('close');$(".category-check").hide();$("#category-name").attr("value","");$("#category-new-form").dialog('open');dWidth=$("#category-name").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#category-name").width(inputWidth);$("#category-new-form").dialog('option','position','left');}
$("#category-new-form").dialog('option','width',dWidth);}
function categorySave(){fid=$("#category-form").data("fid");if(fid>0){cid=$("#category-name").attr("value");if(cid!=""){catAction="add";$.post("/ajax_toggle_category",{fid:fid,cid:cid,action:catAction});numCat=$("#category-form").data("num-categories");c="c"+ numCat;newNumCat=parseInt(numCat)+ 1;$("#category-form").data("num-categories",newNumCat);if(document.getElementById("#display-categories")){allCategories=$("#display-categories").html();allCategories+="  <div id=\"feed-"+ c+"-list\" class=\"feed-list\">\n    <img id=\"feed-"+ c+"-button\" class=\"show_feed_menu\" onclick=\"showFeedMenu('"+ c+"'); return false;\" src=\"/themes/feedsanywhere/plus.png\" />\n    <a id=\"feed-"+ c+"\" href=\"/category/"+ cid+"\" class=\"bold\">"+ cid+"</a>\n  </div>\n  <ul id=\"feed-"+ c+"-menu\" class=\"edit-feed\">\n    <li id=\"feed-"+ c+"-delete\" class=\"settings-links\" onclick=\"categoryDelete('"+ cid+"','"+ c+"')\">\n      <div>Delete</div>\n    </li>\n    <li id=\"feed-"+ c+"-rename\" class=\"settings-links\" onclick=\"categoryRename('"+ cid+"','"+ c+"')\">\n      <div>Rename</div>\n    </li>\n  </ul>\n";$("#display-categories").html(allCategories);}
if(document.getElementById("#feed-"+ c+"-button")){$("#feed-"+ c+"-button").show();}
catMenu=$("#cat-menu").html();catMenu+="      <li id=\"cat-"+ c+"\" class=\"settings-links\" onclick=\"categoryToggle('"+ cid+"',"+ numCat+")\">\n        <span id=\"cat-"+ numCat+"-check\" class=\"category-check\">&#x2713;</span>\n        <div class=\"settings-options\">"+ cid+"</div>\n      </li>\n";$("#cat-menu").html(catMenu);feedCategoryList=$("#category-form").data("categories-"+ fid);feedCategoryList=String(feedCategoryList);if(feedCategoryList==""||feedCategoryList==undefined){feedCategoryList=numCat+'';}else{feedCategoryList=feedCategoryList+","+ numCat;}
$("#category-form").data("categories-"+ fid,feedCategoryList);if(document.getElementById("#feed-"+ c+"-button")){editFeedMenu();}}}
$("#category-form").data("fid","");$("#category-new-form").dialog('close');}
function rename(fid,feedName){if(fid>0){$("#feed-"+ fid+"-menu").slideUp("fast");$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");fontSize=$("body").css("font-size");$("#rename-name").css("font-size",fontSize);$("#rename-form").dialog('open');dWidth=$("#rename-name").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#rename-name").width(inputWidth);$("#rename-form").dialog('option','position','left');}
$("#rename-form").dialog('option','width',dWidth);$("#rename-name").attr("value",feedName);$("#rename-form").data("fid",fid);$("#rename-form").data("feedName",feedName);}else{alert("The feed cannot be renamed.");}}
function renameSave(){fid=$("#rename-form").data("fid");if(fid>0){feedName=$("#rename-form").data("feedName");newName=$("#rename-name").attr("value");$.post("/ajax_rename_feed",{fid:fid,title:newName});origTitle=$("#feed-"+ fid).html();origTitle=origTitle.replace("&gt;",">");origTitle=origTitle.replace("&lt;","<");unreadCount=origTitle.replace(feedName,"");$("#feed-"+ fid).html(newName+ unreadCount);$("#feed-"+ fid+"-rename").unbind('click');$("#feed-"+ fid+"-rename").click(function(){rename(fid,newName);});}
$("#rename-form").dialog('close');}
function categoryRename(cid,c){if(cid!=""){$("#feed-"+ c+"-menu").slideUp("fast");$("#feed-"+ c+"-button").attr("src","/themes/feedsanywhere/plus.png");fontSize=$("body").css("font-size");$("#category-rename-name").css("font-size",fontSize);$("#category-rename-form").dialog('open');dWidth=$("#category-rename-name").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#category-rename-name").width(inputWidth);$("#category-rename-form").dialog('option','position','left');}
$("#category-rename-form").dialog('option','width',dWidth);$("#category-rename-name").attr("value",cid);$("#category-rename-form").data("cid",cid);$("#category-rename-form").data("c",c);}else{alert("The feed cannot be renamed.");}}
function categoryRenameSave(){cid=$("#category-rename-form").data("cid");c=$("#category-rename-form").data("c");if(cid!=""){newName=$("#category-rename-name").attr("value");$.post("/ajax_rename_category",{cid:cid,newName:newName});origTitle=$("#feed-"+ c).html();origTitle=origTitle.replace("&gt;",">");origTitle=origTitle.replace("&lt;","<");unreadCount=origTitle.replace(cid,"");$("#feed-"+ c).html(newName+ unreadCount);$("#feed-"+ c+"-rename").unbind('click');$("#feed-"+ c+"-rename").click(function(){categoryRename(newName,c);});$("#feed-"+ c+"-delete").unbind('click');$("#feed-"+ c+"-delete").click(function(){categoryDelete(newName,c);});$("#feed-"+ c).attr('href',newName);catMenu=$("#cat-menu").html();catMenu=catMenu.replace(new RegExp(cid,"g"),newName);$("#cat-menu").html(catMenu);}
$("#category-rename-form").dialog('close');}
function categoryDelete(cid,c){if(cid!=""){$("#feed-"+ c+"-menu").slideUp("fast");$("#feed-"+ c+"-button").attr("src","/themes/feedsanywhere/plus.png");fontSize=$("body").css("font-size");$("#category-delete-form").css("font-size",fontSize);$("#category-delete-form").dialog('open');dWidth=$("#category-delete-form").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#category-delete-form").width(inputWidth);$("#category-delete-form").dialog('option','position','left');}
$("#category-delete-form").dialog('option','width',dWidth);$("#category-delete-form").data("cid",cid);$("#category-delete-form").data("c",c);}else{alert("The feed cannot be renamed.");}}
function categoryDeleteYes(){cid=$("#category-delete-form").data("cid");c=$("#category-delete-form").data("c");if(cid!=""){$.post("/ajax_delete_category",{cid:cid});$("#feed-"+ c+"-list").hide();$("#feed-"+ c+"-list").html("");$("#feed-"+ c+"-menu").hide();$("#feed-"+ c+"-menu").html("");$("#feed-"+ c+"-rename").unbind('click');$("#feed-"+ c+"-delete").unbind('click');$("#cat-"+ c).hide();$("#cat-"+ c).html("");}
$("#category-delete-form").dialog('close');}
function editLink(fid){if(fid>0){$("#feed-"+ fid+"-menu").slideUp("fast");$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");$("#edit-url-name").attr("value","");fontSize=$("body").css("font-size");$("#edit-url-name").css("font-size",fontSize);$("#edit-url-form").dialog('open');dPosition=$("#edit-url-name").position("left");lPosition=14- dPosition.left;$("#edit-url-name").css("left",lPosition);dWidth=$("#edit-url-name").width()+ 28;sbw=$(window).width();if(dWidth>sbw||sbw<=320){dWidth=sbw- 6;inputWidth=dWidth- 40;$("#edit-url-name").width(inputWidth);$("#edit-url-form").dialog('option','position','left');}
$("#edit-url-form").dialog('option','width',dWidth);$("#edit-url-form").data("fid",fid);}else{alert("The feed's link cannot be changed.");}}
function editLinkSave(){fid=$("#edit-url-form").data("fid");if(fid>0){newLink=$("#edit-url-name").attr("value");$.post("/ajax_edit_link",{fid:fid,newLink:newLink});$("#feed-"+ fid).attr("title",newLink);}else{alert("An invalid feed was referenced.");}
$("#edit-url-form").dialog('close');$("#feed-"+ fid+"-menu").slideUp("fast");$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");}
function showFeedMenu(fid){id_feed_menu="feed-"+ fid+"-menu";checkOpen=$("#feed-"+ fid+"-button").attr("src");if(checkOpen=="/themes/feedsanywhere/minus.png"){$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/plus.png");$("#feed-"+ fid+"-menu").slideUp("fast").hide();}else if(document.getElementById(id_feed_menu)){$("#feed-"+ fid+"-button").attr("src","/themes/feedsanywhere/minus.png");$("#feed-"+ fid+"-menu").slideDown("fast").show();t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById(id_feed_menu).offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById(id_feed_menu).offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 4);}},200);}}
function showCategoryMenu(fid){id_cat_feed_menu="cat-"+ fid+"-menu";if($("#cat-"+ fid+"-menu").is(":visible")){$("#cat-"+ fid+"-menu").slideUp("fast").hide();}else if(document.getElementById(id_cat_feed_menu)){$("#cat-"+ fid+"-menu").slideDown("fast").show();t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById(id_cat_feed_menu).offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById(id_cat_feed_menu).offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 4);}},200);}}
function showCategoryList(){if($("#feed-category-list").is(":visible")){$("#feed-category-list").slideUp("fast").hide();}else if(document.getElementById("feed-category-list")){$("#feed-category-list").slideDown("fast").show();t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById("feed-category-list").offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById("feed-category-list").offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 4);}},200);}}
function goToCategory(cid){var url="/category/"+ cid;document.location.href=url;}
function manageSubscriptions(){$(".feed-list").css("padding-left","34px");$(".feed-list").css("text-indent","-26px");$("#import-export").show();$(".show_feed_menu").show();}
function hideGoogleError(){var url="/ajax_clear_auth";$.get(url);$("#google-login-error").hide();}
function hideInstapaperError(){var url="/ajax_clear_ip_save";$.get(url);$("#ip-login-error").hide();}
function updateFeed(fid){var url="/ajax_update_feed?fid="+ fid;$.get(url,function(result){if(result>0){$("#updating-feed").show();if(result==1){$("#updating-feed").html("<p class=\"messages\">There is 1 new item available. Click <a href=\"/feed/"+ fid+"\">here</a> to refresh.</p>");}else{$("#updating-feed").html("<p class=\"messages\">There are "+ result+" new items available. Click <a href=\"/feed/"+ fid+"\">here</a> to refresh.</p>");}
$("#obsolete").hide();$("#items_and_nav").data("preload","");}});}
function showShareList(id){$(".settings-links").hover(function(){if($(this).is(".settings-gray")){}else{$(this).addClass("settings-highlight");}},function(){$(this).removeClass("settings-highlight");});if($("#share-"+ id+"-list").is(":visible")){$("#share-"+ id+"-list").slideUp("fast").hide();}else if(document.getElementById("share-"+ id+"-list")){$("#share-"+ id+"-list").slideDown("fast").show();$("#share-"+ id+"-list").hover(function(){},function(){$(this).slideUp("fast");});t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById("share-"+ id+"-list").offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById("share-"+ id+"-list").offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 8);}},200);}}
function email(url,id,page,auto,feed_num){Interesting(id,page,auto,feed_num);if(isTouchSupported()){$("#email-"+ id).addClass("settings-highlight");$(".settings-links").hover=null;setTimeout(function(){document.location.href=url;},200);}else{document.location.href=url;}}
function shareGooglePlus(id){if(isTouchSupported()){$("#reader-"+ id).addClass("settings-highlight");$(".settings-links").hover=null;setTimeout(function(){$("#reader-"+ id).removeClass("settings-highlight");},200);}
if($("#google-"+ id+"-check").is(":visible")){$("#google-"+ id+"-check").html("&#8230;");ac="unshare";}else{$("#google-"+ id+"-check").html("&#8230;");$("#google-"+ id+"-check").show();ac="share";}
var url="/ajax_share?action="+ ac+"&id="+ id;$.get(url,function(result){if(result==0||result==2){if(ac=="share"){$("#google-"+ id+"-check").hide();}else{$("#google-"+ id+"-check").html("&#x2713;");$("#google-"+ id+"-check").show();}
if(result==2){var c=confirm("Authorization is required for access to your Google Reader account. Would you like to do that now?\n\nWarning: Check your pop-up blocker if a new window does not open.\n");if(c==true){if(ac=="unshare"){$("#google-"+ id+"-check").html("&#8230;");}else{$("#google-"+ id+"-check").html("&#8230;");$("#google-"+ id+"-check").show();}
prevCommand=encodeURIComponent(url);authorizeUrl="/google_oauth?init=1&p="+ prevCommand;window.open(authorizeUrl);}}else{alert("ERROR: The item could not be shared on Google Reader.");}}else{if(ac=="share"){$("#google-"+ id+"-check").html("&#x2713;");}else{$("#google-"+ id+"-check").hide();}}});}
function shareFacebook(id){if(isTouchSupported()){$("#facebook-"+ id).addClass("settings-highlight");$(".settings-links").hover=null;setTimeout(function(){$("#facebook-"+ id).removeClass("settings-highlight");},200);}
if($("#facebook-"+ id+"-check").is(":visible")){$("#facebook-"+ id+"-check").html("&#8230;");$("#facebook-"+ id+"-check").show();commentId=$("#"+ id).data("facebook");var url="/ajax_facebook_remove?id="+ commentId;$.get(url,function(result){$("#facebook-"+ id+"-check").hide();});}else{$("#facebook-"+ id+"-check").html("&#8230;");$("#facebook-"+ id+"-check").show();var url="/ajax_facebook?id="+ id;$.get(url,function(result){if(result==0||result==2){$("#facebook-"+ id+"-check").hide();if(result==2){var c=confirm("Authorization is required to post to your Facebook account. Would you like to do that now?\n\nWarning: Check your pop-up blocker if a new window does not open.\n");if(c==true){$("#facebook-"+ id+"-check").show();authorizeUrl="/facebook_oauth?init=1&id="+ id;window.open(authorizeUrl);}}else{alert("ERROR: The item could not be posted to Facebook.");}}else{$("#"+ id).data("facebook",result);$("#facebook-"+ id+"-check").html("&#x2713;");}});}}
function shareTwitter(id){if(isTouchSupported()){$("#twitter-"+ id).addClass("settings-highlight");$(".settings-links").hover=null;setTimeout(function(){$("#twitter-"+ id).removeClass("settings-highlight");},200);}
if($("#twitter-"+ id+"-check").is(":visible")){$("#twitter-"+ id+"-check").html("&#8230;");$("#twitter-"+ id+"-check").show();commentId=$("#"+ id).data("twitter");var url="/ajax_twitter_remove?id="+ commentId;$.get(url,function(result){$("#twitter-"+ id+"-check").hide();});}else{$("#twitter-"+ id+"-check").html("&#8230;");$("#twitter-"+ id+"-check").show();var url="/ajax_twitter?id="+ id;$.get(url,function(result){if(result==0||result==2){$("#twitter-"+ id+"-check").hide();if(result==2){var c=confirm("Authorization is required to post to your Twitter account. Would you like to do that now?\n\nWarning: Check your pop-up blocker if a new window does not open.\n");if(c==true){$("#twitter-"+ id+"-check").show();authorizeUrl="/twitter_oauth?init=1&id="+ id;window.open(authorizeUrl);}}else{alert("ERROR: The item could not be posted to Twitter.");}}else{$("#"+ id).data("twitter",result);$("#twitter-"+ id+"-check").html("&#x2713;");}});}}
function saveToInstapaper(id){if(isTouchSupported()){$("#instapaper-"+ id).addClass("settings-highlight");$(".settings-links").hover=null;setTimeout(function(){$("#instapaper-"+ id).removeClass("settings-highlight");},200);}
if($("#instapaper-"+ id+"-check").is(":visible")){alert("Removing an item from Instapaper is not supported.");}else{$("#instapaper-"+ id+"-check").html("&#8230;");$("#instapaper-"+ id+"-check").show();var url="/ajax_instapaper?id="+ id;$.get(url,function(result){if(result==0||result==2||result==3){$("#instapaper-"+ id+"-check").hide();if(result==2||result||3){if(result==2){var c=confirm("Authorization failed. Would you like to fix that now?\n\nWarning: Check your pop-up blocker if a new window does not open.\n");}else{var c=confirm("Authorization is required to post to your Instapaper account. Would you like to do that now?\n\nWarning: Check your pop-up blocker if a new window does not open.\n");}
if(c==true){$("#instapaper-"+ id+"-check").show();prevCommand=encodeURIComponent(url);authorizeUrl="/settings?p="+ prevCommand+"#instapaper-authentication";window.open(authorizeUrl);}}else{alert("ERROR: The item could not be saved to Instapaper.");}}else{$("#instapaper-"+ id+"-check").html("&#x2713;");}});}}
function incrementAjaxCounter(){openRequests=$("#main").data("ajax");if(openRequests!=""&&openRequests!=undefined){openRequests=parseInt(openRequests)+ 1;$("#main").data("ajax",openRequests);}else{$("#main").data("ajax","1");}}
function decrementAjaxCounter(){openRequests=$("#main").data("ajax");if(openRequests!=""&&openRequests!=undefined){openRequests=parseInt(openRequests)- 1;$("#main").data("ajax",openRequests);}else{$("#main").data("ajax","0");}}
function categoryMenu(){$("#feed-category-list").hover(function(){},function(){$("#feed-category-list").slideUp("fast");});$(".settings-links").hover(function(){if($(this).is(".settings-gray")){}else{$(this).addClass("settings-highlight");}},function(){$(this).removeClass("settings-highlight");});if(isTouchSupported()){$("#feed-category-list").find("li").each(function(){$(this).bind("touchstart",function(event,obj){$(this).addClass("settings-highlight");$(this).onclick=null;$(".settings-links").hover=null;menuEntry=$(this).html();menuEntry=menuEntry.replace(/ \([0-9\+]+\)/,"");url="/category/"+ menuEntry;setTimeout(function(){document.location.href=url;},100);});});}
$("#feed-category-list").find("li").each(function(){$(this).click(function(){menuEntry=$(this).html();menuEntry=menuEntry.replace(/ \([0-9\+]+\)/,"");document.location.href="/category/"+ menuEntry;});});}
function resizeMain(mainWidth,psetting,simple,noThumbs){$("#main").data("width",mainWidth);$("#items_and_nav").data("noThumbs",noThumbs);sbw=$(window).width();$("#main").data("sbw",sbw);maxLimit=sbw- 16;if(sbw<=500){$("#main").width("100%");}else if(mainWidth!=0&&mainWidth<maxLimit){$("#main").width(mainWidth);}else{$("#main").width(maxLimit);}
$("#main").resizable({minWidth:500,resize:function(event,ui){$("#main").height("auto");changeMainWidth(psetting,simple,noThumbs,0);},stop:function(event,ui){mainWidth=$("#main").width();maxLimit=$(window).width()- 20;if(mainWidth>maxLimit){mainWidth=0;}
var url="/ajax_width?width="+ mainWidth;if(!$("#fa_login").is(":visible")){$.get(url);}
$("#main").data("width",mainWidth);}});$(".ui-resizable-e").hover(function(){$("#main").css("border-right-width","3px");$("#main").css("border-right-color","#16ff00");$("#main").css("border-left-width","3px");$("#main").css("border-left-color","#16ff00");},function(){$("#main").css("border-right-width","1px");$("#main").css("border-right-color","gray");$("#main").css("border-left-width","1px");$("#main").css("border-left-color","gray");});$(".ui-resizable-e").dblclick(function(){$("#main").css("border-right-width","1px");$("#main").css("border-right-color","gray");$("#main").css("border-left-width","1px");$("#main").css("border-left-color","gray");sbw=$(window).width();maxLimit=sbw- 16;$("#main").width(maxLimit);$("#main").data("width",maxLimit);var url="/ajax_width?width=0";if(!$("#fa_login").is(":visible")){$.get(url);}});}
function formatDescriptions(){$(".desc_body").each(function(){if($(this).html().match("<img ")||$(this).html().match("<object ")||$(this).html().match("<embed ")){mainWidth=$("#main").width();$(this).find("img").each(function(){formatElement(this);});$(this).find("object").each(function(){formatElement(this);});$(this).find("embed").each(function(){formatElement(this);});}});}
function positionElement(obj){mainWidth=$("#main").width();divWidth=0;imgHeight=obj.height;imgWidth=obj.width;imgSpace=mainWidth- imgWidth;imgFloat=$(obj).css("float");imgTextAlign=$(obj).css("text-align");if($(obj).parent().is("div")){if($(obj).parent("div").is(".desc_body")){divSpace=200;}else{divWidth=$(obj).parent("div").width();if(divWidth<imgWidth){divSpace=200;}else{divSpace=divWidth- imgWidth;if(divSpace<100){$(obj).parent("div").css("font-size","90%");$(obj).parent("div").css("color","#404040");}}}}else if($(obj).parent("a").parent().is("div")){if($(obj).parent("a").parent("div").is(".desc_body")){divSpace=200;}else{divWidth=$(obj).parent("a").parent("div").width();if(divWidth<imgWidth){divSpace=200;}else{divSpace=divWidth- imgWidth;if(divSpace<100){$(obj).parent("a").parent("div").css("font-size","90%");$(obj).parent("a").parent("div").css("color","#404040");}}}}else{divSpace=200;}
mainDivDiff=mainWidth- divWidth;if(imgFloat=="none"&&imgTextAlign!="center"){if($(obj).parent().css("float")!="none"||$(obj).parent().parent().css("float")!="none"){noFloat=1;}else{noFloat=0;}
if((imgWidth>=300||imgSpace<125||$(obj).parent().is("li")||$(obj).parent().parent().is("li"))&&divSpace>100){$(obj).css("margin-left","auto");$(obj).css("margin-right","auto");$(obj).css("width",imgWidth);$(obj).css("display","block");$(obj).css("clear","both");$(obj).css("text-align","center");if($(obj).parent().is("li")){$(obj).parent("li").parent("ul").css("text-align","center");$(obj).parent("li").parent("ul").children().css("clear","both");$(obj).parent("li").parent("ul").children().css("margin-bottom","4px");$(obj).parent("li").parent("ul").children().css("margin-left","4px");$(obj).parent("li").parent("ul").children().css("margin-right","4px");$(obj).parent("li").parent("ul").children().width(imgWidth);$(obj).parent("li").parent("ul").children().css("list-style-type","none");$(obj).parent("li").parent("ul").children().css("display","inline-block");$(obj).parent("li").parent("ul").children().css("text-align","center");$(obj).parent("li").parent("ul").children().css("vertical-align","middle");$(obj).parent("li").parent("ul").children().css("font-size","90%");}else if($(obj).parent().parent().is("li")){$(obj).parent().parent("li").parent("ul").css("text-align","center");$(obj).parent().parent("li").parent("ul").children().css("clear","both");$(obj).parent().parent("li").parent("ul").children().css("margin-bottom","4px");$(obj).parent().parent("li").parent("ul").children().css("margin-left","4px");$(obj).parent().parent("li").parent("ul").children().css("margin-right","4px");$(obj).parent().parent("li").parent("ul").children().width(imgWidth);$(obj).parent().parent("li").parent("ul").children().css("list-style-type","none");$(obj).parent().parent("li").parent("ul").children().css("display","inline-block");$(obj).parent().parent("li").parent("ul").children().css("text-align","center");$(obj).parent().parent("li").parent("ul").children().css("vertical-align","middle");$(obj).parent().parent("li").parent("ul").children().css("font-size","90%");}}else if((imgWidth>=400&&divSpace<=100)||mainDivDiff<100){if($(obj).parent().is("div")){$(obj).parent("div").css("float","none");$(obj).parent("div").css("margin-left","auto");$(obj).parent("div").css("margin-right","auto");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").css("width",divWidth);$(obj).parent("div").css("display","block");$(obj).parent("div").css("clear","both");$(obj).parent("div").css("text-align","center");$(obj).parent("div").children().css("float","none");$(obj).parent("div").children().css("margin-left","0px");$(obj).parent("div").children().css("margin-right","0px");$(obj).parent("div").children().css("text-align","center");}else if($(obj).parent("a").parent().is("div")){$(obj).parent("a").parent("div").css("float","none");$(obj).parent("a").parent("div").css("margin-left","auto");$(obj).parent("a").parent("div").css("margin-right","auto");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").css("width",divWidth);$(obj).parent("a").parent("div").css("display","block");$(obj).parent("a").parent("div").css("clear","both");$(obj).parent("a").parent("div").css("text-align","center");$(obj).parent("a").parent("div").children().css("float","none");$(obj).parent("a").parent("div").children().css("margin-left","0px");$(obj).parent("a").parent("div").children().css("margin-right","0px");$(obj).parent("a").parent("div").children().css("text-align","center");}}else if(imgWidth>10&&imgHeight>200&&noFloat==0){$(obj).css("margin-left","8px");$(obj).css("margin-right","0px");if(divSpace>100){$(obj).css("float","right");}else if($(obj).parent().is("div")){$(obj).parent("div").css("float","right");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").children().css("margin-left","8px");$(obj).parent("div").children().css("margin-right","0px");}else if($(obj).parent("a").parent().is("div")){$(obj).parent("a").parent("div").css("float","right");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").children().css("margin-left","8px");$(obj).parent("a").parent("div").children().css("margin-right","0px");$(obj).parent("a").css("margin-left","0px");}}else if(imgWidth>10&&imgHeight>30&&noFloat==0){$(obj).css("margin-left","0px");$(obj).css("margin-right","8px");if(divSpace>100){$(obj).css("float","left");}else if($(obj).parent().is("div")){$(obj).parent("div").css("float","left");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").children().css("margin-left","0px");$(obj).parent("div").children().css("margin-right","8px");}else if($(obj).parent("a").parent().is("div")){$(obj).parent("a").parent("div").css("float","left");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").children().css("margin-left","0px");$(obj).parent("a").parent("div").children().css("margin-right","8px");$(obj).parent("a").css("margin-right","0px");}}}else if(imgFloat=="left"){if((imgSpace<125&&divSpace>100)||imgWidth>300||mainDivDiff<100){$(obj).css("float","none");$(obj).css("margin-left","auto");$(obj).css("margin-right","auto");$(obj).css("width",imgWidth);$(obj).css("display","block");$(obj).css("clear","both");$(obj).css("text-align","center");if(mainDivDiff<100){if($(obj).parent().is("div")){$(obj).parent("div").css("float","none");$(obj).parent("div").css("margin-left","auto");$(obj).parent("div").css("margin-right","auto");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").css("width",divWidth);$(obj).parent("div").css("display","block");$(obj).parent("div").css("clear","both");$(obj).parent("div").css("text-align","center");$(obj).parent("div").children().css("float","none");$(obj).parent("div").children().css("margin-left","0px");$(obj).parent("div").children().css("margin-right","0px");$(obj).parent("div").children().css("text-align","center");}else if($(obj).parent("a").parent().is("div")){$(obj).parent("a").parent("div").css("float","none");$(obj).parent("a").parent("div").css("margin-left","auto");$(obj).parent("a").parent("div").css("margin-right","auto");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").css("width",divWidth);$(obj).parent("a").parent("div").css("display","block");$(obj).parent("a").parent("div").css("clear","both");$(obj).parent("a").parent("div").css("text-align","center");$(obj).parent("a").parent("div").children().css("float","none");$(obj).parent("a").parent("div").children().css("margin-left","0px");$(obj).parent("a").parent("div").children().css("margin-right","0px");$(obj).parent("a").parent("div").children().css("text-align","center");}}}else{if(divSpace<=100){$(obj).css("float","none");}
$(obj).css("margin-left","0px");$(obj).css("margin-right","8px");}}else if(imgFloat=="right"){if((imgSpace<125&&divSpace>100)||imgWidth>300||mainDivDiff<100){$(obj).css("float","none");$(obj).css("margin-left","auto");$(obj).css("margin-right","auto");$(obj).css("width",imgWidth);$(obj).css("display","block");$(obj).css("clear","both");$(obj).css("text-align","center");if(mainDivDiff<100){if($(obj).parent().is("div")){$(obj).parent("div").css("float","none");$(obj).parent("div").css("margin-left","auto");$(obj).parent("div").css("margin-right","auto");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").css("width",divWidth);$(obj).parent("div").css("display","block");$(obj).parent("div").css("clear","both");$(obj).parent("div").css("text-align","center");$(obj).parent("div").children().css("float","none");$(obj).parent("div").children().css("margin-left","0px");$(obj).parent("div").children().css("margin-right","0px");$(obj).parent("div").children().css("text-align","center");}else if($(obj).parent("a").parent().is("div")){$(obj).parent("a").parent("div").css("float","none");$(obj).parent("a").parent("div").css("margin-left","auto");$(obj).parent("a").parent("div").css("margin-right","auto");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").css("width",divWidth);$(obj).parent("a").parent("div").css("display","block");$(obj).parent("a").parent("div").css("clear","both");$(obj).parent("a").parent("div").css("text-align","center");$(obj).parent("a").parent("div").children().css("float","none");$(obj).parent("a").parent("div").children().css("margin-left","0px");$(obj).parent("a").parent("div").children().css("margin-right","0px");$(obj).parent("a").parent("div").children().css("text-align","center");}}}else{if(divSpace<=100){$(obj).css("float","none");}
$(obj).css("margin-left","8px");$(obj).css("margin-right","0px");}}else if(imgTextAlign=="center"){if(imgWidth>200||imgSpace<125){$(obj).css("float","none");$(obj).css("margin-left","auto");$(obj).css("margin-right","auto");$(obj).css("width",imgWidth);$(obj).css("display","block");$(obj).css("clear","both");$(obj).css("text-align","center");if($(obj).parent().is("div")){parentDivWidth=$(obj).parent("div").width();if(parentDivWidth>200){$(obj).parent("div").css("margin-left","auto");$(obj).parent("div").css("margin-right","auto");$(obj).parent("div").css("margin-bottom","4px");$(obj).parent("div").css("width",parentDivWidth);$(obj).parent("div").css("display","block");$(obj).parent("div").css("clear","both");$(obj).parent("div").css("text-align","center");}}else if($(obj).parent("a").parent().is("div")){parentDivWidth=$(obj).parent("a").parent("div").width();if(parentDivWidth>200){$(obj).parent("a").parent("div").css("margin-left","auto");$(obj).parent("a").parent("div").css("margin-right","auto");$(obj).parent("a").parent("div").css("margin-bottom","4px");$(obj).parent("a").parent("div").css("width",parentDivWidth);$(obj).parent("a").parent("div").css("display","block");$(obj).parent("a").parent("div").css("clear","both");$(obj).parent("a").parent("div").css("text-align","center");}}}else if(imgSpace>24){$(obj).css("margin-left","4px");$(obj).css("margin-right","4px");$(obj).css("width",imgWidth);}}}
function formatElement(obj){imgSrc=$(obj).attr('src');useImage=1;imgTextAlign=$(obj).css("text-align");if(imgTextAlign=="right"||imgTextAlign=="-webkit-right"||imgTextAlign=="-moz-right"){$(obj).css("float","right");}else if(imgSrc!=undefined){var skipImages=new Array();skipImages[0]="/tracker/";skipImages[1]="feedads";skipImages[2]="statcounter";skipImages[3]="http://feeds\.feedburner\.com/";skipImages[4]="/ads\.";skipImages[5]="semiaccurate.com/openx/www/delivery/";for(s in skipImages){if(imgSrc.match(skipImages[s])){useImage=0;break;}}}
if(useImage==1){$(obj).css("margin-bottom","4px");$(obj).css("height","");imgWidth=obj.width;if(imgWidth<2){$(obj).load(function(){positionElement(obj);});}else{positionElement(obj);}}}
function setFontSize(){if(window.localStorage){fontSize=parseInt(localStorage.getItem("fontSize"));$("body").css("font-size",fontSize);}}
function setupMainMenu(){if(isTouchSupported()){$("#main-menu").find("li").each(function(){$(this).bind("touchstart",function(event,obj){$(this).addClass("settings-highlight");menuEntry=$(this).html();menuEntry=menuEntry.replace(/ \([0-9\+]+\)/,"");if(menuEntry=="Show Interesting"){url="/feed/interesting";}else if(menuEntry=="Show All"){url="/feed/all";}else if(menuEntry=="Show Saved"){url="/feed/saved";}else if(menuEntry=="Show Popular"){url="/feed/popular";}else if(menuEntry=="Select a Feed"){url="/select_feed";}else if(menuEntry=="Add/Find a Feed"||$(this).html()=="Find a Feed"){url="/add_find_feed";}else if(menuEntry=="Publish Feeds"){url="/publish_feeds";}else if(menuEntry=="Settings"){url="/settings";}else{url="/category/"+ menuEntry;}
setTimeout(function(){document.location.href=url;},100);});});}else{$("#main-menu").find("li").each(function(){$(this).click(function(){menuEntry=$(this).html();menuEntry=menuEntry.replace(/ \([0-9\+]+\)/,"");if(menuEntry=="Show Interesting"){document.location.href="/feed/interesting";}else if(menuEntry=="Show All"){document.location.href="/feed/all";}else if(menuEntry=="Show Saved"){document.location.href="/feed/saved";}else if(menuEntry=="Show Popular"){document.location.href="/feed/popular";}else if(menuEntry=="Select a Feed"){document.location.href="/select_feed";}else if(menuEntry=="Add/Find a Feed"||$(this).html()=="Find a Feed"){document.location.href="/add_find_feed";}else if(menuEntry=="Publish Feeds"){document.location.href="/publish_feeds";}else if(menuEntry=="Settings"){document.location.href="/settings";}else{document.location.href="/category/"+ menuEntry;}});});}}
function isTouchSupported(){var el=document.createElement('div');eventName='ontouchstart';var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,'return;');isSupported=typeof el[eventName]=='function';}
el=null;return isSupported;}
function mainMenu(){maxMainWidth=$(window).width()- 24;if($("#main-menu").width()>maxMainWidth){$("#main-menu").width(maxMainWidth);}
if($("#main-menu").is(":visible")){$("#main-menu").slideUp("fast");}else{$("#main-menu").slideDown("fast").show();if(isTouchSupported()){}else{$("#main-menu").hover(function(){},function(){$("#main-menu").slideUp("fast");});}
t=setTimeout(function(){windowPosition=window.pageYOffset;itemOffsetTop=document.getElementById("main-menu").offsetTop+ document.getElementById("main").offsetTop;itemPosition=itemOffsetTop- windowPosition;itemHeight=document.getElementById("main-menu").offsetHeight;windowHeight=window.innerHeight;bottomPosition=windowHeight- itemPosition- itemHeight;if(itemHeight>windowHeight){window.scrollTo(0,itemOffsetTop- 4);}else if(bottomPosition<10){user_agent=navigator.userAgent;if(user_agent.match("iPhone")){if(user_agent.match("iPhone OS 3")||user_agent.match("iPhone OS 2")||user_agent.match("iPhone OS 1")){bottomPosition=windowHeight- itemOffsetTop- itemHeight;}}
window.scrollBy(0,-bottomPosition+ 4);}},200);}}
function setProfile(value){exdays=31536000;var exdate=new Date();exdate.setDate(exdate.getDate()+ exdays);var c_value=escape(value)+((exdays==null)?"":"; expires="+exdate.toUTCString());document.cookie="profile="+ c_value;}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function changeProfile(){profile=$("#select-profile").val();if(profile=="global"){$("#new-profile-div").hide();setProfile("global");document.location.href="/settings";}else if(profile=="create"){$("#new-profile-div").show();$("#delete-profile").hide();}else{$("#new-profile-div").hide();setProfile(profile);document.location.href="/settings";}}/*
    http://www.JSON.org/json2.js
    2011-02-23

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html


    This code should be minified before deployment.
    See http://javascript.crockford.com/jsmin.html

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
    NOT CONTROL.


    This file creates a global JSON object containing two methods: stringify
    and parse.

        JSON.stringify(value, replacer, space)
            value       any JavaScript value, usually an object or array.

            replacer    an optional parameter that determines how object
                        values are stringified for objects. It can be a
                        function or an array of strings.

            space       an optional parameter that specifies the indentation
                        of nested structures. If it is omitted, the text will
                        be packed without extra whitespace. If it is a number,
                        it will specify the number of spaces to indent at each
                        level. If it is a string (such as '\t' or '&nbsp;'),
                        it contains the characters used to indent at each level.

            This method produces a JSON text from a JavaScript value.

            When an object value is found, if the object contains a toJSON
            method, its toJSON method will be called and the result will be
            stringified. A toJSON method does not serialize: it returns the
            value represented by the name/value pair that should be serialized,
            or undefined if nothing should be serialized. The toJSON method
            will be passed the key associated with the value, and this will be
            bound to the value

            For example, this would serialize Dates as ISO strings.

                Date.prototype.toJSON = function (key) {
                    function f(n) {
                        // Format integers to have at least two digits.
                        return n < 10 ? '0' + n : n;
                    }

                    return this.getUTCFullYear()   + '-' +
                         f(this.getUTCMonth() + 1) + '-' +
                         f(this.getUTCDate())      + 'T' +
                         f(this.getUTCHours())     + ':' +
                         f(this.getUTCMinutes())   + ':' +
                         f(this.getUTCSeconds())   + 'Z';
                };

            You can provide an optional replacer method. It will be passed the
            key and value of each member, with this bound to the containing
            object. The value that is returned from your method will be
            serialized. If your method returns undefined, then the member will
            be excluded from the serialization.

            If the replacer parameter is an array of strings, then it will be
            used to select the members to be serialized. It filters the results
            such that only members with keys listed in the replacer array are
            stringified.

            Values that do not have JSON representations, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays they will be replaced with null. You can use
            a replacer function to replace those with JSON values.
            JSON.stringify(undefined) returns undefined.

            The optional space parameter produces a stringification of the
            value that is filled with line breaks and indentation to make it
            easier to read.

            If the space parameter is a non-empty string, then that string will
            be used for indentation. If the space parameter is a number, then
            the indentation will be that many spaces.

            Example:

            text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

            text = JSON.stringify([new Date()], function (key, value) {
                return this[key] instanceof Date ?
                    'Date(' + this[key] + ')' : value;
            });
            // text is '["Date(---current time---)"]'


        JSON.parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = JSON.parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });

            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
                var d;
                if (typeof value === 'string' &&
                        value.slice(0, 5) === 'Date(' &&
                        value.slice(-1) === ')') {
                    d = new Date(value.slice(5, -1));
                    if (d) {
                        return d;
                    }
                }
                return value;
            });


    This is a reference implementation. You are free to copy, modify, or
    redistribute.
*/var JSON;if(!JSON){JSON={};}
(function(){"use strict";function f(n){return n<10?'0'+ n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+ 1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+ string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+ a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+ string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+ gap+ partial.join(',\n'+ gap)+'\n'+ mind+']':'['+ partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+ v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+ v);}}}}
v=partial.length===0?'{}':gap?'{\n'+ gap+ partial.join(',\n'+ gap)+'\n'+ mind+'}':'{'+ partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+ a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+ text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());
