$(document).ready(function(){
	$("#categorias").change(function(){
		for (count=1;count<=categorias;count++){
			if (this.value == 0) document.getElementById('msgslctsubcat').style.display='block';
			if (count == this.value){
				var campo =  "sub-"+this.value
				if (document.getElementById(campo)){
					document.getElementById('msgslctsubcat').style.display='none';
					document.getElementById(campo).style.display='block';
					document.getElementById(campo).disabled=false;
				}
			}else{
				var campo =  "sub-"+count
				if (document.getElementById(campo)){
					document.getElementById(campo).style.display='none';
					document.getElementById(campo).disabled=true;
				}
			}
		}
	}).change();
	
	$("#lnkmasimagen").click(function(){
		var primerimagen = document.getElementById("primerimagen")
		var masimagen = document.getElementById("masimagen")
		masimagen.innerHTML = masimagen.innerHTML + primerimagen.innerHTML
	})
	

	
    //formulario de contactos
	$("#frmContacto").submit(function(){
		if ($("#nombrecompleto1").val() == 0){
			alert('Debe de colocar su nombre completo');
			$("#nombrecompleto1").focus();
			return false;
		}
		if ($("#email1").val() == 0){
			alert('Debe de colocar su email');
			$("#email1").focus();
			return false;
		} else {
		   var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 
			if (!filter.test($("#email1").val())) { 
				alert("Este no parece ser una direccion de email valida, favor verifique!!"); 
				$("#email1").focus(); 
				return false; 
			}		
        }
		if (($("#tmensaje").val() == 0) && ($("#tmensaje").val() == 0) ){
			alert('Debe colocar el tema del mensaje');
			$("#direccion").focus();
			return false;
		}
		if (($("#comentarios").val() == 0) && ($("#comentarios").val() == 0) ){
			alert('Debe colocar el mensaje');
			$("#direccion").focus();
			return false;
		}
		if (confirm('żEsta todo correcto?')) return true;
		else return false; 
	})
	
	$("#frm").submit(function(){
		
		if ($("#nombrecompleto1").val() == 0){
			alert('Debe de colocar su nombre completo');
			$("#nombrecompleto1").focus();
			return false;
		}
		if ($("#mostrar").val() == 0){
			alert('Debe seleccionar si desea que se muestre su nombre');
			$("#mostrar").focus();
			return false;
		}
		if ($("#email1").val() == ""){
			alert('Debe de colocar su email');
			$("#email1").focus();
			return false;
		} else {
		   var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 
			if (!filter.test($("#email1").val())) { 
				alert("Este no parece ser una direccion de email valida, favor verifique!!"); 
				$("#email1").focus(); 
				return false; 
			}		
        }
		if ($("#nombrecompleto2").val() == 0){
			alert('Debe de colocar el nombre completo a quie envia');
			$("#nombrecompleto2").focus();
			return false;
		}
		if ($("#email2").val() == ""){
			alert('Debe de colocar el email a quien envia');
			$("#email2").focus();
			return false;
		} else {
		   var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 
			if (!filter.test($("#email2").val())) { 
				alert("Este no parece ser una direccion de email valida, favor verifique!!"); 
				$("#email2").focus(); 
				return false; 
			}		
        }
		if (($("#direccion").val() == 0) && ($("#direccion").val() == 0) ){
			alert('Debe escribir la direccion');
			$("#direccion").focus();
			return false;
		}
		if (($("#telefono1").val() == 0) && ($("#telefono1").val() == 0) ){
			alert('Debe escribir el telefono');
			$("#telefono1").focus();
			return false;
		}		
		if (($("#tmensaje").val() == 0) && ($("#tmensaje").val() == 0) ){
			alert('Debe escribir el tema del mensaje');
			$("#tmensaje").focus();
			return false;
		}
		if ($("#comentarios").val() == 0){
			alert('Coloque un mensaje');
			$("#comentarios").focus();
			return false;
		}
		if ($("#motivo").val() == 0){
			alert('Seleccione el motivo del pedido');
			$("#motivo").focus();
			return false;
		}  		

		if (confirm('żEsta todo correcto?')) return true;
		else return false;
	
	})

	$("#frmLogin").submit(function(){

   		if ($("#email").val() == ""){
			alert('Debe ingresar el correo electronico');
			$("#email").focus();
			return false;
		}

   		if ($("#clave").val() == ""){
			alert('Debe ingresar la clave');
			$("#clave").focus();
			return false;
		} 	
})

	//formulario de subirimagen
	$("#frmart").submit(function(){
		if ($("#titulo").val() == ""){
			alert('Debe de colocar el titulo del producto');
			$("#titulo").focus();
			return false;
		}
		if ($("#precio").val() == ""){
			alert('Debe de colocar el precio del producto');
			$("#precio").focus();
			return false;
		}	    
		if ($("#codigo").val() == ""){
			alert('Debe de colocar el codigo del producto');
			$("#codigo").focus();
			return false;
		}
		if ($("#estatus").val() == 0){
			alert('Debe seleccionar el estatus.');
			$("#estatus").focus();
			return false;
		}
		if ($("#categorias").val() == 0){
			alert('Debe seleccionar una categoria.');
			$("#categorias").focus();
			return false;
		}
		if ($(".slcsubcategorias").val() == 0){
			alert('Debe seleccionar la subcategoria.');
			$("#categorias").focus();
			return false;
		}		
		if ($("#descripcion").val() == ""){
			alert('Debe colocar la descripcion del producto');
			$("#descripcion").focus();
			return false;
		}
		if ($("#comprar").val() == ""){
			alert('Debe colocar el codigo de paypal');
			$("#comprar").focus();
			return false;
		}
		if ($("#image").val() == "" && $("#idart").val() == ""){
			alert('Debe seleccionar una imagen');
			$("#image").focus();
			return false;
		}
		if (confirm('żEsta seguro de publicar este producto?')) return true;
		else return false;
	})
	
	jQuery(function($) {
		$('.masktel').mask("(999) 999-9999");
		$('#email').alphanumeric({allow:"@._-"});
		$('.maskalpha').alphanumeric({allow:". "});
		$('.masknomtienda').alphanumeric({allow:" "});
		$('.masktitulo').alphanumeric({allow:",.)($%@#/ "});
		$('.maskdireccion').alphanumeric({allow:",.)($%@#:/ "});
		$('.maskusuario').alphanumeric({allow:"._-@"});
		$('.maskint').numeric('0[1-9]|1[012]');
		$('.maskfloat').numeric({allow:"."});
		$('#phoneext').mask("(999) 999-9999? x99999");
		$("#tin").mask("99-9999999");
		$(".fecha").mask("99/99/9999");
		$("#ssn").mask("999-99-9999");
		$("#eyescript").mask("~9.99 ~9.99 999");
	});
	
	


	
	
	
})
/* $(document).ready(function(){	
	for (i = 1;i<20;i++) {
	    $(".sm" + i).css( "padding-left","25px");
	    //$("#m" + i).css( "color","#000");
	    $(".sm" + i).hide();
	}
	$(".1").toggle(
		function () {
			$("#m" + this.id).attr("innerHTML", "[-]");
    	    $("#menu li.sm" + this.id).show("fast");
			return false;
		},
		function () {
            $("#m" + this.id).attr("innerHTML", "[+]");
    	    $("#menu li.sm" + this.id).hide(500);			
			return false;
		}
	);	 */
	
/*	$("#menu ul").hide();
	$("#productos ul li.subcat").hover(function(){
		$(this).children("ul").slideDown("fast");							 
	}, function(){
		$(this).children("ul").slideUp("fast");	
	})
	$("#menu ul").hover(function(){
		$(this).parents("li").addClass("active");							 
	}, function(){
		$(this).parents("li").removeClass("active");	
	})
	$("li#opcionespag img").click(function(){
	   var nuevo_color = '/css/lp' + $(this).attr("id") + '.css';
	   $("#d_color").attr("href", nuevo_color);	
	   set_cookie("lp_colores",nuevo_color);
	   return false;										   
    })
	$("#listaslnk tr:odd").addClass("odd");*/
/* })
 */
// galeria de fotos - Detalle //
/* $(document).ready(function(){
	if(document.getElementById("gallery"))
	{ 
		$("#tamanoft").attr("innerHTML", $("#placeholder").attr("title")); 
		$("#gallery a").click(function(){
			$("#tamanoft").attr("innerHTML", $(this).attr("title"));
			$("#lbox").attr("href", $(this).attr("href"));
			$("#placeholder").attr("src", $(this).attr("href"));
			$("#placeholder").attr("width", $(this).attr("id"));
			$("#placeholder").attr("height", $(this).attr("name"));
			return false;
		})		
	}
}) */
// clicks en vip //
/* $(document).ready(function(){
	if(document.getElementById("vip"))
	{
		$("#vip a").click(function(){
			return false;
		})		
	}
}) */
/* $(document).ready(function(){
	if (document.getElementById("listaslnk")) {
		var trs = document.getElementById("listaslnk").getElementsByTagName("tr");
		for(var i=0;i<trs.length;i++)
		{
			trs[i].onmouseover = function()
			{
				$(this).addClass('over').show("slow");	
			}
			trs[i].onmouseout = function()
			{
				$(this).removeClass('over').show('slow');	
			}
		}
	}
})

function jumpsubcat(valor) {
	location.href=valor.value;
} */
