
j=jQuery;window.alert=function(){};var included_files=new Array();var currentpage=window.location.href.split("/").pop();if(currentpage==""){currentpage="/index.htm";}
function include_once(script_filename){if(!in_array(script_filename,included_files)){included_files[included_files.length]=script_filename;var html_doc=document.getElementsByTagName('head').item(0);var js=document.createElement('script');js.setAttribute('language','javascript');js.setAttribute('type','text/javascript');js.setAttribute('src',script_filename);html_doc.appendChild(js);return false;}}
function in_array(needle,haystack){for(var i=0;i<haystack.length;i++){if(haystack[i]==needle){return true;}}
return false;}
function reqWin(desktopURL,alternateWidth,alternateHeight,noScrollbars)
{if((alternateWidth&&self.screen.availWidth*0.8<alternateWidth)||(alternateHeight&&self.screen.availHeight*0.8<alternateHeight))
{noScrollbars=false;alternateWidth=Math.min(alternateWidth,self.screen.availWidth*0.8);alternateHeight=Math.min(alternateHeight,self.screen.availHeight*0.8);}
else
noScrollbars=typeof(noScrollbars)!="undefined"&&noScrollbars==true;window.open(desktopURL,'requested_popup','toolbar=no,location=no,status=no,menubar=no,scrollbars='+(noScrollbars?'no':'yes')+',width='+(alternateWidth?alternateWidth:480)+',height='+(alternateHeight?alternateHeight:220)+',resizable=no');return false;}
var jGrowlm='<div class="top-right jGrowl" id="jGrowl"><div class="jGrowl-notification"></div><div style="display: block;" class="jGrowl-notification default"><div class="close"><a>×</a></div><div class=\"header\"></div><div class=\"message\" id=\"jGrowlmessage\"></div></div></div>';var jGrowlspeed=2000;jGrowl=function(msg,speed,easing,callback){if(!msg){msg="Undefined call to message. Please report to the administrator";}
if(speed)
{jGrowlspeed=speed;}else{jGrowlspeed=2000;}
j("div#jGrowlmessage").html(msg);return j("div.jGrowl").animate({opacity:'toggle'},speed,easing,callback);};j(document).ready(function(){j('div#content').after("<div id=\"innerContent\">");j('div#dynamicContent').prepend("</div>");j('#bottom').after(jGrowlm);j(".close").click(function(){j('.jGrowl').fadeOut(jGrowlspeed);});j('#dynamicContent img').error(function(){w=125;h=125;if(j(this).height()){h=j(this).height();w=h;}
else if(j(this).width()){w=j(this).width();h=w}
t=j(this).attr("title");if(!currentpage){currentpage=document.location.href;}
currentpage=encodeURI(currentpage);j(this).attr("src","/images/error.png").height(h).width(w).attr("title","Sorry for the inconvenience; this image is - for some unexpected reason - unavailable. You do not need to report the error; it is done automatically. ");j.get("/error.php?errormode=image&page="+currentpage+"&index="+j("#dynamicContent img").index(this)+"&t="+t);});j('.expand:has(h2, h3) ol, .expand:has(h2, h3) :eq(1)').slideUp(1000).parents('.message').prepend(j('<a href="#'+j('.expand:has(h2, h3)').attr("rel")+'" class="right arrow_link">Expand</a>').click(function(){j('.expand ol').slideToggle(1000);if(j(this).text()=="Expand"&&j('.expand ol').is(":hidden")){j(this).text("Shrink");}else{j(this).text("Expand");}}));if(j("#ytvideo").length>0){include_once("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js");include_once("/js/embed_youtube.js");}
j('span.text-reference').css("fontWeight","bold").hover(function(){j("#"+j(this).attr("rel")).css("backgroundColor","rgb(255,255,0)").css("backgroundColor","rgb(255,255,0, 0.8)");},function(){j("#"+j(this).attr("rel")).css("backgroundColor","");});j(".ssi_table").parent().before("<span id=\"error_notice\" style=\"color: rgb(255, 0, 0);\"></span>");j.getScript('/js/shareit.js');});function ajax_login(ajax_view){checkforchange=false;ajax_name=j.trim(j("#user").attr("value"));ajax_pass=j.trim(j("#passwrd").attr("value"));ajax_cookie="-1";if(ajax_name===""||ajax_pass===""||ajax_cookie===""){j('#news').slideUp(2000,function(){if(j("#error_notice").text()!="All form fields must be filled in to log in to Darren Beige."){j("#error_notice").text("All form fields must be filled in to log in to Darren Beige.");}
else{j("#error_notice").css("font-weight","bold");}
j("#news").slideDown(1000);});return true;}
j('#news').slideUp(2000,function(){j.ajax({type:"POST",url:"http://wonders-of-the-brain.co.uk/forum/index.htm?action=login2",data:"user="+ajax_name+"&passwrd="+ajax_pass+"&cookielength="+ajax_cookie+"&ajax=true&view="+ajax_view,success:function(){var time=new Date();j.get("/sidebar.php?ajax=login&view="+ajax_view+"&operaCacheBuster="+time.getTime(),function(data){j('#news').html(data);j('#news').slideDown(1000)})
checkforchange=true;},error:function(){j("#error_notice").text("The server is currently busy, and could not handle your request. Please wait a few minutes and try again.")
j('#news').slideDown(2000)}});})}
function ajax_logout(ajax_session,ajax_view){if(ajax_session==""){return false;}
j('#news').slideUp(1000);j.ajax({type:"GET",url:"http://wonders-of-the-brain.co.uk/forum/index.htm?action=logout;sesc="+ajax_session,success:function(){var time=new Date();j.get("/sidebar.php?ajax=logout&view="+ajax_view+"&operaCacheBuster="+time.getTime(),function(data){j('#news').html(data);j('#news').slideDown(1000)})}});}
var scrolltotop={setting:{startline:800,scrollto:0,scrollduration:1000,fadeduration:[500,100]},controlHTML:'<a href="#top" class="arrow_link">Return To Top of Page</a>',controlattrs:{offsetx:5,offsety:5},anchorkeyword:'#top',state:{isvisible:false,shouldvisible:false},scrollup:function(){if(!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto)
if(typeof dest=="string"&&j('#'+dest).length==1)
dest=j('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop:dest},this.setting.scrollduration);},keepfixed:function(){var $window=j(window)
var controlx=$window.scrollLeft()+$window.width()-this.$control.width()-this.controlattrs.offsetx
var controly=$window.scrollTop()+$window.height()-this.$control.height()-this.controlattrs.offsety
this.$control.css({left:controlx+'px',top:controly+'px'})},togglecontrol:function(){var scrolltop=j(window).scrollTop()
if(!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)?true:false
if(this.state.shouldvisible&&!this.state.isvisible){this.$control.stop().animate({opacity:1},this.setting.fadeduration[0])
this.state.isvisible=true}
else if(this.state.shouldvisible==false&&this.state.isvisible){this.$control.stop().animate({opacity:0},this.setting.fadeduration[1])
this.state.isvisible=false}},init:function(){j(document).ready(function($){var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws||iebrws&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest
mainobj.$body=(window.opera)?(document.compatMode=="CSS1Compat"?$('html'):$('body')):$('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>').css({position:mainobj.cssfixedsupport?'fixed':'absolute',bottom:mainobj.controlattrs.offsety,right:mainobj.controlattrs.offsetx,opacity:0,cursor:'pointer'}).click(function(){mainobj.scrollup();return false}).appendTo('body')
if(document.all&&!window.XMLHttpRequest&&mainobj.$control.text()!='')
mainobj.$control.css({width:mainobj.$control.width()})
mainobj.togglecontrol()
$(window).bind('scroll resize',function(e){mainobj.togglecontrol()})})}}
scrolltotop.init()