/////////////////////////powered by punknomas@hotmail.com/////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////

function objetoAjax(){

	var xmlhttp=false;

	try {

		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

	} catch (e) {

		try {

		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

		} catch (E) {

			xmlhttp = false;

  		}

	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

		xmlhttp = new XMLHttpRequest();

	}

	return xmlhttp;

}





function load_page(url)



{



	



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET",url +"?rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}





function tipo_comprobante(tipo)



{



if (tipo=='factura')

{

document.getElementById('factura').style.visibility='visible'

document.getElementById('factura').style.display ='';

document.factura.chek.value='lll';

	

}

else

{

document.getElementById('factura').style.visibility='hidden'

document.getElementById('factura').style.display ='none';

document.factura.chek.value='';

	

}





}



function save_comprobante(nombre,telefono,codigo,direccion,ciudad,postal,ruc,razon,direccionn)



{



	



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?save_comprobante=true&nombrecom="+nombre+"&telefonocom="+telefono+"&codigocom="+codigo+"&direccion="+direccion+"&ciudad="+ciudad+"&postal="+postal+"&rucc="+ruc+"&razon="+razon+"&direccionn="+direccionn+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}







function entrega(distrito,peso)



{



	divresultado=document.getElementById('cap_lugar');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();

 if (distrito=='')

 {

	 alert('Debe seleccionar un lugar de entrega valido')

	

 }

 else

 {

	ajax.open("GET","entrega.php?entrega="+distrito+"&peso="+peso+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)

 }

}







function entregar(distrito,lugar,peso,comprobante)



{



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();

 if (distrito=='')

 {

	 alert('Debe seleccionar un lugar de entrega valido')

	

 }

 else

 {

	ajax.open("GET","mete_producto.php?entregar="+distrito+"&lugar="+lugar+"&comprobante="+comprobante+"&pesoss="+peso+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)

 }

}







function eliminar_carrito(url)



{

	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET",url +"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}



function pago_deposito(codigo)



{

	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?codigo="+codigo+"&pagodeposito=true&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}





function editar_cantidad(linea,id_prod)



{



	divresultado=document.getElementById('editar'+linea+'cantidad');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","editar_cantidad.php?div="+linea+"&codigo="+id_prod+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}





function editar_talla(linea,id_prod,edad)



{



	divresultado=document.getElementById('editar'+linea+'talla');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","editar_talla.php?div="+linea+"&codigo="+id_prod+"&edad="+edad+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}





function editar_cantidad_save(cantidad,linea)



{



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?cantidad="+cantidad+"&linea="+linea+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}



function editar_talla_save(talla,linea)



{



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?talla="+talla+"&linear="+linea+"&tallar=true&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}







function finalizar(costo_envio,ubicacion,total)



{

	

	   if (document.frmfin.nombre.value==''){ 

       alert("Tiene que ingresar el nombre del contacto") 

       document.frmfin.nombre.focus() 

       return false; 

	   

    } 



    if (document.frmfin.telefono.value==''){ 

       alert("Tiene que ingresar el telefono del contacto") 

       document.frmfin.telefono.focus() 

       return false; 

	   

    } 

	

			    if (document.frmfin.direccion.value==''){ 

       alert("Tiene que ingresar la direccion del lugar de entrega") 

       document.frmfin.direccion.focus() 

       return false; 

	   

    } 

	

		    if (document.frmfin.ciudad.value==''){ 

       alert("Tiene que ingresar la  ciudad de entrega") 

       document.frmfin.ciudad.focus() 

       return false; 

	   

    } 



	 

	



	

		    if (document.frmfin.postal.value==''){ 

       alert("Tiene que ingresar el Codigo Postal") 

       document.frmfin.postal.focus() 

       return false; 

	   

    } 

	

	 

	 

/*	 if (document.frmfin.comprobante.value==''){ 

       alert("Tiene que seleccionar el tipo de comprobante") 

       document.frmfin.comprobante.focus() 

       return false; 

	   

    }*/

		  

		  

		  if (document.factura.chek.value!='')

		  {

			 

			 

	if (document.factura.ruc.value==''){ 

       alert("Tiene ingresar su ruc") 

       document.factura.ruc.focus() 

       return false; 

	   

    }  

	if (document.factura.razonsocial.value==''){ 

       alert("Tiene ingresar la razonsocial") 

       document.factura.comprobante.focus() 

       return false; 

	   

    }  

	if (document.factura.direccion.value==''){ 

       alert("Tiene que ingresar la direccion") 

       document.factura.direccion.focus() 

       return false; 

	   

    }   

	

	

			  

		}

	nom=document.frmfin.nombre.value;

	tel=document.frmfin.telefono.value;

	ent=document.destino.entrega.value;

	entt=document.destino.entregar.value;

	

	dire=document.frmfin.direccion.value;

	ciu=document.frmfin.ciudad.value;

	pos= document.frmfin.postal.value;

	

	

	//datos de factura

	

	

	

	

	ruc=document.factura.ruc.value;

	razon=document.factura.razonsocial.value;

	direccion=document.factura.direccion.value;

	

	

	

	/////////////////////////////

	



 if (document.factura.chek.value!='')

		  

		  {		

		tipo='factura';	  

		  }

		  else

		  {

			tipo='boleta';	   

			}



	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?entrega="+ent+"&entregar="+entt+"&nombre="+nom+"&telefono="+tel+"&referencia=&costoenvio="+costo_envio+"&ubicacion="+ubicacion+"&total="+total+"&direccion="+dire+"&ciudad="+ciu+"&postal="+pos+"&rucc="+ruc+"&razon="+razon+"&direccionn="+direccion+"&tipo="+tipo+"&fin=fin&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)



}











function carrito(tal,can,codigo,foto,nombre,precio,preciox,fotomax,edad,peso)



{



	

	divresultado=document.getElementById('camisetasss');



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","mete_producto.php?id="+codigo+"&talla="+tal+"&cantidad="+can+"&foto="+foto+"&nombre="+nombre+"&precio="+precio+"&preciox="+preciox+"&fotomax="+fotomax+"&edad="+edad+"&peso="+peso+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)

}



function validar(){ 

    //valido el nombre 

    if (document.form1.txtnick.value==''){ 

       alert("Tiene  que ingresar su E-mail") 

       document.form1.txtnick.focus() 

       return false; 

	   

    } 



    if (document.form1.txtpass.value==''){ 

       alert("Tiene que ingresar su contraseņa") 

       document.form1.txtpass.focus() 

       return false; 

	   

} 

		  

}

	

	

	

function validar1(){ 

    //valido el nombre 

    if (document.form5.txtnick.value==''){ 

       alert("Tiene  que ingresar su E-mail") 

       document.form5.txtnick.focus() 

       return false; 

	   

    } 



    if (document.form5.txtpass.value==''){ 

       alert("Tiene que ingresar su contraseņa") 

       document.form5.txtpass.focus() 

       return false; 

	   

} 

		  

}

	



function valida_final(){ 

    //valido el nombre 

    if (document.frmfin.nombre.value==''){ 

       alert("Tiene que ingresar el nombre del contacto") 

       document.frmfin.nombre.focus() 

       return false; 

	   

    } 



    if (document.frmfin.telefono.value==''){ 

       alert("Tiene que ingresar el telefono del contacto") 

       document.frmfin.telefono.focus() 

       return false; 

	   

    } 

	    if (document.frmfin.direccion.value==''){ 

       alert("Tiene que ingresar en lugar de entrega") 

       document.frmfin.direccion.focus() 

       return false; 

	   

    } 

	    if (document.frmfin.referencia.value==''){ 

       alert("Tiene que ingresar la referencia del lugar de entrega") 

       document.frmfin.referencia.focus() 

       return false; 

	   

    } 

		  

}





function cambiar(foto,codigo,maximo,nombre,precio,descrip)

{



	divresultado=document.getElementById('principal'+codigo);



	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("GET","imagen.php?foto="+foto+"&maximo="+maximo+"&nombre="+nombre+"&precio="+precio+"&descripcion="+descrip+"&rand=" + Aleatorio,true);



	ajax.onreadystatechange=useHttpResponse;



	ajax.send(null)

	

	

	







}





function limpiar_contacto()

{

	

	document.contacto.nombres.value='';

	document.contacto.apellidos.value='';

	document.contacto.email.value='';

	document.contacto.pais.value='';

	document.contacto.comentario.value='';

	document.contacto.fono.value='';

	document.contacto.ciudad.value='';



	document.contacto.nombres.focus() 

	

return false; 





}



function limpiar()

{

	

	document.registrate.mail.value='';

	document.registrate.pass.value='';

	document.registrate.repass.value='';

	document.registrate.nombres.value='';

	document.registrate.apellidos.value='';

	document.registrate.direccion.value='';

	document.registrate.distrito.value='';

	document.registrate.telefono.value='';

	document.registrate.ciudad.value='';

	document.registrate.celular.value='';

document.registrate.mail.focus() 

return false; 





}

function limpiar_olvido()

{

	

	document.frmolvido.olvido.value='';

	document.frmolvido.olvido.focus() 

return false; 





}



function enviar()



{

	

	

	divresultado=document.getElementById('msg_mail');

	mai=document.registrate.mail.value;

	pas=document.registrate.pass.value;

	rep=document.registrate.repass.value;

	nom=document.registrate.nombres.value;

	ape=document.registrate.apellidos.value;

	dir=document.registrate.direccion.value;

	dis=document.registrate.distrito.value;

	tel=document.registrate.telefono.value;

	cel=document.registrate.celular.value;

	ciu=document.registrate.ciudad.value;

	

	

	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("POST","registrate/registrate.php?rand=" + Aleatorio,true);

	document.getElementById('msg_mail').style.visibility="visible";

	ajax.onreadystatechange=useHttpResponse;

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

    ajax.send("mail="+mai+"&pass="+pas+"&repass="+rep+"&nombres="+nom+"&apellidos="+ape+"&direccion="+dir+"&distrito="+dis+"&telefono="+tel+"&celular="+cel+"&ciudad="+ciu);





}









function enviar_contacto()



{

	divresultado=document.getElementById('msg_mail');

	nom=document.contacto.nombres.value;

	ape=document.contacto.apellidos.value;

	ema=document.contacto.email.value;

	pai=document.contacto.pais.value;

	com=document.contacto.comentario.value;

	fono=document.contacto.fono.value;

	ciu=document.contacto.ciudad.value;



	

	

	

	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("POST","contactenos/contactenos.php?rand=" + Aleatorio,true);

	document.getElementById('msg_mail').style.visibility="visible";

	ajax.onreadystatechange=useHttpResponse;

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

    ajax.send("nombres="+nom+"&apellidos="+ape+"&email="+ema+"&pais="+pai+"&comentario="+com+"&ciudad="+ciu+"&telefono="+fono);





}





function enviar_olvido()



{

	divresultado=document.getElementById('msg_olvido');

	olv=document.frmolvido.olvido.value;



	

	

	var Aleatorio=parseInt(Math.random()*99999999);



	ajax=new objetoAjax();



	ajax.open("POST","olvido/olvido.php?rand=" + Aleatorio,true);

	document.getElementById('msg_olvido').style.visibility="visible";

	ajax.onreadystatechange=useHttpResponse;

	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

    ajax.send("olvido="+olv);





}



function ocultar()

{	

/*divresultado=document.getElementById('imagen_code');*/

	 document.getElementById('msg_mail').style.visibility="hidden";



/*	 var Aleatorio=parseInt(Math.random()*99999999);

	 ajax=new objetoAjax();

	 ajax.open("GET","registrate/validar.php?rand=" + Aleatorio,true);

	 ajax.onreadystatechange=useHttpResponse;

	 	ajax.send(null)*/

}





function ocultar_olvido()

{	

/*divresultado=document.getElementById('imagen_code');*/

	 document.getElementById('msg_olvido').style.visibility="hidden";



/*	 var Aleatorio=parseInt(Math.random()*99999999);

	 ajax=new objetoAjax();

	 ajax.open("GET","registrate/validar.php?rand=" + Aleatorio,true);

	 ajax.onreadystatechange=useHttpResponse;

	 	ajax.send(null)*/

}









function useHttpResponse() {



	



   if (ajax.readyState == 4) 



   {



   		 if(ajax.status == 200) 



		{



			divresultado.innerHTML=ajax.responseText;



			



		}



  } 



  else 



  {



  divresultado.innerHTML = '<center><p /><img src="images/cargando.gif" alt="cargando..."></center>';



  }





}





function useHttpResponses() {



	



   if (ajax.readyState == 4) 



   {



   		 if(ajax.status == 200) 



		{



			divresultado.innerHTML=ajax.responseText;



			



		}



  } 



  else 



  {



  divresultado.innerHTML = '';

  



  }





}