function share(){
	window.location = "envia_amic.php?l="+escape(window.location);
}

jQuery(document).ready(function(){
	function cLang(lang){
		$.ajax({
			type: "GET",
			url: "_lang.php",
			data: "l="+lang,
			cache: false,
			success: function(response){
				if(response != ""){
					//Reload page
					location.reload(true);
				}
			}
		});
	}
	$('._cat').click(function(){
		cLang(1);
	});
	$('._es').click(function(){
		cLang(2);
	});
	
	$("a.boto_imprimir").click(function(){
		window.print();
	});
	
	setTimeout("minH()",1000);
	
	var loc = window.location;
	loc = loc+"";
	if( loc.indexOf(".php") < 0 ){
		$('#cabecera').attr("class","");
	}
});

function minH(){
	jQuery(document).ready(function(){
		//-- MIN container HEIGHT controller
		var inc = parseInt(jQuery(document).height())-parseInt(jQuery('body').height());
		if(inc > 0 && exclude == ""){
			//Elements envolved in website HEIGHT
			var elem1_H = parseInt($('#mid').height());
			jQuery('#mid').css("height",(elem1_H+inc)+"px");
			
			var elem2_H = parseInt($('#colright').height());
			jQuery('#colright').css("height",(elem2_H+inc)+"px");
		}else if(exclude == "videos"){
			
			//Exclusive for videos section
			var rinc = (jQuery(window).height())-parseInt(jQuery('body').height());
			if(inc > 0){
				//Elements envolved in website HEIGHT
				var elem1_H = parseInt($('#mid').height());
				jQuery('#mid').css("height",(elem1_H+inc)+"px");
				
				var elem2_H = parseInt($('#colright').height());
				jQuery('#colright').css("height",(elem2_H+inc)+"px");
			}else if(rinc < -5){
				//Elements envolved in website HEIGHT
				var elem1_H = parseInt($('#mid').height());
				jQuery('#mid').css("height","");
				
				var elem2_H = parseInt($('#colright').height());
				jQuery('#colright').css("height","");
			}
		}
		//END -- MIN controller
		setTimeout("minH()",1000);
	});
}

var exclude = ""; //MIN container HEIGHT -- MUTEX

