
//Homepage
function swapIndexDivs() {
	$("#index1").fadeOut(1000, function() {
		$("#index1").remove();
		/*$("#index2").fadeIn(1500, function() {
			
			jQuery('#index3 P A IMG').css('opacity', 0.6);
			jQuery('#index3 P A IMG').hover(
				//Hover
				function() {
					jQuery(this).css('opacity', 1.0);
				},
				//Normal
				function() {
					jQuery(this).css('opacity', 0.6);
				}
			);
			$("#index3").fadeIn(1000);
			setTimeout("window.location='/index2.php'",500);
		});*/
		setTimeout("window.location='/index2.php'",500);
	});
}

//Menu
function initMenu() {
	jQuery('#menu .menuItem A IMG.button').css('opacity', 0.6);
	jQuery('#menu .menuItem A IMG.button').hover(
		//Hover
		function() {
			jQuery(this).css('opacity', 1.0);
		},
		//Normal
		function() {
			jQuery(this).css('opacity', 0.6);
		}
	);
}

//Ejemplos
function initExamples() {
	jQuery('#examples .item IMG').css('opacity', 0.6);
	jQuery('#examples .item IMG').hover(
		//Hover
		function() {
			jQuery(this).css('opacity', 1.0);
		},
		//Normal
		function() {
			jQuery(this).css('opacity', 0.6);
		}
	);
	$('#examples .item A').lightBox();
}

//Backoffice - Add/edit stores
function initAddEditStores() {
	//Comunidad
	jQuery('#id_comunidad').change(
		function () {
			var selected=$("#id_comunidad option:selected");
			if (selected.val()==0) {
				$('#ciudadhtml').html("Choose the 'Comunidad' first...");
			} else {
				$('#ciudadhtml').load("/backoffice/stores_edit_ciudads_ajax.php?id_comunidad="+selected.val());
			}
		}
	);
}
function initAddEditStoresCiudads() {
	//Ciudad
	var selected=$("#id_ciudad option:selected");
	if (selected.val()>0) {
		jQuery('#ciudad').hide();
	}
	jQuery('#id_ciudad').change(
		function () {
			var selected=$("#id_ciudad option:selected");
			if (selected.val()==0) {
				jQuery('#ciudad').show();
			} else {
				jQuery('#ciudad').hide();
			}
		}
	);
}