<!--
function NewWindow(mypage,myname,w,h,scroll) {
  var win = null;
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  win = window.open(mypage,myname,settings)
  if(win.window.focus){win.window.focus();}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='catalogo.php?pagina=2&marca="+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Javascript che modifica il colore dello sfondo dei link
function onColor(foo) {
   foo.style.backgroundColor='#011E63';
}

function offColor(foo) {
   foo.style.backgroundColor='#015E94';
}

function changeimage(percorso,targetimg) {
	if (document.images){
		document.images[targetimg].src=percorso
	}
}

function controllaq(field,quant_min) {
    var checkvalue=parseInt(field.value);
	if (checkvalue < quant_min || isNaN(checkvalue)) {
		field.value = quant_min ;
	}
}

function piuuno(field,quant_min) {
	var checkvalue=parseInt(field.value) + 1;
	field.value = checkvalue;
}

function menouno(field,quant_min) {
	var checkvalue=parseInt(field.value);
	if (checkvalue > quant_min) {
		field.value = field.value - 1;
	}
}

function puliscitext(elm){
   if (!elm.base) elm.base = elm.value
   if (elm.value == elm.base) elm.value = "";
   else if (elm.value == "") elm.value = elm.base;
}

function createRequest() {
	var richiesta;
	var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer") {
		richiesta = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		richiesta = new XMLHttpRequest();
	}
	return richiesta;
}

var req=createRequest();

function caricaProfessioni(id_settore) {
    if(id_settore=="") {
     document.getElementById("professioni").innerHTML="<select name='professione' class='campotxt'><option value=''>--- scegli la professione ---</option></select>";
    }
    else {
     req.open('GET','carica_professioni.php?id_settore='+id_settore);
     req.onreadystatechange = gestisciContenuto;
     req.send(null);
    }
}

function gestisciContenuto() {
	if (req.readyState == 4) {
		var response = req.responseText;
        document.getElementById("professioni").innerHTML=response;
	}
}

function show_dettagli(fb_id) {
    document.getElementById("dettagli_"+fb_id).style.display="";
}

function hide_dettagli(fb_id) {
    document.getElementById("dettagli_"+fb_id).style.display="none";
}

function close_div(iden) {
    document.getElementById(iden).style.display="none";
}

function ins_feedback(fb_id) {
    // visualizza gif animata x attesa
    document.getElementById("fdb_esito_"+fb_id).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='../images_web/attesa_feedback.gif' alt='operazione in corso....'>";
    var fdb_txt=document.getElementById("feedback_"+fb_id).getElementsByTagName("textarea")[0].value;
    if(fdb_txt!='') {
     req.open('GET','feedback_ins.php?id='+fb_id+'&fdb_txt='+fdb_txt);
     req.onreadystatechange = gestisciContenuto2;
     req.send(null);
    }
    else {
     document.getElementById("fdb_esito_"+fb_id).style.color="#FF0000";
     document.getElementById("fdb_esito_"+fb_id).innerHTML="<b>&nbsp; &raquo; INSERIRE IL TESTO !</b>";
    }
}

function gestisciContenuto2() {
	if (req.readyState == 4) {
		var response = req.responseText;
		var esito = response.substring(0,2);
		var id = response.substring(3);
		if(esito=="ok") {
         document.getElementById("fdb_esito_"+id).style.color="#00CC00";
         document.getElementById("fdb_esito_"+id).innerHTML="<b>&nbsp; &raquo; INVIATO !</b>";
         document.getElementById("feedback_"+id).getElementsByTagName("textarea")[0].setAttribute("disabled","true");
         document.getElementById("fdb_invia_"+id).setAttribute("disabled","true");
        }
        else {
         document.getElementById("fdb_esito_"+id).style.color="#FF0000";
         document.getElementById("fdb_esito_"+id).innerHTML="<b>&nbsp; &raquo; NON INVIATO !</b>";
        }
 	    // infine 'ferma' la gif animata x l'attesa
	}
}

function TargetBlank()
{
  var i = 0;
  var collegamenti = document.links;
  var tot_links = collegamenti.length;
  for (i=0; i<tot_links; i++)
  {
    if (collegamenti[i].className=="blank_banner_box")
    {
      collegamenti[i].target = "_blank";
    }
  }
  setTimeout("showFloatingBanner()", 1500);
}

function showFloatingBanner() {
    if(document.getElementById('absloute_posbnr')) {
   	 var floatingBanner=document.getElementById('absloute_posbnr');
     floatingBanner.style.display='block';
    }
}

function aggiorna_totale(valuve) {
  switch(valuve) {
   case "Contrassegno":
   		document.getElementById('totale2').innerHTML="<br>+ &euro; 5,00 contrassegno";  		
   break;
  }
}

function aggiorna_totale2(valore) {
  document.getElementById('totale').innerHTML=document.concludi_ordine.elements["totaleOK_"+valore].value;
}

function showPicsUtilities() {
	if($$('img.favs_ico').length) {
		var allFavsImgs=$$('img.favs_ico');
		allFavsImgs.each(function(aFavsImg) {
			var parents=aFavsImg.ancestors();
			var theParent=parents[0];
			if(theParent) {
				aFavsImg.show();
				aFavsImg.observe('click', function(event) {
					var modal="add";
					if(this.readAttribute("src").indexOf("remove")>-1)
						modal="remove";
					event.stop();
					manageFavs(this.readAttribute("id").replace("favs_", ""),modal);					
				});
			}
		});
	}
}

function manageFavs(idf,modal) {
	var parameters='idf='+idf+'&modal='+modal;
	var theRequest = new Ajax.Request('manage_favs.php', {method: 'get', parameters: parameters, asynchronous: false, evalJS: 'force'});
}

function refListPrint() {
	window.print();
}

function showSellerDetails(sellerId) {
	$('wait_img').hide();
	var parameters='id='+sellerId;
	var theRequest = new Ajax.Updater($('seller_details'),'get_seller_details.php', {
		method: 'post',
		parameters: parameters,
		asynchronous: false,
		onComplete: function() {
			var mapLat=$('map_lat') ? $('map_lat').value : null;
			var mapLon=$('map_lon') ? $('map_lon').value : null;
			if(mapLat && mapLon)
				showSellerMap(mapLat,mapLon);
		}
	});
}

function showSellerMap(mapLat,mapLon) {	
	if (GBrowserIsCompatible()) {
		var map = new GMap2($("map"),{mapTypes:[G_SATELLITE_MAP,G_NORMAL_MAP,G_HYBRID_MAP]});
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		var center = new GLatLng(mapLat,mapLon);
		map.setCenter(center, 17);      		      		
		var markerDescription = "PaganoPiante";
		map.addOverlay(createMarker(new GLatLng(mapLat,mapLon),markerDescription));
	}
}

function createMarker(point, description) {
	var marker = new GMarker(point,{draggable: true});
	GEvent.addListener(marker, "dragstart", function() {
		map.closeInfoWindow();
	});
              
	GEvent.addListener(marker, "dragend", function() {
		marker.openInfoWindowHtml(description);
	});
              
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(description);
	});
	return marker;
}

Event.observe(window,'load',function() {
	TargetBlank();
	showPicsUtilities();
	if($('preferiti_print'))
		refListPrint();
	if($('map'))
		showMap();
});
//-->