dojo.provide("fantasy.client");
dojo.require("dojo.lfx.*");
dojo.require("dojo.event.*");
dojo.require("dojo.lfx.extras");
dojo.require("dojo.widget.Checkbox");
fantasy.client.is_minimized=0;
fantasy.client.current_scrollview=[];
fantasy.client.current_scrollview.topic=1;
fantasy.client.current_scrollview.questions=1;
fantasy.client.current_scrollview.overview=1;
fantasy.client.questions_container_height=332;
fantasy.client.questions_container_width=332;
fantasy.client.topics_container_height=402;
fantasy.client.topics_container_width=228;
fantasy.client.questionsoverview_container_height=372;
fantasy.client.questionsoverview_container_width=332;
fantasy.client.max_elements=13;
fantasy.client.headers_cnt=0;
fantasy.client.element_height=Math.floor(fantasy.client.topics_container_height/fantasy.client.max_elements);
fantasy.client.current_level=0;
fantasy.client.current_nodeId=null;
fantasy.client.current_nodeName=null;
fantasy.client.activeTopics=[];
fantasy.client.cache=[];
fantasy.client.topics=null;
fantasy.client.questions=null;
fantasy.client.questionNodes=[];
fantasy.client.currentCategory=null;
fantasy.client.renderedTopics=[];
fantasy.client.selectedMatches=[];
fantasy.client.questionCounter=0;
fantasy.client.results=[];
fantasy.client.minimizeSelect=function(_1){
if(fantasy.client.is_minimized=="0"){
if(_1=="1"){
dojo.byId("square_one_mini").style.backgroundColor="#ad2c31";
}
if(_1=="4"){
dojo.byId("square_two_mini").style.backgroundColor="#ad2c31";
}
if(_1=="2"){
dojo.byId("square_three_mini").style.backgroundColor="#ad2c31";
}
if(_1=="3"){
dojo.byId("square_four_mini").style.backgroundColor="#ad2c31";
}
fantasy.client.loadSurveyData(_1);
fantasy.client.is_minimized=1;
dojo.byId("content").style.zIndex=100;
dojo.lfx.combine(dojo.lfx.implode(dojo.byId("square_one"),dojo.byId("square_one_mini"),350),dojo.lfx.implode(dojo.byId("square_two"),dojo.byId("square_two_mini"),350),dojo.lfx.implode(dojo.byId("square_three"),dojo.byId("square_three_mini"),350),dojo.lfx.implode(dojo.byId("square_four"),dojo.byId("square_four_mini"),350),dojo.lfx.html.fadeShow(dojo.byId("content"),650),dojo.lfx.html.fadeShow(dojo.byId("container_mini"),850)).play(100);
}
};
fantasy.client.maximizeSelect=function(_2){
if(fantasy.client.is_minimized==1){
fantasy.client.is_minimized=0;
dojo.byId("square_one_mini").style.backgroundColor="#490202";
dojo.byId("square_two_mini").style.backgroundColor="#490202";
dojo.byId("square_three_mini").style.backgroundColor="#490202";
dojo.byId("square_four_mini").style.backgroundColor="#490202";
dojo.lfx.combine(dojo.lfx.html.fadeHide(dojo.byId("content"),20,null,function(_3){
dojo.byId("content").style.zIndex=-5;
}),dojo.lfx.explode(dojo.byId("square_one_mini"),dojo.byId("square_one"),350),dojo.lfx.explode(dojo.byId("square_two_mini"),dojo.byId("square_two"),350),dojo.lfx.explode(dojo.byId("square_three_mini"),dojo.byId("square_three"),350),dojo.lfx.explode(dojo.byId("square_four_mini"),dojo.byId("square_four"),350),dojo.lfx.html.fadeHide(dojo.byId("container_mini"),250)).play(100);
}
};
fantasy.client.initWelcome=function(){
url=window.location.href;
array_url=url.split("#");
if(array_url[1]){
if(array_url[1]=="join"){
token=gup("email");
dojo.byId("join_email").value=token;
fantasy.client.toggleSurveyJoin("join");
}else{
if(array_url[1]=="result"){
token=gup("token");
dojo.byId("result_token").value=token;
token=gup("email");
dojo.byId("result_email").value=token;
fantasy.client.toggleSurveyJoin("result");
}else{
fantasy.client.toggleSurveyJoin("new");
}
}
}else{
fantasy.client.toggleSurveyJoin("new");
}
error=gup("error");
if(error=="noaccess"){
dojo.byId("error_msg").innerHTML="Somehow you don't have access to a survey. Please check whether you entered the correct email and password combination.";
dojo.byId("alert_error").style.display="";
}else{
if(error=="insurvey"){
dojo.byId("error_msg").innerHTML="You still have to close another survey before you can start a new one.";
dojo.byId("alert_error").style.display="";
}else{
if(error=="partnerinsurvey"){
dojo.byId("error_msg").innerHTML="Your partner still has to close a survey.";
dojo.byId("alert_error").style.display="";
}else{
if(error=="form"){
dojo.byId("error_msg").innerHTML="There was an error in your data and somehow you passed the validation. ouch";
dojo.byId("alert_error").style.display="";
}else{
if(error=="unknownsurvey"){
dojo.byId("error_msg").innerHTML="We can't seem to find the survey. Maybe you provided a wrong survey token? Please check your email and make sure all data are filled in correctly.";
dojo.byId("alert_error").style.display="";
}else{
if(error=="notuniquekey"){
dojo.byId("error_msg").innerHTML="You have used this password already for another survey. Please choose a different one.";
dojo.byId("alert_error").style.display="";
}else{
if(error=="notuniquekeypartner"){
dojo.byId("error_msg").innerHTML="Your partner has used this password already in a different survey. Please choose a different one.";
dojo.byId("alert_error").style.display="";
}else{
if(error.length>0){
dojo.byId("error_msg").innerHTML="We don't exactly know why an error happened. Please just try again or send us a message if it happens more often.";
dojo.byId("alert_error").style.display="";
}
}
}
}
}
}
}
}
var _4={url:"/FANTASY/Alert/Has/",method:"POST",type:"text/json",load:function(_5,_6){
eval("var decoded_data = "+_6);
if(decoded_data.RESPONSE_TYPE=="SUCCESS"){
survey_id=decoded_data.RESPONSE.ID;
survey_token=decoded_data.RESPONSE.TOKEN;
survey_closed=decoded_data.RESPONSE.CLOSED;
fantasy.client.toggleSurveyStatus(survey_id,survey_token,survey_closed);
}
}};
dojo.io.bind(_4);
fantasy.client.howToInit();
};
fantasy.client.initSurvey=function(){
dojo.lfx.html.fadeHide(dojo.byId("container_mini"),0,0,function(){
dojo.html.removeClass(dojo.byId("container_mini"),"hidden");
}).play();
dojo.lfx.html.fadeHide(dojo.byId("content"),0,0,function(){
dojo.html.removeClass(dojo.byId("content"),"hidden");
}).play();
dojo.event.connect(dojo.byId("square_one"),"onclick",function(_7){
fantasy.client.minimizeSelect("1");
});
dojo.event.connect(dojo.byId("square_two"),"onclick",function(_8){
fantasy.client.minimizeSelect("4");
});
dojo.event.connect(dojo.byId("square_three"),"onclick",function(_9){
fantasy.client.minimizeSelect("2");
});
dojo.event.connect(dojo.byId("square_four"),"onclick",function(_a){
fantasy.client.minimizeSelect("3");
});
dojo.event.connect(dojo.byId("square_one_mini"),"onclick",function(_b){
fantasy.client.maximizeSelect("1");
});
dojo.event.connect(dojo.byId("square_two_mini"),"onclick",function(_c){
fantasy.client.maximizeSelect("4");
});
dojo.event.connect(dojo.byId("square_three_mini"),"onclick",function(_d){
fantasy.client.maximizeSelect("2");
});
dojo.event.connect(dojo.byId("square_four_mini"),"onclick",function(_e){
fantasy.client.maximizeSelect("3");
});
dojo.event.connect(dojo.byId("topic_scroller_button_up"),"onclick",function(){
fantasy.client.scrollerScrollUp("topic");
});
dojo.event.connect(dojo.byId("topic_scroller_button_down"),"onclick",function(){
fantasy.client.scrollerScrollDown("topic");
});
dojo.event.connect(dojo.byId("questions_scroller_button_up"),"onclick",function(){
fantasy.client.scrollerScrollUp("questions");
});
dojo.event.connect(dojo.byId("questions_scroller_button_down"),"onclick",function(){
fantasy.client.scrollerScrollDown("questions");
});
dojo.event.connect(dojo.byId("overview_scroller_button_up"),"onclick",function(){
fantasy.client.scrollerScrollUp("overview");
});
dojo.event.connect(dojo.byId("overview_scroller_button_down"),"onclick",function(){
fantasy.client.scrollerScrollDown("overview");
});
};
fantasy.client.initResults=function(){
bindArgs={url:"/FANTASY/Alert/Result/"+dojo.byId("result_token").value,method:"POST",type:"text/json",load:function(_f,_10){
eval("var decoded_data = "+_10);
if(decoded_data.RESPONSE_TYPE=="SUCCESS"){
fantasy.client.results=decoded_data.RESPONSE;
fantasy.client.fillResult(fantasy.client.results);
fantasy.client.loadResultAdvice("");
}else{
if(decoded_data.RESPONSE_TYPE=="ERROR"){
alert("Acess denied!");
}
}
}};
bindArgs.content={password:dojo.byId("result_password").value,email:dojo.byId("result_email").value};
dojo.io.bind(bindArgs);
};
fantasy.client.initDirectory=function(){
};
fantasy.client.renderScrollStatus=function(_11){
fantasy.client.current_scrollview.topic=1;
fantasy.client.current_scrollview.questions=1;
fantasy.client.current_scrollview.overview=1;
while(dojo.byId(_11+"_scroller_status").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId(_11+"_scroller_status").firstChild);
}
count=dojo.byId(_11+"_scroll_container").childNodes.length;
if(count==1){
dojo.html.setDisplay(dojo.byId(_11+"_scroller_status_container"),"none");
dojo.html.setDisplay(dojo.byId(_11+"_scroller_button_up"),"none");
dojo.html.setDisplay(dojo.byId(_11+"_scroller_button_down"),"none");
return;
}
dojo.html.setDisplay(dojo.byId(_11+"_scroller_status_container"),"");
dojo.html.setDisplay(dojo.byId(_11+"_scroller_button_up"),"");
dojo.html.setDisplay(dojo.byId(_11+"_scroller_button_down"),"");
height=(422/2)-((count*11)/2);
dojo.byId(_11+"_scroller_status").style.top=height+"px";
for(var i=1;i<=count;i++){
if(i==1){
color="#ad2c31";
}else{
color="#490202";
}
statusElement=document.createElement("div");
statusElement.innerHTML="";
dojo.html.setStyle(statusElement,"position","relative");
dojo.html.setStyle(statusElement,"top","-50%");
dojo.html.setStyle(statusElement,"width","10px");
dojo.html.setStyle(statusElement,"height","9px");
dojo.html.setStyle(statusElement,"background-color",color);
dojo.html.setStyle(statusElement,"margin-bottom","2px");
dojo.html.setStyle(statusElement,"font-size","1px");
statusElement.setAttribute("id",_11+"_scroller_status_"+i);
dojo.byId(_11+"_scroller_status").appendChild(statusElement);
dojo.byId(_11+"_scroller_status_"+i).i=i;
dojo.event.connect(dojo.byId(_11+"_scroller_status_"+i),"onclick",dojo.lang.hitch(dojo.byId(_11+"_scroller_status_"+i),function(e){
fantasy.client.skipScroller(this.i,_11);
}));
}
};
fantasy.client.skipScroller=function(_14,_15){
if(fantasy.client.current_scrollview[_15]<_14){
for(i=fantasy.client.current_scrollview[_15];i<_14;i++){
fantasy.client.scrollerScrollDown(_15);
}
}else{
if(fantasy.client.current_scrollview[_15]>_14){
for(i=fantasy.client.current_scrollview[_15];i>_14;i--){
fantasy.client.scrollerScrollUp(_15);
}
}
}
};
fantasy.client.updateScrollview=function(_16){
count=dojo.byId(_16+"_scroll_container").childNodes.length;
for(var i=1;i<=count;i++){
if(i==fantasy.client.current_scrollview[_16]){
color="#ad2c31";
}else{
color="#490202";
}
dojo.byId(_16+"_scroller_status_"+i).style.backgroundColor=color;
}
};
fantasy.client.scrollerScrollUp=function(_18){
fantasy.client.scrollerView=fantasy.client.current_scrollview[_18];
if(fantasy.client.current_scrollview[_18]==1){
fantasy.client.current_scrollview[_18]=dojo.byId(_18+"_scroll_container").childNodes.length;
fantasy.client.nextView=fantasy.client.current_scrollview[_18];
}else{
fantasy.client.current_scrollview[_18]--;
fantasy.client.nextView=fantasy.client.current_scrollview[_18];
}
for(var i=1;i<=dojo.byId(_18+"_scroll_container").childNodes.length;i++){
if(i!=fantasy.client.nextView&&i!=fantasy.client.scrollerView){
dojo.byId(_18+"_view_"+i).style.visibility="hidden";
}
dojo.byId(_18+"_view_"+fantasy.client.nextView).style.top=-fantasy.client.topics_container_height+"px";
dojo.byId(_18+"_view_"+fantasy.client.nextView).style.visibility="";
dojo.byId(_18+"_view_"+fantasy.client.scrollerView).style.top=0+"px";
dojo.byId(_18+"_view_"+fantasy.client.scrollerView).style.visibility="";
}
dojo.lfx.combine(dojo.lfx.html.slideBy(dojo.byId(_18+"_view_"+fantasy.client.nextView),{top:fantasy.client.topics_container_height,left:0},200,200),dojo.lfx.html.slideBy(dojo.byId(_18+"_view_"+fantasy.client.scrollerView),{top:fantasy.client.topics_container_height,left:0},200,200)).play(10);
fantasy.client.updateScrollview(_18);
};
fantasy.client.scrollerScrollDown=function(_1a){
fantasy.client.scrollerView=fantasy.client.current_scrollview[_1a];
if(fantasy.client.current_scrollview[_1a]==dojo.byId(_1a+"_scroll_container").childNodes.length){
fantasy.client.current_scrollview[_1a]=1;
fantasy.client.nextView=fantasy.client.current_scrollview[_1a];
}else{
fantasy.client.current_scrollview[_1a]++;
fantasy.client.nextView=fantasy.client.current_scrollview[_1a];
}
for(var i=1;i<=dojo.byId(_1a+"_scroll_container").childNodes.length;i++){
if(i!=fantasy.client.nextView&&i!=fantasy.client.scrollerView){
dojo.byId(_1a+"_view_"+i).style.visibility="hidden";
}
dojo.byId(_1a+"_view_"+fantasy.client.nextView).style.top=fantasy.client.topics_container_height+"px";
dojo.byId(_1a+"_view_"+fantasy.client.nextView).style.visibility="";
dojo.byId(_1a+"_view_"+fantasy.client.scrollerView).style.top=0+"px";
dojo.byId(_1a+"_view_"+fantasy.client.scrollerView).style.visibility="";
}
dojo.lfx.combine(dojo.lfx.html.slideBy(dojo.byId(_1a+"_view_"+fantasy.client.nextView),{top:-fantasy.client.topics_container_height,left:0},200,200),dojo.lfx.html.slideBy(dojo.byId(_1a+"_view_"+fantasy.client.scrollerView),{top:-fantasy.client.topics_container_height,left:0},200,200)).play(10);
fantasy.client.updateScrollview(_1a);
};
fantasy.client.loadSurveyData=function(_1c,_1d){
var i=0;
while(dojo.byId("questions_scroll_container").hasChildNodes()){
if(!fantasy.client.questionNodes[fantasy.client.currentCategory]){
fantasy.client.questionNodes[fantasy.client.currentCategory]=[];
}
fantasy.client.questionNodes[fantasy.client.currentCategory][i]=dojo.byId("questions_scroll_container").removeChild(dojo.byId("questions_scroll_container").firstChild);
i++;
}
fantasy.client.currentCategory=_1c;
if(fantasy.client.cache[_1c]&&fantasy.client.topics){
fantasy.client.topics=fantasy.client.cache[_1c].categories;
fantasy.client.questions=fantasy.client.cache[_1c].questions;
fantasy.client.currentLevel=fantasy.client.topics.level;
if(!fantasy.client.activeTopics[fantasy.client.currentLevel]){
fantasy.client.activeTopics[fantasy.client.currentLevel]=[];
}
fantasy.client.activeTopics[fantasy.client.currentLevel].name=fantasy.client.topics.detail.name;
fantasy.client.activeTopics[fantasy.client.currentLevel].id=fantasy.client.topics.detail.id;
if(fantasy.client.topics.children.length>0){
fantasy.client.renderedTopics=[];
fantasy.client.renderTopics();
fantasy.client.renderScrollStatus("topic");
}else{
if(_1d!==true){
fantasy.client.updateActive(_1c);
}
}
fantasy.client.renderQuestions();
fantasy.client.renderScrollStatus("questions");
}else{
fantasy.client.cache[_1c]=[];
bindArgs={url:"/FANTASY/AjaxData/Get/?type=Questions&category="+_1c,method:"POST",type:"text/json",load:function(_1f,_20){
eval("var decoded_data = "+_20);
fantasy.client.cache[_1c].questions=decoded_data;
fantasy.client.questions=fantasy.client.cache[_1c].questions;
fantasy.client.renderQuestions();
fantasy.client.renderScrollStatus("questions");
}};
dojo.io.bind(bindArgs);
bindArgs={url:"/FANTASY/AjaxData/Get/?type=Categories&mode=js&node="+_1c,method:"POST",type:"text/json",load:function(_21,_22){
eval("var decoded_data = "+_22);
fantasy.client.cache[_1c].categories=decoded_data;
fantasy.client.topics=decoded_data;
fantasy.client.currentLevel=fantasy.client.topics.level;
if(!fantasy.client.activeTopics[fantasy.client.currentLevel]){
fantasy.client.activeTopics[fantasy.client.currentLevel]=[];
}
fantasy.client.activeTopics[fantasy.client.currentLevel].name=fantasy.client.topics.detail.name;
fantasy.client.activeTopics[fantasy.client.currentLevel].id=fantasy.client.topics.detail.id;
if(fantasy.client.topics.children.length>0){
fantasy.client.renderedTopics=[];
fantasy.client.renderTopics();
fantasy.client.renderScrollStatus("topic");
}else{
if(_1d!==true){
fantasy.client.updateActive(_1c);
}
}
}};
dojo.io.bind(bindArgs);
}
};
fantasy.client.renderQuestions=function(){
super_container=dojo.byId("questions_scroll_container");
if(fantasy.client.questionNodes[fantasy.client.currentCategory]&&fantasy.client.questionNodes[fantasy.client.currentCategory].length>0){
for(i=0;i<fantasy.client.questionNodes[fantasy.client.currentCategory].length;i++){
super_container.appendChild(fantasy.client.questionNodes[fantasy.client.currentCategory][i]);
}
return;
}
question_height=0;
view=1;
element_container=document.createElement("div");
element_container.style.height=fantasy.client.questions_container_height+"px";
element_container.style.width=fantasy.client.questions_container_width+"px";
element_container.setAttribute("id","questions_view_"+view);
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
if(fantasy.client.questions.length==0){
question_container=contentContainer=fantasy.client.createRounded("rounded_medium","no_questions");
element_container.appendChild(question_container);
dojo.byId("no_questions").innerHTML="Click on the buttons to the left to see the questions related to each topic. <p>If you want to go back to the four main topics 'Fetish, S&M, Role Play and Sexual Behaviour', click on the little squares above or on the 'Overview' button below.</p>";
}else{
for(var i in fantasy.client.questions){
q_one=null;
q_two=null;
q_three=null;
height=0;
question_container=null;
if(fantasy.client.questions[i].question_one_id!==null){
q_one=document.createElement("tr");
dojo.html.setClass(q_one,"question_content");
contentCol=document.createElement("td");
dojo.html.setClass(contentCol,"question_content_text");
contentCol.innerHTML=fantasy.client.questions[i].question_one;
checkbox_container=document.createElement("td");
checkbox_container.setAttribute("valign","top");
dojo.html.setClass(checkbox_container,"question_content_checkbox");
var _24=dojo.widget.createWidget("Checkbox",{id:"question_one_"+i,value:"question_one_"+i,templateCssString:null,templateCssPath:"/css/Checkbox.css"});
callback=fantasy.client.setMatch("question_one_"+i);
_24.onClick=callback;
checkbox_container.appendChild(_24.domNode);
q_one.appendChild(checkbox_container);
q_one.appendChild(contentCol);
}
if(fantasy.client.questions[i].question_two_id!==null){
q_two=document.createElement("tr");
dojo.html.setClass(q_two,"question_content");
contentCol=document.createElement("td");
dojo.html.setClass(contentCol,"question_content_text");
contentCol.innerHTML=fantasy.client.questions[i].question_two;
checkbox_container=document.createElement("td");
checkbox_container.setAttribute("valign","top");
dojo.html.setClass(checkbox_container,"question_content_checkbox");
var _25=dojo.widget.createWidget("Checkbox",{id:"question_two_"+i,value:"question_two_"+i,templateCssString:null,templateCssPath:"/css/Checkbox.css"});
callback=fantasy.client.setMatch("question_two_"+i);
_25.onClick=callback;
checkbox_container.appendChild(_25.domNode);
q_two.appendChild(checkbox_container);
q_two.appendChild(contentCol);
}
if(fantasy.client.questions[i].question_three_id!==null){
q_three=document.createElement("tr");
dojo.html.setClass(q_three,"question_content");
contentCol=document.createElement("td");
dojo.html.setClass(contentCol,"question_content_text");
contentCol.innerHTML=fantasy.client.questions[i].question_three;
checkbox_container=document.createElement("td");
checkbox_container.setAttribute("valign","top");
dojo.html.setClass(checkbox_container,"question_content_checkbox");
var _26=dojo.widget.createWidget("Checkbox",{id:"question_three_"+i,value:"question_three_"+i,templateCssString:null,templateCssPath:"/css/Checkbox.css"});
callback=fantasy.client.setMatch("question_three_"+i);
_26.onClick=callback;
checkbox_container.appendChild(_26.domNode);
q_three.appendChild(checkbox_container);
q_three.appendChild(contentCol);
}
if(q_one||q_two||q_three){
top_border=document.createElement("div");
dojo.html.setClass(top_border,"question_border_top");
question_table=document.createElement("table");
tablebody=document.createElement("tbody");
tablehead=document.createElement("thead");
tablefoot=document.createElement("tfoot");
if(q_one){
tablebody.appendChild(q_one);
}
if(q_two){
tablebody.appendChild(q_two);
}
if(q_three){
tablebody.appendChild(q_three);
}
question_table.appendChild(tablehead);
question_table.appendChild(tablefoot);
question_table.appendChild(tablebody);
question_container=document.createElement("div");
dojo.html.setClass(question_container,"question_container");
question_container.appendChild(top_border);
question_container.appendChild(question_table);
bottom_border=document.createElement("div");
dojo.html.setClass(bottom_border,"question_border_bottom");
question_container.appendChild(bottom_border);
}
if(question_container){
tmp_container=question_container.cloneNode(true);
dojo.byId("get_height").style.width=fantasy.client.questions_container_width+"px";
dojo.byId("get_height").appendChild(tmp_container);
obj_height=dojo.html.getMarginBox(dojo.byId("get_height"));
while(dojo.byId("get_height").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("get_height").firstChild);
}
height=obj_height.height;
question_height=question_height+height;
if(question_height<=fantasy.client.questions_container_height){
element_container.appendChild(question_container);
}else{
question_height=height;
view++;
element_container=document.createElement("div");
element_container.style.height=fantasy.client.questions_container_height+"px";
element_container.style.visibility="hidden";
element_container.style.height=fantasy.client.questions_container_height+"px";
element_container.style.width=fantasy.client.questions_container_width+"px";
element_container.setAttribute("id","questions_view_"+view);
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
element_container.appendChild(question_container);
}
}
}
}
};
fantasy.client.setMatch=function(id){
return function(){
if(fantasy.client.selectedMatches[id]){
fantasy.client.questionCounter--;
delete fantasy.client.selectedMatches[id];
}else{
fantasy.client.questionCounter++;
array=id.split("_");
arr_id=array[2];
key=array[0]+"_"+array[1];
fantasy.client.selectedMatches[id]=fantasy.client.questions[arr_id][key];
}
};
};
fantasy.client.updateActive=function(_28){
for(var i in fantasy.client.renderedTopics){
topicId=i;
if(_28==topicId){
dojo.html.setClass(dojo.byId("topic_link_"+topicId),"topic_act");
}else{
dojo.html.setClass(dojo.byId("topic_link_"+topicId),"topic_inact");
}
}
};
fantasy.client.renderTopics=function(){
super_container=dojo.byId("topic_scroll_container");
while(dojo.byId("topic_scroll_container").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("topic_scroll_container").firstChild);
}
while(dojo.byId("topic_scroll_header").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("topic_scroll_header").firstChild);
}
element_space=fantasy.client.max_elements-fantasy.client.currentLevel;
for(var i=0;i<fantasy.client.currentLevel;i++){
j=i+1;
field=document.createElement("div");
field.style.height=fantasy.client.element_height+"px";
field.style.backgroundColor="";
contentLink=document.createElement("a");
contentLink.innerHTML=fantasy.client.activeTopics[j].name;
dojo.html.setClass(contentLink,"header_text");
dojo.html.addClass(contentLink,"topic_header");
field.appendChild(contentLink);
field.setAttribute("onclick","fantasy.client.loadSurveyData("+fantasy.client.activeTopics[j].id+", true)");
field.setAttribute("id","header_"+fantasy.client.activeTopics[j].id);
dojo.byId("topic_scroll_header").appendChild(field);
}
view=1;
element_container=document.createElement("div");
element_container.style.height=fantasy.client.topics_container_height+"px";
element_container.style.width=fantasy.client.topics_container_width+"px";
element_container.setAttribute("id","topic_view_"+view);
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
for(var x=0;x<fantasy.client.currentLevel;x++){
field=document.createElement("div");
field.style.height=fantasy.client.element_height+"px";
element_container.appendChild(field);
}
for(i=1;i<=fantasy.client.topics.children.length;i++){
j=i-1;
topicId=fantasy.client.topics.children[j].id;
fantasy.client.renderedTopics[topicId]=true;
field=document.createElement("div");
field.style.height=fantasy.client.element_height+"px";
contentLink=document.createElement("a");
contentLink.innerHTML=fantasy.client.topics.children[j].name;
contentLink.setAttribute("id","topic_link_"+topicId);
dojo.html.setClass(contentLink,"topic_text");
field.appendChild(contentLink);
field.setAttribute("id","topic_"+topicId);
var _2c=fantasy.client.setTopic(topicId);
dojo.event.connect(field,"onclick",_2c);
dojo.html.setClass(field,"topic_inact");
element_container.appendChild(field);
if(i%element_space===0){
view++;
element_container=document.createElement("div");
element_container.style.height=fantasy.client.topics_container_height+"px";
element_container.setAttribute("id","topic_view_"+view);
element_container.style.visibility="hidden";
element_container.style.height=fantasy.client.topics_container_height+"px";
element_container.style.width=fantasy.client.topics_container_width+"px";
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
for(x=0;x<fantasy.client.currentLevel;x++){
field=document.createElement("div");
field.style.height=fantasy.client.element_height+"px";
element_container.appendChild(field);
}
}
}
if(fantasy.client.topics.length%element_space!==0){
super_container.appendChild(element_container);
}
};
fantasy.client.setTopic=function(_2d){
return function(evt){
fantasy.client.loadSurveyData(_2d,false);
};
};
renderTopicHeaders=function(){
};
fantasy.client.startCurrentPage="new_one";
fantasy.client.enterQuestionnaire=function(_2f,_30){
if(_2f=="new_init"){
dojo.byId("start_init").style.display="";
dojo.byId("start_partner").style.display="none";
fantasy.client.startCurrentPage="new_one";
}else{
if(_2f=="new_one"||fantasy.client.startCurrentPage=="new_one"){
if(dojo.byId("name").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("name"),true);
box=dojo.html.getBorderBox(dojo.byId("name"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter a name. <br /><br />Use a name your partner knows so when he/her gets the invitation email it is clear who you are.";
dojo.byId("helping_dialog").style.display="";
return false;
}
if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(dojo.byId("email").value)){
position=dojo.html.getAbsolutePosition(dojo.byId("email"),true);
box=dojo.html.getBorderBox(dojo.byId("email"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter an email<br /><br />We don't give your data away to third parties! The email is required so only you can access the fantasy survey.<br />If you are worried that we save your data just use one of the public free email services.";
dojo.byId("helping_dialog").style.display="";
return;
}
dojo.byId("start_init").style.display="none";
dojo.byId("start_partner").style.display="";
dojo.byId("name_partner").focus();
dojo.byId("start_password").style.display="none";
fantasy.client.startCurrentPage="new_two";
}else{
if(_2f=="new_two"||fantasy.client.startCurrentPage=="new_two"){
dojo.byId("start_partner").style.display="";
dojo.byId("start_password").style.display="none";
if(dojo.byId("name_partner").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("name_partner"),true);
box=dojo.html.getBorderBox(dojo.byId("name_partner"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter your partners name. <br />";
dojo.byId("helping_dialog").style.display="";
return;
}
if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(dojo.byId("email_partner").value)){
position=dojo.html.getAbsolutePosition(dojo.byId("email_partner"),true);
box=dojo.html.getBorderBox(dojo.byId("email_partner"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter an email<br /><br />We don't give your data away to third parties! The email is required so only you can access the fantasy survey.<br />If you are worried that we save your data just use one of the public free email services.";
dojo.byId("helping_dialog").style.display="";
return;
}
if(dojo.byId("email_partner").value==dojo.byId("email").value){
position=dojo.html.getAbsolutePosition(dojo.byId("email_partner"),true);
box=dojo.html.getBorderBox(dojo.byId("email_partner"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter a different email<br /><br />Your partners email can't be the same as your email.";
dojo.byId("helping_dialog").style.display="";
return;
}
dojo.byId("start_partner").style.display="none";
dojo.byId("start_password").style.display="";
dojo.byId("password").focus();
fantasy.client.startCurrentPage="new_three";
}else{
if(_2f=="new_three"||fantasy.client.startCurrentPage=="new_three"){
if(dojo.byId("password").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("password"),true);
box=dojo.html.getBorderBox(dojo.byId("password"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please provide a password.";
dojo.byId("helping_dialog").style.display="";
return (true);
}
dojo.byId("helping_dialog").style.display="none";
_30.submit();
dojo.byId("start_password").style.display="none";
dojo.byId("alert_loading").style.display="";
}
}
}
}
dojo.byId("helping_dialog").style.display="none";
};
fantasy.client.joinQuestionnaire=function(_31){
dojo.byId("helping_dialog").style.display="none";
if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(dojo.byId("join_email").value)){
position=dojo.html.getAbsolutePosition(dojo.byId("join_email"),true);
box=dojo.html.getBorderBox(dojo.byId("join_email"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter your email.";
dojo.byId("helping_dialog").style.display="";
return;
}
if(dojo.byId("join_password").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("join_password"),true);
box=dojo.html.getBorderBox(dojo.byId("join_password"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please the survey passsword";
dojo.byId("helping_dialog").style.display="";
return;
}
_31.submit();
dojo.byId("alert_existing").style.display="none";
dojo.byId("alert_loading").style.display="";
dojo.byId("helping_dialog").style.display="none";
};
fantasy.client.toggleSurveyJoin=function(_32){
dojo.byId("helping_dialog").style.display="none";
dojo.byId("alert_start").style.display="";
dojo.byId("alert_loading").style.display="none";
dojo.html.setClass(dojo.byId("survey-link-start"),"rounded-tab-li");
dojo.html.setClass(dojo.byId("survey-link-join"),"rounded-tab-li");
dojo.html.setClass(dojo.byId("survey-link-result"),"rounded-tab-li");
if(_32=="new"){
dojo.html.addClass(dojo.byId("survey-link-start"),"tab-act");
dojo.html.addClass(dojo.byId("survey-link-join"),"tab-inact");
dojo.html.addClass(dojo.byId("survey-link-result"),"tab-inact");
dojo.byId("alert_existing").style.display="none";
dojo.byId("alert_new").style.display="";
dojo.byId("alert_result").style.display="none";
}else{
if(_32=="result"){
dojo.html.addClass(dojo.byId("survey-link-start"),"tab-inact");
dojo.html.addClass(dojo.byId("survey-link-join"),"tab-inact");
dojo.html.addClass(dojo.byId("survey-link-result"),"tab-act");
dojo.byId("alert_existing").style.display="none";
dojo.byId("alert_new").style.display="none";
dojo.byId("alert_result").style.display="";
}else{
dojo.html.addClass(dojo.byId("survey-link-start"),"tab-inact");
dojo.html.addClass(dojo.byId("survey-link-join"),"tab-act");
dojo.html.addClass(dojo.byId("survey-link-result"),"tab-inact");
dojo.byId("alert_existing").style.display="";
dojo.byId("alert_new").style.display="none";
dojo.byId("alert_result").style.display="none";
}
}
};
fantasy.client.menuContent=[];
fantasy.client.menuContent["content_about"]=1;
fantasy.client.menuContent["content_home"]=1;
fantasy.client.menuContent["content_privacy"]=1;
fantasy.client.menuContent["content_howitworks"]=1;
fantasy.client.triggerContent=function(_33){
dojo.byId("helping_dialog").style.display="none";
for(key in fantasy.client.menuContent){
dojo.html.setClass(dojo.byId("li-"+key),"rounded-tab-li");
if(key==_33){
dojo.html.addClass(dojo.byId("li-"+key),"tab-act");
dojo.byId(key).style.display="";
}else{
dojo.html.addClass(dojo.byId("li-"+key),"tab-inact");
dojo.byId(key).style.display="none";
}
}
};
fantasy.client.sending=0;
fantasy.client.contactForm=function(){
if(fantasy.client.sending==0){
fantasy.client.sending=1;
}else{
alert("Still sending emails!");
return;
}
sender_email=dojo.byId("sender_email").value;
sender=dojo.byId("sender").value;
message=dojo.byId("friend_message").value;
if(sender_email.length==0||sender.length==0||message.length==0){
alert("Please fill in all the fields!");
fantasy.client.sending=0;
return;
}
var _34={url:"/FANTASY/Messenger/Send/",method:"POST",type:"text/json",load:function(_35,_36){
eval("var decoded_data = "+_36);
fantasy.client.sending=0;
alert("Thank you for contacting us!");
dojo.byId("sender").value="";
dojo.byId("sender_email").value="";
dojo.byId("friend_message").value="";
},content:{message:message,sender:sender,sender_email:sender_email}};
dojo.io.bind(_34);
};
fantasy.client.sending=0;
fantasy.client.suggestSite=function(){
if(fantasy.client.sending==0){
fantasy.client.sending=1;
}else{
alert("Still sending emails!");
return;
}
sender_email=dojo.byId("sender_email").value;
sender=dojo.byId("sender").value;
site_title=dojo.byId("sender_sitetitle").value;
site_url=dojo.byId("sender_siteurl").value;
site_bannerurl=dojo.byId("sender_bannerurl").value;
site_recurl=dojo.byId("sender_recurl").value;
message=dojo.byId("friend_message").value;
var _37="NEW WEBSITE: "+site_title+"\nSENDER: "+sender+"\nSENDER EMAIL: "+sender_email+"\nURL: "+site_url+"\nBANNER: "+site_bannerurl+"\nRECIPROCAL LINK: "+site_recurl+"\nMESSAGE:\n"+message;
if(sender_email.length==0||sender.length==0||message.length==0||site_title.length==0||site_url.length==0){
alert("Please fill in all the fields!");
fantasy.client.sending=0;
return;
}
var _38={url:"/FANTASY/Messenger/Send/",method:"POST",type:"text/json",load:function(_39,_3a){
eval("var decoded_data = "+_3a);
fantasy.client.sending=0;
alert("Thank you for submitting your website! After we have reviewed your website we will contact you.");
dojo.byId("sender").value="";
dojo.byId("sender_email").value="";
dojo.byId("friend_message").value="";
dojo.byId("sender_sitetitle").value="";
dojo.byId("sender_siteurl").value="";
dojo.byId("sender_bannerurl").value="";
dojo.byId("sender_recurl").value="";
},content:{message:_37,sender:sender,sender_email:sender_email}};
dojo.io.bind(_38);
};
fantasy.client.toggleSurveyStatus=function(_3b,_3c,_3d){
dojo.byId("helping_dialog").style.display="none";
if(_3d=="0"){
fantasy.client.toggleInOpenSurvey(_3b,_3c);
}else{
fantasy.client.toggleInClosedSurvey();
}
};
fantasy.client.toggleInOpenSurvey=function(id,_3f){
dojo.byId("close_error").style.display="none";
dojo.byId("error_msg").innerHTML="You started a survey but didn't close it. Please close it first to continue!<br /><br /><a href=\"/Fantasy/Survey/Join/\" class=\"notice_txt\"  >Click here to continue the alert</a>";
dojo.byId("alert_error").style.display="";
};
fantasy.client.toggleInClosedSurvey=function(){
dojo.byId("close_error").style.display="none";
dojo.byId("error_msg").innerHTML="You are currently in a survey and this survey has to be filled in by your partner first.<br /><br /><a href=\"javascript: void(0);\" onclick=\"fantasy.client.toggleSurveyJoin('join');\" class=\"notice_txt\">Click here to continue an open survey</a>";
dojo.byId("alert_error").style.display="";
};
fantasy.client.startAlert=function(){
dojo.byId("notice_content").innerHTML="";
dojo.byId("helping_dialog").style.display="none";
dojo.byId("fantasy_questions").style.display="";
dojo.byId("fantasy_questions_overview").style.display="none";
};
fantasy.client.togglePage=function(_40){
dojo.byId("helping_dialog").style.display="none";
if(_40=="result"){
dojo.byId("fantasy_questions").style.display="none";
dojo.byId("fantasy_questions_overview").style.display="none";
dojo.byId("fantasy_questions_final").style.display="none";
}else{
if(_40=="alert_overview"){
if(fantasy.client.questionCounter<5){
alert("Please select at least 5 fantasies you can imagine sharing with your partner. Otherwise the chance for a match will be extremely low.");
return;
}
fantasy.client.renderQuestionOverview();
fantasy.client.renderScrollStatus("overview");
dojo.byId("fantasy_questions").style.display="none";
dojo.byId("fantasy_questions_overview").style.display="";
dojo.byId("fantasy_questions_final").style.display="none";
}else{
if(_40=="alert_final"){
dojo.byId("fantasy_questions").style.display="none";
dojo.byId("fantasy_questions_overview").style.display="none";
dojo.byId("fantasy_questions_final").style.display="";
}
}
}
};
fantasy.client.renderQuestionOverview=function(){
super_container=dojo.byId("overview_scroll_container");
while(super_container.hasChildNodes()){
dojo.dom.destroyNode(super_container.firstChild);
}
question_height=0;
view=1;
element_container=document.createElement("div");
if(dojo.widget.byId("overview_overview_"+view)){
dojo.widget.byId("overview_overview_"+view).destroy();
}
element_container.style.height=fantasy.client.questionsoverview_container_height+"px";
element_container.style.width=fantasy.client.questionsoverview_container_width+"px";
element_container.setAttribute("id","overview_view_"+view);
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
for(var i in fantasy.client.selectedMatches){
array=i.split("_");
id=array[2];
key=array[0]+"_"+array[1];
result=document.createElement("tr");
dojo.html.setClass(result,"question_content");
contentCol=document.createElement("td");
dojo.html.setClass(contentCol,"questionoverview_content_text");
contentCol.innerHTML=fantasy.client.selectedMatches[i];
result.appendChild(contentCol);
question_container=document.createElement("div");
dojo.html.setClass(question_container,"question_container");
top_border=document.createElement("div");
dojo.html.setClass(top_border,"question_border_top");
question_table=document.createElement("table");
tablebody=document.createElement("tbody");
tablehead=document.createElement("thead");
tablefoot=document.createElement("tfoot");
tablebody.appendChild(result);
question_table.appendChild(tablehead);
question_table.appendChild(tablefoot);
question_table.appendChild(tablebody);
question_container.appendChild(top_border);
question_container.appendChild(question_table);
bottom_border=document.createElement("div");
dojo.html.setClass(bottom_border,"question_border_bottom");
question_container.appendChild(bottom_border);
question_clone=question_container.cloneNode(true);
dojo.byId("get_height").style.width=fantasy.client.questionsoverview_container_width+"px";
dojo.byId("get_height").appendChild(question_clone);
obj_height=dojo.html.getMarginBox(dojo.byId("get_height"));
while(dojo.byId("get_height").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("get_height").firstChild);
}
height=obj_height.height;
question_height=question_height+height;
if(question_height<=fantasy.client.questionsoverview_container_height){
element_container.appendChild(question_container);
}else{
question_height=height;
view++;
element_container=document.createElement("div");
if(dojo.widget.byId("overview_overview_"+view)){
dojo.widget.byId("overview_overview_"+view).destroy();
}
element_container.style.height=fantasy.client.questionsoverview_container_height+"px";
element_container.style.visibility="hidden";
element_container.style.height=fantasy.client.questionsoverview_container_height+"px";
element_container.style.width=fantasy.client.questionsoverview_container_width+"px";
element_container.setAttribute("id","overview_view_"+view);
dojo.html.setClass(element_container,"scroller_view");
super_container.appendChild(element_container);
element_container.appendChild(question_container);
}
}
};
fantasy.client.isSendingAlert=0;
fantasy.client.submitAlert=function(){
if(fantasy.client.isSendingAlert==1){
alert("You are still submitting the current alert! Please be patient.");
return;
}
if(fantasy.client.questionCounter<5){
alert("Please select at least 5 fantasies you can imagine sharing with your partner. Otherwise the chance for a match will be extremely low.");
return;
}
contentMatches=[];
for(var i in fantasy.client.selectedMatches){
contentMatches[i]="checked";
}
fantasy.client.isSendingAlert=1;
var _43={url:"/FANTASY/Alert/Submit/",method:"POST",type:"text/json",load:function(_44,_45){
eval("var decoded_data = "+_45);
fantasy.client.isSendingAlert=0;
if(decoded_data.RESPONSE_TYPE=="SUCCESS"){
fantasy.client.togglePage("alert_final");
}else{
if(decoded_data.RESPONSE_TYPE=="ERROR"){
alert("Oooops! There was an error!");
}
}
}};
_43.content=contentMatches;
dojo.io.bind(_43);
};
fantasy.client.viewResult=function(_46){
dojo.byId("helping_dialog").style.display="none";
if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(dojo.byId("result_email").value)){
position=dojo.html.getAbsolutePosition(dojo.byId("result_email"),true);
box=dojo.html.getBorderBox(dojo.byId("result_email"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter your email.";
dojo.byId("helping_dialog").style.display="";
return;
}
if(dojo.byId("result_password").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("result_password"),true);
box=dojo.html.getBorderBox(dojo.byId("result_password"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please the survey passsword";
dojo.byId("helping_dialog").style.display="";
return;
}
if(dojo.byId("result_token").value.length===0){
position=dojo.html.getAbsolutePosition(dojo.byId("result_token"),true);
box=dojo.html.getBorderBox(dojo.byId("result_token"));
xPos=position.left+box.width+15;
yPos=position.top-5;
dojo.byId("helping_dialog").style.top=yPos+"px";
dojo.byId("helping_dialog").style.left=xPos+"px";
dojo.byId("notice_content").innerHTML="Please enter the survey token";
dojo.byId("helping_dialog").style.display="";
return;
}
dojo.byId("alert_result").style.display="none";
dojo.byId("alert_loading").style.display="";
_46.submit();
};
fantasy.client.fillResult=function(_47){
var i=1;
for(member in _47.members){
dojo.byId("user_"+i).innerHTML=_47.members[member];
i++;
}
if(_47.percentage[1]){
dojo.byId("square_one_result_content").innerHTML=_47.percentage[1]+"%";
}
if(_47.percentage[2]){
dojo.byId("square_three_result_content").innerHTML=_47.percentage[2]+"%";
}
if(_47.percentage[3]){
dojo.byId("square_four_result_content").innerHTML=_47.percentage[3]+"%";
}
if(_47.percentage[4]){
dojo.byId("square_two_result_content").innerHTML=_47.percentage[4]+"%";
}
};
fantasy.client.createRounded=function(_49,_4a){
roundedContainer=document.createElement("div");
dojo.html.setClass(roundedContainer,_49);
contentRounded=document.createElement("div");
dojo.html.setClass(contentRounded,"content");
dojo.html.addClass(contentRounded,"p");
topBorder=document.createElement("div");
dojo.html.setClass(topBorder,"t");
contentRounded.appendChild(topBorder);
content_container=document.createElement("div");
content_container.setAttribute("id",_4a);
contentRounded.appendChild(content_container);
bottomBorder=document.createElement("div");
dojo.html.setClass(bottomBorder,"b");
bottom_container=document.createElement("div");
bottomBorder.appendChild(bottom_container);
roundedContainer.appendChild(contentRounded);
roundedContainer.appendChild(bottomBorder);
return roundedContainer;
};
fantasy.client.createResultAdvice=function(id,_4c,_4d){
if(_4c.length==0){
return;
}
adviceContainer=document.createElement("div");
header=document.createElement("h3");
img=document.createElement("img");
img.src=_4d;
header.appendChild(img);
adviceContainer.appendChild(header);
rounded=fantasy.client.createRounded("rounded_medium",id);
adviceContainer.appendChild(rounded);
dojo.byId("result_right_advice").appendChild(adviceContainer);
p_spacer=document.createElement("p");
dojo.byId("result_right_advice").appendChild(p_spacer);
for(var i=0;i<_4c.length;i++){
contentContainer=fantasy.client.createRounded("rounded_dark",id+"_"+i);
dojo.html.setStyle(contentContainer,"margin-top","5px");
dojo.byId(id).appendChild(contentContainer);
if(_4c[i].Name.length>0){
header="<h4>"+_4c[i].Name+"</h4>";
}
contentContainer=header+_4c[i].Content;
if(_4c[i].Link&&_4c[i].Link.length>0){
readmore_link="<p><a href=\"/Fantasy/Links/Go/"+_4c[i].Id+"\" target=\"_blank\" >read more...</a></p>";
contentContainer=contentContainer+readmore_link;
}
dojo.byId(id+"_"+i).innerHTML=contentContainer;
div=document.createElement("div");
dojo.byId(id).appendChild(div);
}
p_spacer=document.createElement("p");
dojo.byId(id).appendChild(p_spacer);
};
var arr_Elements=[];
var time,pos;
var dir;
function Scroll_DN(_4f){
if(!arr_Elements[_4f]){
arr_Elements[_4f]=[];
arr_Elements[_4f].pos=0;
}
arr_Elements[_4f].pos=arr_Elements[_4f].pos-3;
pos=arr_Elements[_4f].pos;
elementHeight=dojo.html.getMarginBox(dojo.byId(_4f)).height;
viewportHeight=dojo.html.getPaddingBox(dojo.byId(_4f+"_visible")).height;
scrollheight=elementHeight-viewportHeight;
if(pos>-scrollheight){
document.getElementById(_4f).style.top=pos+"px";
time=setTimeout("Scroll_DN('"+_4f+"')",50);
}
}
function Scroll_Stop(){
if(time){
clearTimeout(time);
}
}
function Scroll_UP(_50){
if(!arr_Elements[_50]){
arr_Elements[_50]=[];
arr_Elements[_50].pos=0;
}
arr_Elements[_50].pos=arr_Elements[_50].pos+3;
pos=arr_Elements[_50].pos;
if(pos<=0){
document.getElementById(_50).style.top=pos+"px";
if(pos<2000){
time=setTimeout("Scroll_UP('"+_50+"')",50);
}
}
}
fantasy.client.loadResults=function(id,_52){
matches=fantasy.client.results.questions;
almost=matches.almost;
activemember=fantasy.client.results.active_member;
current_matches=[];
almost_matches=[];
if(matches&&matches[activemember]&&matches[activemember][_52]){
current_matches=matches[activemember][_52];
}
if(almost&&almost[_52]){
almost_matches=almost[_52];
}
while(dojo.byId("results_container").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("results_container").firstChild);
}
while(dojo.byId("directory-subtopics-list").hasChildNodes()){
dojo.dom.destroyNode(dojo.byId("directory-subtopics-list").firstChild);
}
dojo.byId("current_topic").innerHTML="";
cat_container=[];
cnt=0;
total_cnt=0;
arr_topics=[];
arr_results=[];
for(i in current_matches){
for(j=0;j<current_matches[i].length;j++){
if(i==id){
arr_results[arr_results.length]=current_matches[i][j];
}
if(!arr_topics[current_matches[i][j].cat_id]){
arr_topics[current_matches[i][j].cat_id]=current_matches[i][j].cat_name;
}
}
}
for(i in arr_results){
total_cnt++;
if(cnt===0){
headerElement=document.createElement("h3");
headerElement.innerHTML="Your exact matches";
dojo.byId("results_container").appendChild(headerElement);
cnt++;
}
headerContainer=fantasy.client.createRounded("rounded_light","result_cat_"+arr_results[i].question_id);
dojo.byId("results_container").appendChild(headerContainer);
question_table=document.createElement("table");
tablebody=document.createElement("tbody");
table_t=document.createElement("tr");
table_td_1=document.createElement("td");
table_td_1.setAttribute("valign","middle");
dojo.html.setClass(table_td_1,"directory-question");
table_td_1.innerHTML=arr_results[i]["q_text"];
table_td_2=document.createElement("td");
container_div=document.createElement("div");
container_div.setAttribute("id","question-content-icons-"+arr_results[i].question_id);
dojo.html.setClass(container_div,"question-content-links");
table_td_2.appendChild(container_div);
table_t.appendChild(table_td_1);
table_t.appendChild(table_td_2);
tablebody.appendChild(table_t);
tablehead=document.createElement("thead");
tablefoot=document.createElement("tfoot");
question_table.appendChild(tablehead);
question_table.appendChild(tablefoot);
question_table.appendChild(tablebody);
dojo.byId("result_cat_"+arr_results[i].question_id).appendChild(question_table);
ressource_div=document.createElement("div");
ressource_div.setAttribute("id","ressources_"+arr_results[i].question_id);
dojo.byId("result_cat_"+arr_results[i].question_id).appendChild(ressource_div);
fantasy.client.loadResultRessources(arr_results[i].question_id);
}
cnt=0;
arr_results=[];
for(i in almost_matches){
for(j=0;j<almost_matches[i].length;j++){
if(i==id){
arr_results[arr_results.length]=almost_matches[i][j];
}
if(!arr_topics[almost_matches[i][j].cat_id]){
arr_topics[almost_matches[i][j].cat_id]=almost_matches[i][j].cat_name;
}
}
}
catalmost_container=[];
cnt=0;
for(i in arr_results){
total_cnt++;
if(cnt===0){
headerElement=document.createElement("h3");
headerElement.innerHTML="<br />Close Match! This shows that your partner may have a similar interest.<br /> Just not precisely what you chose.";
dojo.byId("results_container").appendChild(headerElement);
cnt++;
}
headerContainer=fantasy.client.createRounded("rounded_light","result_cat_"+arr_results[i].question_id);
dojo.byId("results_container").appendChild(headerContainer);
question_table=document.createElement("table");
tablebody=document.createElement("tbody");
table_t=document.createElement("tr");
table_td_1=document.createElement("td");
table_td_1.setAttribute("valign","middle");
dojo.html.setClass(table_td_1,"directory-question");
table_td_1.innerHTML=arr_results[i]["name"];
table_td_2=document.createElement("td");
container_div=document.createElement("div");
container_div.setAttribute("id","question-content-icons-"+arr_results[i].question_id);
dojo.html.setClass(container_div,"question-content-links");
table_td_2.appendChild(container_div);
table_t.appendChild(table_td_1);
table_t.appendChild(table_td_2);
tablebody.appendChild(table_t);
tablehead=document.createElement("thead");
tablefoot=document.createElement("tfoot");
question_table.appendChild(tablehead);
question_table.appendChild(tablefoot);
question_table.appendChild(tablebody);
dojo.byId("result_cat_"+arr_results[i].question_id).appendChild(question_table);
ressource_div=document.createElement("div");
ressource_div.setAttribute("id","ressources_"+arr_results[i].question_id);
dojo.byId("result_cat_"+arr_results[i].question_id).appendChild(ressource_div);
fantasy.client.loadResultRessources(arr_results[i].question_id);
}
for(topic in arr_topics){
li_t=document.createElement("li");
div_rl=document.createElement("div");
dojo.html.setClass(div_rl,"topic-rounded-l");
div_rl.innerHTML="&nbsp;";
div_rr=document.createElement("div");
dojo.html.setClass(div_rr,"topic-rounded-r");
div_rr.innerHTML="&nbsp;";
link_c=document.createElement("a");
link_c.setAttribute("href","javascript: fantasy.client.loadResults("+topic+","+_52+");");
span_c=document.createElement("span");
dojo.html.setClass(span_c,"directory-topic");
if(id==topic){
span_c.innerHTML="<strong class=\"p_std\">"+arr_topics[topic]+"</strong>";
dojo.byId("current_topic").innerHTML="Results for: "+arr_topics[topic];
}else{
span_c.innerHTML=arr_topics[topic];
}
link_c.appendChild(span_c);
li_t.appendChild(div_rl);
li_t.appendChild(link_c);
li_t.appendChild(div_rr);
dojo.byId("directory-subtopics-list").appendChild(li_t);
}
if(total_cnt===0){
headerElement=document.createElement("h3");
headerElement.innerHTML="Please click on the sub-categories above to see the fantasies matches you have with your partner.";
dojo.byId("results_container").appendChild(headerElement);
}
};
fantasy.client.resultCache=[];
fantasy.client.loadResultRessources=function(cat){
if(!cat){
cat="";
}
if(fantasy.client.resultCache[cat]){
if(fantasy.client.resultCache[cat]["FANTASY_ICONS"]){
dojo.byId("question-content-icons-"+cat).innerHTML=fantasy.client.resultCache[cat]["FANTASY_ICONS"];
}
if(fantasy.client.resultCache[cat]["RESSOURCES"]){
dojo.byId("ressources_"+cat).innerHTML=fantasy.client.resultCache[cat]["RESSOURCES"];
}
}else{
var _54={url:"/FANTASY/AjaxData/Get/?type=Ressources&by=cat&cat="+cat,method:"POST",type:"text/json",load:function(_55,_56){
eval("var decoded_data = "+_56);
fantasy.client.resultCache[cat]=decoded_data;
if(decoded_data["FANTASY_ICONS"]){
dojo.byId("question-content-icons-"+cat).innerHTML=decoded_data["FANTASY_ICONS"];
}
if(decoded_data["RESSOURCES"]){
dojo.byId("ressources_"+cat).innerHTML=decoded_data["RESSOURCES"];
}
}};
dojo.io.bind(_54);
}
};
fantasy.client.sending=0;
fantasy.client.inviteFriends=function(){
if(fantasy.client.sending==0){
fantasy.client.sending=1;
}else{
alert("Still sending emails!");
return;
}
email_1=dojo.byId("friend_email_1").value;
email_2=dojo.byId("friend_email_2").value;
email_3=dojo.byId("friend_email_3").value;
email_4=dojo.byId("friend_email_4").value;
sender_email=dojo.byId("sender_email").value;
sender=dojo.byId("sender").value;
message=dojo.byId("friend_message").value;
var _57={url:"/FANTASY/Messenger/Send/",method:"POST",type:"text/json",load:function(_58,_59){
eval("var decoded_data = "+_59);
fantasy.client.sending=0;
dojo.byId("friend_email_1").value="";
dojo.byId("friend_email_2").value="";
dojo.byId("friend_email_3").value="";
dojo.byId("friend_email_4").value="";
alert("Thank you! Of course you can keep inviting friends by entering more email addresses.");
},content:{email_1:email_1,email_2:email_2,email_3:email_3,email_4:email_4,message:message,sender:sender,sender_email:sender_email}};
dojo.io.bind(_57);
};
fantasy.client.callbackResultMatch=function(id){
return function(){
fantasy.client.loadResultAdvice(id);
};
};
fantasy.client.howtoContent=[];
fantasy.client.howtoContent[0]=[];
fantasy.client.howtoContent[0]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[0]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveystart_tn.png";
fantasy.client.howtoContent[0]["TITLE"]="Step 1";
fantasy.client.howtoContent[0]["CONTENT"]="You start a FantasyAlert by providing your and your partners email and name. Also choose a password to make sure only you can access the FantasyAlert. <br />You can have several FantasyAlerts but remember that for each of them you have to set a different password. The password and your email acts as an identifier for a survey.<br /><br />Once you click 'Enter' you can start the FantasyAlert and we will invite your partner to join (Step 5.)";
fantasy.client.howtoContent[1]=[];
fantasy.client.howtoContent[1]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[1]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveyselector_tn.png";
fantasy.client.howtoContent[1]["TITLE"]="Step 2";
fantasy.client.howtoContent[1]["CONTENT"]="On the following screen you will see the four main categories: Fetish, S&M, Roleplay and Sexual Behaviour. These topics are the entry points to all questions. <br /><br />Click on one of the topics to see the questions and click on the button 'Overview' to go back to this screen.";
fantasy.client.howtoContent[2]=[];
fantasy.client.howtoContent[2]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[2]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveyquestions_tn.png";
fantasy.client.howtoContent[2]["TITLE"]="Step 3";
fantasy.client.howtoContent[2]["CONTENT"]="After clicking on the topic you will be presented with all the questions available. Simply check the checkbox for topics you like. <br /><br />Remember, Your partner will only see the topics you both have choosen, so you can be as honest as you like.<br /><br />If you want to go back to the topic screen simply click on the 'Overview' button.";
fantasy.client.howtoContent[3]=[];
fantasy.client.howtoContent[3]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[3]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveyoverview_tn.png";
fantasy.client.howtoContent[3]["TITLE"]="Step 4";
fantasy.client.howtoContent[3]["CONTENT"]="On this page you will get an overview of all topics for confirmation. If everything is right, click on the 'Submit' button to submit your FantasyAlert.";
fantasy.client.howtoContent[4]=[];
fantasy.client.howtoContent[4]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[4]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveyjoin_tn.png";
fantasy.client.howtoContent[4]["TITLE"]="Step 5";
fantasy.client.howtoContent[4]["CONTENT"]="After your partner received an invitation, he/she will get directed to this screen to enter the email and password of the FantasyAlert. Step 2. - 4. are exactly the same.";
fantasy.client.howtoContent[5]=[];
fantasy.client.howtoContent[5]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[5]["IMG"].src="http://www.myfantasyalert.com/images/slides/surveyclosed_tn.png";
fantasy.client.howtoContent[5]["TITLE"]="Step 6";
fantasy.client.howtoContent[5]["CONTENT"]="After you and your partner have completed the FantasyAlert we will present you with the 'FantasyAlert Completed' screen. Then we will create the FantasyMatch and send you an email with the link to your personalized results page. <br /><br />Feel free to tell your friends about the site. ";
fantasy.client.howtoContent[6]=[];
fantasy.client.howtoContent[6]["IMG"]=new Image(180,143);
fantasy.client.howtoContent[6]["IMG"].src="http://www.myfantasyalert.com/images/slides/result_tn.png";
fantasy.client.howtoContent[6]["TITLE"]="Step 7";
fantasy.client.howtoContent[6]["CONTENT"]="On your personalized results page you will see which fantasies match exactly to your partners results. We present you with a selection of links, articles and other interesting content in regards to the fantasies you selected.";
fantasy.client.currentHowTo=0;
fantasy.client.howToInit=function(){
dojo.byId("howto_step").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["TITLE"];
howto_img=fantasy.client.howtoContent[fantasy.client.currentHowTo]["IMG"];
howto_img.setAttribute("id","howto_image");
dojo.dom.replaceNode(dojo.byId("howto_image"),howto_img);
dojo.byId("howto_content").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["CONTENT"];
};
fantasy.client.howToNext=function(){
fantasy.client.currentHowTo++;
if(fantasy.client.howtoContent[fantasy.client.currentHowTo]){
dojo.byId("howto_step").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["TITLE"];
howto_img=new Image(180,143);
howto_img=fantasy.client.howtoContent[fantasy.client.currentHowTo]["IMG"];
howto_img.setAttribute("id","howto_image");
dojo.dom.replaceNode(dojo.byId("howto_image"),howto_img);
dojo.byId("howto_content").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["CONTENT"];
}else{
fantasy.client.currentHowTo--;
}
if(fantasy.client.howtoContent.length==fantasy.client.currentHowTo+1){
dojo.byId("howto_next").innerHTML="[Next]";
}else{
dojo.byId("howto_next").innerHTML="[<a href=\"javascript: void(0);\" onclick=\"fantasy.client.howToNext();\">Next</a>]";
}
dojo.byId("howto_previous").innerHTML="[<a href=\"javascript: void(0);\" onclick=\"fantasy.client.howToPrevious();\">Previous</a>]";
};
fantasy.client.howToPrevious=function(){
fantasy.client.currentHowTo--;
if(fantasy.client.howtoContent[fantasy.client.currentHowTo]){
dojo.byId("howto_step").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["TITLE"];
howto_img=fantasy.client.howtoContent[fantasy.client.currentHowTo]["IMG"];
howto_img.setAttribute("id","howto_image");
dojo.dom.replaceNode(dojo.byId("howto_image"),howto_img);
dojo.byId("howto_content").innerHTML=fantasy.client.howtoContent[fantasy.client.currentHowTo]["CONTENT"];
}else{
fantasy.client.currentHowTo++;
}
if(fantasy.client.currentHowTo==0){
dojo.byId("howto_previous").innerHTML="[Previous]";
}else{
dojo.byId("howto_previous").innerHTML="[<a href=\"javascript: void(0);\" onclick=\"fantasy.client.howToPrevious();\">Previous</a>]";
}
dojo.byId("howto_next").innerHTML="[<a href=\"javascript: void(0);\" onclick=\"fantasy.client.howToNext();\">Next</a>]";
};
fantasy.client.openDirectoryRessources=[];
fantasy.client.showDirectoryRessources=function(_5b){
for(open_element in fantasy.client.openDirectoryRessources){
if(_5b!=open_element){
if(dojo.byId(open_element)){
dojo.byId(open_element).style.display="none";
}
delete fantasy.client.openDirectoryRessources[open_element];
}
}
if(!fantasy.client.openDirectoryRessources[_5b]){
dojo.html.setClass(dojo.byId(_5b),"");
dojo.byId(_5b).style.display="";
}
fantasy.client.openDirectoryRessources[_5b]=1;
};
fantasy.client.hideDirectoryRessources=function(){
for(open_element in fantasy.client.openDirectoryRessources){
dojo.lfx.html.wipeOut(dojo.byId(open_element),300).play();
delete fantasy.client.openDirectoryRessources[open_element];
}
};
function dump(arr,_5d){
var _5e="";
if(!_5d){
_5d=0;
}
var _5f="";
for(var j=0;j<_5d+1;j++){
_5f+="    ";
}
if(typeof (arr)=="object"){
for(var _61 in arr){
value=arr[_61];
if(typeof (value)=="object"){
_5e+=_5f+"'"+_61+"' ...\n";
_5e+=dump(value,_5d+1);
}else{
_5e+=_5f+"'"+_61+"' => \""+value+"\"\n";
}
}
}else{
_5e="===>"+arr+"<===("+typeof (arr)+")";
}
return _5e;
}
function gup(_62){
_62=_62.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var _63="[\\?&]"+_62+"=([^&#]*)";
var _64=new RegExp(_63);
var _65=_64.exec(window.location.href);
if(_65==null){
return "";
}else{
return _65[1];
}
}

