function showFavoritesPopup(){var pop=document.getElementById('addtofavoritespopup');pop.innerHTML="<div class=\"rbox\"><div class=\"rboxInner\">Loading...</div></div>";pop.style.display='block';getAjaxContent('addtofavoritespopup','addtofavoritespopup',wallpaperid);add2favspopup=true;return;}
function closeFavoritesPopup(){document.getElementById('addtofavoritespopup').style.display='none';add2favspopup=false;return;}
function previewClick(e){if((navigator.appName=="Netscape"&&e.which==3)||(navigator.appName=='Microsoft Internet Explorer'&&event.button==2)){alert("To view this wallpaper full-size, please click the \"Download Now\" button in the right column.");return false;}
return true;}
function add2favorites(newflag){ajaxPutGet('add2favorites',wallpaperid,newflag);return;}
function submitEmail2Friend(){var yourname=document.getElementById('e2fyourname');var youremail=document.getElementById('e2fyouremail');var friendnames=new Array(3);var friendemails=new Array(3);var atleastone=false;if(sendingemail2friend)return;if(yourname.value==""||yourname.value=="Your Name"){document.getElementById('e2fstatus').innerHTML="<br />Please enter your name so your friends know who's recommending this wallpaper!<br /><br />";return;}
if(youremail.value==""||youremail.value=="Your Email"){document.getElementById('e2fstatus').innerHTML="<br />Please enter your email address so your friends know who's recommending this wallpaper!<br /><br />";return;}
for(i=1;i<=3;i++){friendnames[i-1]="";friendemails[i-1]="";if(document.getElementById('e2ffriend'+i+'name').value!="Friend "+i+" Name")
friendnames[i-1]=document.getElementById('e2ffriend'+i+'name').value;if(document.getElementById('e2ffriend'+i+'email').value!="Friend "+i+" Email")
friendemails[i-1]=document.getElementById('e2ffriend'+i+'email').value;if(friendnames[i-1]!=""&&friendemails[i-1]!="")atleastone=true;friendnames[i-1].replace("||","|");friendemails[i-1].replace("||","|");}
if(!atleastone){document.getElementById('e2fstatus').innerHTML="<br />Please enter at least one friend's name and email address before continuing.<br /><br />";return;}
sendingemail2friend=true;yourname.disabled=true;youremail.disabled=true;for(i=1;i<=3;i++){document.getElementById('e2ffriend'+i+'name').disabled=true;document.getElementById('e2ffriend'+i+'email').disabled=true;}
document.getElementById('e2fstatus').style.color="#009000";document.getElementById('e2fstatus').innerHTML="<br />Processing, please wait...<br /><br />";ajaxPutGet("sendemail2friend",wallpaperid,yourname.value+"||"+friendnames.join("||")+"|-|"+youremail.value+"||"+friendemails.join("||"));return;}
function voteThumbOver(side){if(side=="up"){document.getElementById('doyoulike-up').src="http://cdn.desktopnexus.com/images/doyoulike-thumbup-over.gif";}else if(side=="down"){document.getElementById('doyoulike-down').src="http://cdn.desktopnexus.com/images/doyoulike-thumbdown-over.gif";}
return;}
function handleReportViolation(results){switch(results){case"dmcaInvalidEmail":alert("We could not validate your email address.  We require a valid email to begin the DMCA claim process.");break;case"dmcaGood":alert("We have received your claim of a potential copyright violation and have automatically created a new case file for investigation.  However before we can continue, we do require some additional information.  You should be receiving an email shortly with instructions on how to proceed.");break;default:case"1":alert("This wallpaper (ID #"+wallpaperid+") has been reported.  If moderator action is deemed appropriate, we will try to act as quickly as possible.\n\nThank you so much for your help!");break;}
shadeDivMouseDown();return;}
function voteThumbOut(side){if(side=="up"&&current_vote!="up"){document.getElementById('doyoulike-up').src="http://cdn.desktopnexus.com/images/doyoulike-thumbup.gif";}else if(side=="down"&&current_vote!="down"){document.getElementById('doyoulike-down').src="http://cdn.desktopnexus.com/images/doyoulike-thumbdown.gif";}
return;}
function voteThumbCast(side){if(side==current_vote)return;var url="/ajax?type=vote&paper="+wallpaperid+"&vote="+side;http.open("GET",url,true);http.onreadystatechange=handleHttpResponse;http.send(null);var statuselem=document.getElementById('doyoulike-status');if(side=="up"){statuselem.innerHTML="Voted Up!";if(current_vote=="down")
current_points=parseInt(current_points)+2;else if(current_vote=="")
current_points=parseInt(current_points)+1;current_vote="up";document.getElementById('doyoulike-down').src="http://cdn.desktopnexus.com/images/doyoulike-thumbdown.gif";}else if(side=="down"){statuselem.innerHTML="Voted Down!";if(current_vote=="up")
current_points=parseInt(current_points)-2;else if(current_vote=="")
current_points=parseInt(current_points)-1;current_vote="down";document.getElementById('doyoulike-up').src="http://cdn.desktopnexus.com/images/doyoulike-thumbup.gif";}
fadeText("doyoulike-status","E9EEF4","000000",80,2);if(current_points>0)
document.getElementById('doyoulike-points').innerHTML="+"+current_points;else
document.getElementById('doyoulike-points').innerHTML=current_points;fadeText("doyoulike-points","CDD9E7","6485AE",80,2);return;}
function loggedOutVote(){document.getElementById('voteLoginBlock').innerHTML="Hi stranger! We're glad you are trying to interact with our community.  To vote on your favorite wallpapers, we now require you to <a href=\"http://www.desktopnexus.com/signup\" style=\"text-decoration: underline; color: #070; font-weight: bold;\">register</a> for a 100% free Desktop Nexus account. The signup process only takes about 10 seconds, and you'll instantly have access to all the features Desktop Nexus has to offer.  If you're already a member, <a href=\"http://www.desktopnexus.com/login\" style=\"text-decoration: underline;\">click here to login</a>.";document.getElementById('shadediv').style.display='block';document.getElementById('voteLoginBlock').style.display='block';return;}
function fadeText(id,start,end,steps,speed){var startrgb,endrgb,er,eg,eb,step,rint,gint,bint,step;var target=document.getElementById(id);steps=steps||20;speed=speed||20;target.step=1;target.style.color="#"+start;clearInterval(target.timer);endrgb=colorConvert(end);er=endrgb[0];eg=endrgb[1];eb=endrgb[2];startrgb=colorConvert(start);r=startrgb[0];g=startrgb[1];b=startrgb[2];target.r=r;target.g=g;target.b=b;rint=Math.round(Math.abs(target.r-er)/steps);gint=Math.round(Math.abs(target.g-eg)/steps);bint=Math.round(Math.abs(target.b-eb)/steps);if(rint==0){rint=1}
if(gint==0){gint=1}
if(bint==0){bint=1}
target.step=1;target.timer=setInterval(function(){fadeChange(id,steps,er,eg,eb,rint,gint,bint)},speed);}
function fadeChange(id,steps,er,eg,eb,rint,gint,bint){var target=document.getElementById(id);var color;if(target.step<=steps){var r=target.r;var g=target.g;var b=target.b;if(r>=er){r=r-rint;}else{r=parseInt(r)+parseInt(rint);}
if(g>=eg){g=g-gint;}else{g=parseInt(g)+parseInt(gint);}
if(b>=eb){b=b-bint;}else{b=parseInt(b)+parseInt(bint);}
target.style.color='rgb('+r+','+g+','+b+')';target.r=r;target.g=g;target.b=b;target.step=target.step+1;}else{clearInterval(target.timer);target.style.color='rgb('+er+','+eg+','+eb+')';}}
function colorConvert(color){var rgb=[parseInt(color.substring(0,2),16),parseInt(color.substring(2,4),16),parseInt(color.substring(4,6),16)];return rgb;}
