function space(str){return str.replace(/-/g,' ');}
function unspace(str){return str.replace(/ /g,'-');}
function unspacePlus(str){return str.replace(/ /g,'+');}
var rollerx='<div class="loadimg"><img src="/scripts/images/roller.gif" /></div>';var rollerx_mini='<div class="loadimg"><img src="/scripts/images/roller_mini.gif" /></div>';var fooz=new Date;var unixtime=parseInt(fooz.getTime()/1000);var unixtimex=unixtime+60*60*24*30;var domain_exp=document.domain.split('.');function tand(str){return str.replace(/&/g,'#-#').replace(/\+/g,'#piu#');}
function untand(str){return str.replace(/#-#/g,'&');}
function in_array(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}}
function evento(tit,text){if($('#evento').length==0){$('body').append('<div id="evento"><div id="evento_close" class="curvultra">X</div><div id="evento_tit"></div><div id="evento_text"></div></div>');$('#evento_close').click(function(){$('#evento').animate({bottom:-130},600);});}
$('#evento_tit').html(tit);$('#evento_text').html(text);$('#evento').fadeTo(0,0.9).animate({bottom:35},600);$.timer(20000,function(){$('#evento').animate({bottom:-130},600);});}
function setcok(nome,valore,expi){if(expi==null){expi=365;}
$.cookie(nome,valore,{expires:expi,path:'/',domain:'.'+domain_exp[domain_exp.length-2]+'.'+domain_exp[domain_exp.length-1]});}
function textSize(plumin){if(plumin==2){sizeFo=14;$('.ico-norm').addClass('hide');}
else{sizeFo=parseInt($('.sizable').css('font-size'));if(plumin==0){sizeFo--;}else if(plumin==1){sizeFo++;}
$('.ico-norm').removeClass('hide');}
if(sizeFo>10&&sizeFo<19){$('.sizable').css('font-size',sizeFo);setcok('textsize',sizeFo);}}
$(document).ready(function(){$('.focusx').live('focusin',function(){if($(this).val()==$(this).attr('rel')){$(this).val('');}}).live('focusout',function(){if($(this).val()==""){$(this).val($(this).attr('rel'));}});$("a[rel='colorbox']").colorbox({photo:true,maxHeight:'100%',maxWidth:'100%',current:''});$.ajaxSetup({type:'POST'});$('.tip').tipsy({live:true,gravity:$.fn.tipsy.autoNS});$('.tip_west').tipsy({gravity:'w'});$('.hidex').hide().removeClass('hidex');if($('.box_tabs').length!=0){$('.box_tabs .box_titolo').each(function(e,ele){$(ele).click(function(){$(this).parent().children('.act').removeClass('act');$(this).addClass('act');artoz=$(this).parent().children('.box_bottom').children();$(artoz).not($(artoz).eq(e)).addClass('hide');$(artoz).eq(e).removeClass('hide');arto=$(this).parent().children('.box_tabs_content').children();$(arto).not($(arto).eq(e)).stop().fadeOut(400,function(){$(arto).eq(e).stop().fadeIn(400);});});});}
if($('.nobody').length==0){var rwall=Math.floor(19*Math.random());$('body').css('background','url(/img/wallpapers/wall_'+rwall+'.jpg) no-repeat #FFF top center fixed');}
if($('#poll_options input').length!=0){$('#poll_options input').click(function(){option_id=$(this).val();poll_id=$('#poll_options').attr('rel');divParent=$('#poll_options').parent();$(divParent).html(rollerx);$.ajax({url:'http://'+location.hostname+'/survey/vote',data:'format=json&poll_id='+poll_id+'&option_id='+option_id,success:function(data){$(divParent).html(data);}});});}
$('a[href*=#]').not('.noscroll').click(function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname){var $target=$(this.hash);$target=$target.length&&$target||$('[name='+this.hash.slice(1)+']');if($target.length){var targetOffset=$target.offset().top;$('html,body').animate({scrollTop:targetOffset},1500);return false;}}});$('#atag, #pulstag').click(function(e){e.preventDefault();logybox(5,'&info='+$(this).attr('rel'));});$('.gotoreg').click(function(e){e.stopPropagation();$('#registrati .logreg_puls').trigger('click');});$('#social_statistiche').click(function(){logybox(1);});if($('#completa').length!=0){$('#completa a.avert').click(function(){if($('#completa table tr').length>1){$(this).parent().parent().remove();ape=Math.round(parseInt($('#completa_perc > div').attr('style').substr(7,2))+(100/12))+'%';$('#completa_perc > div').css('width',ape).html(ape);}
else{$('#completa > div').fadeTo(400,0,function(){$(this).html('<div class="pady" align="center"><span class="tbig">Complimenti!</span><br />Hai completato l\'esplorazione.<br /><br /><span class="tmed">Adesso divertiti più che puoi nel mondo <strong>Gamempire</strong>!</span></div>').fadeTo(400,1);});}
$.ajax({url:'http://'+location.hostname+'/index/user-exploration',data:'format=json&setting_name='+$(this).attr('rel')});});}
if($('.notallowed_anonymous').length!=0){$('.notallowed_anonymous').click(function(e){e.preventDefault();logybox('alert','Devi essere registrato per poter accedere a questa funzione');return false;});}
switch(domain_exp[domain_exp.length-2]){case'findempire':pub_google="UA-5204385-5";break;case'rankempire':pub_google="UA-5204385-6";break;case'gamempire':default:pub_google="UA-5204385-1";break;}
window._gaq=window._gaq||[];window._gaq.push(['_setAccount',pub_google]);});$(window).bind("load",function(){if($('#wrapper').length!=0){pos=$('#wrapper').position();newPos=$(window).height()-(pos.top+$(document.body).height())-16;if(newPos>0){$('#content > div').animate({'padding-bottom':newPos},1000);}}});
