function AbreNoticia(id){
	$.ajax({ 
			type: "POST",
			url: "php/noticias.php",
			data: "idnoticia="+id,
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});	
}
function AbrePortada(){
	$.ajax({ 
			type: "POST",
			url: "portada.php",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});	
}

function AbreProducto(id){
	$.ajax({ 
			type: "POST",
			url: "php/fichaproducto.php",
			data: "idproducto="+id,
			success: function(datos){
				$("#fichaproducto").html(datos);
			}
	});	
}
function AbreSomos(){
	$.ajax({ 
			type: "GET",
			url: "somos.html",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});	
}

function AbreLegal(){
	$.ajax({ 
			type: "POST",
			url: "legal.html",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});	
}


function AbreContactar(){
	$.ajax({ 
			type: "POST",
			url: "php/contactar.php",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});	
}

function AbreP(ifs){
	$.ajax({ 
			type: "POST",
			url: "php/fichaproducto.php",
			data: "idproducto="+ifs,
			success: function(datos){
				$("#fichaproducto").html(datos);
			}
	});	
}

function AbreProductos(){
	$.ajax({ 
			type: "POST",
			url: "php/productos.php",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});
	
	
}

function AbreNoticias(){
	$.ajax({ 
			type: "POST",
			url: "php/noticias.php",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});
	
	
}
function AbreMultimedia(){
	$.ajax({ 
			type: "POST",
			url: "php/multimedia.php",
			data: "id=1",
			success: function(datos){
				$("#contenedor").html(datos);
			}
	});
	
	
}

function cambiarcategorias(){
	
	id=$('#idcategoria').val();
	if(id=='-1'){
		$("tr[rel='categorias']").show();
		
	} else {
		$("tr[rel='categorias']").hide();
		$(".cate"+id).show();
	}
	
	
}

function cargacategoriasmultimedia(){
	id=$('#tipo').val();
	$.ajax({ 
			type: "POST",
			url: "php/categoriasmultimedia.php",
			data: "id="+id,
			success: function(datos){
				$("#categoriasmultimedia").html(datos);
			}
	});
	
	
	
	
}
function cargagaleria(){
	
	id=$('#idcategoria').val();
	$.ajax({ 
			type: "POST",
			url: "php/galeriamultimedia.php",
			data: "id="+id,
			success: function(datos){
				$("#fichagaleria").html(datos);
			}
	});
	
	
	
}

function valida(){
	var errors=0;
	var errorstxt='';
	
	if($('#contacto').val()==''){
		errors++;
		errorstxt=errorstxt+'La Persona de contacto es Obligatoria.<br>'
	
	}
	if($('#empresa').val()==''){
		errors++;
		errorstxt=errorstxt+'La Empresa es Obligatoria.<br>'
	
	}
	if($('#email').val()==''){
		errors++;
		errorstxt=errorstxt+'El Email es Obligatorio.<br>'
	
	}
	if($('#comentarios').val()==''){
		errors++;
		errorstxt=errorstxt+'Los Comentarios son obligatorios.<br>'
	
	}
	if(!$("#acepto").is(":checked")){
		errors++;
		errorstxt=errorstxt+'Debe aceptar la clausula de proteci&oacute;n de datos.<br>'
	
	}
	
	if(errors==0){
		$('#frm').submit();
	} else {
	
		$('#errores').html(errorstxt);
	}
}
