var proxy = "proxy.php";
var mapLoaded = false;
var swPhoto = 0;


window.onresize = function()
	{
	resizeContenidor();
	}
function resizeContenidor()
	{
	var wW = document.documentElement.clientWidth;
	var hW = document.documentElement.clientHeight;
	var wC = document.getElementById("contenidor").offsetWidth;
	var hC = document.getElementById("contenidor").offsetHeight;
	
	if(wW < wC)
		{
		document.getElementById("contenidor").style.left = "0px";
		document.getElementById("contenidor").style.marginLeft = "0px";
		document.getElementById("contenidor").style.top = "0px";
		document.getElementById("contenidor").style.marginTop = "0px";
		}
	else
		{
		document.getElementById("contenidor").style.left = "50%";
		document.getElementById("contenidor").style.marginLeft = "-492.5px";
		document.getElementById("contenidor").style.top = "50%";
		document.getElementById("contenidor").style.marginTop = "-295px";
		}
	}

function showPage(idp, idm){
	$(".menuSelected").removeClass("menuSelected");
	$("#menu_"+idm).addClass("menuSelected");
	$(".central").hide();
	$("#ctl_"+idp).show();
	
	if(swPhoto == 0 && idp == 7){
		swPhoto = 1;
	  $('#photos').galleryView({
			panel_width: 750,
			panel_height: 310,
			frame_width: 100,
			frame_height: 75,
			overlay_opacity: 0.6
		});
	}
}

		

function showCampeones(obj, id){
	$("#ctl_3 .semiBotoSelected").removeClass('semiBotoSelected');
	$(obj).addClass("semiBotoSelected");
	$("#ctl_3 .semiContent").hide();
	$("#camp_"+id).show();
}

function selectDoc(obj, src, id){
	$("#ctl_8 .docItemSelected").removeClass("docItemSelected");
	$(obj).addClass("docItemSelected");
	$("#docAmpli").html("<img src='"+src+"' />");

	$("#docAmpli").unbind('click');
	$("#docAmpli").bind('click', function(event){
		showBook(id);
	});
}

function showActivities(obj, id){
	$("#ctl_4 .semiBotoSelected").removeClass('semiBotoSelected');
	$(obj).addClass("semiBotoSelected");
	$("#ctl_4 .semiContent").hide();
	$("#act_"+id).show();
}

function showBook(id){
	$(".subbok").hide();
	$("#subbook"+id).show();
	$("#book").show(1000);
}

function showAvis(){
	$("#dialog").dialog({
		bgiframe		: true,
		resizable		: false,
		height			:	250,
		width				:	400,
		modal				: true,
		overlay: {
			backgroundColor: '#000',
			opacity: 0.8
		},
		buttons: {
			'Acepto las condiciones de uso': function() {
				$.ajax({
				  url			: "sendMail.php",
				  data		: $("#frmSoc").serialize(),
				  type		:	"POST",
				  cache		: false,
				  success	: function(html){
				  	if(html == ''){
							$("#dialog").dialog('close');
							$('form')[1].reset();
				  	} else {
				  		alert(html);
							$("#dialog").dialog('close');
				  	}
					}
				});
			},
			Cancel: function() {
				$(this).dialog('close');
			}
		}
	});
	$("#dialog").dialog('open');

}