
/*


var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;

d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( nua.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);
	ie = ( d.all && !op );
	ie4 = ( ie && !dom );

	/*
	ie5x tests only for functionality. ( dom||ie5x ) would be default settings. 
	Opera will register true in this test if set to identify as IE 5
	*/

/*	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );
}

*/



var archivio = new LinkedList();


function loadBegin(id,sezione1,sezione2,titolo_menu1,titolo_menu2,titolo) {
	this.archivio.add(new Archivio());
	this.archivio.add(new Archivio());
	if(sezione1 != 0) {

		$('titolo_sezione').update(titolo);
		$('titolo_menu_1').update(titolo_menu1);
		$('titolo_menu_2').update(titolo_menu2);
		new Ajax.Updater('menu1','../menuLaterale.php',{ method: "get", parameters:{sezione:sezione1, min:0, max:30, pos: 0} });
		new Ajax.Updater('menu2','../menuLaterale.php',{ method: "get", parameters:{sezione:sezione2, min:0, max:30, pos: 1} });
		new Ajax.Request('../articolo.php',{ method: "get", parameters:{id:id}, onSuccess: updateDestra });
		creaArchivio(sezione1,0);
		creaArchivio(sezione2,1);
	} if(id == "sherazade") {
		changeSection('moda',' ',' ','moda')
	} else if(id != 0) {

		$('titolo_sezione').update(titolo);
		new Ajax.Request('../articolo.php',{ method: "get", parameters:{id:id}, onSuccess: updateDestra });
	} else {

		changeSection('oggi nel mondo','news',' ','oggi');
	}
}


function updateDestra(transport) {
	
	$('destro').update(transport.responseText);
	getMainHeight();
}


function changeSection(titolo,titolo_menu1,titolo_menu2,menu1,menu2) {
	
	$('titolo_sezione').update(titolo);
	$('titolo_menu_1').update(titolo_menu1);
	$('titolo_menu_2').update(titolo_menu2);
	new Ajax.Updater('menu1','../menuLaterale.php',{ method: "get", parameters:{sezione:menu1, min:0, max:30, pos: 0} });
	new Ajax.Updater('menu2','../menuLaterale.php',{ method: "get", parameters:{sezione:menu2, min:0, max:30, pos: 1} });
	new Ajax.Request('../articolo.php',{ method: "get", parameters:{sezione:menu1}, onSuccess: updateDestra });
	creaArchivio(menu1,0);
	creaArchivio(menu2,1);
}

function creaArchivio(sezione,archivio) {
	new Ajax.Request("../include/get_init_archivio.php",{
		method: "get",
		parameters: {sezione: sezione, pos: archivio},
		onSuccess: initArchivio
	});	
}

function initArchivio(transport) {
			json = transport.responseText.evalJSON();
			archivio.get(json.pos).init(json.tot,json.pag,json.sezione,0,json.pos);
			//$('imposta'+sezione).update('Record da ' + 1 + ' a ' + this.archivio.get(json.pos).printMax()  + ' su ' + json.tot);
			
}


function getPositionTop(This){
		var el = This;var pT = 0;
		while(el){pT+=el.offsetTop;el=el.offsetParent;}
		return pT
	}

	
function getMainHeight() {
	
	var articolo =  getPositionTop($('altezzaArticolo'));//$('altezzaArticolo').positionedOffset().top;
	
		var menu1 =  getPositionTop($('altezza0'));//$('altezza0').positionedOffset().top;
		var menu2 =  getPositionTop($('altezza1'));//$('altezza1').positionedOffset().top;
		var temp = menu1 > menu2 ? menu1 : menu2;
		temp = temp > articolo ? temp : articolo+300;
		temp = temp+10;


	if($('grande').getHeight() < temp) {
		new Effect.Morph('grande', { 
	 		 style: {
	    	backgroundColor: '#ffffff',
	    	height: temp+'px'
		  },
 		 duration: 0.0
		});
	}
}