﻿String.prototype.toSlug=function(){var lower=this.toLowerCase();var replaced=lower.replace("á","a");replaced=replaced.replace("é","e");replaced=replaced.replace("í","i");replaced=replaced.replace("ó","o");replaced=replaced.replace("ú","u");replaced=replaced.replace("ñ","n");replaced=replaced.replace("ä","a");replaced=replaced.replace("ë","e");replaced=replaced.replace("ï","i");scond=replaced.replace(/[^a-z\s]/,"");result=scond.replace(" ","-");return result;}
String.prototype.simpleQuoteSlash=function(){return this.replace("'","\\'");}
Core={duplicate:function(o){function N(){}
N.prototype=o;return new N();},local:{plegate:function(args){var child=$(args.object).children("ul");$(child.get(0)).slideToggle("fast");},insertEvents:function(){$(".clickable").mouseover(function(){$(this).addClass("hover");});$(".clickable").mouseout(function(){$(this).removeClass("hover");});}},newVote:function(args){$.post("/"+Core.local.folder+"vote/json/function/newVote",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="error"){alert(response.data);}else{window.location.reload();}});},steamNavbar:{getTabByTitle:function(tab){if(this.elements){for(el in this.elements){var that=this.elements[el];if(that.myTabs){for(il in that.myTabs){var thot=that.myTabs[il];if(thot.html.title.a.get(0)==tab){return thot;}}}}}
return 0;},make:function(args){$.extend(this,args);this.elements={};for(el in this.sections){this.element.make({title:el,tabs:this.sections[el],parent:this});}
this.draw();},draw:function(){this.html={holder:{div:$("<div id='steam-holder'></div>")},hidden:{div:null},navbar:{div:$("<div id='steam-navbar'></div>"),wideDialog:{div:$("<div class='dialog wide'></div>"),header:{div:$("<div class='header'></div>")},content:{div:$("<div class='content'></div>"),menu:{div:$("<div class='menu'></div>")},closeButton:{a:$("<a class='close-button' href='javascript:Core.steamNavbar.closeDialog()'>X</a>'")},field:{div:$("<div class='field'></div>")}},footer:{div:$("<div class='footer'></div>")}}}}
if($(document.body).index("#steam-hidden")==-1){this.html.hidden.div=$("<div id='steam-hidden' style='display: none'></div>");this.html.hidden.div.prependTo(document.body);}else{this.html.hidden.div=$("#steam-hidden");}
this.html.navbar.wideDialog.div.append(this.html.navbar.wideDialog.header.div);this.html.navbar.wideDialog.content.div.append(this.html.navbar.wideDialog.content.menu.div);this.html.navbar.wideDialog.content.div.append(this.html.navbar.wideDialog.content.closeButton.a);this.html.navbar.wideDialog.content.div.append(this.html.navbar.wideDialog.content.field.div);this.html.navbar.wideDialog.div.append(this.html.navbar.wideDialog.content.div);this.html.navbar.wideDialog.div.append(this.html.navbar.wideDialog.footer.div);this.html.navbar.div.append(this.html.navbar.wideDialog.div);for(el in this.elements){var that=this.elements[el];this.html.navbar.div.append(that.html.link.a);if(that.myTabs){for(il in that.myTabs){var thot=that.myTabs[il];this.html.navbar.wideDialog.content.field.div.append(thot.html.content.div);this.html.hidden.div.append(thot.html.title.a);}}}
this.html.holder.div.append(this.html.navbar.div);$(document.body).prepend(this.html.holder.div);if($.browser.msie){this.html.navbar.wideDialog.div.css("margin-left",this.html.navbar.div.offset().left+"px");}},closeDialog:function(){for(el in this.elements){var element=this.elements[el];if(element.isDisplayed){element.hide();}}},element:{make:function(args){var newEl=Core.duplicate(this);$.extend(newEl,args);newEl.parent.elements[newEl.title]=newEl;newEl.myTabs={};if(newEl.tabs){for(el in newEl.tabs){if(newEl.tabs[el].content){newEl.tab.make({title:el,content:newEl.tabs[el].content,parent:newEl});}else if(newEl.tabs[el].id){newEl.tab.make({title:el,content:$("#"+newEl.tabs[el].id+" > *"),parent:newEl});$("#"+newEl.tabs[el].id).remove();}else if(newEl.tabs[el].collumns){newEl.tab.make({title:el,collumns:newEl.tabs[el].collumns,parent:newEl});}else if(newEl.tabs[el].reference&&newEl.tabs[el].resources){newEl.tab.make({title:el,reference:newEl.tabs[el].reference,resources:newEl.tabs[el].resources,relations:newEl.tabs[el].relations,parent:newEl});}}}
newEl.draw();return newEl;},draw:function(){this.html={link:{a:$("<a class='section' id='section-"+this.title.toSlug()+"'>"+this.title+"</a>"),arrow:{div:$("<div class='arrow'></div>"),innerDiv:$("<div></div>")}}}
this.html.link.arrow.div.append(this.html.link.arrow.innerDiv);this.html.link.a.append(this.html.link.arrow.div);this.html.link.a.attr("href","javascript:Core.steamNavbar.elements['"+this.title.simpleQuoteSlash()+"'].show()");},show:function(){if(!this.isDisplayed){this.html.link.a.attr("href","javascript:Core.steamNavbar.elements['"+this.title.simpleQuoteSlash()+"'].hide()");this.html.link.a.addClass("the-chosen-one");if(this.myTabs){for(el in this.myTabs){var that=this.myTabs[el];this.parent.html.navbar.wideDialog.content.menu.div.append(that.html.title.a);}}
this.html.link.arrow.div.show();if($("#steam-navbar .dialog:hidden")){if(this.myTabs){for(el in this.myTabs){this.myTabs[el].select();break;}}
if(window.innerHeight){this.parent.html.navbar.wideDialog.content.div.css("height",(window.innerHeight-100)+"px");this.parent.html.navbar.wideDialog.content.div.css("margin","-"+(window.innerHeight-70)+"px 0 0 0");this.parent.html.navbar.wideDialog.content.field.div.css("height",(window.innerHeight-140)+"px");}
this.parent.html.navbar.wideDialog.div.show();}
this.isDisplayed=true;}},hide:function(){if(this.isDisplayed){this.html.link.a.attr("href","javascript:Core.steamNavbar.elements['"+this.title.simpleQuoteSlash()+"'].show()");this.html.link.a.removeClass("the-chosen-one");if(this.myTabs){for(el in this.myTabs){var that=this.myTabs[el];that.html.title.a.appendTo("#steam-hidden");}}
this.html.link.arrow.div.hide();if(!this.parent.html.navbar.wideDialog.content.menu.div.children().size()){this.parent.html.navbar.wideDialog.div.hide();}else{var changeSelection=false;if(this.myTabs){for(el in this.myTabs){var that=this.myTabs[el];if(Core.steamNavbar.currentTab==that){changeSelection=true;break;}}}
if(changeSelection){Core.steamNavbar.getTabByTitle(this.parent.html.navbar.wideDialog.content.menu.div.children()[0]).select();}}
this.isDisplayed=false;}},tab:{make:function(args){var newEl=Core.duplicate(this);$.extend(newEl,args);newEl.parent.myTabs[newEl.title]=newEl;if(newEl.collumns){newEl.doneCollumns={};for(col in newEl.collumns){var tCol=newEl.collumns[col];this.collumn.make({title:col,data:newEl.collumns[col],parent:newEl});}}else if(newEl.reference&&newEl.resources){newEl.reference.parent=newEl;this.referenceObj.make(newEl.reference);newEl.resources.parent=newEl;this.resourcesObj.make(newEl.resources);}
newEl.draw();return newEl;},draw:function(){this.html={title:{a:$("<a class='title' id='tab-"+this.title.toSlug()+"'>"+this.title+"</a>")},content:{div:$("<div class='inner-content' id='content-"+this.title.toSlug()+"'></div>")}}
if(this.doneCollumns){for(co in this.doneCollumns){var col=this.doneCollumns[co];this.html.content.div.append(col.html.container.div);}}else if(this.reference&&this.resources){this.relations.html={divHolder:$("<div class='relations-holder'></div>"),div:$("<div class='relations'></div>")}
this.relationss={};for(el in this.relations){if(el!="html"){var hey=this.relations[el];this.relationss[hey]={html:{a:$("<a>"+hey+"</a>")}}
this.relationss[hey].title=hey;this.relationss[hey].parent=this;this.relationss[hey].html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.title+"\"].myTabs[\""+this.title+"\"].relationss[\""+hey+"\"].setRelation()");this.relationss[hey].setRelation=function(){var arguments={"targetId":this.parent.reference.selectedReference.id,"relationship":this.title,"originId":this.parent.resources.selectedResource.id,"targetType":this.parent.reference.selectedReference.type,"context":{"originType":this.parent.resources.selectedResource.type,"tab":this.parent.title,"menu":this.parent.parent.title}};$.post("/"+Core.local.folder+this.parent.resources.selectedResource.type+"/json/function/setProfileIn",{"arguments":JSON.stringify(arguments)},function(data){var result=eval("("+data+")");var great=Core.steamNavbar.elements[result.arguments.context.menu].myTabs[result.arguments.context.tab].resources.getResourceById(result.arguments.originId);great.hideMenu();if(result.type=="success"){var sexy=Core.steamNavbar.elements[result.arguments.context.menu].myTabs[result.arguments.context.tab].reference.getReference({id:result.arguments.targetId,type:result.arguments.targetType});if(!sexy.relations){sexy.relations=[];}
sexy.relations.push({id:result.arguments.originId,type:result.arguments.context.originType,relationship:result.arguments.relationship});sexy.select();}else if(result.type=="error"){alert(result.data);}});}
this.relations.html.div.append(this.relationss[hey].html.a);}}
this.relations.html.divHolder.append(this.relations.html.div);this.resources.html.div.append(this.relations.html.divHolder);this.html.content.div.append(this.reference.html.div);this.html.content.div.append(this.resources.html.div);for(il in this.reference.references){var ol=this.reference.references[il];ol.select();break;}}else{this.html.content.div.append(this.content);}
this.html.title.a.attr("href","javascript:Core.steamNavbar.elements['"+this.parent.title.simpleQuoteSlash()+"'].myTabs['"+this.title.simpleQuoteSlash()+"'].select()");},select:function(){if(Core.steamNavbar.currentTab&&Core.steamNavbar.currentTab!=this){Core.steamNavbar.currentTab.deselect();}
this.html.title.a.addClass("the-chosen-one");this.html.content.div.show();Core.steamNavbar.currentTab=this;},deselect:function(){this.html.title.a.removeClass("the-chosen-one");this.html.content.div.hide();},collumn:{make:function(args){var newEl=Core.duplicate(this);$.extend(newEl,args);newEl.parent.doneCollumns[newEl.title]=newEl;newEl.draw();return newEl;},draw:function(){this.html={container:{div:$("<div class='collumn'></div>"),title:{h2:$("<h2>"+this.title+"</h2>")},content:{ul:$("<ul></ul>")}}}
for(da in this.data){var dat=this.data[da];dat.html={li:$("<li id='element-"+dat.id+"-"+dat.type+"'></li>"),a:$("<a href='javascript:Core.steamNavbar.elements[\""+this.parent.parent.title+"\"].myTabs[\""+this.parent.title+"\"].doneCollumns[\""+this.title+"\"].data[\""+da+"\"].select()'>"+da+"</a>")}
dat.title=da;dat.parent=this;dat.html.li.append(dat.html.a);dat.select=function(){this.html.a.addClass("the-chosen-one");this.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.parent.title+"\"].myTabs[\""+this.parent.parent.title+"\"].doneCollumns[\""+this.parent.title+"\"].data[\""+this.title+"\"].deselect()");}
dat.deselect=function(){this.html.a.removeClass("the-chosen-one");this.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.parent.title+"\"].myTabs[\""+this.parent.parent.title+"\"].doneCollumns[\""+this.parent.title+"\"].data[\""+this.title+"\"].select()");}
this.html.container.content.ul.append(dat.html.li);}
this.html.container.div.append(this.html.container.title.h2);this.html.container.div.append(this.html.container.content.ul);}},referenceObj:{make:function(args){var newEl=Core.duplicate(this);$.extend(newEl,args);newEl.parent.reference=newEl;newEl.selectedReference=null;newEl.draw();return newEl;},draw:function(){this.html={div:$("<div class='reference'></div>"),title:{h2:$("<h2>"+this.title+"</h2>")},content:{ul:$("<ul></ul>")}}
for(il in this.references){var je=this.references[il];je.title=il;je.html={li:$("<li></li>"),a:$("<a>"+il+"</a>")}
je.parent=this;je.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.title+"\"].myTabs[\""+this.parent.title+"\"].reference.references[\""+il+"\"].select()");je.select=function(){if(!this.html.a.hasClass("the-chosen-one")){for(x in this.parent.references){var y=this.parent.references[x];y.html.a.removeClass("the-chosen-one");}}
Core.steamNavbar.elements[this.parent.parent.parent.title].myTabs[this.parent.parent.title].resources.deselect();if(this.relations){for(ol in this.relations){var rel=this.relations[ol];for(er in Core.steamNavbar.elements[this.parent.parent.parent.title].myTabs[this.parent.parent.title].resources.resources){var or=Core.steamNavbar.elements[this.parent.parent.parent.title].myTabs[this.parent.parent.title].resources.resources[er];if(or.id==rel.id){or.setRole(rel.relationship);}}}}
this.parent.selectedReference=this;this.html.a.addClass("the-chosen-one");}
je.html.li.append(je.html.a);this.html.content.ul.append(je.html.li);}
this.html.div.append(this.html.title.h2);this.html.div.append(this.html.content.ul);},getReference:function(args){for(hi in this.references){var hey=this.references[hi];if(hey.id==args.id&&hey.type==args.type){return hey;}}}},resourcesObj:{make:function(args){var newEl=Core.duplicate(this);$.extend(newEl,args);newEl.parent.resources=newEl;newEl.selectedResource=null;newEl.draw();return newEl;},draw:function(){this.html={div:$("<div class='resources'></div>"),title:{h2:$("<h2>"+this.title+"</h2>")},content:{ul:$("<ul></ul>")}}
var odd=0;for(il in this.resources){var je=this.resources[il];je.title=il;je.parent=this;je.html={li:$("<li></li>"),a:$("<a></a>"),target:{span:$("<span class='target'>"+il+"</span>")},role:{span:$("<span class='role'></span>")}}
je.setRole=function(role){this.html.role.span.text(role);this.html.a.addClass("active");}
je.cleanRole=function(){this.html.role.span.text("");this.html.a.removeClass("active");}
je.hasMenuDisplayed=false;je.displayMenu=function(){if(!this.hasMenuDisplayed){this.parent.closeMenu();this.parent.selectedResource=this;var nativeOffset=this.parent.html.content.ul.offset();var currentOffset=this.html.a.offset();if($.browser.msie){this.parent.parent.relations.html.divHolder.css("margin-top",(currentOffset.top-nativeOffset.top)+"px");this.parent.parent.relations.html.divHolder.css("margin-left",(currentOffset.left-10)+"px");}else if($.browser.safari){this.parent.parent.relations.html.divHolder.css("margin-top",(currentOffset.top-nativeOffset.top+45)+"px");this.parent.parent.relations.html.divHolder.css("margin-left",(currentOffset.left-20)+"px");}else{this.parent.parent.relations.html.divHolder.css("margin-top",(currentOffset.top-nativeOffset.top+30)+"px");this.parent.parent.relations.html.divHolder.css("margin-left",(currentOffset.left-20)+"px");}
this.parent.parent.relations.html.div.show();this.html.a.addClass("the-chosen-one");this.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.parent.title+"\"].myTabs[\""+this.parent.parent.title+"\"].resources.resources[\""+this.title+"\"].hideMenu();");this.hasMenuDisplayed=true;}}
je.hideMenu=function(){if(this.hasMenuDisplayed){this.parent.parent.relations.selectedResource=null;this.parent.parent.relations.html.div.hide();this.html.a.removeClass("the-chosen-one");this.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.parent.title+"\"].myTabs[\""+this.parent.parent.title+"\"].resources.resources[\""+this.title+"\"].displayMenu();");this.hasMenuDisplayed=false;}}
je.html.a.attr("href","javascript:Core.steamNavbar.elements[\""+this.parent.parent.title+"\"].myTabs[\""+this.parent.title+"\"].resources.resources[\""+je.title+"\"].displayMenu();");if(odd%4<2){je.html.a.addClass("odd");}else{je.html.a.addClass("even");}
odd++;je.html.a.append(je.html.target.span);je.html.a.append(je.html.role.span);je.html.li.append(je.html.a);this.html.content.ul.append(je.html.li);}
this.html.div.append(this.html.title.h2);this.html.div.append(this.html.content.ul);},deselect:function(){for(ol in this.resources){var res=this.resources[ol];res.cleanRole();}},closeMenu:function(){for(ar in this.resources){var je=this.resources[ar];je.hideMenu();}},getResourceById:function(id){for(er in this.resources){var hi=this.resources[er];if(hi.id==id){return hi;}}
return 0;}}}}},postAsFavourite:function(args){$.post("/"+Core.local.folder+"photo/json/function/setAsFavourite",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){alert("The picture has been saved.");}else{alert(response.data);}});},saveFriend:function(args){$.post("/"+Core.local.folder+"user/json/function/saveFriend",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){alert("Your friend has been saved.");}else{alert(response.data);}});},deleteFavourite:function(args){$.post("/"+Core.local.folder+"photo/json/function/deleteFavourite",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){alert("The picture was deleted from your collection.");window.location.reload();}else{alert(response.data);}});},deleteFriend:function(args){$.post("/"+Core.local.folder+"user/json/function/deleteFriend",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){alert("Your friend was deleted succesfully.");window.location.reload();}else{alert(response.data);}});},deletePost:function(args){$.post("/"+Core.local.folder+"post/json/function/deleteById",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){$("#post-"+response.arguments.id).fadeOut("fast");}else{alert(response.data);}});},deleteTopic:function(args){if(confirm("You are about to delete a topic, are you sure you want to proceed?")){$.post("/"+Core.local.folder+"topic/json/function/deleteById",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){window.location="/"+Core.local.folder+"forum/"+response.arguments.context.parentSlug;}else{alert(response.data);}});}},deleteForumCategory:function(args){if(confirm("You are about to delete a forum category, are you sure you want to proceed?")){$.post("/"+Core.local.folder+"forumCategory/json/function/deleteById",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){window.location="/"+Core.local.folder+"forum/";}else{alert(response.data);}});}},deleteForum:function(args){if(confirm("You are about to delete a forum, are you sure you want to proceed?")){$.post("/"+Core.local.folder+"forum/json/function/deleteById",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){window.location="/"+Core.local.folder+"forumCategory/"+response.arguments.context.parentSlug;}else{alert(response.data);}});}},setAsPictureOfTheWeek:function(args){$.post("/"+Core.local.folder+"photo/json/function/setAsPictureOfTheWeek",{arguments:JSON.stringify(args)},function(data){var response=eval("("+data+")");if(response.type=="success"){alert("Photo setted as favourite successfully. Reload to see the changes");}else{alert(response.data);}});}}
http://www.sintillate.co.uk/dev5/+core/themes/sintillate/html/js/swfobject.js