/*var title="";
var popupW="";
var popupH="";*/

function trasparenta(){
}

/*function sendToActionScript(value) {
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}else {
		return document[movieName]
	}
}

function setPopupBody(){
	if(NomeID != undefined){
		prendiElementoDaId('TB_ajaxContent').innerHTML='<div id="popupbody">'+JStext[NomeID]+'</div>';
		tb_init('#popupbody a.thickbox, #popupbody area.thickbox, #popupbody input.thickbox');
		trasparenta();
	}
}*/

function goPage(target, pag){
	window.open(target+pag,"_self");
}

function changepag(obj, page){
	var Ind= obj.selectedIndex;
	var Value= obj.options[Ind].value;
	goPage(page, Value);
}

/*function finder(){
	var Value= encodeURIComponent(trim(prendiElementoDaId('finder').value));
	goPage('http://elletretreti.it/cerca.php', Value);
}

function omissis_out(risultato){
	if(risultato!=""){
		//aggiunge i risultati nel div
		var splitted = risultato.split("[divisore]");
		for (var i=1; i<splitted.length; i++) {
			JStext[((JStext_starterLength*1)+((i*1)-1))]=splitted[i];
		}
		JStext_starterLength= JStext_starterLength+(splitted.length-1);
		var omissis= prendiElementoDaId('omissis');
		omissis.innerHTML="";
		omissis.className="";
		omissis.innerHTML=splitted[0];
		removeLoad();
		trasparenta();
		tb_init('#'+target+' a.thickbox, #'+target+' area.thickbox, #'+target+' input.thickbox');
	}else{
		//non c'e nessun risultato
		removeLoad();
		JStext[JStext_starterLength]="Non &egrave; stato trovato nessun nuovo articolo.";
		tb_show('Nessun Risultato', 'l33t/popup.htm?height=100&amp;width=300&amp;id='+JStext_starterLength, 'false');
	}
}*/

/*function login(){
	//tb_remove();
	var username= encodeURIComponent(trim(prendiElementoDaId('nikname').value));
	var password= encodeURIComponent(prendiElementoDaId('password').value);
	Shadowbox.close();
	if(username!="" && password!=""){
		AjaxDati("l33t/tools/setcookie.php", "username="+username+"&password="+password, "modif_out");
	}else{
		JStext[JStext_starterLength]="Completare i campi nickname e password correttamente.";
		tb_show('Errore', 'l33t/popup.htm?height=100&amp;width=300&amp;id='+JStext_starterLength, 'false');
	}
}*/

function logout(){
	AjaxDati("../../l33t/tools/removecookie.php", "", "modif_out");
}

function modif_out(risultato){
	if(risultato=="ok"){
		//ricarica la pagina
		location.reload();
	}else{
		//non e riuscito a settare il cookie
		removeLoad();
		Shadowbox.open({
	        content:    "<div style='padding-top:10px;padding-left:25px;padding-right:25px;text-align:center'>Impossibile effettuare l'operazione richiesta. Verifica che i dati siano corretti e riprova pi&ugrave; tardi.<br/>Se il problema persite contattare l'amministratore.</div>",
	        player:     "html",
	        title:      "Errore",
	        height:     100,
	        width:      300
	    });
	}
}

function AjaxDati(pagina, valori, out){
	setLoad();
	var log_ajax=assegnaXMLHttpRequest();
	if(log_ajax) {
		log_ajax.open("POST", pagina, true);
		log_ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		log_ajax.setRequestHeader("connection", "close");
		log_ajax.onreadystatechange = function() {
			if(log_ajax.readyState === readyState.COMPLETATO) {
				if(statusText[log_ajax.status] === "OK"){
					// operazione avvenuta con successo
					eval(out+"(log_ajax.responseText);");
				}else{
					// errore di caricamento
					removeLoad();
					Shadowbox.open({
				        content:    "<div style='padding-top:10px;padding-left:25px;padding-right:25px;text-align:center'>Impossibile effettuare l'operazione richiesta.<br />Errore riscontrato: "+statusText[log_ajax.status]+"<br/> Riprova pi&ugrave; tardi, se il problema persite contattare l'amministratore.</div>",
				        player:     "html",
				        title:      "Errore",
				        height:     100,
				        width:      300
				    });
				}
			} 
		}
		// invio richiesta (i parametri)
		log_ajax.send(valori);
	}
}

/*function feed_out(risultato){
	if(risultato=="ok"){
		//ricarica la pagina
		removeLoad();
		JStext[JStext_starterLength]="L'operazione &egrave; avvenuta con successo.<br/>Le tue preferenze sono state salvate e il tuo Feed &egrave; gi&agrave; stato aggiornato.";
		tb_show('Conferma', 'l33t/popup.htm?height=100&amp;width=300&amp;id='+JStext_starterLength, 'false');
	}else{
		//non e riuscito a settare il cookie
		removeLoad();
		JStext[JStext_starterLength]=risultato;
		tb_show('Errore', 'l33t/popup.htm?height=100&amp;width=300&amp;id='+JStext_starterLength, 'false');
	}
}*/

function setLoad(){
	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
		}
		if(! prendiElementoDaId('overlay')){
			var overscrean=document.createElement("DIV");
			overscrean.setAttribute("id","overlay");
			document.body.appendChild(overscrean);
		}
		prendiElementoDaId('overlay').innerHTML="<div id='overlay_bg'></div><div id='load'><a href='javascript:removeLoad();'><img src='http://elletretreti.it/forum/Themes/classic/images/loading.gif' /></a></div>";
	} catch(e) {
		//nothing here
	}
}

function removeLoad(){
	try {
		document.body.removeChild(prendiElementoDaId('overlay'));
	} catch(e) {
		//nothing here
	}
}

function setMenu(Target){
	prendiElementoDaId('menu_all').style.display="none";
	prendiElementoDaId('menu_cerca').style.display="none";
	prendiElementoDaId('menu_'+Target).style.display="block";
}

/*function setPopupArray(stringa, titolo, W, H){
	title=titolo;
	popupW=W;
	popupH=H;
	AjaxDati("l33t/parser/ParserExpress.php", "testo="+encodeURIComponent(stringa)+"&JStext="+JStext_starterLength, "setPopupArray_out");
}

function setPopupArray_out(stringa){
	stringa=decodeURIComponent(stringa);
	var splitted = stringa.split("[divisore]");
	for (i in splitted) {
		JStext[((JStext_starterLength*1)+(i*1))]=decodeURIComponent(splitted[i]);
	}
	removeLoad();
	tb_show(title, 'l33t/popup.htm?height='+popupH+'&width='+popupW+'&id='+JStext_starterLength, '');
}*/

function trim(stringa){
	while (stringa.substring(0,1) == ' '){
		stringa = stringa.substring(1, stringa.length);
	}
	while (stringa.substring(stringa.length-1, stringa.length) == ' '){
		stringa = stringa.substring(0,stringa.length-1);
	}
	return stringa;
}