Starmind.Utilities={Translation:{close:"close"},AjaxForm:{onSubmit:function(d,b){d=$(d);if(b==null){b={}}if(b.loading==null){b.loading=true}if(b.loading){var a=d.getElementsByTagName("input");var e=null;for(var c=0;c<a.length;c++){if(a[c].type=="submit"){e=$(a[c]);break}}if(e!=null){Starmind.Utilities.Loading.attachTo(e)}}new Ajax.Updater(d.parentNode,d.action+((d.action.charAt(d.action.length-1)!="/")?"/":"")+"format/html/",{method:"post",parameters:d.serialize(),evalScripts:true,encoding:"UTF-8",onComplete:function(f){try{$("utl_load_img").hide()}catch(g){}},on404:function(f){Starmind.Utilities.Error.show("Connection Error: "+f.statusText)},onFailure:function(f){Starmind.Utilities.Error.show("Connection Error: "+f.status+" -- "+f.statusText)}});d.disable()}},Loading:{attachTo:function(b,a){b=$(b);var d=$("utl_load_img");if(d!=null){d.remove()}if(a==null){a="right"}switch(a){case"left":var c=b.cumulativeOffset().left-24;break;default:var c=b.cumulativeOffset().left+b.getWidth()+8;break}d=new Element("img",{src:"/img/loading_small.gif",width:"16",height:"16",id:"utl_load_img"}).setStyle({position:"absolute",width:"16px",height:"16px",top:(b.cumulativeOffset().top+(b.getHeight()/2)-8)+"px",left:c+"px"});$(document.body).insert(d)},remove:function(){try{$("utl_load_img").remove()}catch(a){}}},AjaxRequest:function(a,b){Starmind.Utilities.Internal.AjaxLoading.show();if(b==null){b="";method="get"}else{method="post"}new Ajax.Request(a,{method:method,postBody:b,evalJS:true,encoding:"UTF-8",onComplete:function(c){Starmind.Utilities.Internal.AjaxLoading.hide()},on404:function(c){Starmind.Utilities.Error.show("Connection Error: "+c.statusText)},onFailure:function(c){Starmind.Utilities.Error.show("Connection Error: "+c.status+" -- "+c.statusText)}})},AjaxPopup:function(c,a){if(a==null){a={}}var d=((a.width!=null)?a.width:"600");var h=((a.title!=null)?a.title:"");var g=((a.params!=null)?a.params:null);var b=((a.closeLabel!=null)?a.closeLabel:Starmind.Utilities.Translation.close);var e=(a.closeUrl!=null?a.closeUrl:"javascript:;");var f=new Starmind.Utilities.PopupInstance(d,b,e);f.create(h);f.show();f.callback(c,g);return false},MenuUpdate:function(){new Ajax.Request("/ajax/user/news/",{method:"get",postBody:"",evalJS:true,encoding:"UTF-8"})},News:{_cache:null,update:function(a){if(a==null&&this._cache!=null){a=this._cache;this._cache=null}if(a!=null){if(Prototype.Browser.IE&&typeof document.body.style.maxHeight=="undefined"){for(var c=0;c<a.length;c++){var d=$("smmn-"+a[c][0]);if(d!=null){if(a[c][1]>0){if(d.getWidth()==0){this._cache=a;window.setTimeout("Starmind.Utilities.News.update()",1000);return}}}}}for(var c=0;c<a.length;c++){var b=$("nnx-"+a[c][0]);var f=$("nnxa-"+a[c][0]);if(b==null){var d=$("smmn-"+a[c][0]);if(d!=null){if(a[c][1]>0){var e=Math.round(d.cumulativeOffset().left-(document.viewport.getDimensions().width/2)+d.getWidth()+2)+"px";b=new Element("div",{id:"nnx-"+a[c][0]}).addClassName("mnnmb").setStyle({top:(d.cumulativeOffset().top-20)+"px",marginLeft:e}).update(a[c][1]);$(document.body).insert({bottom:b});f=new Element("img",{id:"nnxa-"+a[c][0],width:10,height:6,border:0,src:"/img/hmenu/newsarrow.gif"}).addClassName("mnnmb").setStyle({top:(b.cumulativeOffset().top+b.getHeight()-1)+"px",marginLeft:e});$(document.body).insert({bottom:f})}}}else{b.update(a[c][1]);if(a[c][1]>0){f.show();b.show()}else{f.hide();b.hide()}}}}}},Language:{timeout:null,selectClick:function(){if($("language_changer").className==""){this.selectHover()}else{this.selectHide()}},selectHover:function(){if(this.timeout!=null){window.clearTimeout(this.timeout)}if($("language_changer").className==""){$("language_changer").className="hover";new Effect.BlindDown("language_changer_ul",{duration:0.2});$("language_changer_arrow").src="/img/language/arrow2.gif"}},selectOut:function(){if(this.timeout!=null){window.clearTimeout(this.timeout)}this.timeout=window.setTimeout("Starmind.Utilities.Language.selectHide();",1000)},selectHide:function(){if(this.timeout!=null){window.clearTimeout(this.timeout)}if($("language_changer").className=="hover"){$("language_changer").className="";new Effect.BlindUp("language_changer_ul",{duration:0.2});$("language_changer_arrow").src="/img/language/arrow1.gif?1"}},changeLanguage:function(b){this.selectHide();new Starmind.Utilities.AjaxRequest("/ajax/user/language.change","id="+b);var a=new Element("div",{style:"background:#000;display:none;width:100%;height:100%;position:absolute;top:0;left:0;z-index:5000;"});$(document.body).insert(a);new Effect.Appear(a,{duration:3,to:0.6})}},Pagination:{container:"",init:function(a){if(this.container==""){this.container=a||"pagination_content";Event.observe(window,"load",function(){Starmind.Utilities.Pagination.start()})}},start:function(){if(Prototype.Browser.IE){$(document.body).insert(new Element("iframe",{id:"pagination_history_iframe",src:"/js/lib/mvdm/blank.html",style:"top:0;left:0;width:1px;height:1px;visibility:hidden"}))}$(document.body).insert(new Element("input",{id:"pagination_history_field",type:"hidden"}));var a=YAHOO.util.History.getBookmarkedState("url");a=a||"";YAHOO.util.History.register("url",a,function(c){Starmind.Utilities.Pagination.update(c)});YAHOO.util.History.onReady(function(){var c=YAHOO.util.History.getCurrentState("url");if(a!=""){window.location.href=a}});try{YAHOO.util.History.initialize("pagination_history_field","pagination_history_iframe")}catch(b){}},update:function(a){try{if(a!=""){this.showLoading();new Ajax.Updater(this.container,a+((a.charAt(a.length-1)!="/")?"/":"")+"format/html/",{method:"get",evalScripts:true,encoding:"UTF-8",onComplete:function(c){Starmind.Utilities.Pagination.removeLoading();if(Prototype.Browser.IE){pngfix()}},on404:function(c){Starmind.Utilities.Error.show("Connection Error: "+c.statusText)},onFailure:function(c){Starmind.Utilities.Error.show("Connection Error: "+c.status+" -- "+c.statusText)}})}}catch(b){window.location.href=a}},flip:function(a){try{if(a!=""){YAHOO.util.History.navigate("url",a);$(this.container).scrollTo()}}catch(b){this.container="pagination_content";Starmind.Utilities.Pagination.start();try{YAHOO.util.History.navigate("url",a)}catch(b){window.location.href=a}}},showLoading:function(){this.removeLoading();var a=$(this.container).getDimensions();var b=$(this.container).cumulativeOffset();$(document.body).insert(new Element("div",{id:"pagination_loading_container",style:"position:absolute;width:"+a.width+"px;height:"+a.height+"px;top:"+b.top+"px;left:"+b.left+"px;"}).insert(new Element("div",{style:"-moz-border-radius:5px;-webkit-border-radius:5px;width:45px;height:45px;background:#fff;border:1px solid #ccc;padding:5px;margin:"+((a.height/2)-26)+"px 0 0 "+((a.width/2)-26)+"px;"}).insert(new Element("img",{src:"/img/loading45.gif",width:"45",height:"45",border:"0"}))))},removeLoading:function(){try{$("pagination_loading_container").remove()}catch(a){}}},PopupInstance:function(a,c,b){this.width=a;this.height=200;this.title=null;this.content=null;this.sm_popup=null;this.sm_popup_content=null;this.sm_popup_close=null;this.create=function(h,g){var e=Starmind.Utilities.Internal.Page.getPageScroll();var f=Starmind.Utilities.Internal.Page.getPageSize();this.sm_popup=document.createElement("div");this.sm_popup.className="popup_container";this.sm_popup.style.width=this.width+"px";this.sm_popup_content=document.createElement("div");this.sm_popup_content.className="temp_unused";this.sm_popup_close=document.createElement("div");this.sm_popup_close.className="popup_close";var d=document.createElement("a");d.href=b;d.className="defaultbutton";d.innerHTML=c;var i=this;d.onclick=function(){i.remove()};this.sm_popup_close.appendChild(d);this.content=document.createElement("div");this.content.className="popup_content";this.content.innerHTML='<img src="/img/loading.gif" width="32" height="32" style="margin: 20px 0 20px '+(this.width/2-16)+'px" />';this.sm_popup.style.display="none";this.sm_popup.style.top=(e[1]+((f[3]-35-this.height)/2)+"px");this.sm_popup.style.left=(((f[0]-20-this.width)/2)+"px");this.title=document.createElement("div");this.title.className="title";this.title.innerHTML=h;this.title.style.display=((h==null||h=="")?"none":"");this.sm_popup_content.appendChild(this.title);this.sm_popup_content.appendChild(this.content);this.sm_popup_content.appendChild(this.sm_popup_close);this.sm_popup.appendChild(this.sm_popup_content);Starmind.Utilities.Internal.Popup.showOverlay(true);document.body.appendChild(this.sm_popup);Starmind.Utilities.Internal.Popup.registerInstance(this)};this.callback=function(f,h){if(h==null){var d="";var e="GET"}else{var d=h;var e="POST"}var g=this;this.content.className="popup_content";this.content.innerHTML='<img src="/img/loading.gif" width="32" height="32" style="margin: 20px 0 20px '+(this.width/2-16)+'px" />';this.rearrange();new Ajax.Updater(this.content,(f+((f.charAt(f.length-1)!="/")?"/":"")+"format/html/"),{method:e,parameters:d,evalScripts:true,encoding:"UTF-8",onComplete:function(i){g.rearrange()},on404:function(i){Starmind.Utilities.Error.show("Connection Error: "+i.statusText)},onFailure:function(i){Starmind.Utilities.Error.show("Connection Error: "+i.status+" -- "+i.statusText)}})};this.show=function(){if(this.sm_popup==null){this.create()}this.sm_popup.style.display="block";Starmind.Utilities.Internal.Popup.showOverlay(true)};this.hide=function(){if(this.sm_popup!=null){this.sm_popup.style.display="none"}Starmind.Utilities.Internal.Popup.showOverlay(false)};this.remove=function(){Starmind.Utilities.Internal.Popup.unregisterInstance(this);this.sm_popup.parentNode.removeChild(this.sm_popup);this.sm_popup=null;Starmind.Utilities.Internal.Popup.showOverlay(false)};this.rearrange=function(){var e=Starmind.Utilities.Internal.Page.getPageSize();var d=Starmind.Utilities.Internal.Page.getPageScroll();this.sm_popup.style.width=this.width+"px";this.sm_popup.style.left=(((e[0]-20-this.width)/2)+"px");var f=d[1]+((e[3]-35-$(this.sm_popup).getHeight())/2);if(f<10){f=10}this.sm_popup.style.top=f+"px"}},Form:{submitParent:function(b){try{var a=b.parentNode;while(a.tagName!="FORM"){a=a.parentNode}a.submit()}catch(c){alert("STARMIND ERROR: No Form found!")}},getParent:function(b){try{var a=b.parentNode;while(a.tagName!="FORM"){a=a.parentNode}return a}catch(c){alert("STARMIND ERROR: No Form found!")}},inProgress:[],counter:0,onSubmit:function(a){if(a.id==""||a.id=="undefinied"||a.id==null){a.id="form_ip_"+counter++}if(this.isInProgress(a)){this.removeFromProgress(a);return true}else{this.inProgress[this.inProgress.length]=a.id;Starmind.Utilities.Internal.Form.indicateSubmission();setTimeout("$('"+a.id+"').submit();",1500)}return false},isInProgress:function(b){for(var a=0;a<this.inProgress.length;a++){if(this.inProgress[a]==b.id){return true}}return false},removeFromProgress:function(c){var a=[];for(var b=0;b<this.inProgress.length;b++){if(this.inProgress[b]!=c.id){a[a.length]=this.inProgress[b]}}this.inProgress=a}},Error:{show:function(b){var a=$("main_error_message");if(a==null){a=document.createElement("div");a.className="error_message";a.id="main_error_message";a.style.display="none";$("main_container").insert({top:a})}$(a).update(b);if($(a).style.display=="none"){new Effect.Appear(a)}else{new Effect.Highlight(a,{startcolor:"#CC0000",endcolor:"#ffcccc"})}},hide:function(){var a=$("main_error_message");if(a!=null){a.hide()}}},Success:{show:function(b){var a=$("main_success_message");if(a==null){a=document.createElement("div");a.className="success_message";a.id="main_success_message";a.style.display="none";$("main_container").insert({top:a})}$(a).update(b);if($(a).style.display=="none"){new Effect.Appear(a)}else{new Effect.Highlight(a,{startcolor:"#ccee00",endcolor:"#f3ffad"})}},hide:function(){var a=$("main_success_message");if(a!=null){a.hide()}}},Internal:{Popup:{_instances:new Array(),_idCounter:0,_overlay_div:null,getID:function(){return Starmind.Utilities.Internal.Popup._idCounter++},getActiveInstance:function(){return Starmind.Utilities.Internal.Popup._instances[Starmind.Utilities.Internal.Popup._instances.length-1]},registerInstance:function(a){for(var b=0;b<Starmind.Utilities.Internal.Popup._instances.length;b++){Starmind.Utilities.Internal.Popup._instances[Starmind.Utilities.Internal.Popup._instances.length].remove()}Starmind.Utilities.Internal.Popup._instances[Starmind.Utilities.Internal.Popup._instances.length]=a},unregisterInstance:function(a){var b=new Array();for(var c=0;c<Starmind.Utilities.Internal.Popup._instances.length;c++){if(Starmind.Utilities.Internal.Popup._instances[c].id!=a.id){b[b.length]=Starmind.Utilities.Internal.Popup._instances[c]}}Starmind.Utilities.Internal.Popup._instances=b},removeAll:function(){for(var a=0;a<Starmind.Utilities.Internal.Popup._instances.length;a++){if(Starmind.Utilities.Internal.Popup._instances[a].id!=popup.id){temp[temp.length]=Starmind.Utilities.Internal.Popup._instances[a]}}},showOverlay:function(e){if(e&&Starmind.Utilities.Internal.Popup._overlay_div==null){var b=Starmind.Utilities.Internal.Page.getPageSize();Starmind.Utilities.Internal.Popup._overlay_div=document.createElement("div");Starmind.Utilities.Internal.Popup._overlay_div.className="popup_overlay";Starmind.Utilities.Internal.Popup._overlay_div.style.height=b[1]+"px";Starmind.Utilities.Internal.Popup._overlay_div.innerHTML="&nbsp;";document.body.appendChild(Starmind.Utilities.Internal.Popup._overlay_div)}else{if(e){Starmind.Utilities.Internal.Popup._overlay_div.style.display=""}else{Starmind.Utilities.Internal.Popup._overlay_div.style.display="none"}}var a=navigator.userAgent.indexOf("MSIE ");if(Prototype.Browser.IE&&a!=-1&&parseFloat(navigator.userAgent.substr(a+5,a+8))<7){var d=$("starmind_container").getElementsByTagName("select");for(var c=0;c<d.length;c++){d[c].style.display=(e?"none":"")}}}},Loading:{show:function(b,c){b=((b==null)?true:b);c=((c==null)?"ppl_loading":c);var a=$(c);if(a!=null){a.style.display=(b?"":"none")}}},AjaxLoading:{show:function(){Starmind.Utilities.Internal.AjaxLoading.toggle(true)},hide:function(){Starmind.Utilities.Internal.AjaxLoading.toggle(false)},toggle:function(c){if(c==null){c=true}var e=$("starmind_ajax_loading");if(e==null){var d=document.createElement("div");d.className="ajax_loading";d.style.display="none";d.id="starmind_ajax_loading";var b=new Image(16,16);b.src="/img/ajax/loading.gif";var a=document.createElement("img");a.width="16";a.height="16";a.src=b.src;d.appendChild(a);document.body.appendChild(d)}if(c){Effect.SlideDown("starmind_ajax_loading",{duration:0.3})}else{Effect.SlideUp("starmind_ajax_loading",{duration:0.3})}}},Page:{getPageSize:function(){var c,a;if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}return new Array(pageWidth,pageHeight,b,d)},getPageScroll:function(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}return new Array("",a)}},Form:{indicateSubmission:function(){$("progressBarId").style.display="block";Starmind.Utilities.Internal.Popup.showOverlay(true)},insertProgress:function(){$(document.body).insert(new Element("div",{id:"progressBarId"}).setStyle({width:"45px",height:"45px",position:"absolute",top:"50%",left:"50%",margin:"-22px 0 0 -22px",border:"1px solid #ccc",background:"#fff",display:"none",zIndex:1700}).insert(new Element("img",{src:"/img/loading45.gif",width:"45",height:"45",border:"0"})))}}},Head:{addScript:function(d){var c=$(document.getElementsByTagName("head")[0]);var a=c.getElementsByTagName("script");for(var b=0;b<a.length;b++){if(a[b].src.indexOf(d)!=-1){return}}c.insert(new Element("script",{type:"text/javascript",src:d,media:"screen"}))},addStylesheet:function(a){var c=$(document.getElementsByTagName("head")[0]);var d=c.getElementsByTagName("link");for(var b=0;b<d.length;b++){if(d[b].rel=="stylesheet"&&d[b].href.indexOf(a)!=-1){return}}c.insert(new Element("link",{rel:"stylesheet",type:"text/css",href:a}))}},AdQuestions:{TypeChange:function(b){var a=$(b);if(!$("containerDiv")){$(a.parentNode).insert(new Element("div",{id:"containerDiv"}))}switch(a.value){case"user":$("containerDiv").innerHTML="";break;case"tags":$("containerDiv").innerHTML=$("predefined_tags_container").innerHTML;break;case"maintags":$("containerDiv").innerHTML=$("predefined_main_tags_container").innerHTML;break}}},Facebook:{onLogin:function(){window.location.href="/facebook/connect/onlogin"},onPermissionChange:function(a){}},Hints:{remove:function(a){new Ajax.Request("/hint/builder/suppress",{parameters:{id:a}})},attach:function(c,a,b){switch(a){case"1":this.attachYellowBar(c,b);break;case"2":this.attachHiddenContainer(c,b);break}},attachHiddenContainer:function(d,b){var a=$("hhc_hidden");var c=$("hhc_close");if(a!=null){a.update(b);if(c!=null){c.onclick=function(){$(this).hide();$("hhc_hidden").hide();Starmind.Utilities.Hints.remove(d);return false};c.onmouseover=function(){$("hhc_hidden").className="transparent"};c.onmouseout=function(){$("hhc_hidden").className=""};c.show()}a.show()}},attachYellowBar:function(e,c){var a=$("ybh_container");var b=$("ybh_content");var d=$("ybh_close");if(a==null){a=new Element("div",{id:"ybh_container"});b=new Element("div",{id:"ybh_content","class":"center"});d=new Element("a",{id:"ybh_close",href:"#close-hint"}).update("x");a.insert(d);a.insert(b);a.setStyle({display:"none",top:$("smhead").getHeight()+"px"});$("mc100").insert({before:a})}d.onclick=function(){$("ybh_container").hide();Starmind.Utilities.Hints.remove(e);return false};d.onmouseover=function(){$("ybh_container").className="transparent"};d.onmouseout=function(){$("ybh_container").className=""};b.update(c);a.show()}},Tabs:{activate:function(c){$("sub_content").update(new Element("img",{src:"/img/loading45.gif",width:"45",height:"45",border:"0",alt:"..."}).setStyle({margin:"100px 0 0 "+($("sub_content").getWidth()/2-22)+"px"}));var a=$("tabs").getElementsByTagName("li");for(var b=0;b<a.length;b++){$(a[b]).className=""}$(c).parentNode.className="active";new Ajax.Updater("sub_content",$(c).href+"format/html/",{method:"get",evalScripts:true})}},Search:{Selector:function(a){var c=[];var b=[];var g=a.getToken();var f=0;for(var d=0;d<a.options.array.length&&c.length<a.options.choices;d++){var e=a.options.array[d];var h=a.options.ignoreCase?e.t.toLowerCase().indexOf(g.toLowerCase()):e.t.indexOf(g);while(h!=-1){if(h==0&&e.t.length!=g.length){c.push('<li id="'+e.l+'"><table><tr><td class="img"><img src="'+e.i+'"></td><td class="text"><strong>'+e.t.substr(0,g.length)+"</strong>"+e.t.substr(g.length)+"</td></tr></table></li>");break}else{if(g.length>=a.options.partialChars&&a.options.partialSearch&&h!=-1){if(a.options.fullSearch||/\s/.test(e.t.substr(h-1,1))){b.push('<li id="'+e.l+'"><table><tr><td class="img"><img src="'+e.i+'"></td><td class="text">'+e.t.substr(0,h)+"<strong>"+e.t.substr(h,g.length)+"</strong>"+e.t.substr(h+g.length)+"</td></tr></table></li>");break}}}h=a.options.ignoreCase?e.t.toLowerCase().indexOf(g.toLowerCase(),h+1):e.t.indexOf(g,h+1)}}if(b.length){c=c.concat(b.slice(0,a.options.choices-c.length))}return"<ul>"+c.join("")+"</ul>"}}};