
//-------------------------------------------------------------------------------------
//DIVS MOSTRAR/OCULTAR
//-------------------------------------------------------------------------------------
function toggleCSS(id){
	
	var elm = document.getElementById(id);
	var d = elm.style.display;
	
    if(id == 'tab_concello'){
    	document.getElementById('button_tab_eventos').className = 'tab_on';
    	document.getElementById('button_tab_concello').className = 'tab_off';

	    if (d && (d != "none" || d == ""))
	    	toggleDiv('tab_eventos', 'tab_concello');
    }
	if(id == 'tab_eventos'){
    	document.getElementById('button_tab_eventos').className = 'tab_off';
    	document.getElementById('button_tab_concello').className = 'tab_on';

	    if (d && (d != "none" || d == ""))
	    	toggleDiv('tab_eventos', 'tab_concello');
    }	
    //toggleDiv('tab_eventos', 'tab_concello');
}

function toggleDiv(id, param){
	var elm = document.getElementById(id);    
    if (!elm || elm.length == 0) return;
    var d = elm.style.display;
        //alert(d);
    if (d && (d != "none" || d == "")){
    	

        elm.style.display = "none";
	    elm.style.visibility = "hidden";
	    
	    	    
    }
    else{
        elm.style.display = "block";
        elm.style.visibility = "visible";
        if(id == 'user_extras'){
	        elm.style.display = "none";
	        elm.style.visibility = "hidden";
        	document.getElementById('user_extras_txt').innerHTML = USER_EXTRAS_OFF;
        }
    }
    
    //CASOS ESPECIALES
    if(param != ''){
    	toggleDiv(param);
    }
}

function mostrarDiv(id){
	var elm = document.getElementById(id);    
    if (!elm || elm.length == 0) return;
    var d = elm.style.display;
        
    elm.style.display = "block";
    elm.style.visibility = "visible";	
}

function ocultarDiv(id){
	var elm = document.getElementById(id);    
    if (!elm || elm.length == 0) return;
    var d = elm.style.display;
        
    elm.style.display = "none";
    elm.style.visibility = "hidden";	
}

function PopupCenter(pageURL, title,w,h) {
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}

function modalFlashMessage(text){
	//alert(text);
	$.modal('<div style="background-color:#fff; width:800px">'+text+'</div>'
			, {minWidth:800, minHeight:50, opacity:60, escClose:true, overlayClose:true, overlayCss: {backgroundColor:"#000"}});
}

function modalPagina(ruta, w, h){
	$.modal('<div style="background-color:#fff; width:'+(w+0)+'px; height:'+(h+0)+'px; overflow:hidden"><iframe src="'+ruta+'" width="'+w+'" height="'+h+'" frameborder="no"></iframe></div>'
			, {minWidth:w, minHeight:h, opacity:60, escClose:true, overlayClose:true, overlayCss: {backgroundColor:"#000"}});
}

function modalEstandar(imagen, w, h){
	$.modal('<div style="background-color:#fff; width:'+(w+0)+'px; height:'+(h+0)+'px; overflow:hidden"><img src="'+imagen+'" width="'+w+'" height="'+h+'" /></div>'
			, {minWidth:w, minHeight:h, opacity:60, escClose:true, overlayClose:true, overlayCss: {backgroundColor:"#000"}});
}

function modalPortada(imagen){
	var h = $(window).height();
	var w = $(window).width();
	
	var alto_imagen = h - 80;
	var ancho_imagen = h / 1.54;
	
	$.modal('<div style="background-color:#fff; width:'+ ancho_imagen + 'px; height:'+ alto_imagen +'px"><img src="'+imagen+'" width="'+ ancho_imagen +'" height="'+ alto_imagen +'" /></div>'
			, {minWidth:'+ (ancho_imagen - 100) + ', minHeight:'+ (alto_imagen - 100) +', opacity:60, escClose:true, overlayClose:true, overlayCss: {backgroundColor:"#000"}});
}

function modalVideo(video){
	//alert(video);
	$.modal('<div style="background-color:#fff; width:800px; height:600px"><iframe frameborder="no" src="'+video+'" width="800" height="600" /></div>'
			, {minWidth:800, minHeight:600, opacity:60, escClose:true, overlayClose:true, overlayCss: {backgroundColor:"#000"}});
}

function modalLogin(){
	//alert('siola');
	
//	var aviso = '
//		<div id="modalmsg" class="radius10">
//			<h3>Contenido restringido</h3>
//			<h2>Para acceder a esta sección, necesitas estar conectado como usuario de MásVigo.</h2>
//			<h1>		
//				<input type="button" value="Ya dispongo de cuenta de usuario" onclick="location.href = \'mi_cuenta\'" />
//				<input type="button" value="Crear una cuenta gratuita" onclick="location.href = \'mi_cuenta\'" />
//			</h1>
//		
//			<h2>Si lo prefieres, puedes acceder directamente utilizando tu cuenta de Facebook.</h2>
//			<h1 style="margin-left:120px"><fb:login-button size="large" length="long"></fb:login-button></h1>
//		</div>';

	var aviso = '';
	aviso += '<div id="modalmsg" class="radius10">';
	aviso += '	<h3>Contenido restringido</h3>';
	aviso += '	<h2>Para acceder a esta secci&oacute;n, debes identificarte como usuario de M&aacute;sVigo.</h2>';
	aviso += '	<h1>';
	aviso += '		<input type="button" value="Crear una cuenta gratuita" onclick="location.href = \'mi_cuenta\'" />';
	aviso += '		&nbsp;&nbsp;&nbsp;';
	aviso += '		<input type="button" value="Ya dispongo de mi cuenta de usuario" onclick="location.href = \'mi_cuenta\'" />';
	aviso += '	</h1>';
	aviso += '	<br/>';
	aviso += '	<h2>Si lo prefieres, puedes acceder directamente utilizando tu cuenta de Facebook.</h2>';
	aviso += '	<h1 style="margin-left:120px"><fb:login-button size="large" length="long"></fb:login-button></h1>';
	aviso += '</div>';
	
	
	$.modal(aviso, {minWidth:465, minHeight:170, opacity:80, overlayCss: {backgroundColor:"#000"}, onClose: function(){ location.href = "index.php"; return true; $.modal.close();  }});
}

//	$.modal(\'<div style="background-color:#fff; width:200px; height:290px"><img src="" width="200" height="290" /></div>\'
//			, {minWidth:200, minHeight:290, opacity:60, overlayCss: {backgroundColor:"#000"}});

//	$("#modalmsg").modal({
//		onClose: function(){ location.href = "index.php"; return true; $.modal.close();  },
//		opacity:80,
//		overlayCss: {backgroundColor:"#000"}
//	});



