var msg_div=$('.msg');$('<div id="close-msg"><a href="" class="btn btn-del">X</a></div>').click(function(){msg_div.slideUp(150,function(){msg_div.remove()});return false;}).appendTo(msg_div);msg_div.slideDown(400,function(){window.setTimeout(function(){msg_div.slideUp(400,function(){msg_div.remove();});},5000);});if(!Array.prototype.map)
{Array.prototype.map=function(fun)
{var len=this.length>>>0;if(typeof fun!="function")
throw new TypeError();var res=new Array(len);var thisp=arguments[1];for(var i=0;i<len;i++)
{if(i in this)
res[i]=fun.call(thisp,this[i],i,this);}
return res;};}
if(!Array.prototype.filter)
{Array.prototype.filter=function(fun)
{var len=this.length>>>0;if(typeof fun!="function")
throw new TypeError();var res=[];var thisp=arguments[1];for(var i=0;i<len;i++)
{if(i in this)
{var val=this[i];if(fun.call(thisp,val,i,this))
res.push(val);}}
return res;};}
if(!Array.prototype.some)
{Array.prototype.some=function(fun)
{var i=0,len=this.length>>>0;if(typeof fun!="function")
throw new TypeError();var thisp=arguments[1];for(;i<len;i++)
{if(i in this&&fun.call(thisp,this[i],i,this))
return true;}
return false;};}
$(document).ajaxError(function(e,xhr,settings,exception){gygo_log("AJAX call failed, debugging information follows:");gygo_log(e);gygo_log(xhr);gygo_log(settings);gygo_log(exception);});$(document).ajaxStart(function(){$('body').css('cursor','wait');}).ajaxStop(function(){$('body').css('cursor','default');});function gygo_log(message){if(typeof console!='undefined'&&typeof console.log=='function'){console.log(message);}}
function gygo_unstable(){alert("Hmm, we have got a little confused! It's time to reload your browser, otherwise you might lose your work :(");}
function gygo_random_scores(overwrite){$('.results-lhs input, .results-rhs input, .score-input').val(function(){if(!overwrite&&$(this).val())return $(this).val();var s;var r=Math.random();if(r<0.125){s=0;}
else if(r<0.45){s=1;}
else if(r<0.65){s=2;}
else if(r<0.85){s=3;}
else if(r<0.92){s=4;}
else if(r<0.96){s=5;}
else if(r<0.98){s=6;}
else{s=7;}
return s;});}
function uuid(){var uuid=[],chars=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];for(var i=0;i<36;i++){var c;if(i==8||i==13||i==18||i==23){uuid.push('-');}
else if(i==14){uuid.push('4');}
else{c=0|Math.random()*16;if(i==19)c=(c&0x3)|0x8;uuid.push(chars[c]);}}
return uuid.join('');}
function name2slug(name){return name.toLowerCase().replace(/[^a-z0-9-]+/g,'').replace(/-+/g,'-').substring(0,35);}
var is_fast_browser=false;if(navigator){if(typeof(navigator.userAgent)=='string'){if(navigator.userAgent.toLowerCase().indexOf('chrome')>-1){is_fast_browser=true;}}}
jQuery.extend(jQuery.easing,{snapBack:function(x,t,b,c,d){return c*(t/=d)*t+b;}});var $top_menu_ul=$('#top-rhs-menu ul');$('#top-rhs-menu-target > a').click(function(){if($top_menu_ul.is(':visible')){$top_menu_ul.hide();}
else{$top_menu_ul.show();$(document).one('click',function(){$top_menu_ul.hide();});}
return false;});
