// JavaScript Document

function removeTown(id) {
	
	if (confirm("¿Está seguro de que desea mover el municipio a la papelera?")) {
		document.location.href = '../br/Towns.php?method=removeTown&id='+id+'&redirect=../web/towns.php?';
	}
}

function recoverTown(id) {
	
	if (confirm("¿Está seguro de que desea recuperar el municipio?")) {
		document.location.href = '../br/Towns.php?method=recoverTown&id='+id+'&redirect=../web/towns.php?';
	}
}

function showHideProvince(check) {

	if (check.checked) {
		$("#list     .province"+check.value+" :checkbox").attr("checked", "checked");
		$("#captions .province"+check.value+" li").fadeIn();
	} else {
		$("#list     .province"+check.value+" :checkbox").attr("checked", "");
		$("#captions .province"+check.value+" li").fadeOut();
	}
}

function showHideTown(check) {
	
	if (check.checked) {
		$('#town'+check.value).fadeIn();
	} else {
		$('#town'+check.value).fadeOut();
	}
}


function initTownsMenus() {

	$("#map #captions li").each(function() {
							   
		$(this).qtip({
			content: '<img src="'+$(this).attr('img')+'" style="border:solid 1px #A9DB66;" />',
			position: {
				corner: {
					tooltip: 'bottomMiddle', // ...and position it center of the screen
               		target: 'topMiddle' // ...and position it center of the screen
				},
				adjust: { 
					screen: true,
					x:-7
				}
			},
			style: {
				name: 'green',
				tip: true			
			},
			hide: { when: 'mouseout', fixed: true }
		});
	});
}

