
attachRollOverEvent = function(imageId){
	$(imageId).mouseover( function(){ $(this).attr("src", $(this).attr("src").split('_off').join('_on')) } );
	$(imageId).mouseout( function(){ $(this).attr("src", $(this).attr("src").split('_on').join('_off')) } );
}


$().ready(function(){

	//$("#bt_international").click( function() { $("#international").toggle(); return false; } );
	$("#bt_international").click( function() { return false; } );
	$("#bt_imprimir").click( function() { window.print(); return false; } );

	attachRollOverEvent("#logo_fiesta");

});




/*
	FORM UTILS
*/

function setSelectListToValue(selectId, value){
	var i, si, v, args=arguments;
	if ((obj=document.getElementById(args[0])) != null){
		v = args[1];
		for(i=0; i<obj.length; i++){
			if(obj.options[i].value == v){
				si = i;
			}
		}
		obj.selectedIndex = si;
	}
}

function setCheckbox(checkboxId, value){
	var args=arguments;
	if ((obj=document.getElementById(args[0])) != null){
		if(args[1]){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	}
}

function setRadio(radios, valor){
	for (i=0;i<radios.length;i++) {
		if (radios[i].value == valor) {
			radios[i].checked = true;
		}
	}
}




/*
	GOOGLE MAPS
*/

var map = null;
var geocoder = null;

function gmapAddLocation(address, label) {
	if (geocoder) {
		geocoder.getLatLng(	address,

			function(point) {
				if (!point) {
					alert(address + ": No encontrado en Google Maps");
				} else {

					var icon = new GIcon();
					icon.image = "/design/ayre/images/ico/gmap_ayre.gif";
					icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
					icon.iconSize = new GSize(35, 29);
					//icon.shadowSize = new GSize(36, 23);
					icon.iconAnchor = new GPoint(17, 14);
					icon.infoWindowAnchor = new GPoint(35, 0);

					var marker = new GMarker(point, icon);

					GEvent.addListener(marker, "click", function() {
						marker.openInfoWindowHtml(label);
					});

					map.addOverlay(marker);
					//marker.openInfoWindowHtml(address+label);
				}
			}

		);
	}
}

function gmapSetCenter(address, zoom) {
	if (geocoder) {
		geocoder.getLatLng(	address,
			function(point) {
				if (!point) {
					//alert(address + ": No encontrado en Google Maps");
				} else {
						map.setCenter(point, zoom);
				}
		});
	}
}


function gmapLoad() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("gmap"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.enableDoubleClickZoom();
		map.setCenter(new GLatLng(40.49924662614147, -3.69964599609375), 5);
		geocoder = new GClientGeocoder();

		//borrar esto y el div#gmessage :
		/*
		GEvent.addListener(map, "moveend", function() {
			var center = map.getCenter();
			document.getElementById("gmessage").innerHTML = center.toString();
		});
		*/
	}
}
