/* CREOInteractive - JAVASCRIPT DOCUMENT */


var nn    = document.layers                  ? true              : false;
var w3c   = document.getElementById          ? true              : false;
var beg   = nn                               ? "document.layers" : (w3c ? "document.getElementById('" : "document.all");
var beg2  = "document.getElementsByTagName('";
var mid   = nn                               ? ""                : (w3c ? "').style" : ".style");
var mid2  = nn                               ? ""                : (w3c ? "')"       : "");
var iedom = document.all||document.getElementById;

var browser_ie  = ( ((ind = navigator.appVersion.indexOf("MSIE")) > -1 && navigator.userAgent.indexOf("Opera") == -1) ? true : false );
var browser_ie6 = navigator.appVersion.indexOf("MSIE 6.0");
var arVersion 	= navigator.appVersion.split("MSIE");
var version 	= parseFloat(arVersion[1]);









function findPos_box(obj,position) {
   var curleft = curtop = 0;
   curheight = obj.offsetHeight;
   curwidth = obj.offsetWidth;
   if (obj.offsetParent) {
      curleft = obj.offsetLeft;
      curtop = obj.offsetTop;
      while (obj = obj.offsetParent) {
         curleft += obj.offsetLeft;
         curtop += obj.offsetTop;
		 if(obj.className=="scroll_item_pg"){
			 break;
		 }
      }
   }
   if(position=='top'){
      return curtop;
   }else if(position=='bottom'){
      return curtop+curheight;
   }else if(position=='left'){
      return curleft;
   }else if(position=='right'){
      return curleft+curwidth;
   }else{
	  return false;
   }
}


var cursor = {x:0, y:0};
function findPos_cur(e) {
    e = e || window.event;
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    }else{
        cursor.x = e.clientX +
            (document.documentElement.scrollLeft ||
            document.body.scrollLeft) -
            document.documentElement.clientLeft;
        cursor.y = e.clientY +
            (document.documentElement.scrollTop ||
            document.body.scrollTop) -
            document.documentElement.clientTop;
    }
    //return cursor;
}




function msg_permission(){
	alert("Mi dispiace, ma non hai i permessi per questa operazione!");	
}

/* Motore per scroller Foto */
var scrollspeed = 1;
function getallscroller() {
	var objTags = document.getElementsByTagName("span"); 
	for( var i = 0; i < objTags.length; i++ ) {
	 if( objTags[i].className == "scroll_arrow" ) {
	  temp_id = (objTags[i].id).split("_");
	  switch(temp_id[1]){
	   case "up":
		direction = "up";
		objTags[i].onmouseover = function(){
						this_id = (this.id).split("_");
						timerID = setInterval('moveup("scroll_box")',40);
					};
	   break;
	   case "down":
		direction = "down";
		objTags[i].onmouseover = function(){
						this_id = (this.id).split("_");
						timerID = setInterval('movedown("scroll_box")',40);
					};
	   break;
	   case "left":
		direction = "left";
		objTags[i].onmouseover = function(){
						this_id = (this.id).split("_");
						timerID = setInterval('moveleft("scroll_box")',40);
					};
	   break;
	   case "right":
		direction = "right";
		objTags[i].onmouseover = function(){
						this_id = (this.id).split("_");
						timerID = setInterval('moveright("scroll_box")',40);
					};
	   break;
	  }
	  objTags[i].onmouseout = function(){clearInterval(timerID);};
	 }
	}
	
	scrollspeed=(document.all)?4:6;
}
	
function moveup(obj){
	eval(beg+obj+mid2).scrollTop -= scrollspeed;
}
function movedown(obj){
	eval(beg+obj+mid2).scrollTop += scrollspeed;
}
function moveleft(obj){
	eval(beg+obj+mid2).scrollLeft -= scrollspeed;
}
function moveright(obj){
	eval(beg+obj+mid2).scrollLeft += scrollspeed;
}
/* Motore per scroller Foto */


/* Motore per nascondere-visualizzare le righe */
function seeall(yesno){
	i = 1;
	obj = "testo";
	while( eval(beg+obj+"_"+i+"_0"+mid2) ){
		obj = obj+"_"+i;
		
		if(yesno=="no"){
			eval(beg+obj+"_a"+mid2).href="javascript:see_yesno('"+obj+"')";
			eval(beg+obj+"_a"+mid2).title = "Espandi";
			eval(beg+obj+"_img"+mid2).src = "/img/graphic/piu.jpg";
		}else{
			eval(beg+obj+"_a"+mid2).href="javascript:see_yesno('"+obj+"')";
			eval(beg+obj+"_a"+mid2).title = "Contrai";
			eval(beg+obj+"_img"+mid2).src = "/img/graphic/meno.jpg";
		}
		obj_temp =  obj.replace("testo","row");
		var boxes1 = (document.getElementById(obj_temp)).getElementsByTagName('dd');
		var boxes2 = (document.getElementById(obj_temp)).getElementsByTagName('p');
		var boxes3 = (document.getElementById(obj_temp)).getElementsByTagName('div');
		
		if(boxes1.length>0){
			var boxes = boxes1;
		}else if(boxes2.length>0){
			var boxes = boxes2;
		}else if(boxes3.length>0){
			var boxes = boxes3;
		}else{
			var boxes = new Array();	   
		}
		j = 0;
		while(boxes[j]){
		  if((boxes[j].id).substring(0,6)=="testo_"){
			  if(yesno=="no"){
			   boxes[j].style.display = "none";
			  }else{
			   boxes[j].style.display = "block";
			  }
		  }
		  j++;
		}
		i++;
		obj="testo";
	}
}



function see_yesno(obj){
	tr_show = "block";
	tr_hide = "none"; 
	
	
	i = 0;
	while( tr_now = eval(beg+obj+"_"+i+mid2) ){
		//tr_now = eval(beg+obj+"_"+i+mid); 
		obj_tmp = obj.replace("testo","row");
		if( tr_now.style.display == tr_show ){
			tr_now.style.display = tr_hide;
		}else if( tr_now.style.display == tr_hide ){
			tr_now.style.display = tr_show;
		}else{
			tr_now.style.display = tr_show;
		}/*else if( !tr_now.style.display ) {
			tr_now.style.display = tr_hide;
		}*/
		if(tr_now.style.display == tr_hide){
			eval(beg+obj+"_a"+mid2).href  = "javascript:see_yesno('"+obj+"')";
			eval(beg+obj+"_a"+mid2).title = "Espandi";
			eval(beg+obj+"_img"+mid2).src = "/img/graphic/piu.jpg";
		}else{
			eval(beg+obj+"_a"+mid2).href  = "javascript:see_yesno('"+obj+"')";
			eval(beg+obj+"_a"+mid2).title = "Contrai";
			eval(beg+obj+"_img"+mid2).src = "/img/graphic/meno.jpg";
		}
		i++;
	} 
}
/* Motore per nascondere-visualizzare le righe */



/* Motore per creare l'effetto HOVER sulle righe delle tabelle */
function row_collector() {
	try{
		var rows = (document.getElementById('body_archivio')).getElementsByTagName('div');
	}catch(e){
		var rows = new Array();
	}
	for (var i=0;i<rows.length;i++)
	{
	   if(rows[i].className.substring(0,3)=="row"){
		 rows[i].onmouseover=function(){this.className+='_ruled';}
		 rows[i].onmouseout =function(){this.className=((this.className).replace("_ruled",""));return false}
	   }
	}
}
/* Motore per creare l'effetto HOVER sulle righe delle tabelle */




/* Motore per creare l'effetto HOVER sulle colonne del sito */
var col_timeout = 0;
var columns  	= new Array();
var columns2 	= new Array();
var columns_arr	= new Array();
function column_collector() {
	try{
		columns  = (document.getElementById('body')).getElementsByTagName('div');
		columns2 = (document.getElementById('body')).getElementsByTagName('span');
	}catch(e){
		columns  = new Array();
		columns2 = new Array();
	}
	cont = 1;
	for (var i=0;i<columns.length;i++)
	{
		if(columns[i].className.substring(0,3)=="col"){
			columns[i].onmouseover=function(){if(this.className.lastIndexOf("_click")==-1 && this.className.lastIndexOf("_ruled")==-1){this.className+='_ruled';}/*clearTimeout(col_timeout);*/return false}
			columns[i].onmouseout =function(){if(this.className.lastIndexOf("_click")==-1){this.className=((this.className).replace("_ruled",""));}/*col_timeout=setTimeout("column_animate()",1000);*/return false}
			columns_arr[cont] = columns[i].id;
			cont++;
		}
	}
	//col_timeout = setTimeout("column_animate()",1000);
	for (var i=0;i<columns2.length;i++)
	{
		if(columns2[i].className.substring(0,12)=="linea_bottom"){
			columns2[i].style.top = ((document.getElementById('equal').offsetHeight)-66)+"px";
		}
	}
}
var col_check = 0;
function column_animate() {
	clearTimeout(col_timeout);
	if(col_check!=0) {
		eval(beg+columns_arr[col_check]+mid2).className = ((eval(beg+columns_arr[col_check]+mid2).className).replace("_ruled",""));
	}
	if(col_check==3) {
		col_check = 0;
	}
	eval(beg+columns_arr[(col_check+1)]+mid2).onmouseover();
	col_check = (col_check+1);
	col_timeout = setTimeout("column_animate()",3500);
}
/*
//clearTimeout(col_timeout);
var col_check = 0;
function column_animate(column) {
	for (var i=0;i<columns.length;i++)
	{
		if(columns[i].className.substring(0,3)=="col"){
			columns[i].className = ((columns[i].className).replace("_ruled",""));
			if(columns[i].id == column) {
				columns[i].onmouseover();
				id_array  = (columns[i].id).split("_");
				col_check = parseInt(id_array[(id_array.length-1)]);
			}
			if(col_check>i) {
				ii = (i+1);
			}else{
				ii = 0;
			}
			setTimeout(("column_animate('"+columns[ii].id+"')"),2000);
			if(col_check==2){
				col_check = 0;
			}
		}
	}
}
*/
/* Motore per creare l'effetto HOVER sulle colonne del sito */




/* Motore per creare l'effetto HOVER sulle foto del sito */
var interval 	   = new Array();
var orginal_width  = new Array();
var orginal_height = new Array();
function photo_collector() {
	var photo1 = (document.getElementById('body')).getElementsByTagName('img');
	
	if(photo1.length>0){
		var photo = photo1;
	}else{
		var photo = new Array();	   
	}
	for (var i=0;i<photo.length;i++)
	{
		if(photo[i].className=="img_photo"){
			photo[i].onmouseover = function(){orginal_width[this.id]=this.width;orginal_height[this.id]=this.height;interval[this.id]=setInterval("image_zoomer('"+this.id+"')",1);}
			photo[i].onmouseout  = function(){this.width=(!(orginal_width[this.id])?100:orginal_width[this.id]);this.height=(!(orginal_height[this.id])?100:orginal_height[this.id]);this.style.left="0px";this.style.top="0px";clearInterval(interval[this.id]);}
			if(document.getElementById('container').className=="gallery"){
				//photo[i].onclick = function(){loadpage("img_ajax",("id="+(this.id.replace('img_photo_',''))));return false;}
				var img_id  = photo[i].id.replace('img_photo_','');
				eval(beg+'a_photo_'+img_id+mid2).onclick = function(){alphavalue=1;box_grey_alpha("in");loadpage("img_ajax",("id="+(this.id.replace('a_photo_',''))));return false;}
			}
		}
	}
	box_grey_collector();
}
function box_grey_collector(){
	try{
	eval(beg+'box_grey'+mid2).onclick = function(){
		alphavalue = 1;
		old_width  = 0;
		old_height = 0;
		tmp_width  = 0;
		tmp_height = 0;
		clearTimeout(resize_timeout);
		
		eval(beg+"box_preload"+mid2).style.display = "none";
		
		obj_box = eval(beg+"img_popup"+mid2);
		//obj_box.style.overflow 		= "hidden";
		obj_box.style.height     	= "0px";
		obj_box.style.width	   		= "0px";
		obj_box.style.marginTop  	= "0px";
		obj_box.style.marginLeft 	= "0px";
		obj_box.style.display 		= "none";
		obj_box.style.visibility 	= "hidden";
		obj_box.innerHTML  			= "";
		
		box_grey_alpha("out");
	}
	}catch(e){}
}
function image_zoomer(objTT) {
	var obj = eval(beg+objTT+mid2);
	if(obj.width<201 || obj.height<201){
		if(obj.width<201){
			obj.width  = (parseInt(obj.width)+4);
			if( isNaN(parseInt(obj.style.left)) ){
				obj.style.left = "0px";
			}
			obj.style.left = (parseInt(obj.style.left)-2)+"px";
		}
		if(obj.height<201){
			obj.height = (parseInt(obj.height)+4);
			if( isNaN(parseInt(obj.style.top)) ){
				obj.style.top = "0px";
			}
			obj.style.top = (parseInt(obj.style.top)-2)+"px";
		}
	}else{
		clearInterval(interval[objTT]);
	}
	return false;
}
/* Motore per creare l'effetto HOVER sulle foto del sito */




function cat_advance(xmlHttp_tmp) {
	eval(beg+"box_schede"+mid2).innerHTML = xmlHttp_tmp;
}
function web_advance(xmlHttp_tmp) {
	eval(beg+"column_3"+mid2).onmouseout();
	xmlHttp_tmp_split = xmlHttp_tmp.split("/* -- ^cat^ -- */");
	eval(beg+"fotografia_group"+mid2).innerHTML = xmlHttp_tmp_split[0];
	eval(beg+"box_schede"+mid2).innerHTML 		= xmlHttp_tmp_split[1];
}




function box_grey_alpha(vers,alpha){
	var ctrl = true;
	obj_grey = eval(beg+"box_grey"+mid2);
	
	if(isNaN(alpha)){
		if(vers=="in"){
			alpha = 1;
			obj_grey.style.display 	  = "block";
			obj_grey.style.visibility = "visible";
		}else{
			alpha = 9;
		}
	}
	
	obj_grey.style.opacity 	  = alpha/10;
	obj_grey.style.MozOpacity = alpha/10;
	obj_grey.style.filter  	  = 'alpha(opacity='+(alpha*10)+')';
	
	if(vers=="in"){
		alpha++;
		if(alpha > 9){
			ctrl = false;
		}
	}else{
		alpha--;
		if(alpha < 1){
			ctrl = false;
			obj_grey.style.display 	  = "none";
			obj_grey.style.visibility = "hidden";
		}
	}
	if(ctrl){
		setTimeout("box_grey_alpha('"+vers+"',"+alpha+")",30);
	}
}
var alphavalue = 1;
function img_alpha(){
	obj_img = eval(beg+"img_loading"+mid2);
	
	obj_img.style.opacity 	 = alphavalue/10;
	obj_img.style.MozOpacity = alphavalue/10;
	obj_img.style.filter  	 = 'alpha(opacity='+(alphavalue*10)+')';
	
	alphavalue++;
	if(alphavalue <= 10){
		setTimeout("img_alpha()",100);
	}
}
var resize_timeout = 0;
function img_popup_resize(){
	clearTimeout(resize_timeout);
	
	obj_box    = eval(beg+"img_popup"+mid2);
	tmp_width  = (tmp_width ==0) ? old_width  : tmp_width;
	tmp_height = (tmp_height==0) ? old_height : tmp_height;
	
	
	if(iwidth!=tmp_width){
		if(iwidth<old_width){
			step = ((tmp_width-iwidth)>10) ? 10 : (tmp_width-iwidth);
			tmp_width = tmp_width-step;
		}else if(iwidth>old_width){
			step = ((iwidth-tmp_width)>10) ? 10 : (iwidth-tmp_width);
			tmp_width = tmp_width+step;
		}
		obj_box.style.backgroundPositionX = ((tmp_width/2)-88)+"px";
	}
	if(iheight!=tmp_height){
		if(iheight<old_height){
			step = ((tmp_height-iheight)>10) ? 10 : (tmp_height-iheight);
			tmp_height = tmp_height-step;
		}else if(iheight>old_height){
			step = ((iheight-tmp_height)>10) ? 10 : (iheight-tmp_height);
			tmp_height = tmp_height+step;
		}
		obj_box.style.backgroundPositionY = ((tmp_height/2)-36)+"px";
	}
	//obj_box.innerHTML 	= "<img src=\"/img/graphic/gallery_load.gif\" style=\"position:abolute;top:50%;left:50%;margin:\" alt=\"Loading Image\" />";
	obj_box.style.marginTop  = "-"+(tmp_height/2)+"px";
	obj_box.style.marginLeft = "-"+(tmp_width/2)+"px";
	
	//obj_box.style.backgroundPosition = ""+((tmp_width/2)-88)+"px "+((tmp_height/2)-36)+"px";
		
	obj_box.style.height     = tmp_height+"px";
	obj_box.style.width	   	 = tmp_width+"px";
	
	
	if( (iwidth!=tmp_width) || (iheight!=tmp_height) ){
		resize_timeout = setTimeout("img_popup_resize()",20);
	}else{
		eval(beg+"box_preload"+mid2).style.display = "none";
		
		obj_box.innerHTML 	= wxmlHttp_tmp;
	
		correctPNG();
		img_alpha();
		
		obj_box.onmousemove = findPos_cur;
	
		old_width  			= iwidth;
		old_height 			= iheight;
	}
}


var iwidth	   = 0;
var iheight	   = 0;
var old_width  = 0;
var old_height = 0;
var tmp_width  = 0;
var tmp_height = 0;
var wxmlHttp_tmp = ""
function big_advance(xmlHttp_tmp) {	
	wxmlHttp_tmp = xmlHttp_tmp;
	
	eval(beg+"box_preload"+mid2).style.display = "block";
	
	alphavalue = 1;
		
	var xmlHttp_fin  = xmlHttp_tmp.split(' ');
	iwidth		  	 = xmlHttp_fin[3].substring((xmlHttp_fin[3].indexOf('width')+7),(xmlHttp_fin[3].length-1));
	iwidth			 = (parseInt(iwidth)+4);//
	iheight		 	 = xmlHttp_fin[2].substring((xmlHttp_fin[2].indexOf('height')+8),(xmlHttp_fin[2].length-1));
	iheight			 = (parseInt(iheight)+4);//+66
	var img_preview	 = new Image();
	
	var img_arrtmp   = xmlHttp_tmp.split(' ');
	var img_srctmp   = img_arrtmp[1].replace('src="','');
	var img_srctmp   = img_srctmp.replace('"','');
	
	obj_box  = eval(beg+"img_popup"+mid2);
	
	img_preview.onload = function () {
		obj_box.innerHTML = "";
		if(old_width==0 && old_height==0){
			old_width  = iwidth;
			old_height = iheight;
		}
		img_popup_resize();
		//alert(iwidth+" - "+old_width+" | "+iheight+" - "+old_height);
	}
	obj_box.style.display    = "block";
	obj_box.style.visibility = "visible";
	
	img_preview.src	= img_srctmp;
}
function img_advance(xmlHttp_tmp) {
	wxmlHttp_tmp = xmlHttp_tmp;
	
	eval(beg+"box_preload"+mid2).style.display = "block";
	
	alphavalue = 1;
	
	xmlHttp_tmp		 = xmlHttp_tmp.split('</h4>');
	var xmlHttp_fin  = xmlHttp_tmp[1].split(' ');
	iwidth		  	 = xmlHttp_fin[3].substring((xmlHttp_fin[3].indexOf('width')+7),(xmlHttp_fin[3].length-1));
	iwidth			 = (parseInt(iwidth)+4);//218
	iheight		 	 = xmlHttp_fin[2].substring((xmlHttp_fin[2].indexOf('height')+8),(xmlHttp_fin[2].length-1));
	iheight			 = (parseInt(iheight)+66);
	var img_preview	 = new Image();
	
	var img_arrtmp   = xmlHttp_tmp[1].split(' ');
	var img_srctmp   = img_arrtmp[1].replace('src="','');
	var img_srctmp   = img_srctmp.replace('"','');
	
	obj_box  = eval(beg+"img_popup"+mid2);
	
	img_preview.onload = function () {
		obj_box.innerHTML = "";
		if(old_width==0 && old_height==0){
			old_width  = iwidth;
			old_height = iheight;
		}
		img_popup_resize();
		//alert(iwidth+" - "+old_width+" | "+iheight+" - "+old_height);
	}
	obj_box.style.display    = "block";
	obj_box.style.visibility = "visible";
	
	img_preview.src	= img_srctmp;
}
var img_timeout   = 0;
var img_interval  = 0;
var prevnext_time = 0;
var img_innerhtml = "";
function img_loading_onmouseover(){
	if(alphavalue==11){
		clearTimeout(img_interval);
		obj_img = eval(beg+"img_loading"+mid2);
		
		if(cursor.y>(findPos_box(obj_img,"bottom")-100)){
			img_loading_onmouseout(false);
			
			obj_testo = eval(beg+"testo"+mid2);
			if( isNaN(parseInt(obj_testo.style.height)) ){
				obj_testo.style.height = "6px";
			}
			if(img_innerhtml == ""){
				img_innerhtml = obj_testo.innerHTML;
				obj_testo.innerHTML = "";
			}
			if(parseInt(obj_testo.style.height)<72){
				obj_testo.style.height = (parseInt(obj_testo.style.height)+3)+"px";
				img_interval=setTimeout('img_loading_onmouseover()',5);
			}else{
				obj_testo.innerHTML = img_innerhtml;
				img_innerhtml 		= "";
			}
		}else if(cursor.y<(findPos_box(obj_img,"top")+250)){
			img_loading_onmouseout(false);
		
			center 	 = (findPos_box(obj_img,"left")+findPos_box(obj_img,"right"))/2;
			if(cursor.x>center && (cursor.x>(findPos_box(obj_img,"right")-200)) ){
				prevnext_showhide("next");
			}else if(cursor.x<center && (cursor.x<(findPos_box(obj_img,"left")+200)) ){
				prevnext_showhide("prev");
			}else{
				prevnext_showhide("all");
			}
		}else{
			img_loading_onmouseout(true);
		}
		//eval(beg+"img_popup"+mid2).style.overflow = "visible";
	}
}
function img_loading_onmouseout(exit){
	if(alphavalue==11){
		if((cursor.y>(findPos_box(obj_img,"bottom")-100)) || exit!=false){
			clearTimeout(prevnext_time);
			prevnext_showhide("all");
			/*
			obj_prev = eval(beg+"img_popup_prev"+mid2);
			obj_next = eval(beg+"img_popup_next"+mid2);
			obj_prev.style.left  = "-150px";
			//obj_prev.style.visibility = "hidden";
			obj_next.style.right = "-150px";
			//obj_next.style.visibility = "hidden";
			*/
		}
		
		if((cursor.y<(findPos_box(obj_img,"bottom")-100)) || exit!=false){
			clearTimeout(img_interval);
			obj_testo = eval(beg+"testo"+mid2);
			if(img_innerhtml == ""){
				img_innerhtml 		= obj_testo.innerHTML;
				obj_testo.innerHTML = "";		
			}
			if(parseInt(eval(beg+"testo"+mid).height)>6){
				obj_testo.style.height = (parseInt(obj_testo.style.height)-3)+"px";
				img_interval=setTimeout('img_loading_onmouseout()',5);
			}else{
				obj_testo.innerHTML = img_innerhtml;
				img_innerhtml 		= "";
			}
		}
	}
}
function prevnext_showhide(obj_arrow){
	if(alphavalue==11){	
		clearTimeout(prevnext_time);
		obj_prev = eval(beg+"img_popup_prev"+mid2);
		obj_next = eval(beg+"img_popup_next"+mid2);
		
		if( isNaN(parseInt(obj_prev.style.left)) ){
			obj_prev.style.left  = "-150px";
		}
		if( isNaN(parseInt(obj_next.style.right)) ){
			obj_next.style.right = "-150px";
		}
		
		if(obj_arrow=="all"){
			if(parseInt(obj_prev.style.left)>-150){
				obj_prev.style.left  = (parseInt(obj_prev.style.left)-5)+"px";
				//obj_prev.style.visibility = "hidden";
			}
			if(parseInt(obj_next.style.right)>-150){
				obj_next.style.right = (parseInt(obj_next.style.right)-5)+"px";
				//obj_next.style.visibility = "hidden";
			}
		}else if(obj_arrow=="prev"){
			if(parseInt(obj_prev.style.left)<0){
				obj_prev.style.left  = (parseInt(obj_prev.style.left)+5)+"px";
				//obj_prev.style.visibility = "hidden";
			}
			if(parseInt(obj_next.style.right)>-150){
				obj_next.style.right = (parseInt(obj_next.style.right)-5)+"px";
				//obj_next.style.visibility = "hidden";
			}
		}else if(obj_arrow=="next"){
			if(parseInt(obj_next.style.right)<0){
				obj_next.style.right  = (parseInt(obj_next.style.right)+5)+"px";
				//obj_prev.style.visibility = "hidden";
			}
			if(parseInt(obj_prev.style.left)>-150){
				obj_prev.style.left = (parseInt(obj_prev.style.left)-5)+"px";
				//obj_next.style.visibility = "hidden";
			}
		}
		prevnext_time = setTimeout('prevnext_showhide("'+obj_arrow+'")',10);
	}
}






//var strGif = "img/graphic/transparentpixel.gif"
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 and 6.
{
   if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
   {
	   for(var i=0; i<document.images.length; i++)
	   {
		  var img = document.images[i];
		  var imgName = img.src.toUpperCase();
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		  {
			 var imgID = (img.id) ? "id='" + img.id + "' " : "";
			 var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			 var imgStyle = "display:block;" + (img.style.cssText).toLowerCase();//
			 var imgAttribs = img.attributes;
			 for (var j=0; j<imgAttribs.length; j++)
			 {
				var imgAttrib = imgAttribs[j];
				if (imgAttrib.nodeName == "align")
				{		  
				   if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle;
				   if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle;
				   break
				}
			 }
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle;
			 strNewHTML += " style=\"" + "width:" + img.width + "px;height:" + img.height + "px;" + ((imgStyle.length>14) ? (imgStyle+";") : (""));
			 strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
			 strNewHTML += "(src='" + img.src + "', sizingMethod='scale');\"";
			 strNewHTML += ">&nbsp;</span>";
			 /*
			 strAddMap = "<img style=\"position:relative; left:-" + img.width + "px; top:-" + img.height + "px;" + "height:" + img.height + "px;width:" + img.width +"\" " + "src=\"" + strGif + "\" border=\"" + img.border + "\" />";
			 if (img.parentElement.href) strNewHTML += strAddMap;
			 */
			 img.outerHTML = strNewHTML;
			 
			 //"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', src='"+imgName+"', sizingMethod='scale');";
			 i = i-1;
		  }
	   }
   }
}



/* Inizio richieste pagina */
var xmlHttp;
var pagHttp;

function loadpage(page,querystring) {
	if(querystring.search(/null/i)==-1){
		pagHttp = page;
		var url = "/"+page+".php"+(querystring ? "?"+querystring+"&sid="+Math.random() : "?sid="+Math.random());
		xmlHttp = GetXmlHttpObject(stateChanged);
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
}

function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		xmlHttp_tmp = xmlHttp.responseText;
		//var funct = pagHttp.split("_");		
		if(pagHttp.search(/img_/i)!=-1){
			img_advance(xmlHttp_tmp);
		}else if(pagHttp.search(/cat_/i)!=-1){
			cat_advance(xmlHttp_tmp);
		}else if(pagHttp.search(/web_/i)!=-1){
			web_advance(xmlHttp_tmp);
		}else if(pagHttp.search(/image/i)!=-1){
			big_advance(xmlHttp_tmp);
		}else{
			alert("Servizio temporaneamente disattivato.\nContattare il WEBAdmin per maggiori informazioni.");
		}
		xmlHttp_tmp = "";
	} 
}

function GetXmlHttpObject(handler) { 
	var objXmlHttp = null;
	if (navigator.userAgent.indexOf("Opera")>=0){
	   objXmlHttp		  = new XMLHttpRequest();
	   objXmlHttp.onload  = handler;
	   objXmlHttp.onerror = handler; 
	   return objXmlHttp;
	}
	if (navigator.userAgent.indexOf("MSIE")>=0){ 
	   var strName = "Msxml2.XMLHTTP";
	   if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
		  strName  = "Microsoft.XMLHTTP";
	   } 
	   try{ 
		  objXmlHttp = new ActiveXObject(strName);
		  objXmlHttp.onreadystatechange=handler;
		  return objXmlHttp;
	   }catch(e){ 
		  alert("Error. Scripting for ActiveX might be disabled");
		  return;
	   } 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0){
	   objXmlHttp		  = new XMLHttpRequest();
	   objXmlHttp.onload  = handler;
	   objXmlHttp.onerror = handler; 
	   return objXmlHttp;
	}
}
/* Fine richieste pagina */





/* Inizio gestione HANDLER */
function generic_onload() {
	if(document.getElementById('container').className=="homepage"){
		column_collector();
	}
	if(document.getElementById('container').className=="gallery" || document.getElementById('container').className=="portfolio" ){
		photo_collector();
	}
	row_collector();
	getallscroller();
}

//setup onload function
if(typeof window.addEventListener != 'undefined') { //.. gecko, safari, konqueror and standard	
	window.addEventListener('load', generic_onload, false);
} else if(typeof document.addEventListener != 'undefined') { //.. opera 7	
	document.addEventListener('load', generic_onload, false);
} else if(typeof window.attachEvent != 'undefined') { //.. win/ie
	window.attachEvent('onload', generic_onload);
} else {
	if(typeof window.onload == 'function') {
		var existing  = onload;			
		window.onload = function() { //add new onload handler
			generic_onload();
		};
	} else {
		window.onload = generic_onload;
	}
}
/* Fine gestione HANDLER */