// JavaScript Document

// bg 2 /////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function ubicacionMoto()
{
	var TV = TamVentana();
	document.getElementById('moto0').style.width=TV[0]+"px";
	document.getElementById('moto0').style.height=TV[1]+"px";
}


// pasafotos ////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function verweb(){ document.getElementById('bd').style.display="block";	}
// pasafotos ////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function bgpasafoto(){ setInterval(next, 20000);}
var contador=1;
function next() 
{
	if(contador!=4)
	{
		$("#bg").fadeOut('slow',function(){cambia1()});
		function cambia1()
		{
			$("#bg").attr("src","img/bg"+contador+".jpg");
			$("#bg").fadeIn('slow');
		}
	contador++;
	}else{
		$("#bg").fadeOut('slow',function(){cambia2()});
		function cambia2()
		{
			$("#bg").attr("src","img/bg1.jpg");
			$("#bg").fadeIn('slow');
		}
		contador=1;
	}
}

function prev() 
{
	if(contador!=1)
	{
		contador--;
		$("#bg").fadeOut('slow',function(){cambia1()});
		function cambia1()
		{
			$("#bg").attr("src","img/bg"+contador+".jpg");
			$("#bg").fadeIn('slow');
		}	
	}else{
		$("#bg").fadeOut('slow',function(){cambia2()});
		function cambia2()
		{
			$("#bg").attr("src","img/bg4.jpg");
			$("#bg").fadeIn('slow');
		}
		contador=4;
	}
}
// bg ///////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function bg100size() 
{  	
	var theWindow        = $(window),
		$bg              = $("#bg"),
		aspectRatio      = $bg.width() / $bg.height();			    			    		
	function resizeBg() {
		
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
			$bg
				.removeClass()
				.addClass('bgheight');
		} else {
			$bg
				.removeClass()
				.addClass('bgwidth');
		}				
	}			                   			
	theWindow.resize(function() {
		resizeBg();
	}).trigger("resize");		
}

// cursor ///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function cursor(id){$(id).css("cursor","pointer");}
// testeo ///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function testeo1()
{	
	if(document.getElementById('testeoGrid').style.display=="none")
	{
		document.getElementById('testeoGrid').style.display="block";
		$("#testeoGrid").css("height", $(document).height());
		document.getElementById('testeoGrid').style.background="url(css/img/testeo_24.png)";
	}else{
		document.getElementById('testeoGrid').style.display="none";
	}
}
// RESPUESTA MAIL ///////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function respuestaMail()
{
	$(".shadow").css("height", $(document).height());
	str = document.URL;
	ubicacion = str.split("#");	
	if(ubicacion[1]=="enviado"){
		$('#mailenviado').fadeIn('slow');
		$('#shadow').fadeIn('slow');
		$('#Cerrar_mailenviado').fadeIn('slow');
	}	
}
function ocultar_mail()
{
	$("#shadow").fadeOut('slow'); 
	$("#mailenviado").fadeOut('slow');
	$('#Cerrar_mailenviado').fadeOut('slow');
}
// FUNCIONES GENERALES //////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function ocultar(contenido){$(contenido).fadeOut('slow');}
function mostrar(contenido){$(contenido).fadeIn('slow');}

// TAMAŅO PANTALLA //////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function TamVentana() {  
  var Tamanyo = [0, 0];  
  if (typeof window.innerWidth != 'undefined')  
  {  
    Tamanyo = [  
        window.innerWidth,  
        window.innerHeight  
    ];  
  }  
  else if (typeof document.documentElement != 'undefined'  
      && typeof document.documentElement.clientWidth !=  
      'undefined' && document.documentElement.clientWidth != 0)  
  {  
 Tamanyo = [  
        document.documentElement.clientWidth,  
        document.documentElement.clientHeight  
    ];  
  }  
  else   {  
    Tamanyo = [  
        document.getElementsByTagName('body')[0].clientWidth,  
        document.getElementsByTagName('body')[0].clientHeight  
    ];  
  }  
  return Tamanyo;  
}  



