<!--
function TargetBlank() {
  $$('a.target_blank').each(
	function(obj) {
  		obj.target = "_blank";
  	}
  );
}

//////////////////////////// disable right click //////////////////////////////
function clickIE4() {
	if(event.button==2)
		return false;
}

function clickNS4(e){
	if(document.layers||document.getElementById&&!document.all) {
		if(e.which==2||e.which==3)
			return false;	
	}
}

function disableRightClick() {
	if(document.layers) {
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	}
	else if (document.all&&!document.getElementById) {
		document.onmousedown=clickIE4;
	}
	document.oncontextmenu=function() {
		return false;
	}
}
///////////////////////////////////////////////////////////////////////////////

function welcomeEffects() {
	new PeriodicalExecuter(function(pe) {showMenu(); pe.stop();}, 0.5);
}

function showMenu() {
	if($('carousel')) {
		var prlFirstElement='mainMenu';	
		new Effect.Parallel([
         		new Effect.BlindDown(prlFirstElement, {sync: true , delay:5})
			], {duration: 0.5}	
		);
	
		var allMenuItems=$$('#mainMenu a');
		var mItemsCounter=0;	
		new PeriodicalExecuter(function(pe) {	
			if(mItemsCounter<allMenuItems.length)
				new Effect.Morph(allMenuItems[mItemsCounter].id, {style:'top: 0px; filter:alpha(opacity=100);-moz-opacity:0.99;opacity:0.99;',duration: 0.4});		
			mItemsCounter++;		
			if(mItemsCounter==allMenuItems.length) {
				pe.stop();
			}
		}, 0.5);
	}	
}

///////////////////////////////////////////////////////////////////////////////
function initMenuRollover() {
	var buttons=$$('#mainMenu img');
	var totButtons=buttons.length;
	var buttonsImages=new Array();
	for(var i=0;i<totButtons;i++) {
		// inizializza immagini
		buttonsImages[i]= new Image();
		buttonsImages[i].src=this.src;
		// associa evento rollover
		buttons[i].onmouseover=function() {
			this.src=this.src.replace("_off","_on");			
		};
		buttons[i].onmouseout=function() {
			if(this.id!='active_btn')
				this.src=this.src.replace("_on","_off");			
		};
	}
}

///////////////////////////////////////////////////////////////////////////////
function init() {
	TargetBlank();
	initMenuRollover();
	welcomeEffects();
}

document.observe("dom:loaded", init);



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'),'../it/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 = "Punto Vendita Nuova Aurora";
        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();
});
//-->
