function ajaxjq(jurl,jdiv){
$j.ajax({
    type: 'get',
    url: jurl,
    success: function(data, textStatus, XMLHttpRequest){
        $j("#"+jdiv).html(data);
    },
    error:function (xhr, ajaxOptions, thrownError){
		switch(xhr.status){
			case 404: errmxt='file non trovato';break;
			case 500: errmxt='errore interno del Server';break;
			case 400: errmxt='rischiesta non valida';break;
			case 401: errmxt='utente non autorizzato';break;
			case 404: errmxt='file non trovato';break;
			case 500: errmxt='errore interno del server';break;
			case 502: errmxt='gateway non valido';break;
			case 503: errmxt='servizio non disponibile';break;
			case 504: errmxt='gateway timeout';break;
			case 509: errmxt='limite di banda superato';break;
			default: errmxt='sconosciuto';
		}
		var msg = 'Errore '+ xhr.status + ' (' + errmxt + ').<br><a href="javascript:void(0)" onclick="ajaxjq(\''+jurl+'\',\''+jdiv+'\')" title="ricarica">Clicca qui</a> per riprovare.';
		$j("#"+jdiv).html(msg);
    }
});
}
var bustcachevar=1;var loadedobjects="";var rootdomain="http://"+window.location.hostname;var bustcacheparameter="";
function loadpage(page_request,containerid){if(page_request.readyState==4&&(page_request.status==200||window.location.href.indexOf("http")==-1))document.getElementById(containerid).innerHTML=page_request.responseText;}
function ajaxpage(url, containerid){if (typeof jQuery != 'undefined') {ajaxjq(url,containerid)}else{var page_request = false;if(window.XMLHttpRequest)page_request=new XMLHttpRequest();else if(window.ActiveXObject){try{page_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{page_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}else return false;page_request.onreadystatechange=function(){loadpage(page_request,containerid);};if(bustcachevar)bustcacheparameter=(url.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime();page_request.open('GET',url+bustcacheparameter,true);page_request.send(null)}}
//-----------//
function pre1(){
$j("#tdlibdati").fadeOut(50,function(){
	vedihg();
});
accorlib();
arrotimg('full');
jQuery("#formx").validationEngine('attach', {promptPosition : "bottomLeft"});
jQuery("#ricse").validationEngine('attach', {promptPosition : "topLeft"});
$j("#mainmenu").tabs();
}
function pre2(){
var $tabs = $j('#mainmenu').tabs();
$j('#my-text-link').click(function(){
   $tabs.tabs('select',0);
   return false;
});
feed('T');
}
function pre3(von){
var tdl='opacity';
if(von==1){
	tdl='';
}
if(cercaCookie("risoluzione")==null || cercaCookie("risoluzione")<950){
	$j('#lofslidecontent45').lofJSidernews({auto:false,interval:7000,direction:tdl,isPreloaded:false,maxItemDisplay:4,navigatorHeight:75,navigatorWidth:230,duration:1000,easing:'easeInOutSine'});$j("#sortable").sortable({axis:'y',handle:'img:.icdra',update:function(event,ui){var result=$j('#sortable').sortable('toArray');aggarrbox(result)}});
}
else{
	$j('#lofslidecontent45').lofJSidernews({auto:false,interval:7000,direction:tdl,isPreloaded:false,maxItemDisplay:4,navigatorHeight:75,navigatorWidth:310,duration:1000,easing:'easeInOutSine'});$j("#sortable").sortable({axis:'y',handle:'img:.icdra',update:function(event,ui){var result=$j('#sortable').sortable('toArray');aggarrbox(result)}});
}
}
function pre4(){
$j(window).bind("load", function() {
	if(document.getElementById("buttaltez1").value==null || !esiste('buttaltez1')){
		if(esiste('hidaltz1')){
			var atzmn=document.getElementById("hidaltz1").value;
		}
	}
	else{
		var atzmn=document.getElementById("buttaltez1").value;
	}
	adatta(atzmn);
});
}
function cercaCookie(xname){var xnameEQ=xname+"=";var xca=document.cookie.split(';');for(var xi=0;xi<xca.length;xi++){var xc=xca[xi];while(xc.charAt(0)==' ')xc=xc.substring(1,xc.length);if(xc.indexOf(xnameEQ)==0)return xc.substring(xnameEQ.length,xc.length)}return null}
function deflibox(){
	return 'li_lib__li_eve__li_not__li_ine__li_ric__li_voc__li_fee__li_cas__li_vet__li_gio';
}
function remoround(rcld){
var fgclk=' '+rcld +' ';
fgclk=fgclk.replace(" rounded ", "");
fgclk=fgclk.replace(/^\s+|\s+$/g,"");
fgclk=' '+fgclk;
return fgclk;
}
function arrotimg(iai){
if (iai!='full'){
	if(esiste(iai)){
		var idia='#'+iai;
		var spctrn='span_'+iai;
		if(!esiste(spctrn)){
			$j(idia).wrap(function() {
			var oldclasssfull=$j(this).attr('class');
			var oldclass=remoround(oldclasssfull);
			return '<span id="span_'+iai+'" style="background-image:url(' + $j(this).attr('src') + '); height: '+ $j(this).height() + 'px; width: '+ $j(this).width() + 'px;" class="roundimg'+oldclass+'">';
			});
		}
	}
	else{
		arrottax(iai);
	}
}
else{
	$j('img.rounded').wrap(function() {
	var oldclasssfull=$j(this).attr('class');
	var oldclass=remoround(oldclasssfull);
	return '<span id="span_' + $j(this).attr('id') + '" style="background-image:url(' + $j(this).attr('src') + '); height: '+ $j(this).height() + 'px; width: '+ $j(this).width() + 'px;" class="roundimg'+oldclass+'">';
	});
}
}
function arrottax(tipbv){
arr=setInterval( function() { arrottay(tipbv); }, 700 );
}
function arrottay(tipr){
if(esiste(tipr)){
	window.clearInterval(arr);
	arrotimg(tipr);
}
}
function accorlib(){
var hjknvf=$j('#titolo_libro').html();
var cophnk=hjknvf;
var mxlgc=42;
if(cercaCookie("risoluzione")==null || cercaCookie("risoluzione")<950){
	mxlgc=31;
}
else if(cercaCookie("risoluzione")==950){
	mxlgc=35;
}
var cmxlgc=mxlgc-3;
if(hjknvf.length>mxlgc){
   cophnk=cophnk.substr(0,cmxlgc)+"…";
}
$j('#titolo_libro').html(cophnk);
}/*
function tweet(ntw){
if(screen.width){
	var vvsr=screen.width;
}
else{
	var vvsr=770;
}
var testixncv='Messagio di prova';
var txurhnj='twe'+'et.p'+'hp?nms='+ntw+'&ris='+vvsr;
$j.get(txurhnj, function(dataj){
	testixncv=dataj;
	if(dataj!=0){//alert(data);
		$j("#aprimenu").hide(50,function(){
			$j('#buttvertip').after('<input id="hidnumtwe" type="hidden" value="0"><input id="blocktwe" type="hidden" value="0"><div id="hidtwtxt"></div><input id="hidnotip" type="hidden" value="0">');
			tweetmsg(ntw,testixncv);
		});
	}
});
}*/
function tweetmsg(exm,txo){
var oktwsx=document.getElementById("blocktwe").value;//tot tweet
var minmintwi=document.getElementById("hidmintwrea").value;
if(oktwsx==0){
	var numxtw=5;
	if(minmintwi<numxtw){
		numxtw=minmintwi;
	}
	var mxartw=numxtw-1;
	var cvbghl=document.getElementById("hidnumtwe").value;
	var exm2=cvbghl;
	if(exm=='suc'){//succ
		if(cvbghl==mxartw || txo==0){
			exm2=0;
		}
		else{
			exm2++;
		}
	}
	else{//prec
		if(cvbghl==0){
			exm2=mxartw;
		}
		else{
			exm2--;
		}
	}
	var dvcrc1='#hidtwtxt'+exm2;
	var dvcrc2='#hidtwdat'+exm2;
	var txtftw=$j(dvcrc1).html();
	var datatwe=$j(dvcrc2).html();
	$j("#twnum").html(exm2+1);
	$j("#divtweet").html(twurl(txtftw));
	$j("#tweetdata").html(datatwe);
	document.getElementById("hidnumtwe").value=exm2;
}
}
function tweetnew(trf,err,idt){
var numxtw=5;
if (esiste('blocktwe')){document.getElementById("blocktwe").value=1;}
if (esiste('divtweet')){$j("#divtweet").html('<div align="center"><img src="images/caricamento.gif" alt="caricamento" title="caricamento" class="icentr"><br>Aggiornamento tweet in corso...</div>');}
if(trf=='ref'){/*
	$j.jTwitter('jQueryHowto', 1, function(posts){//primo
		var txtftw=posts[0].text;
		var datatwe=getTweetTime(posts[0].created_at);
		document.getElementById("twnum").innerHTML=1;
		document.getElementById("divtweet").innerHTML=txtftw;
		document.getElementById("tweetdata").innerHTML=datatwe;
		document.getElementById("hidnumtwe").value=0;
		tweetagg(trf,numxtw);
	});*/
	$j.ajax({
    url: 'http://twitter.com/status/user_timeline/'+idt+'.json?count=5&callback=?',
    dataType: 'jsonp',
    success: function(data) {
		var countweet=data.length;
		if(countweet>=1){
			var vfdkjg=document.getElementById("intertweerr").value;
			if(vfdkjg==1){
				window.clearInterval(twreer);
			}
			var txtftw=twurl(data[0].text);
			var datatwe=getTweetTime(data[0].created_at);
			$j("#twnum").html(1);
			$j("#divtweet").html(txtftw);
			$j("#tweetdata").html(datatwe);
			$j("hidnumtwe").value=0;
			tweetagg(trf,numxtw,idt);
		}
		else{//errore
			var txtftw=tweeterr(1,idt);
			var datatwe=tweeterr(2,idt);
			$j("#twnum").html(1);
			$j("#divtweet").html(txtftw);
			$j("#tweetdata").html(datatwe);
			document.getElementById("hidnumtwe").value=0;
			document.getElementById("blocktwe").value=1;
			var vfdkjg=document.getElementById("intertweerr").value;
			tweetimer(30);
			if(vfdkjg==0){
				document.getElementById("intertweerr").value=1;
				twreer=setInterval( function() { tweetnew('ref',0,idt); }, 30000 );
			}
		}
    },
       error: function(){ 
			var txtftw=tweeterr(1,idt);
			var datatwe=tweeterr(2,idt);
			$j("#twnum").html(1);
			$j("#divtweet").html(txtftw);
			$j("#tweetdata").html(datatwe);
			document.getElementById("hidnumtwe").value=0;
			document.getElementById("blocktwe").value=1;
			var vfdkjg=document.getElementById("intertweerr").value;
			tweetimer(30);
			if(vfdkjg==0){
				document.getElementById("intertweerr").value=1;
				twreer=setInterval( function() { tweetnew('ref',0,idt); }, 30000 );
			}
         }
    });
}
else{//primo caricamento
	if(screen.width){
		var vvsr=screen.width;
	}
	else{
		var vvsr=770;
	}
	var testixncv='Messagio di prova';
	var txurhnj='twe'+'et.p'+'hp?nms=1&ris='+vvsr;
	var getrhnj=$j.get(txurhnj, function(dataj){
		if(dataj!=0){//alert(data);
			var txo=dataj;
			$j("#aprimenu").hide(50,function(){
				if(err=='ok' || err==0 || err==10){
					$j('#buttvertip').after('<div id="hidtwtall"><input type="hidden" id="hidmintwrea" value="0"><input id="hidnumtwe" type="hidden" value="0"><input id="intertweerr" type="hidden" value="0"><input id="intertweagg" type="hidden" value="0"><input id="blocktwe" type="hidden" value="0"><input id="hidnotip" type="hidden" value="0"></div>');
				}
				/*
				$j.jTwitter('jQueryHowto', 1, function(posts){//primo
					var txtftw=posts[0].text;
					var datatwe=getTweetTime(posts[0].created_at);
					txo=txo.replace("x_tweet_max_x",numxtw);
					txo=txo.replace("x_tweet_txt_x",txtftw);
					txo=txo.replace("x_tweet_dat_x",datatwe);
					$j('#tdcolsx').validationEngine('showPrompt', txo, 'twit', 'topLeft', false);
					tweetagg(trf,numxtw,txtftw,datatwe);
				});*/
				$j.ajax({
    				url: 'http://twitter.com/status/user_timeline/'+idt+'.json?count=5&callback=?',
    				dataType: 'jsonp',
    				success: function(data) {
						var countweet=data.length;
						if(countweet>=1){
							if(numxtw>countweet){
								numxtw=countweet;
							}
							document.getElementById("hidmintwrea").value=countweet;
							
							var txtftw=twurl(data[0].text);
							var datatwe=getTweetTime(data[0].created_at);
							txo=txo.replace("x_tweet_max_x",numxtw);
							txo=txo.replace("x_tweet_txt_x",txtftw);
							txo=txo.replace("x_tweet_dat_x",datatwe);
							if(err=='ok' || err==0 || err==10){
								$j('#tdcolsx').validationEngine('showPrompt', txo, 'twit', 'topLeft', false);
							}
							else{//reload x primo caricamento senza esito
								$j("#twnum").html(1);
								$j("#divtweet").html(txtftw);
								$j("#tweetdata").html(datatwe);
								document.getElementById("hidnumtwe").value=0;
							}
							tweetagg(trf,numxtw,idt);
						}
						else{//errore
							var jkbcnk=document.getElementById("intertweerr").value;
							if(jkbcnk==0){//primo errore
								if(err==10){//evito caricamento box
									$j("#hidtwtall").remove();
									var ghjks=document.getElementById("buttvertip").value;
									if(!esiste('hidnotip')){
										ghjks=0;
									}
									if(!esiste('valtip_tdcolsx') && ghjks==0 && nomenu()){//suggerimenti
										promsh();
									}
								}
								else{
									var txtftw=tweeterr(1,idt);
									var datatwe=tweeterr(2,idt);
									txo=txo.replace("x_tweet_max_x",numxtw);
									txo=txo.replace("x_tweet_txt_x",txtftw);
									txo=txo.replace("x_tweet_dat_x",datatwe);
									document.getElementById("blocktwe").value=1;
									$j('#tdcolsx').validationEngine('showPrompt', txo, 'twit', 'topLeft', false);
									tweetimer(30);
									document.getElementById("intertweerr").value=1;
									twreer=setInterval( function() { tweetnew('ref',0,idt); },30000 );
								}
							}
							else{//ancora errore
								
							}							
						}
    				},
       				error: function(){ 
						$j("#hidtwtall").remove();
						var ghjks=document.getElementById("buttvertip").value;
						if(!esiste('hidnotip')){
							ghjks=0;
						}
						if(!esiste('valtip_tdcolsx') && ghjks==0 && nomenu()){//suggerimenti
							promsh();
						}
         			}
    			});

			});
		}
	});
	getrhnj.error(function(){//errore caricamento
		errconn();
	});
}
}
function tweetagg(tgd,mxd,twi){/*
$j.jTwitter('jQueryHowto', mxd, function(posts){
	var ddgxc='';
	var txtftw='';
	var datatwe='';
	if(tgd=='ref'){//aggiornamento
		for(idx=0;idx<mxd;idx++){
			txtftw=posts[idx].text;
			datatwe=getTweetTime(posts[idx].created_at);
			var dvcrc1='hidtwtxt'+exm2;
			var dvcrc2='hidtwdat'+exm2;
			document.getElementById(dvcrc1).innerHTML=txtftw;
			document.getElementById(dvcrc2).innerHTML=datatwe;
		}
		document.getElementById("hidnumtwe").value=0;
	}
	else{
		for(idx=0;idx<mxd;idx++){//nuovo
			txtftw=posts[idx].text;
			datatwe=getTweetTime(posts[idx].created_at);
			ddgxc=ddgxc+'<div id="hidtwtxt'+idx+'">'+txtftw+'</div><div id="hidtwdat'+idx+'">'+datatwe+'</div>';
		}
		$j('#buttvertip').after(ddgxc);
		document.getElementById("hidnumtwe").value=0;
		twrefr=setInterval( function() { tweetagg('ref'); }, 17000 );
	}
	if (esiste('blocktwe')){document.getElementById("blocktwe").value=0;}
});*/
$j.ajax({
	url: 'http://twitter.com/status/user_timeline/'+twi+'.json?count=5&callback=?',
    dataType: 'jsonp',
    success: function(data) {
		var ddgxc='';
		var txtftw='';
		var datatwe='';
		var countweet=data.length;
		if(countweet>=1){
			if(mxd>countweet){
				mxd=countweet;
			}
			if(tgd=='ref'){//aggiornamento
				for(idx=0;idx<mxd;idx++){
					txtftw=data[idx].text;
					datatwe=getTweetTime(data[idx].created_at);
					var dvcrc1='#hidtwtxt'+idx;
					var dvcrc2='#hidtwdat'+idx;
					$j(dvcrc1).html(txtftw);
					$j(dvcrc2).html(datatwe);
				}
				document.getElementById("hidnumtwe").value=0;
			}
			else{
				for(idx=0;idx<mxd;idx++){//nuovo
					txtftw=data[idx].text;
					datatwe=getTweetTime(data[idx].created_at);
					ddgxc=ddgxc+'<div id="hidtwtxt'+idx+'">'+txtftw+'</div><div id="hidtwdat'+idx+'">'+datatwe+'</div>';
				}
				ddgxc='<div id="hidtwtxtall">'+ddgxc+'</div>';
				$j('#buttvertip').after(ddgxc);
				document.getElementById("hidnumtwe").value=0;
				document.getElementById("intertweagg").value=1;
				var timeaggtw=120000;//tempo di update automatico
				twrefr=setInterval(function(){tweetnew('ref','ok',twi)},timeaggtw);
			}
			if (esiste('blocktwe')){document.getElementById("blocktwe").value=0;}
		}
		else{//errore
			
		}
    },
    error: function(){ 
		var txtftw=tweeterr(0,twi);
		var datatwe=tweeterr(2,twi);
		$j("#twnum").html(1);
		$j("#divtweet").html(txtftw);
		$j("#tweetdata").html(datatwe);
		document.getElementById("hidnumtwe").value=0;
		document.getElementById("blocktwe").value=1;
    }
});
}
function errconn(ter){
var testixncv='<table width="100%" cellpadding="0" cellspacing="0" class="tabse point"><tr><td height="98" align="center"><div style="padding-left:10px;padding-right:10px;"><img src="images/icona_avviso.png" alt="avviso" title="avviso" style="margin-bottom:5px"><br><div align="left">Errore di connessione.<br>Clicca su questo riquadro per chiuderlo.</div></div></td></tr></table>';
$j('#tdcolsx').validationEngine('showPrompt', testixncv, 'val', 'topLeft', false);
if(ter==1){
	$j('#valtip_tdcolsx').click(function() {
		$j("#aprimenu").fadeIn('slow');
	});
}
}
function retweetnew(vb,gj){
	tweetnew(vb,gj);
}
function tweeterr(tex,gid){
if(tex<=1){//txt
	var ttdrc=' (riconnessione automatica tra <span id="sectwerr"></span> secondi)';
	if(tex==0){
		ttdrc='';
	}
	var cxcj='Errore di connessione'+ttdrc+'.<br><div align="center"><a href="javascript:closetwit(0,\''+gid+'\')" title="riprova">Riconnetti</a></div>';
}
else{//data
	var cxcj='poco fa';
}
return cxcj;
}
function tweetimer(sec){
var milis=0; 
var secon=sec+2 ;
timerr(milis,secon);
}
function timerr(milisec,seconds){
 if (milisec<=0){ 
    milisec=9;
    seconds-=1; 
 } 
 if (seconds<=-1){ 
    milisec=0;
    seconds+=1;
 } 
 else {
    milisec-=1 ;
	if(esiste('sectwerr')){
		$j('#sectwerr').html(seconds); 
    	setTimeout( function() { timerr(milisec,seconds); },100)
	}
	else{
		clearTimeout();
	}
}
}
function closetwit(tjk,ntw){
$j("#valtip_tdcolsx").fadeOut(100, function() {
	var txhgfj=document.getElementById("intertweagg").value;
	var txhsnk=document.getElementById("intertweerr").value;
	if(txhgfj==1){window.clearInterval(twrefr);}
	if(txhsnk==1){window.clearInterval(twreer);}
	$j("#valtip_tdcolsx").remove();
	$j("#hidtwtxtall").remove();
	if(tjk!=null){
		if(tjk!=0){//chiusura + apertura menu
			$j("#aprimenu").fadeIn('slow');
			if(esiste('intertweerr')){
				var vfdkjg=document.getElementById("intertweerr").value;
				if(vfdkjg==1){
					window.clearInterval(twreer);
				}
			}
		}
		else{
			if(ntw!=null){
				tweetnew('new',0,ntw);
			}
		}
	}
	else{//chiusura totale
		if(esiste('intertweerr')){
			var vfdkjg=document.getElementById("intertweerr").value;
			if(vfdkjg==1){
				window.clearInterval(twreer);
			}
		}
	}
});
}
function notweet(caon){if(caon=="cancel"){settaCookie('notweet','attivo',-1);window.location.reload()}else{nobox('notweet',90)}}
function noevent(cavn){if(cavn=="cancel"){settaCookie('no_eventi','attivo',-1);window.location.reload()}else{nobox('no_eventi',90)}}
var browstweet = function() {
    var ua = navigator.userAgent;
    return {
    	ie: ua.match(/MSIE\s([^;]*)/)
    };
}();
function twurl(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
text=text.replace(exp,'<a href="$1" target="new">$1</a>'); 
text=text.replace(/\s+#/gi, " ");
text=text.replace(/\W#/gi, "");
return text.replace(/\s*#/gi,' ');
}
function getTweetTime(dateString) {
var rightNow = new Date();
var then = new Date(dateString);
if (browstweet.ie) {
	// IE can't parse these crazy Ruby dates
	then = Date.parse(dateString.replace(/( \+)/, ' UTC$1'));
}
var diff = rightNow - then;
var second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24,
week = day * 7;
if (isNaN(diff) || diff < 0) {
	return ""; // return blank string if unknown
}
if (diff < second * 2) {
	// within 2 seconds
	return "adesso";
}
if (diff < minute) {
	return Math.floor(diff / second) + " secondi fa";
	}
if (diff < minute * 2) {
	return "1 minuto fa";
	}
if (diff < hour) {
	return Math.floor(diff / minute) + " minuti fa";
	}
if (diff < hour * 2) {
	return "1 ora fa";
	}
if (diff < day) {
	return  Math.floor(diff / hour) + " ore fa";
	}
if (diff > day && diff < day * 2) {
	return "ieri";
	}
if (diff < day * 365) {
	return Math.floor(diff / day) + " giorni fa";
	}
else {
	return "oltre 1 anno fa";
}
}
function showhidden(){
var shddnxc=$j('#hidvals').html();
alert(shddnxc);
}
function mostraevento(){
/*
var mmu='min'+'imen'+'u.p'+'hp';
var mmu2=mmu+'?t=eve';
ajaxpage(mmu2, 'tabs-2');
*/
$j("#valtip_tdcolsx").remove();
var testixncv='Messagio di prova';
var txurhnj='min'+'imenu.p'+'hp?t=eve&pop=1';
var getfghj=$j.get(txurhnj, function(dataj){
	testixncv=dataj;
	if(dataj!=0){//alert(data);
		$j("#aprimenu").hide(50,function(){
			$j('#tdcolsx').validationEngine('showPrompt', testixncv, 'eve', 'topLeft', false);
			$j('#buttvertip').after('<input id="hidnotip" type="hidden" value="0">');
		});
	}
});
getfghj.error(function(){//errore caricamento
	errconn(1);
});
}
function prompris(prs){
$j("#valtip_tdcolsx").remove();
var testixncv='Messagio di prova';
var txurhnj='tip'+'s.p'+'hp?nms=1&ris='+prs;
var getgghj=$j.get(txurhnj, function(dataj){
	testixncv=dataj;
	if(dataj!=0){//alert(data);
		$j("#aprimenu").hide(50,function(){
			$j('#tdcolsx').validationEngine('showPrompt', testixncv, 'pass', 'topLeft', false);
			$j('#buttvertip').after('<input id="hidnotip" type="hidden" value="0">');
		});
	}
});
getgghj.error(function(){//errore caricamento
	errconn(1);
});
}
function promsh(ndp){
//chiudi aperti
$j("#valtip_tdcolsx").remove();
var testixvcv='Messagio di prova';
var txurhvj='tip'+'s.p'+'hp?nms=1';
if(ndp!=null){
	txurhvj=txurhvj+'&hmt='+ndp;
}
var getdpkj=$j.get(txurhvj, function(datav){
	testixvcv=datav;
	if(datav!=0){
		$j("#aprimenu").hide(50,function(){
			$j('#tdcolsx').validationEngine('showPrompt', testixvcv, 'pass', 'topLeft', false);
			$j('#buttvertip').after('<input id="hidnotip" type="hidden" value="0">');
		});
	}
});
getdpkj.error(function(){//errore caricamento
	errconn(1);
});
}
function promshow(){
$j("#aprimenu").hide(50,function(){
	$j("#valtip_tdcolsx").remove();
	promhome();
	});
}
function promhome(){
var testixcv='Messagio di prova';
var txurhj='tip'+'s.p'+'hp?nms=1&home=1';
var geteemkl=$j.get(txurhj, function(data){
	testixcv=data;
	if(data!=0){
		$j('#tdcolsx').validationEngine('showPrompt', testixcv, 'pass', 'topLeft', false);
		$j('#buttvertip').after('<input id="hidnotip" type="hidden" value="0">');
	}
});
geteemkl.error(function(){//errore caricamento
	errconn(1);
});
}
function promshre(nfg){
if(nfg!=""){
	$j("#valtip_tdcolsx").fadeOut(50,function(){
		promsh(nfg);
			});
}
else{
	$j("#valtip_tdcolsx").fadeOut(50,function(){
		promsh();
	});
}
}
function closetip(){
$j("#valtip_tdcolsx").fadeOut(100, function() {
	$j("#valtip_tdcolsx").remove();
	$j("#aprimenu").fadeIn('slow');
});
}
function hidepr(np){
var nckxdf='notip'+np;
$j("#valtip_tdcolsx").fadeOut(100,function(){
	settaCookie(nckxdf,'attivo',90);
	$j("#valtip_tdcolsx").remove();
	$j("#aprimenu").fadeIn('slow');
});
}
function zeromenu(){
var $tabs = $j('#mainmenu').tabs();
$tabs.tabs('select', 0);
}
function mostramenu(numvb,zsug){
	if(numvb!='all'){
		var $tabs = $j('#mainmenu').tabs();
		$tabs.tabs('select',numvb);
		if(zsug!=null){
			verifmenu(2,0,2,0,0,1);
		}
		else{
			verifmenu(2,0,2,0,0);
		}
	}
	else{
		verifmenu(2,0,2,0,0,1);
	}
	$j('#aprimenu').fadeOut(100,function(){
		$j('#mainmenu').fadeIn('slow');
	});
}
function chiudimenu(){
	$j('#mainmenu').fadeOut(100,function(){
		$j('#aprimenu').fadeIn('slow');
		verifmenu(2,0,2,0,0,1);
	});
}
function color(thisdiv,tipcol){
var codcolor='#CAF0FF';
if (tipcol!=null){
	switch(tipcol){
	case "blu"://blu
		codcolor='#CAF0FF';
		break
	case "gr1"://grigio scuro
		codcolor='#E4E4E4';
		break
	case "gr2"://grigio chiaro
		codcolor='#F0F0F0';
		break
	case "gr3"://grigio bott
		codcolor='#D6D6D6';
		break
	case "pin"://rosa
		codcolor='#FFCAF4';
		break
	case "whi"://bianco
		codcolor='#FFFFFF';
		break
	case "yel"://giallo
		codcolor='#E3F277';
		break
	}
}
thisdiv.style.backgroundColor=codcolor;
}
function decolor(thisdivs){
thisdivs.style.backgroundColor='#E5E5E5';
}
function register(){
var dovpgrsk="uten"+"ti/iscriz"+"ione.p"+"hp";
location.href=dovpgrsk;
}
function login(){
$j('#loginout').fadeOut(100);
$j('#sidebar_search').fadeOut(100,function(){
	$j('#formx').fadeIn('slow');
});
}
function delogin(){
$j('#formx').fadeOut(100,function(){
	$j('#sidebar_search').fadeIn('slow');
	$j('#loginout').fadeIn('slow');
});
}
function controlris(){
if (window.screen){
	var verarisyx=window.screen.width;
}
else{
	var verarisyx=770;
}
if (cercaCookie("risoluzione") != null){
	var cookrisyx=cercaCookie("risoluzione");
}
else{
	var cookrisyx=700;
	var nomcookrisyx='Piccola';
}
if(cookrisyx==1200){
	var nomcookrisyx='Grande';
}
else if(cookrisyx==950){
	var nomcookrisyx='Media';
}
if(verarisyx>=950){
	if(verarisyx>=1200){
		pixerisyx=1200;
		var nomerisyx='Grande';
	}
	else {
		pixerisyx=950;
		var nomerisyx='Media';
	}
}
else {
	pixerisyx=770;
	var nomerisyx='Piccola';
}
if(pixerisyx!=cookrisyx){
	return 'err_'+cookrisyx+'_'+nomcookrisyx+'_'+pixerisyx+'_'+nomerisyx;
}
else{
	return 'ok_'+cookrisyx+'_'+pixerisyx+'_'+nomerisyx;
}
}
function correggi(){void(0);}
function ignora(){void(0);}
function nomess(idcookie,giorni){if(giorni){var durata=giorni}else{var durata=30}var r=confirm("Eliminare questo avviso?\nSe sì, il messaggio non sarà visualizzato per "+durata+" giorni.\nPotrai ripristinare il box andando nella sezione \"PREFERENZE\" del sito accessibile all'indirizzo www.bracegirdle.it/preferenze.php.");if(r==true){settaCookie(idcookie,'attivo',durata);window.location.reload()}}
function nobox(idcookie,giorni){if(giorni){var durata=giorni}else{var durata=30}var r=confirm("Eliminare questo riquadro?\nSe sì, il box non sarà visualizzato per "+durata+" giorni.\nPotrai ripristinare il riquadro andando nella sezione \"PREFERENZE\" del sito accessibile all'indirizzo www.bracegirdle.it/preferenze.php.");if(r==true){settaCookie(idcookie,'attivo',durata);window.location.reload()}}
function scriviris(sdarry){
var myArrDas=sdarry.split('_');
var provacsrisx=myArrDas[0];
var cookeenrisx=myArrDas[1];
var nomcookrisx=myArrDas[2];
var screenrisx=myArrDas[3];
var nomscreenrisx=myArrDas[4];
if(provacsrisx=='err'){
	var navinbra1='in <strong>www.bracegirdle.it</strong> ';
	var navinbra2=' per il tuo schermo';
	var ignortext=' oppure <a href="javascript:ignora()" title="ignora" onclick="nomess(\'nodialris\',90)">ignora</a>';
	if(cercaCookie("nodialris") != null){
		ignortext='';
	}
	if(cercaCookie("risoluzione")==null || cercaCookie("risoluzione")<950){
		navinbra1='';
		navinbra2='';
	}
	var htdivris='<div class="divris">La tua risoluzione di navigazione '+navinbra1+'<u>non è quella ottimale</u>'+navinbra2+'.<br><a href="javascript:correggi()" title="correggi" onclick="settaCookie(\'risoluzione\','+screenrisx+',365);window.location.reload();">Clicca qui</a> per correggere le impostazioni'+ignortext+'.';
	if(cercaCookie("tempris")!=null){//risol. provv.
		htdivris='<div class="divris">Risoluzione ottimale memorizzata. <br><a href="javascript:correggi()" title="correggi" onclick="window.location.reload()">Clicca qui</a> per utilizzare la nuova impostazione.';
	}
}
else{
	var htdivris='<div class="divris">La tua risoluzione di navigazione in <strong>www.bracegirdle.it</strong> è quella ottimale per le dimensioni del tuo schermo.</div>';
}
$j('#tabs-3').html(htdivris);
}
function scrividisp(nfyt){
if(nfyt==0){
	var txhmsd='<div class="divaggbox">Disposizione box predefinita.<br>Puoi personalizzarla spostando i singoli box e salvando le impostazioni.</div>';
}
else{
	var txhmsd='<div class="divaggbox">Disposizione box personalizzata.<br>Clicca sul pulsante per ripristinare la disposizone predefinita.<br><div align="center"><input type="button" class="point" value=" Ripristina " title="ripristina" onclick="restbox()"></div></div>';
}
$j('#tabs-1').html(txhmsd);
}
function libri(supr,nlsp,maxlt){
document.getElementById("buttlibnum").value=nlsp;
var homy2='http://www.brace'+'girdle.it/';
var esty2='.php';
var dvlbtx=homy2+'minibox'+esty2+'?tab=libri&action=desc';
var dvlbtt=homy2+'minibox'+esty2+'?tab=libri&action=tit1';
if(!esiste('hidbutlib')){
	$j('#buttlibesp').after('<input id="hidbutlib" type="hidden" value="0">');
	document.getElementById("buttlibesp").value=0;
	var gfjlibl=0;
}
else{
	var gfjlibl=document.getElementById("buttlibesp").value;
}
var aadggj='&sel='+supr+'&nmc='+nlsp+'&hb='+gfjlibl;
dvlbtx=dvlbtx+aadggj;
dvlbtt=dvlbtt+aadggj;
ajaxpage(dvlbtx,'desc_libri');
ajaxpage(dvlbtt,'tit_libri');
var nltkj=nlsp;
if(supr=='prec'){
	nltkj--;
	if(nlsp==1){
		nltkj=maxlt;
	}
}
else{
	nltkj++;
	if(nlsp==maxlt){
		nltkj=1;
	}
}
var jkkj='img_lib_tolk_'+nltkj;
arrotimg(jkkj);
}
function restbox(){
settaCookie('homebox',365,-1);
window.location.reload();
}
function scrivieve(){
var mmu='min'+'imen'+'u.p'+'hp';
var mmu2=mmu+'?t=eve';
ajaxpage(mmu2, 'tabs-2');
}
function scrivibrow(){
var mmu='brows'+'er_hom'+'e.p'+'hp';
var mmu2=mmu+'?t=brw';
ajaxpage(mmu2, 'tabs-4');
}
function msgavv(qdb,vex){
var mmu='brows'+'er_hom'+'e.p'+'hp';
if(vex!=null){
	var mmu2=mmu+'?t=msg&tbr='+qdb+'&texpl='+vex;
}
else{
	var mmu2=mmu+'?t=msg&tbr='+qdb+'&texpl=100';
}
ajaxpage(mmu2, 'msgavv');
$j('#msgavvdiv').slideDown('slow');
}
function chiudimsg(){
var $tabs = $j('#mainmenu').tabs();
var sechjkl=document.getElementById("buttsectab").value;
if(sechjkl>0){//alert(sechjkl);
	$tabs.tabs('select', sechjkl);
}
}
function verifmenu(az1,az2,az3,az4,tipaz,sug){
var ghjki='az1: ['+az1+'] az2: ['+az2+'] az3: ['+az3+'] az4: ['+az4+'] tipaz: ['+tipaz+'] sug: ['+sug+']';//alert(ghjki);
var simenu=0;
var menuidtab=0;
var menuidtab2=0;
if(az1>=1){//box
	if (cercaCookie("homebox") != null){
		var cookdispboox=cercaCookie("homebox");
		var defaultdispbox=deflibox();
		if(cookdispboox!=defaultdispbox){
			var scvds=1;
		}
		else{
			var scvds=0;
		}
	}
	else{
		var scvds=0;
	}
	if(!esiste('hidmodbox')){
		scrividisp(scvds);
	}
}
if (az2>=1){//eventi
	scrivieve();
	if(az2>=2){
		if(cercaCookie("no_eventi") == null){
			simenu=1;
			menuidtab=1;
		}
		menuidtab2=menuidtab2+'_'+menuidtab;
	}
}
if (az3>=1){//risoluzione
	var arrisolxn=controlris();
	scriviris(arrisolxn);
	if (erroris(arrisolxn) && cercaCookie("nodialris") == null){//errore ris
		simenu=1;
		menuidtab=2;
		menuidtab2=menuidtab2+'_'+menuidtab;
	}
}
if (az4>=1){//browser
	scrivibrow();
	if(az4>=2 && az4<3 && cercaCookie("no_ie_comp") == null){//IEcomp
		$j('#buttvertip').after('<input type="hidden" id="hidmsgavvtab" value="0">');
		var jcjarrn='IE'+az4;
		var ArrbjiDas=jcjarrn.split('.');
		var versziec=ArrbjiDas[1];
		msgavv(2,versziec);
		simenu=1;
		menuidtab=3;
		menuidtab2=menuidtab2+'_'+menuidtab;
	}
	else if(az4==3 && cercaCookie("no_ie_old") == null){
		$j('#buttvertip').after('<input type="hidden" id="hidmsgavvtab" value="0">');
		msgavv(3);
		simenu=1;
		menuidtab=3;
		menuidtab2=menuidtab2+'_'+menuidtab;
	}
}
if (simenu==1 && tipaz==1){
	var $tabs = $j('#mainmenu').tabs();
	$tabs.tabs('select',menuidtab);
	var arrjkld=menuidtab2.split('_');
	var totavjd=menuidtab2.split('_').length;
	if(totavjd>=3){
		var finmenufg=arrjkld[totavjd-2];finmenufg++;
		document.getElementById("buttsectab").value=finmenufg;
	}
	if(cercaCookie("risoluzione")!=null){
		if(menuidtab==1){//eventi
			mostraevento();
		}
		else{//alert('all');
			mostramenu('all');
		}
	}
	else{
		settaris();
	}
}
else{//tips
	var ghjks=document.getElementById("buttvertip").value;
	if(!esiste('hidnotip')){
		ghjks=0;
	}
	if(!esiste('valtip_tdcolsx') && ghjks==0 && sug==null && !esiste('hidmsgavvtab') && nomenu()){
		if(cercaCookie("risoluzione")==null){
			settaris();
		}
		else{
			if(cercaCookie("notweet")==null){
				tweetnew('new',10,'bracegirdle_it');
			}
			else{
				promsh();
			}
		}
	}
}
}
function nomenu(){
if(document.getElementById("mainmenu").style.display=="none"){
	return true;
}
else if(document.getElementById("mainmenu").style.display!="block" && $j('#mainmenu').hasClass('dispno')){
	return true;
}
else{
	return false
}
}
function cerca(){
scroll(0,0);
if (document.ricse) {
	document.ricse.q.focus();
}
}
function settaris(){
if (window.screen){
	var scrisxx=window.screen.width;
}
else{
	var scrisxx=770;
}
if(scrisxx>=950){
	if(scrisxx>=1200){
		var appscrix=1200;
	}
	else {
		var appscrix=950;
	}
}
else {
	var appscrix=770;
}
settaCookie('tempris',appscrix,1);
prompris(appscrix);
}
function erroris(arrdavf){
var myArrRis=arrdavf.split('_');
var procssx=myArrRis[0];
if(procssx=='err'){
	return true;
}
else{
	return false;
}
}
function IsNumeric(sText){var ValidChars="0123456789";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1){IsNumber=false}}return IsNumber}
function aggarrbox(arrboxdiv){
var totcoo='';
for (var iax=0; iax<arrboxdiv.length; iax++) {
	if (iax==arrboxdiv.length-1){
   		totcoo=totcoo+arrboxdiv[iax];
	}
	else{
   		totcoo=totcoo+arrboxdiv[iax]+'__';
	}
}
if (cercaCookie("homebox") != null){
	var defadivbox=cercaCookie("homebox");
}
else{
	var defadivbox=deflibox();
}
if(totcoo==defadivbox){
	var addsemodif='';
	var addsemodif='<div class="divaggbox">Disposizione box predefinita.<br>Puoi personalizzarla spostando i singoli box e salvando le impostazioni.</div>';
	var totcoo2=addsemodif;
	$j('#tabs-1').html(totcoo2);
	$j("#valtip_tdcolsx").fadeOut(50, function(){
		$j("#valtip_tdcolsx").remove();
		mostramenu(0,0);
	});
}
else{
	var pulssimem=' memorizza ';
	var pulsnomem=' non memorizzare ';
	if(cercaCookie("risoluzione")==null || cercaCookie("risoluzione")<950){
		pulssimem=' sì ';
		pulsnomem=' no ';
	}
	var addsemodif='<div class="divaggbox"><input type="hidden" id="hidmodbox" value="'+totcoo+'">Disposizione dei box modificata.<br>Vuoi memorizzare la nuova disposizione?<br><div align="center"><input type="button" class="point" value="'+pulssimem+'" title="memorizza" onclick="memorybox(\''+totcoo+'\')"> <input type="button" class="point" value="'+pulsnomem+'" title="non memorizzare" onclick="nomemorybox()"></div></div>';
	var totcoo2=addsemodif;
	$j('#tabs-1').html(totcoo2);
	$j("#valtip_tdcolsx").fadeOut(50, function(){
		$j("#valtip_tdcolsx").remove();
		mostramenu(0,0);
	});
}
var $tabs = $j('#mainmenu').tabs();
$tabs.tabs('select', 0);
if(!esiste('valtip_tdcolsx')){
	$j('#aprimenu').fadeOut(100,function(){
		$j('#mainmenu').fadeIn('slow');
		closetip();
		closetwit();
	});
}
}
function login1(id_name){document.getElementById(id_name).className = 'login1 point';}
function login2(id_name){document.getElementById(id_name).className = 'login2 point';}
function memorybox(tipcoobo){
	if(tipcoobo==deflibox()){
		var tempccokb=-1;
	}
	else{
		var tempccokb=365;
	}
	var valcoobox=document.getElementById('hidmodbox').value;
	settaCookie('homebox',valcoobox,tempccokb);
	$j('#tabs-1').html('<div class="divaggbox">Scelta memorizzata.</div>');
}
function nomemorybox(){
$j('#tabs-1').html('<div class="divaggbox">Disposizione non modificata.</div>');
}
function settaCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()}else{var expires=""}document.cookie=name+"="+value+expires+"; path=/"}
function settaltz(pixitdaz){
	document.getElementById("buttaltez2").value=pixitdaz;
}
function vedihg(){
var sdfsdfdf=document.getElementById("mainagg").offsetHeight;
sdfsdfdf=sdfsdfdf+'px';
document.getElementById("buttaltez1").value=sdfsdfdf;
$j('#buttaltez1').after('<input type="hidden" value="'+sdfsdfdf+'" id="hidaltz1">');
}
function espandi(){
	var althgd=document.getElementById("buttaltez1").value;
	document.getElementById("mainagg").style.height=althgd;
}
function espalibro(){
if(!esiste('hidbutlib')){
	$j('#buttlibesp').after('<input id="hidbutlib" type="hidden" value="0">');
	document.getElementById("buttlibesp").value=0;
	var ifesplib=0;
}
else{
	var ifesplib=document.getElementById("buttlibesp").value;
}
if(ifesplib==0){
	$j('#tdlibdati').fadeIn(50,function(){
	document.getElementById("buttlibesp").value=1;
	$j('#tspanlib').html('Nascondi informazioni');
	document.getElementById("spanlib").title='Nascondi informazioni';
});
}
else{
	$j('#tdlibdati').fadeOut(50,function(){
	document.getElementById("buttlibesp").value=0;
	$j('#tspanlib').html('Ulteriori informazioni');
	document.getElementById("spanlib").title='Ulteriori informazioni';
});
}
adatta();
}
function oldaggio(){
	var ifconthj=document.getElementById("buttaltez3").value;
	var blocaltz=document.getElementById("buttaltez2").value;
	if(ifconthj==0){
		espandi();
		document.getElementById("buttaltez3").value=1;
		$j('#retbottm').html('<span class="buttoldagg point" onClick="oldaggio()" onMouseOver="color(this)" onMouseOut="color(this,\'gr3\')" title="riduci">Riduci</span>');
	}
	else{
		document.getElementById("mainagg").style.height=blocaltz;
		document.getElementById("buttaltez3").value=0;
		$j('#retbottm').html('<span class="buttoldagg point" onClick="oldaggio()" onMouseOver="color(this)" onMouseOut="color(this,\'gr3\')" title="altri aggiornamenti">Mostra tutto</span>');
	}
$j('#buttaltez3').after('<input type="hidden" value="0" id="hidaltz3">');
}
function adattax(){
txc=setInterval("adattay()",700);
}
function adattay(){
var jkjliuy=document.getElementById("sortable").offsetHeight;
var nuovaltezpxy=jkjliuy-354;
var jkjliuy2=document.getElementById("tdsxmenu").offsetHeight;
jkjliuy2=jkjliuy2-42;
if(jkjliuy2>nuovaltezpxy){
	nuovaltezpxy=jkjliuy2;
}
nuovaltezpxy=nuovaltezpxy+'px';
var vecchaltz=document.getElementById("mainagg").style.height;
if(vecchaltz==nuovaltezpxy){
	window.clearInterval(txc);
}
else{
	adatta();
}
}
function adatta(numpixi){
var ifhidalx=document.getElementById("buttaltez3").value;
if(!esiste('hidaltz3')){
	ifhidalx=0;
}
if(ifhidalx==0){//div vecchi aggiornamenti non espanso
	if(numpixi==null){
		//origaltz=document.getElementById("buttaltez").value;
	}
	else{
		var origaltz=numpixi+"px";
		settaltz(origaltz);
	}
	var jkjliu=document.getElementById("sortable").offsetHeight;
	var nuovaltezpx=jkjliu-354;
	var jkjliu2=document.getElementById("tdsxmenu").offsetHeight;
	jkjliu2=jkjliu2-42;
	if(jkjliu2>nuovaltezpx){
		nuovaltezpx=jkjliu2;
	}
	document.getElementById("buttaltez2").value=nuovaltezpx+"px";
	document.getElementById("mainagg").style.height=nuovaltezpx+"px";
	if(numpixi!=null){
		adattax();
	}

}
}
function oldagg(numag){
var ahup=document.getElementById("oldupd");
if(numag=='full'){
   ahup.setAttribute("href","javascript:oldagg('min')");
   document.getElementById("contagg").style.overflow="visible";
}
else{
   ahup.setAttribute("href","javascript:oldagg('full')");
   document.getElementById("contagg").style.overflow="hidden";
}
}
function ifnselect(arsc){
var urscl='http://www.goo'+'gle.com/uds/module'+'s/elements/newsshow/if'+'rame.html?rsz=large&format=300x250&ned=it&hl=it&q='+arsc+'&element=true';
theifr=document.getElementById("ifnews");
theifr.setAttribute("src",urscl);
}
function esiste(oggetto){if(document.getElementById(oggetto)!=null){return true}else{return false}}
function feed(sito){
$j('#tolkien_feed').html('<img src="images/caricamento.gif" alt="caricamento" title="caricamento" class="icentr">');
var tijk='fe';
var urlfeedx='http://';
switch (sito)
{
case "T":
  urlfeedx=urlfeedx+'feeds.feedburner.com/TolkienLibrary';
  urlsitx='http://www.tolkienlibrary.com/';
	break
case "Tolkien Library":
  urlfeedx=urlfeedx+'feeds.feedburner.com/TolkienLibrary';
  urlsitx='http://www.tolkienlibrary.com/';
	break
case "ArsT":
  urlfeedx=urlfeedx+'www.jrrtolkien.it/?feed=rss2';
  urlsitx='http://www.jrrtolkien.it/';
	break
case "Eldamar":
  urlfeedx=urlfeedx+'eldamar.wordpress.com/feed/';
  urlsitx='http://eldamar.wordpress.com/';
	break
case "TheOneRing.net":
  urlfeedx=urlfeedx+'www.theonering.net/torwp/feed/';
  urlsitx='http://www.theonering.net/';
	break
case "Tolkien News":
  urlfeedx=urlfeedx+'www.tolkien-online.com/Tolkien.xml';
  urlsitx='http://www.tolkien-online.com/';
	break
case "topix":
  urlfeedx=urlfeedx+'www.topix.com/rss/who/j-r-r-tolkien';
  urlsitx='http://www.topix.com/';
	break
case "Eldalie.it":
  urlfeedx=urlfeedx+'www.eldalie.it/agenda.rss.php';
  urlsitx='http://www.eldalie.it/';
	break
}
var vcfx=tijk+'ed.p'+'hp?feed='+urlfeedx;
ajaxpage(vcfx, 'tolkien_feed');
var thetfe=document.getElementById("afee");
thetfe.setAttribute("href",urlsitx);
}
function getRandomInt (minint, maxint) {
    return Math.floor(Math.random() * (maxint - minint + 1)) + minint;
}
function vai(urljk,roojk,tipjk) {
if(roojk==0){
	var dovjk="http://www.bra"+"cegird"+"le.it";
}
else{
	//var dovjk='http://';
	urljk=urljk.replace("&","__ecomm__");
	var dovjk='http://www.bra'+'cegird'+'le.it/'+'vai.p'+'hp?c=1&t=1&home=1&u=';
}
if(tipjk==0){
	location.href=dovjk+urljk;
}
else{
	url=window.open('','url');
	url.location.href=dovjk + urljk;
}
}
function impris (value) {
	var name='risoluzione';
	var days=1000;
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function appris(pxris){
	impris(pxris);
}
function mostratab(tabid,act1,act2,act3,contabo){
	var homw2='http://www.bracegirdle.it/';
	var estp2='.php';
	var divtit='tit_'+tabid;
	var divdesc='desc_'+tabid;
	var divbott='bott_'+tabid;
	if (act1!=1){
		var blocx1=0;
		var blocx2=0;
		var blocx3=0;
		var vaibox3=homw2+'minibox'+estp2+'?tab='+tabid+'&home=2';//titolo 'new'
		var vaibox5=homw2+'minibox'+estp2+'?tab='+tabid+'&home=4';//contenuto 'new'
		if (tabid=='preferenze'){
			vaibox5=homw2+'tab'+estp2+'?tab='+tabid+'&home=4&ris='+screen.width;
		}
		else {
			if(act2==0){//restart box
				vaibox3=homw2+'minibox'+estp2+'?tab='+tabid+'&action=tit1';
				vaibox5=homw2+'minibox'+estp2+'?tab='+tabid+'&action=desc';
				var vaibox6=homw2+'minibox'+estp2+'?tab='+tabid+'&action=bott1';
				if(tabid=='casu' || tabid=='vetrina'){
					if(act3>=0){
						var nrancs=getRandomInt(1,act3);
						vaibox5=vaibox5+'&nmc='+nrancs;
						vaibox6=vaibox6+'&nmc='+nrancs;
					}
				}
			}
			else{//primo caricamento bottone 'new'
				var vaibox6=homw2+'minibox'+estp2+'?tab='+tabid+'&action=bott2';
			}
		}
		//esclusioni
		if(tabid=='inelab' || tabid=='casu' || tabid=='vetrina'){
			blocx1=1;
		}
		else if(tabid=='ultric' || tabid=='ultvoc' || tabid=='giorno' || tabid=='stats'){
			blocx1=1;
			blocx3=1;
		}
		else if(tabid=='libri'){
			document.getElementById("buttlibnum").value=1;
			if(!esiste('hidbutlib')){
				$j('#buttlibesp').after('<input id="hidbutlib" type="hidden" value="0">');
				document.getElementById("buttlibesp").value=0;
				var vhdcmn=0;
			}
			else{
				var vhdcmn=document.getElementById("buttlibesp").value;
			}
			vaibox5=vaibox5+'&hb='+vhdcmn;
			blocx3=1;
		}
		if(blocx3==0){//bottone
			ajaxpage(vaibox6,divbott);
		}
		if (blocx1==0){//titolo
			ajaxpage(vaibox3,divtit);
		}
		if (blocx2==0){//contenuto
			ajaxpage(vaibox5,divdesc);
		}
	}
	else {
		if (act3==1 || act3==2){
			var vaibox2=homw2+'tab'+estp2+'?tab='+tabid+'&action='+act2+'&do='+act3+'&count='+contabo;
			ajaxpage(vaibox2,divdesc);
		}
		else{
			var vaibox2=homw2+'tab'+estp2+'?tab='+tabid+'&action='+act2;
			if (tabid=='preferenze'){
				vaibox2=homw2+'tab'+estp2+'?tab='+tabid+'&action='+act2+'&ris='+screen.width;
			}
			else if(tabid=='eventi'){
				vaibox2=homw2+'minibox'+estp2+'?tab='+tabid+'&action=1&vai='+act2;
				var vaibox22=homw2+'minibox'+estp2+'?tab='+tabid+'&action=1&mese=1&vai='+act2;
				ajaxpage(vaibox22,divtit);
			}
			ajaxpage(vaibox2,divdesc);
		}
	}
	if(tabid=='libri'){
		arrotimg('img_lib_tolk_1');
	}
	else if (tabid=='casu'){
		var jklsn='img_doc_cas_'+nrancs;
		arrotimg(jklsn);
	}
adattax();
}
function tab(cosa,oper1,oper2,oper3,conto) {
var homw='http://www.bracegirdle.it/';
var estp='.php';
var divxdesc='desc_'+cosa;
if(cosa=='eventi'){
	if(oper1==0){
		if (oper2==null){//comando da evento
			document.getElementById('boxeventi').style.height='260px';
			document.getElementById('boxeventi').style.minHeight='260px';
		}
		else if(oper2==0){//comando da calendario
			document.getElementById('boxeventi').style.height='160px';
			document.getElementById('boxeventi').style.minHeight='160px';
		}
	}
}
$j('#'+divxdesc).html('<img src="images/caricamento.gif" alt="caricamento" title="caricamento" class="icentr">');
if (cosa==0){
	if(oper1==0){
		mostravetrina(0,0);
	}
}
else{
	mostratab(cosa,oper1,oper2,oper3,conto);
}
}
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});
/* Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 // JavaScript Document
/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 * 
 * Requires: 1.2.2+
 */
(function($) {
var types = ['DOMMouseScroll', 'mousewheel'];
$.event.special.mousewheel = {
	setup: function() {
		if ( this.addEventListener )
			for ( var i=types.length; i; )
				this.addEventListener( types[--i], handler, false );
		else
			this.onmousewheel = handler;
	},
	teardown: function() {
		if ( this.removeEventListener )
			for ( var i=types.length; i; )
				this.removeEventListener( types[--i], handler, false );
		else
			this.onmousewheel = null;
	}
};
$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});
function handler(event) {
	var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
	event = $.event.fix(event || window.event);
	event.type = "mousewheel";
	if ( event.wheelDelta ) delta = event.wheelDelta/120;
	if ( event.detail     ) delta = -event.detail/3;
	// Add events and delta to the front of the arguments
	args.unshift(event, delta);
	return $.event.handle.apply(this, args);
}
})(jQuery);
/**
 * @version		$Id:  $Revision
 * @package		jquery
 * @subpackage	lofslidernews
 * @copyright	Copyright (C) JAN 2010 LandOfCoder.com <@emai:landofcoder@gmail.com>. All rights reserved.
 * @website     http://landofcoder.com
 * @license		This plugin is dual-licensed under the GNU General Public License and the MIT License 
 */
// JavaScript Document
(function($) {
	 $.fn.lofJSidernews = function( settings ) {
	 	return this.each(function() {
			// get instance of the lofSiderNew.
			new  $.lofSidernews( this, settings ); 
		});
 	 }
	 $.lofSidernews = function( obj, settings ){
		this.settings = {
			direction	    	: '',
			mainItemSelector    : 'li',
			navInnerSelector	: 'ul',
			navSelector  		: 'li' ,
			navigatorEvent		: 'click',
			wapperSelector: 	'.lof-main-wapper',
			interval	  	 	: 4000,
			auto			    : true, // whether to automatic play the slideshow
			maxItemDisplay	 	: 3,
			startItem			: 0,
			navPosition			: 'vertical', 
			navigatorHeight		: 100,
			navigatorWidth		: 310,
			duration			: 600,
			navItemsSelector    : '.lof-navigator li',
			navOuterSelector    : '.lof-navigator-outer' ,
			isPreloaded			: true,
			easing				: 'easeInOutQuad'
		}	
		$.extend( this.settings, settings ||{} );	
		this.nextNo         = null;
		this.previousNo     = null;
		this.maxWidth  = this.settings.mainWidth || 600;
		this.wrapper = $( obj ).find( this.settings.wapperSelector );	
		this.slides = this.wrapper.find( this.settings.mainItemSelector );
		if( !this.wrapper.length || !this.slides.length ) return ;
		// set width of wapper
		if( this.settings.maxItemDisplay > this.slides.length ){
			this.settings.maxItemDisplay = this.slides.length;	
		}
		this.currentNo      = isNaN(this.settings.startItem)||this.settings.startItem > this.slides.length?0:this.settings.startItem;
		this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector );	
		this.navigatorItems = $( obj ).find( this.settings.navItemsSelector ) ;
		this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector );
		if( this.settings.navPosition == 'horizontal' ){ 
			this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth );
			this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth );
			this.navigatorOuter.height(	this.settings.navigatorHeight );
		} else {
			this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight );	
			this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight );
			this.navigatorOuter.width(	this.settings.navigatorWidth );
		}		
		this.navigratorStep = this.__getPositionMode( this.settings.navPosition );		
		this.directionMode = this.__getDirectionMode();  
		if( this.settings.direction == 'opacity') {
			this.wrapper.addClass( 'lof-opacity' );
			$(this.slides).css('opacity',0).eq(this.currentNo).css('opacity',1);
		} else { 
			this.wrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':( this.maxWidth ) * this.slides.length } );
		}
		if( this.settings.isPreloaded ) {
			this.preLoadImage( this.onComplete );
		} else {
			this.onComplete();
		}
	 }
     $.lofSidernews.fn =  $.lofSidernews.prototype;
     $.lofSidernews.fn.extend =  $.lofSidernews.extend = $.extend;
	 $.lofSidernews.fn.extend({
		startUp:function( obj, wrapper ) {
			seft = this;
			this.navigatorItems.each( function(index, item ){
				$(item).click( function(){
					seft.jumping( index, true );
					seft.setNavActive( index, item );					
				} );
				$(item).css( {'height': seft.settings.navigatorHeight, 'width':  seft.settings.navigatorWidth} );
			})
			this.registerWheelHandler( this.navigatorOuter, this );
			this.setNavActive(this.currentNo );
			if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){
				this.registerButtonsControl( 'click', this.settings.buttons, this );
			}
			if( this.settings.auto ) 
			this.play( this.settings.interval,'next', true );
			return this;
		},
		onComplete:function(){
			setTimeout( function(){ $('.preload').fadeOut( 900 ); }, 400 );	this.startUp( );
		},
		preLoadImage:function(  callback ){
			var self = this;
			var images = this.wrapper.find( 'img' );
	
			var count = 0;
			images.each( function(index,image){ 
				if( !image.complete ){				  
					image.onload =function(){
						count++;
						if( count >= images.length ){
							self.onComplete();
						}
					}
					image.onerror =function(){ 
						count++;
						if( count >= images.length ){
							self.onComplete();
						}	
					}
				}else {
					count++;
					if( count >= images.length ){
						self.onComplete();
					}	
				}
			} );
		},
		navivationAnimate:function( currentIndex ) { 
			if (currentIndex <= this.settings.startItem 
				|| currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) {
					this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2;
					if (this.settings.startItem < 0) this.settings.startItem = 0;
					if (this.settings.startItem >this.slides.length-this.settings.maxItemDisplay) {
						this.settings.startItem = this.slides.length-this.settings.maxItemDisplay;
					}
			}		
			this.navigatorInner.stop().animate( eval('({'+this.navigratorStep[0]+':-'+this.settings.startItem*this.navigratorStep[1]+'})'), 
												{duration:500, easing:'easeInOutQuad'} );	
		},
		setNavActive:function( index, item ){
			if( (this.navigatorItems) ){ 
				this.navigatorItems.removeClass( 'active' );
				$(this.navigatorItems.get(index)).addClass( 'active' );	
				this.navivationAnimate( this.currentNo );	
			}
		},
		__getPositionMode:function( position ){
			if(	position  == 'horizontal' ){
				return ['left', this.settings.navigatorWidth];
			}
			return ['top', this.settings.navigatorHeight];
		},
		__getDirectionMode:function(){
			switch( this.settings.direction ){
				case 'opacity': this.maxSize=0; return ['opacity','opacity'];
				default: this.maxSize=this.maxWidth; return ['left','width'];
			}
		},
		registerWheelHandler:function( element, obj ){ 
			 element.bind('mousewheel', function(event, delta ) {
				var dir = delta > 0 ? 'Up' : 'Down',
					vel = Math.abs(delta);
				if( delta > 0 ){
					obj.previous( true );
				} else {
					obj.next( true );
				}
				return false;
			});
		},
		registerButtonsControl:function( eventHandler, objects, self ){ 
			for( var action in objects ){ 
				switch (action.toString() ){
					case 'next':
						objects[action].click( function() { self.next( true) } );
						break;
					case 'previous':
						objects[action].click( function() { self.previous( true) } );
						break;
				}
			}
			return this;	
		},
		onProcessing:function( manual, start, end ){	 		
			this.previousNo = this.currentNo + (this.currentNo>0 ? -1 : this.slides.length-1);
			this.nextNo 	= this.currentNo + (this.currentNo < this.slides.length-1 ? 1 : 1- this.slides.length);				
			return this;
		},
		finishFx:function( manual ){
			if( manual ) this.stop();
			if( manual && this.settings.auto ){ 
				this.play( this.settings.interval,'next', true );
			}		
			this.setNavActive( this.currentNo );	
		},
		getObjectDirection:function( start, end ){
			return eval("({'"+this.directionMode[0]+"':-"+(this.currentNo*start)+"})");	
		},
		fxStart:function( index, obj, currentObj ){
				if( this.settings.direction == 'opacity' ) { 
					$(this.slides).stop().animate({opacity:0}, {duration: this.settings.duration, easing:this.settings.easing} );
					$(this.slides).eq(index).stop().animate( {opacity:1}, {duration: this.settings.duration, easing:this.settings.easing} );
				}else {
					this.wrapper.stop().animate( obj, {duration: this.settings.duration, easing:this.settings.easing} );
				}
			return this;
		},
		jumping:function( no, manual ){
			this.stop(); 
			if( this.currentNo == no ) return;		
			 var obj = eval("({'"+this.directionMode[0]+"':-"+(this.maxSize*no)+"})");
			this.onProcessing( null, manual, 0, this.maxSize )
				.fxStart( no, obj, this )
				.finishFx( manual );	
				this.currentNo  = no;
		},
		next:function( manual , item){

			this.currentNo += (this.currentNo < this.slides.length-1) ? 1 : (1 - this.slides.length);	
			this.onProcessing( item, manual, 0, this.maxSize )
				.fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
				.finishFx( manual );
		},
		previous:function( manual, item ){
			this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1;
			this.onProcessing( item, manual )
				.fxStart( this.currentNo, this.getObjectDirection(this.maxSize ), this )
				.finishFx( manual	);			
		},
		play:function( delay, direction, wait ){	
			this.stop(); 
			if(!wait){ this[direction](false); }
			var self  = this;
			this.isRun = setTimeout(function() { self[direction](true); }, delay);
		},
		stop:function(){ 
			if (this.isRun == null) return;
			clearTimeout(this.isRun);
            this.isRun = null; 
		}
	})
})(jQuery);
/*
 * jTwitter 1.1.1 - Twitter API abstraction plugin for jQuery
 * Copyright (c) 2009 jQuery Howto
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 * Plugin + Author URL:
 *   http://jquery-howto.blogspot.com
 */
(function(b){b.extend({jTwitter:function(d,a,c){if(!(d=="undefined"||a=="undefined")){if(b.isFunction(a)){c=a;a=5}b.getJSON("http://twitter.com/status/user_timeline/"+d+".json?count="+a+"&callback=?",function(e){b.isFunction(c)&&c.call(this,e)})}}})})(jQuery);
