

$(function() {

});




  
function poblacion(){

if (document.getElementById('provincias').value =="Madrid"){
$('#acordion2').hide();
$('#acordion3').hide();
$('#tab_zaragoza').hide();
$('#tab_valencia').hide();
$('#tab_madrid').hide();
$('#tab_madrid2').hide();
$('#tab_madrid3').hide();
$('#tab_madrid4').hide();



//si es buit unes cordenades
if($('#acordion1 span.current').text()==""){
	crearMapaGoogle("40.296221,-3.76344");
	$('#tab_madrid').show();
	$("#tab_madrid ul li:first").addClass("active").show(); //Activate first tab
	$("#tab_madrid .tab-content-ubicacion:first").show();
}
//sino es buit fem un switch de el text per cada cordenada  i mostrem el tab madrid que toki
else{
	if ($('#acordion1 span.current').text()=="ARROYO"){
		crearMapaGoogle("40.296221,-3.76344");
		$('#tab_madrid').show();
		$("#tab_madrid ul li:first").addClass("active").show(); //Activate first tab
		$("#tab_madrid .tab-content-ubicacion:first").show();
	}
	if ($('#acordion1 span.current').text()=="MAJADAHONDA"){
		crearMapaGoogle("40.452139,-3.880791");
		$('#tab_madrid2').show();
		$("#tab_madrid2 ul li:first").addClass("active").show(); //Activate first tab
		$("#tab_madrid2 .tab-content-ubicacion:first").show();
	}
	if ($('#acordion1 span.current').text()=="PARQUE SUR"){
		crearMapaGoogle("40.338956,-3.737755");
		$('#tab_madrid3').show();
		$("#tab_madrid3 ul li:first").addClass("active").show(); //Activate first tab
		$("#tab_madrid3 .tab-content-ubicacion:first").show();
	}
	if ($('#acordion1 span.current').text()=="TORRELODONES"){
		crearMapaGoogle("40.567830,-3.916309");
		$('#tab_madrid4').show();
		$("#tab_madrid4 ul li:first").addClass("active").show(); //Activate first tab
		$("#tab_madrid4 .tab-content-ubicacion:first").show();
	}
}

$('#acordion1').show();
}
if (document.getElementById('provincias').value =="Zaragoza"){
$('#acordion1').hide();
$('#acordion3').hide();
$('#tab_madrid').hide();
$('#tab_madrid2').hide();
$('#tab_madrid3').hide();
$('#tab_madrid4').hide();
$('#tab_valencia').hide();

$('#acordion2').show();
$('#tab_zaragoza').show();

$("#tab_zaragoza ul li:first").addClass("active").show(); //Activate first tab
$("#tab_zaragoza .tab-content-ubicacion:first").show(); //Show first tab content

crearMapaGoogle("41.635299,-0.978984");

}
if (document.getElementById('provincias').value =="Valencia"){
$('#acordion1').hide();
$('#acordion2').hide();
$('#tab_madrid').hide();
$('#tab_madrid2').hide();
$('#tab_madrid3').hide();
$('#tab_madrid4').hide();
$('#tab_zaragoza').hide();

$('#acordion3').show();
$('#tab_valencia').show();

$("#tab_valencia ul li:first").addClass("active").show(); //Activate first tab
$("#tab_valencia .tab-content-ubicacion:first").show(); //Show first tab content

crearMapaGoogle("39.534729,-0.446662");

}

}
