
function detectaNavegador(){
	var nav=0;
	
	
	
	//Detectando si es Safari
	var is_safari = navigator.userAgent.toLowerCase().indexOf('safari/') > -1;  
	if (is_safari ){ 
		
		//alert('Su navegador es Safari');
	 	nav = 1;
	 	
	}
	//Detectando si es Chrome
	var is_chrome= navigator.userAgent.toLowerCase().indexOf('chrome/') > -1;  
	if (is_chrome){
		//alert('Su navegador es Google Chrome');
		nav=2;
	}
	 
	//Detectando si es Firefox
	var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;  
	if (is_firefox ){
		//alert('Su navegador es Firefox');
		nav=3;
	}
	 
	//Detectando Cualquier version de IE
	if ('\v'=='v'){
		//alert('Su navegador es Internet Explorer !');
		nav=7;
	}
	 
	//Detectando si es IE6
	var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");  
	if (is_ie6 ){
		
		//alert('Su navegador es Internet Explorer 6');
		nav=6;
	}
	return nav;
	
}

function posicionarLogo( cont ){
	
	if ( detectaNavegador() >= 6){
		//alert( "ancho :" + getAncho() );	
		document.getElementById( cont ).style.left = ( (getAncho() - (1024)) / 2) + 10;
		document.getElementById( 'slogan' ).style.paddingLeft = "330px";
		//document.getElementById( 'redes' ).style.paddingLeft += "100px";
		//alert(" logo : " + document.getElementById( cont ).style.left);
	}
}


/*
 *  Mostrar u ocultar subopciones en el menu principal
 * */

function mo( div ){
	
	if ( document.getElementById(div).style.display == "block" ){
	
		document.getElementById(div).style.display = "none";		
	}else{
		document.getElementById(div).style.display = "block";
	}
}

function getAlto(){
	 
	 var altura = 0; 
	 	 
		if (self.innerHeight) // all except Explorer
		{		
			//alert("primera condicion");
			//altura = self.innerHeight;
			//altura = self.scrollHeight;
			//altura = window.innerWidth;			
			altura = document.body.scrollHeight;
			//alert("primera condicion altura"+altura);
			
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			//alert("para IE 6");
			altura = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			//alert("ultima");
			altura = document.body.clientHeight;
			altura = document.body.scrollHeight;
		}		
		
	 return (altura);
}

function getAncho(){
	 
	 var ancho = 0;
	 
		if (self.innerHeight) // all except Explorer
		{
			ancho = self.innerWidth;			
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			ancho = document.documentElement.clientWidth;		
		}
		else if (document.body) // other Explorers
		{
			
			ancho = document.body.clientWidth;		
		}
		
	 return (ancho);
}


function moModalMostrar( div ){
	
	if ( document.getElementById(div).style.display == "block" ){
		
		document.getElementById(div).style.display = "none";		
	}else{
		
		document.getElementById(div).style.height = getAlto();
		document.getElementById(div).style.width = getAncho()-16;
		
		document.getElementById(div).style.display = "block";
	}
	
}

function modal_productos( enlace ){
	 
	Modalbox.show(enlace.href, {title: enlace.title, height:230, width: 330, afterLoad: function(){ passValue('Current document') } }); 
	return false;
	
}

function validar_cantidad( form ){
	
	if ( form ){
	var cant = document.getElementById( "ajxcantidad" ).value;
		
		//alert( cant );
		
		if ( /^[0-9]+$/.test(cant) && cant > 0){
			//alert("si es numero");
			return true;
		}else{
			alert("Ingresa un valor numerico y mayor que cero");
			document.getElementById( "ajxcantidad" ).value = 1;
			return false;
		}
		
	}else{
		
		return false;
		
	}
	
}

function iracomprar(){
	
	document.getElementById("pagar_a_paypal").submit();
	
}
