data.LastPhoto={};
data.LastPhoto.PhotoProperties={};
data.LastPhoto.LastVote={};
data.NextPhoto={};
var photoEffectDuration=0.25;
document.observe("dom:loaded",function(){
Nifty("div#divWrapper","transparent");
Nifty("div#divHeader","transparent");
Nifty("div#divPrimaryContent","transparent");
Nifty("div#divSecondaryContent","transparent");
Nifty("div#divTertiaryContent","transparent");
Nifty("div#divFooter","transparent");
Nifty("div#divVoteOptions","transparent");
Nifty("div#divSiteShare","transparent");
Nifty("div#divPhotoActionsAndShare","transparent");
Nifty("div#divPhotoFilter","transparent");
Nifty("div#divPromoteFacebook","transparent");
Nifty("div.divActionBar","transparent");
Nifty("div.divVoteResults","transparent");
Nifty("div#divPhotoComments","transparent");
Nifty("div.divModule","transparent");
Event.observe($(document.body),"contextmenu",function(_1){
_1.stop();
});
contentLoaded();
createTakeATourLink();
load();
});
function load(){
var q=window.location.toString().toQueryParams();
var _3=q.p;
if(isNaN(parseInt(_3))){
_3=-1;
}
var _4=((_3==-1)?{}:{"PhotoID":_3});
_4.ReqTime=getReqTime();
_4.RandomSalt=getRandomSalt();
if(data.LoginStatus){
//$("divFindFriendsReminder").show();
}
data.LastPhoto.Loaded=true;
new Ajax.Request("/api/do.php?Action=GetNextPhoto",{method:"GET",onSuccess:parseGetNextPhotoResponse,parameters:_4});
$("ddlAgeRange").stopObserving("change").observe("change",switchPhotoFilter);
$("ddlGender").stopObserving("change").observe("change",switchPhotoFilter);
$("ddlCountry").stopObserving("change").observe("change",switchPhotoFilter);
new Ajax.Request("/api/do.php?Action=GetPhotoResults",{method:"GET",onSuccess:parseGetPhotoResults});
$("lnkResultInfo").stopObserving("click").observe("click",displayResultInfoPopup);
data.Modules.Loaded=false;
}
function nextPhotoLoading(){
data.NextPhoto.Loaded=false;
$("imgNextPhoto").stopObserving("click").hide({queue:"end"});
removeTip($("imgNextPhoto"));
$("nextPhotoMark").hide({queue:"end"});
$$(".nextPhotoPlaceHolder .noPhoto").first().hide({queue:"end"});
$$(".nextPhotoPlaceHolder .centerLoading").first().show({queue:"end"});
}
function getNextPhoto(_5){
var _6=((_5==null)?{}:{"PhotoID":_5});
_6.ReqTime=getReqTime();
_6.RandomSalt=getRandomSalt();
nextPhotoLoading();
new Ajax.Request("/api/do.php?Action=GetNextPhoto",{method:"GET",onSuccess:parseGetNextPhotoResponse,parameters:_6});
}
function parseGetNextPhotoResponse(_7){
var _8=_7.responseJSON;
data.ShowAgeRangeID=_8.ShowAgeRangeID;
data.ShowGender=_8.ShowGender;
data.ShowCountryID=_8.ShowCountryID;
if(_8.Error==""){
if(_8.Result=="Valid"){
showNextPhoto();
return false;
}
data.NextPhoto.PhotoID=_8.PhotoID;
data.NextPhoto.Caption=_8.Caption;
data.NextPhoto.P=_8.P;
data.NextPhoto.Age=_8.Age;
data.NextPhoto.Gender=_8.Gender;
data.NPS=_8.NPS;
if((!(data.Modules.Loaded))||(data.NPS%3==1)){
updateModules();
}
}else{
data.NextPhoto.PhotoID=-1;
data.NextPhoto.Caption="";
data.NextPhoto.P=-1;
if(!(data.Modules.Loaded)){
updateModules();
}
}
showNextPhoto();
}
function showNextPhoto(){
data.NextPhoto.markX=-1;
data.NextPhoto.markY=-1;
var _9=$("txtVoteComment");
if($F(_9)==""){
_9.setStyle({"color":"#999"}).setValue(defaultComment);
}
_9.stopObserving("focus").observe("focus",function(e){
if(data.LoginStatus){
if(this.getValue()==defaultComment){
this.setStyle({"color":"#333"}).setValue("");
}
}else{
pf=new PopupForm();
var xy=e.element().viewportOffset();
var w=350;
pf.setWidth(w);
pf.setLeft(xy.left-(w/2).floor());
pf.setTop(xy.top);
pf.setErrorMsg(commentLoginPopupMessage);
pf.flash(10);
}
});
_9.stopObserving("blur").observe("blur",function(e){
if(this.getValue()==""){
this.setStyle({"color":"#999"}).setValue(defaultComment);
}
});
if(data.NextPhoto.PhotoID>0){
$("imgNextPhoto").stopObserving("load").observe("load",nextPhotoLoad);
$("imgNextPhoto").src=data.NextPhoto.P;
var _e=$("txtShareLink");
_e.value="http://restyleme.com/?p="+data.NextPhoto.PhotoID;
_e.stopObserving("click").observe("click",function(){
_e.activate();
});
}else{
data.NextPhoto.imgWidth=0;
data.NextPhoto.imgHeight=0;
$("txtShareLink").value="";
$("imgNextPhoto").stopObserving("click").hide({queue:"end"});
$$(".nextPhotoPlaceHolder .centerLoading").first().hide({queue:"end"});
$$(".nextPhotoPlaceHolder").first().morph({width:"400px",height:"300px"},{duration:photoEffectDuration,queue:"end"});
$$(".nextPhotoPlaceHolder .noPhoto").first().appear({duration:photoEffectDuration,queue:"end"});
if(($F("ddlAgeRange")==1)&&($F("ddlGender")=="A")&&($F("ddlCountry")==-1)){
$$(".nextPhotoPlaceHolder .spanNoPhotoFilter").first().hide();
$$(".nextPhotoPlaceHolder .spanNoPhotoAll").first().show();
}else{
$$(".nextPhotoPlaceHolder .spanNoPhotoAll").first().hide();
$$(".nextPhotoPlaceHolder .spanNoPhotoFilter").first().show();
}
}
$$("#divPrimaryContent #lnkSendPhoto").first().stopObserving("click").observe("click",showSendPhoto.bindAsEventListener(this,data.NextPhoto.PhotoID));
$$("#divPrimaryContent #lnkFlagBroken").first().stopObserving("click").observe("click",flagBroken.bindAsEventListener(this,data.NextPhoto.PhotoID));
$$("#divPrimaryContent #lnkAddFavorite").first().stopObserving("click").observe("click",flagFavorite.bindAsEventListener(this,data.NextPhoto.PhotoID));
$$("#divPrimaryContent #lnkFlagInappropriate").first().stopObserving("click").observe("click",flagInappropriate.bindAsEventListener(this,data.NextPhoto.PhotoID));
var _f=this;
$$(".lnkCategoryThumbsUp").each(function(l){
l.stopObserving("click").observe("click",voteCategory.bindAsEventListener(_f,data.NextPhoto.PhotoID));
});
$$(".lnkCategoryThumbsDown").each(function(l){
l.stopObserving("click").observe("click",voteCategory.bindAsEventListener(_f,data.NextPhoto.PhotoID));
});
displayVoteInfoMessage(data.NPS);
if((data.NPS>1)&&(data.NPS%16==0)){
//$("divFindFriendsReminder").highlight();
}
}
function nextPhotoLoad(e){
var img=$("imgNextPhoto");
if(img){
var _14=img.getDimensions();
var _15=_14.width;
var _16=_14.height;
data.NextPhoto.imgWidth=_15;
data.NextPhoto.imgHeight=_16;
$$(".nextPhotoPlaceHolder").first().morph({width:_15+"px",height:_16+"px"},{duration:photoEffectDuration,queue:"end"});
$$(".nextPhotoPlaceHolder .centerLoading").first().hide({queue:"end"});
$$(".nextPhotoPlaceHolder .noPhoto").first().hide({queue:"end"});
img.appear({duration:photoEffectDuration,queue:"end",afterFinish:function(){
data.NextPhoto.Loaded=true;
if((data.LastPhoto.Loaded)&&(data.Modules.Loaded)){
syncHeights("divPrimaryContent,divSecondaryContent,divTertiaryContent");
}
}});
var c=$("nextPhotoMark");
img.stopObserving("click").observe("click",function(_18){
_18.stop();
var el=Event.element(_18);
var x=Event.pointerX(_18)-Position.cumulativeOffset(el)[0];
var y=Event.pointerY(_18)-Position.cumulativeOffset(el)[1];
var _1c=Event.pointerX(_18)-(isIE6()?5:c.getWidth()/2);
var _1d=Event.pointerY(_18)-(isIE6()?5:c.getHeight()/2);
data.NextPhoto.markX=Math.floor(1000*x/el.getWidth());
data.NextPhoto.markY=Math.floor(1000*y/el.getHeight());
c.setStyle({left:_1c+"px",top:_1d+"px"});
c.show();
});
c.stopObserving("click").observe("click",function(_1e){
_1e.stop();
data.NextPhoto.markX=-1;
data.NextPhoto.markY=-1;
c.hide();
});
var _1f=data.NextPhoto.Age+" / ";
_1f+="<span class=\"sheet "+((data.NextPhoto.Gender=="M")?"male":"female")+"-tipTitle\"></span>";
addTip(img,data.NextPhoto.Caption,{className:"withToolbar",effect:"appear",title:_1f,hook:{target:"rightMiddle",tip:"topLeft"}});
}
}
function parseGetPhotoResults(_20){
var _21=_20.responseJSON;
if(_21.LastPhoto.Error==""){
data.LastPhoto=_21.LastPhoto;
showLastPhoto(data.LastPhoto);
}else{
data.LastPhoto.PhotoProperties.PhotoID=-1;
$("divWelcome").show();
if($("divAnnouncements")){
$("divAnnouncements").show();
}
}
}
function voteCategory(_22,_23){
_22.stop();
var elm=_22.element();
Tips.hide(elm);
var X=Event.pointerX(_22);
var Y=Event.pointerY(_22);
var _27=-1;
var _28=0;
var tk=elm.identify().split("_");
if(tk.length>2){
var tmp=tk.pop();
if((tmp>0)&&(tmp<11)){
_27=tmp;
}
tmp=tk.pop();
if(tmp=="Up"){
_28=1;
}
if(tmp=="Down"){
_28=-1;
}
}
pf=new PopupForm();
var w=350;
pf.setWidth(w);
pf.setLeft(X);
pf.setTop(Y);
if((_23>0)&&(_27!=-1)&&(_28!=0)){
lastPhotoLoading();
nextPhotoLoading();
var _2c=($F("txtVoteComment")==defaultComment)?"":$F("txtVoteComment");
new Ajax.Request("/api/do.php?Action=InsertVote",{method:"GET",onSuccess:parseInsertVoteResponse,parameters:{"PhotoID":_23,"CategoryID":_27,"X":data.NextPhoto.markX,"Y":data.NextPhoto.markY,"VoteRating":_28,"VoteComment":_2c}});
}else{
pf.setErrorMsg("Invalid vote!");
pf.setInfoMsg("");
pf.flash();
}
return (false);
}
function parseInsertVoteResponse(_2d){
var _2e=_2d.responseJSON;
var _2f="";
if(_2e.NextPhoto.Error!=""){
_2f+=_2e.NextPhoto.Error;
}else{
$("txtVoteComment").setValue("");
}
if(_2e.LastPhoto.Error!=""){
if(_2f!=""){
_2f+="<br /><br />";
}
_2f+=_2e.LastPhoto.Error;
}
if(_2e.LastPhoto.Error==""){
data.LastPhoto=_2e.LastPhoto;
showLastPhoto(data.LastPhoto);
getNextPhoto();
}else{
data.LastPhoto.PhotoProperties.PhotoID=-1;
lastPhotoNotLoading();
showNextPhoto();
}
if(_2f!=""){
pf.setErrorMsg(_2f);
pf.setInfoMsg("");
pf.flash(10);
}
}
function showLastPhoto(lp){
$("divWelcome").hide();
if($("divAnnouncements")){
$("divAnnouncements").hide();
}
up=lp.UserProfile;
pp=lp.PhotoProperties;
var _31,_32,_33;
if(up.Gender=="M"){
_31="he";
_32="him";
_33="his";
}else{
_31="she";
_32="her";
_33="her";
}
var _34="";
var _35=$("divUserAndVotes");
var _36=$("divPhotoComments");
var _37=new Date();
var _38=_37.getTime()+(_37.getTimezoneOffset()*60000);
var _39=Date.parse(up.LastSeenOnlineTime);
var _3a=null;
if(_38-_39>(onlineTimeoutSeconds*1000)){
_34=_31.capitalize()+" is currently offline.<br />Last online: "+up.LastResultsChecked;
_3a=_35.down(".imgOnlineStatus");
_3a.removeClassName("user-online-content").addClassName("user-offline-content");
addTip(_3a,_34,{effect:"appear"});
}else{
_34=_31.capitalize()+" is currently online";
_3a=_35.down(".imgOnlineStatus");
_3a.removeClassName("user-offline-content").addClassName("user-online-content");
addTip(_3a,_34,{effect:"appear"});
}
_35.down(".userName").update(up.UserName);
_35.down(".userAge").update(up.Age);
_35.down(".userCountry").update(up.CountryName);
var _3b=_35.down(".imgUserGender");
if(up.Gender=="M"){
_3b.removeClassName("female-content").addClassName("male-content");
}else{
_3b.removeClassName("male-content").addClassName("female-content");
}
addTip(_3b,((up.Gender=="M")?"Male":"Female"),{effect:"appear"});
if(up.UserID!=data.UserID){
var _3c="";
switch(up.UserStance){
case 2:
_3c="friend-stance";
_34="You are friends with "+_32+".";
break;
case 3:
_3c="enemy-stance";
_34=_31.capitalize()+" is in your enemy list.";
break;
case 6:
_3c="favorite";
_34=_31.capitalize()+" has a style that is in your favorite list.";
break;
default:
_3c="neutral-stance";
_34="You are neutral towards "+_32+".";
break;
}
var _3d=_35.down(".imgUserStance");
_3d.removeClassName("friend-stance-content").removeClassName("enemy-stance-content").removeClassName("favorite-content").removeClassName("neutral-stance-content").addClassName(_3c+"-content");
addTip(_3d,_34,{effect:"appear"});
}
var _3e=null;
var _3f=null;
var _40=null;
var _41=_35.down("a.lnkAddFriendRequest");
_3e=_41.up("span");
if((up.UserStance!=2)&&(up.UserStance!=3)&&(up.UserID!=data.UserID)){
_34="Send "+_32+" an \"Add friend request\"";
_41.stopObserving("click").remove();
_41=new Element("a",{"class":"lnkAddFriendRequest sheetLink",href:""});
_3f=new Element("span",{"class":"sheet sheetHorMargin add-friend-section"});
_40=new Element("span",{"class":"sheetLinkText"});
_40.update("Add Friend");
_41.insert(_3f);
_41.insert(_40);
_3e.insert(_41);
_41.observe("click",addNewFriendQuick.bindAsEventListener(this,up.UserID,up.UserName));
addTip(_41,_34,{effect:"appear"});
_3e.show();
}else{
_3e.hide();
}
var _42=_35.down("a.lnkSendMessage");
_3e=_42.up("span");
if(!((up.OnlyFriendsCanMessage==1)&&(up.UserStance!=2))&&(up.UserID!=data.UserID)){
_34="Send a message to "+_32;
_42.stopObserving("click").remove();
_42=new Element("a",{"class":"lnkSendMessage sheetLink",href:""});
_3f=new Element("span",{"class":"sheet sheetHorMargin send-mail-section"});
_40=new Element("span",{"class":"sheetLinkText"});
_40.update("Send Message");
_42.insert(_3f);
_42.insert(_40);
_3e.insert(_42);
_42.observe("click",sendMessageQuick.bindAsEventListener(this,up.UserID,up.UserName));
addTip(_42,_34,{effect:"appear"});
_3e.show();
}else{
_3e.hide();
}
var _43=_35.down("a.lnkAddFavorite");
_3e=_43.up("span");
if(pp.PhotoID!=-1){
_34="Add this style to your favorites list";
_43.stopObserving("click").remove();
_43=new Element("a",{"class":"lnkAddFavorite sheetLink",href:""});
_3f=new Element("span",{"class":"sheet sheetHorMargin add-favorite-section"});
_40=new Element("span",{"class":"sheetLinkText"});
_40.update("Add Favorite");
_43.insert(_3f);
_43.insert(_40);
_3e.insert(_43);
_43.observe("click",addFavoriteQuick.bindAsEventListener(this,pp.PhotoID));
addTip(_43,_34,{effect:"appear"});
_3e.show();
}else{
_3e.hide();
}
var _44=_35.down("a.lnkViewProfile");
_3e=_44.up("span");
_34="Click to see "+up.UserName+"&#39;s profile";
_44.stopObserving("click").remove();
_44=new Element("a",{"class":"lnkViewProfile sheetLink",href:""});
_3f=new Element("span",{"class":"sheet sheetHorMargin "+((up.Gender=="M")?"male":"female")+"-section"});
_40=new Element("span",{"class":"sheetLinkText"});
_40.update("View Profile");
_44.insert(_3f);
_44.insert(_40);
_3e.insert(_44);
_44.observe("click",getProfile.bindAsEventListener(_44,up.UserID,null,"profile",pp.PhotoID));
addTip(_44,_34,{effect:"appear"});
var _45=_35.down(".imgLastPhoto");
if(pp.PhotoID>0){
_45.stopObserving("load").observe("load",lastPhotoLoad);
_45.src="get_pic_db.php?s=1&v="+pp.PhotoV;
}else{
data.LastPhoto.imgWidth=0;
data.LastPhoto.imgHeight=0;
_45.stopObserving("click").hide({queue:"end"});
_35.down(".lastPhotoPlaceHolder .centerLoading").hide({queue:"end"});
_35.down(".lastPhotoPlaceHolder").morph({width:"200px",height:"200px"},{duration:photoEffectDuration,queue:"end"});
_35.down(".lastPhotoPlaceHolder .noPhoto").appear({duration:photoEffectDuration,queue:"end"});
}
var pvr=getProcessedVoteResults(pp.CategoryVoteResults);
var _47=(lp.LastVote)?new Vote(lp.LastVote):null;
var _48=_35.down(".tblVoteResults");
var _49=null;
if(_47){
if(_47.voteRating==1){
_48.down(".trUserVote .negVote").setStyle({visibility:"hidden"});
_49=_48.down(".trUserVote .posVote span.category");
_49.className="category sheet "+(data.Categories.get(_47.categoryID).CategoryFileName+"-section");
_48.down(".trUserVote .posVote").setStyle({visibility:"visible"});
}else{
if(_47.voteRating==-1){
_48.down(".trUserVote .posVote").setStyle({visibility:"hidden"});
_49=_48.down(".trUserVote .negVote span.category");
_49.className="category sheet "+(data.Categories.get(_47.categoryID).CategoryFileName+"-section");
_48.down(".trUserVote .negVote").setStyle({visibility:"visible"});
}else{
_48.down(".trUserVote .posVote").setStyle({visibility:"hidden"});
_48.down(".trUserVote .negVote").setStyle({visibility:"hidden"});
}
}
}else{
_48.down(".trUserVote .posVote").setStyle({visibility:"hidden"});
_48.down(".trUserVote .negVote").setStyle({visibility:"hidden"});
}
var _4a=_48.down(".trUserVote");
var _4b=_48.down(".trBestWorstCategories .header");
var _4c=_48.down(".trBestWorstCategories .bestCat");
var _4d=_48.down(".trBestWorstCategories .worstCat");
var _4e=_48.down(".trTotalVotes .header");
var _4f=_48.down(".trTotalVotes .posVotes");
var _50=_48.down(".trTotalVotes .negVotes");
_4c.update((pvr.bestCat.VoteCount>0)?pvr.bestCat.VoteCount+" <span class=\"sheet thumbs-up-hover-section\"></span><span class=\"category sheet "+data.Categories.get(pvr.bestCat.CategoryID).CategoryFileName+"-section\"></span>":"");
_4d.update((pvr.worstCat.VoteCount>0)?pvr.worstCat.VoteCount+" <span class=\"sheet thumbs-down-hover-section\"></span><span class=\"category sheet "+data.Categories.get(pvr.worstCat.CategoryID).CategoryFileName+"-section\"></span>":"");
_48.down(".trTotalVotes .totalVotes").update(pvr.totalVotes);
_48.down(".trTotalVotes span.posVotes").update(((pvr.totalVotes>0)?(100*pvr.posVotes/pvr.totalVotes).round()+"% ":""));
_48.down(".trTotalVotes span.negVotes").update(((pvr.totalVotes>0)?(100-(100*pvr.posVotes/pvr.totalVotes)).round()+"% ":""));
if(_47){
data.Modules.CoolStyles.CategoryID=_47.categoryID;
data.Modules.CoolStyles.Gender=up.Gender;
addTip(_4a,"You think "+_31+" should "+((_47.voteRating==1)?"keep":"change")+" "+_33+" "+data.Categories.get(_47.categoryID).CategoryName.toLowerCase()+".",{effect:"appear"});
}
addTip(_4e,"Number of total votes "+_31+" received",{effect:"appear"});
addTip(_4f,"Percentage of favorable votes "+_31+" received overall",{effect:"appear"});
addTip(_50,"Percentage of unfavorable votes "+_31+" received overall",{effect:"appear"});
addTip(_4b,_33.capitalize()+" best and worst style categories");
if(pvr.bestCat.VoteCount>0){
addTip(_4c,pvr.bestCat.VoteCount+" "+((pvr.bestCat.VoteCount>1)?"people":"person")+" thought "+_31+" should keep "+_33+" "+data.Categories.get(pvr.bestCat.CategoryID).CategoryName.toLowerCase()+".",{effect:"appear"});
}
if(pvr.worstCat.VoteCount>0){
addTip(_4d,pvr.worstCat.VoteCount+" "+((pvr.worstCat.VoteCount>1)?"people":"person")+" thought "+_31+" should change "+_33+" "+data.Categories.get(pvr.worstCat.CategoryID).CategoryName.toLowerCase()+".",{effect:"appear"});
}
var _51="";
var fc=pp.PhotoStats.FavoritedCount;
if(fc>0){
_51="<span class=\"spanFavoritedCount\"><span class=\"sheet favorite-content\"></span>"+" This style was favorited "+fc+" time"+((fc>1)?"s":"")+"</span>";
}
var pc=up.PhotoList.length;
if(pc>1){
_51+="<br /><span class=\"sheet "+((up.Gender=="M")?"male":"female")+"-content\"></span> "+up.UserName+" has <a class=\"lnkViewOtherStyles\" href=\"\">"+(pc-1)+" other style"+((pc>2)?"s":"")+"</a>.";
}
_35.down(".divPhotoStats").update(_51);
var _54=_35.down(".divPhotoStats").down("a.lnkViewOtherStyles");
if(_54){
_34="Click to see "+up.UserName+"&#39;s other styles";
_54.observe("click",getProfile.bindAsEventListener(_54,up.UserID,null,"profile",pp.PhotoID));
addTip(_54,_34,{effect:"appear"});
}
var _55=_35.down(".divRandomUserTags");
if(up.UserTags.size()>0){
var _56=up.UserTags.pluck("UserTagCategoryID").uniq();
var _57=_56[(Math.random()*_56.size()).floor()];
var _58=0;
var _59="";
_55.update("");
up.UserTags.each(function(ut){
if(ut.UserTagCategoryID==_57){
if(_58==0){
_59+=("<span class=\"spanUserTagCatName\">"+_33.capitalize()+" "+ut.UserTagCategoryName+": "+"</span>");
}else{
_59+=", ";
}
_59+="<a href=\"browse-users.php?t="+ut.TagID+"\">"+ut.TagName.gsub(" ","&nbsp;")+"</a>";
_58++;
}
});
_55.insert(_59);
Nifty("div.divRandomUserTags","transparent");
_55.show();
}else{
_55.update("");
}
var cs=new Comment(pp.PhotoID,pp.Comments,_36.down(".divPhotoCommentsContent"),false,false);
$("divLastPhoto").show();
}
function lastPhotoLoading(){
var _5c=$("divUserAndVotes");
var img=_5c.down(".imgLastPhoto");
data.LastPhoto.Loaded=false;
img.hide({queue:"end"});
_5c.down(".lastPhotoPlaceHolder .noPhoto").hide({queue:"end"});
_5c.down(".lastPhotoPlaceHolder .centerLoading").show({queue:"end"});
}
function lastPhotoNotLoading(){
var _5e=$("divUserAndVotes");
var img=_5e.down(".imgLastPhoto");
_5e.down(".lastPhotoPlaceHolder .centerLoading").hide({queue:"end"});
_5e.down(".lastPhotoPlaceHolder .noPhoto").hide({queue:"end"});
img.appear({queue:"end"});
data.LastPhoto.Loaded=true;
}
function lastPhotoLoad(e){
var _61=$("divUserAndVotes");
var img=_61.down(".imgLastPhoto");
if(img){
var _63=img.getDimensions();
var _64=_63.width;
var _65=_63.height;
data.LastPhoto.imgWidth=_64;
data.LastPhoto.imgHeight=_65;
_61.down(".lastPhotoPlaceHolder").morph({width:_64+"px",height:_65+"px"},{duration:photoEffectDuration,queue:"end"});
_61.down(".lastPhotoPlaceHolder .centerLoading").hide({queue:"end"});
_61.down(".lastPhotoPlaceHolder .noPhoto").hide({queue:"end"});
img.appear({duration:photoEffectDuration,queue:"end",afterFinish:function(){
data.LastPhoto.Loaded=true;
if((data.NextPhoto.Loaded)&&(data.Modules.Loaded)){
syncHeights("divPrimaryContent,divSecondaryContent,divTertiaryContent");
}
var ptb=_61.down(".divPhotoTags");
new PhotoTag(data.LastPhoto.PhotoProperties.PhotoID,_61.down(".lastPhotoPlaceHolder"),data.LastPhoto.imgWidth,data.LastPhoto.imgHeight,data.LastPhoto.PhotoProperties.PhotoTags,ptb,false,true,true);
}});
var _67=img;
var _68=data.LastPhoto.UserProfile.UserName+"<br />";
_68+=data.LastPhoto.UserProfile.Age+" / ";
_68+="<span class=\"sheet "+((data.LastPhoto.UserProfile.Gender=="M")?"male":"female")+"-tipTitle\"></span>";
_68+=" / "+data.LastPhoto.UserProfile.CountryName;
addTip(img,data.LastPhoto.PhotoProperties.Caption,{className:"withToolbar",effect:"appear",title:_68,hook:{target:"rightMiddle",tip:"topLeft"}});
}
}
function flagInappropriate(_69,_6a){
_69.stop();
Tips.hide(_69.element());
var X=Event.pointerX(_69);
var Y=Event.pointerY(_69);
pf=new PopupForm();
pf.setLeft(X);
pf.setTop(Y);
new Ajax.Request("/api/do.php?Action=FlagInappropriate",{method:"GET",onSuccess:parseFlagInappropriateResponse,parameters:{"PhotoID":_6a}});
return (false);
}
function parseFlagInappropriateResponse(_6d){
var _6e=_6d.responseJSON;
if(_6e.Error==""){
pf.setErrorMsg("");
pf.setInfoMsg("Photo flagged as inappropriate.");
}else{
pf.setErrorMsg(_6e.Error);
pf.setInfoMsg("");
}
pf.flash();
getNextPhoto();
}
function flagBroken(_6f,_70){
_6f.stop();
Tips.hide(_6f.element());
var X=Event.pointerX(_6f);
var Y=Event.pointerY(_6f);
pf=new PopupForm();
pf.setLeft(X);
pf.setTop(Y);
new Ajax.Request("/api/do.php?Action=FlagBroken",{method:"GET",onSuccess:parseFlagBrokenResponse,parameters:{"PhotoID":_70}});
return (false);
}
function parseFlagBrokenResponse(_73){
var _74=_73.responseJSON;
if(_74.Error==""){
pf.setErrorMsg("");
pf.setInfoMsg("Photo flagged as broken.");
}else{
pf.setErrorMsg(_74.Error);
pf.setInfoMsg("");
}
pf.flash();
getNextPhoto();
}
function flagFavorite(_75,_76){
_75.stop();
Tips.hide(_75.element());
var X=Event.pointerX(_75);
var Y=Event.pointerY(_75);
var w=350;
pf=new PopupForm();
pf.setWidth(w);
pf.setLeft(X-(w/2).floor());
pf.setTop(Y);
new Ajax.Request("/api/do.php?Action=FlagFavorite",{method:"GET",onSuccess:parseFlagFavoriteResponse,parameters:{"PhotoID":_76}});
return (false);
}
function parseFlagFavoriteResponse(_7a){
var _7b=_7a.responseJSON;
if(_7b.Error==""){
pf.setErrorMsg("");
pf.setInfoMsg("Photo flagged as favorite.");
pf.flash();
}else{
pf.setErrorMsg(_7b.Error);
pf.setInfoMsg("");
pf.flash(10);
}
}
function switchPhotoFilter(_7c){
nextPhotoLoading();
new Ajax.Request("/api/do.php?Action=GetNextPhoto",{method:"GET",onSuccess:parseGetNextPhotoResponse,parameters:{"PhotoID":data.NextPhoto.PhotoID,"AgeRangeID":$F("ddlAgeRange"),"Gender":$F("ddlGender"),"CountryID":$F("ddlCountry"),"OnlyValidate":1,"ReqTime":getReqTime(),"RandomSalt":getRandomSalt()}});
}
function createTakeATourLink(){
var d=$("divTakeATour");
var _7e=new Element("a",{id:"lnkTakeATour",href:"","class":"bigLink",rel:"Take a tour to learn more about RestyleMe.com"});
_7e.update("Take A Tour");
d.insert(_7e);
d.insert("<br />");
_7e.stopObserving("click").observe("click",function(_7f){
_7f.stop();
$(document.body).scrollTo();
showTourPopup();
return (false);
});
}
function displayVoteInfoMessage(nps){
var msg="";
var _82="";
var _83=["green","#f19d1e"];
var _84=["Pick one of the style categories below and click on its thumbs up/down to send your vote and see the next photo","Did you know that you can mark the photo by clicking on it? By doing that you can tell people \"exactly\" what they should keep or change","Consider writing people a comment about their style in the below text box. Nothing beats a constructive and tasteful comment...","We tried to make this website as easy to use as possible. You can hover your mouse pointer over most links and icons to get more information.","Do you really like a style? Add it to your favorites! You can quickly do so by clicking this <span class=\"sheet add-favorite-content\"></span> icon anywhere you see.","Wanna make some fashion-loving friends? You can quickly send an \"Add Friend\" request by clicking this <span class=\"sheet add-friend-content\"></span> icon anywhere you see.","Are you curious where "+((data.Gender=="M")?"he":"she")+" got that pair of jeans? Ask "+((data.Gender=="M")?"him":"her")+"! You can quickly send someone a message by clicking this <span class=\"sheet send-mail-content\"></span> icon anywhere you see.","Remember, this is not a beauty contest. It's just real people giving style advice to real people. So rate the style, not the person!","Don't you want others to restyle you? Why don't you <a href=\"register.php\">Sign Up!</a> It's fast, easy, and completely free."];
msg=_84[0];
_82=_82[0];
if(nps){
if(nps>_84.length*5){
msg="";
}else{
msg=_84[(nps/5).floor()];
_82=_83[(nps/5).floor()%_83.length];
}
if((nps>0)&&(nps%16==0)&&(!(data.LoginStatus))){
new Effect.BlindDown($("divGuestInfoMessage"),{queue:"end"});
$("divGuestInfoMessage").highlight({queue:"end"});
}else{
new Effect.BlindUp($("divGuestInfoMessage"));
}
}
var _85=$("divVoteInfoMessage");
if(_85){
if(_85.innerHTML!=msg){
$("divVoteInfoMessage").update(msg).setStyle({color:_82}).highlight();
}
}
}
function displayResultInfoPopup(_86){
_86.stop();
Tips.hide(_86.element());
var _87=$("divPrimaryContent").cumulativeOffset();
var X=_87[0]+5;
var Y=_87[1];
var w=300;
pf=new PopupForm("","","Style Results");
pf.setLeft(X);
pf.setTop(Y);
pf.setWidth(w);
var _8b="";
_8b+="<div id=\"divResultInfoPopup\">";
_8b+="<strong>Dots:</strong> Green dots show what people thought this user should keep. ";
_8b+="Red dots show what people thought this user should change.";
_8b+="<br /><br />";
_8b+="<strong>Results:</strong> Shows a summary of all the votes this user received so far. ";
_8b+="Best/worst shows what most people thought this user to keep/change.";
_8b+="<br /><br />";
_8b+="<strong>Tags:</strong> Tags represent areas marked by the user for a style item or a brand. ";
_8b+="You can hover over the tag names to see the tagged areas and how people liked these tags.";
_8b+="<br /><br />";
_8b+="</div>";
pf.setContent(_8b);
pf.setShowOverlay(false);
pf.show();
return (false);
}
function displayRestyleMe20Popup(_8c){
_8c.stop();
Tips.hide(_8c.element());
var w=440;
var X=(((document.viewport.getWidth()-w)/2).floor());
var Y=0;
pf=new PopupForm("","","RestyleMe 2.0");
pf.setLeft(X);
pf.setTop(Y);
pf.setWidth(w);
var _90="";
_90="<img class=\"image\" src=\"/images/misc/rm2-badge.png\">";
_90+="<div id=\"divRestyleMe20\" class=\"divRestyleMe20\">";
_90+="<p></p>";
_90+="As we have already announced in our  we have been working on a major and innovative feature which will ";
_90+="simply take RestyleMe to another level where our users will be able to exchange ";
_90+="style advice even more effectively. Since we are still working on it we can only provide you ";
_90+="limited information but briefly: RestyleMe 2.0 will concentrate heavily on exchanging style advice using ";
_90+="actual products such as shirts, pants or accessories and more. Again we would like to thank our ";
_90+="loyal users and friends who helped us come up with and improve this new great idea!";
_90+="<p></p>";
_90+="RestyleMe Team.";
_90+="<p></p>";
_90+="<b>Want to know when we launch RestyleMe 2.0?</b>";
_90+="<p></p>";
_90+="<b>Email Address:</b> <input id=\"txtNoticeSubscriberEmail\" name=\"txtNoticeSubscriberEmail\" type=\"text\" class=\"textbox\" size=\"22\" />  ";
_90+="<input id=\"btnSend20LaunchEmail\" type=\"button\" class=\"popupButton\"  value=\"Send\" /> ";
_90+="<p></p>";
_90+="<p></p>";
_90+="</div>";
pf.setContent(_90);
pf.setShowOverlay(true);
pf.show();
$("btnSend20LaunchEmail").observe("click",function(){
saveNoticeSubsriberEmail();
});
return (false);
}
function saveNoticeSubsriberEmail(){
if(isValidEmail($F("txtNoticeSubscriberEmail"),false)&&$F("txtNoticeSubscriberEmail")!=""){
var URL="/api/do.php?Action=saveNoticeSubscriber&email="+$F("txtNoticeSubscriberEmail");
new Ajax.Request(URL,{method:"GET",onComplete:function(_92){
var _93=_92.responseText.evalJSON();
if(_93.Error==""){
pf.setErrorMsg("");
pf.setInfoMsg("Email successfully saved! Thanks...");
}else{
pf.setErrorMsg("");
pf.setInfoMsg(_93.Result);
}
}});
}else{
pf.setErrorMsg("Please enter a valid email address!");
pf.setInfoMsg("");
}
}


