	ns=document.layers
	ie=document.all
	function PreCarga() {
  		if (ie) precarga.style.visibility="hidden";
  		if(ns) document.pregarga.visibility="hide";
	}

var cuenta=0;
var envio=0;
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")


function stopErrors() {
 return true;
}
window.onerror = stopErrors;

function netie(net, ie) {
  if ((navigator.appVersion.substring(0,3) >= net && navigator.appName == 'Netscape' && net != -1) || (navigator.appVersion.substring(0,3) >= ie && navigator.appName.substring(0,9) == 'Microsoft' && ie != -1))
    return true;
else return false;
}

function Fecha() {
var mydate=new Date()
		var year=mydate.getYear()
		if (year < 1000)
		year+=1900
		var day=mydate.getDay()
		var month=mydate.getMonth()
		var daym=mydate.getDate()
		if (daym<10)
		daym="0"+daym
		var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
		var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
		return dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year
}

function Time() {
	var Digital=new Date()
	var horas=Digital.getHours()
	var minutos=Digital.getMinutes()
	var segundos=Digital.getSeconds()
if (horas==0)
	horas="00"
	if (minutos<=9)
	minutos="0"+minutos
	if (segundos<=9)
	segundos="0"+segundos
	return (horas+":"+minutos+":"+segundos);
}



function scrollit(seed) {
    var m1  = "Bienvenido a la pagina de AudioSYS 2007!  ";
    var m2  = "..... Esperando sea de su agrado ";
    var m3  = "......Disfrutela ";
    var m4  = "";
    var msg=m1+m2+m3+m4;
    var out = " ";
    var c   = 1;
    if (seed > 100) {
        seed--;
        cmd="scrollit("+seed+")";
        timerTwo=window.setTimeout(cmd,100);
    }
    else if (seed <= 100 && seed > 0) {
    for (c=0 ; c < seed ; c++) {
        out+=" ";
    }
    out+=msg;
    seed--;
    window.status=out;
    cmd="scrollit("+seed+")";
    timerTwo=window.setTimeout(cmd,100);
    }
    else if (seed <= 0) {
    if (-seed < msg.length) {
        out+=msg.substring(-seed,msg.length);
        seed--;
        window.status=out;
        cmd="scrollit("+seed+")";
        timerTwo=window.setTimeout(cmd,100);
    }
    else {
    window.status=" ";
    timerTwo=window.setTimeout("scrollit(100)",75);
      }
   }
}



function Recomendar(URL) {
    URL = URL + "?dato=" + document.form.Email.value + "~" + document.form.Nombre.value
    day = new Date();
    id = day.getTime();
    if (document.form.Nombre.value=="") {
        alert("El Campo Nombre no puede estar Vacio");
        document.form.Nombre.value = "";
        document.form.Nombre.focus();
        return false;
    }
    var goodEmail = document.form.Email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
    if (goodEmail){
        var altura_popup=280; 
        var H = (screen.height - altura_popup) / 2; 
        var anchura_popup=420; 
        var L = (screen.width - anchura_popup) / 2; 
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height='+altura_popup+', width='+anchura_popup+', top='+H+', left='+L);");
        document.form.Email.value = ">>Email de tu Amigo"
        document.form.Nombre.value = ">>tu Nombre"
    } else {
        alert('Entre una direccion de Email Correcta')
        document.form.Email.value = ""
        document.form.Email.focus()
        return false;
    }
}




function EnviarComentario(){
    if (form.tema[0].checked) { 
        form.tema.value="Queja" 
    }
    
    if (form.tema[1].checked) { 
        form.tema.value="Problema" 
    }

if (form.tema[2].checked) { 
form.tema.value="Sujerencia" 
}
if (form.tema[3].checked) { 
form.tema.value="Elogio" 
}
if (form.contacto_solicitado.checked) { 
form.contacto_solicitado.value="Si" 
}else{
form.contacto_solicitado.value="" 
}
URL = "_post/post_contacto.php" + "?dato=" + form.tema.value + "~" + form.Asunto.value + "~" + form.otro_asunto.value + "~" + form.comentario.value + "~" + form.Nombre.value + "~" + form.Email.value + "~" + form.Telefono.value + "~" + form.FAX.value + "~" + form.contacto_solicitado.value 
day = new Date();
id = day.getTime();
	var EmailCorrecto = form.Email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if (form.comentario.value == ""){
		alert("Por favor complete el campo Comentario del formulario");
		form.comentario.focus();
		return false;
		}	
	if (form.Nombre.value == ""){
		alert("Por favor complete el campo Nombre Apellido del formulario");
		form.Nombre.focus();
		return false;
		}	
	if (EmailCorrecto){
   		if (cuenta == 0)
      		{
      		cuenta++;
form.otro_asunto.value = "";                
form.comentario.value = "";
form.Nombre.value = "";
form.Email.value = "";
form.Telefono.value = "";
form.FAX.value = "";		
		
        var altura_popup=330; 
        var H = (screen.height - altura_popup) / 2; 
        var anchura_popup=550; 
        var L = (screen.width - anchura_popup) / 2; 


		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height='+altura_popup+', width='+anchura_popup+', top='+H+', left='+L);");
		} else {
      		alert("El siguiente formulario ya ha sido enviado, muchas gracias.");
      		}
		} else	{ 
				alert('Entre una direccion de Email Correcta');	
				form.Email.value = "";
				form.Email.focus();
				return false;
				}
}


function Download(){
    var mensaje = "Se requiere que complete los siguientes campos:";
    if (document.form.nombre.value=="") {
        mensaje = mensaje + " - Nombre y Apellido";
    }

    if (document.form.direccion.value=="") {
         mensaje = mensaje + " - Direccion";
    }
    
    if (document.form.localidad.value=="") {
        mensaje = mensaje + " - Localidad";
    }

    if (document.form.provincia.value=="") {
        mensaje = mensaje + " - Provincia";
    }

    if (document.form.cp.value=="") {
        mensaje = mensaje + " - Codigo Postal";
    }

    var goodEmail = document.form.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
    if (goodEmail){
        mensaje == "Se requiere que complete los siguientes campos:"
    }else{
        mensaje = mensaje + " - Direccion de Email Incorrecta";
    }

    if (mensaje == "Se requiere que complete los siguientes campos:") {
        
        URL = "_post/post_download.php" + "?dato=" + document.form.nombre.value + "~" + document.form.direccion.value + "~" + document.form.localidad.value + "~" + document.form.cp.value + "~" + document.form.provincia.value + "~" + document.form.email.value;
        day = new Date();
        id = day.getTime();
        document.form.nombre.value ="";
        document.form.direccion.value ="";
        document.form.localidad.value ="";
        document.form.cp.value ="";
        document.form.provincia.value ="";
        document.form.email.value ="";

        var altura_popup=280;
        var anchura_popup=550; 
        
	var H = (screen.height - altura_popup) / 2; 
	var L = (screen.width - anchura_popup) / 2; 
	
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height='+altura_popup+', width='+anchura_popup+', top='+H+', left='+L);");
    
    }else {
        alert(mensaje);
        return false;
    }
}




function Compra(){
var mensaje = "Se requiere que complete los siguientes campos:";
if (document.form.nombre.value=="") {
mensaje = mensaje + " - Nombre y Apellido";
}
if (document.form.direccion.value=="") {
mensaje = mensaje + " - Direccion";
}
if (document.form.telefono.value=="") {
mensaje = mensaje + " - Telefono";
}
if (document.form.localidad.value=="") {
mensaje = mensaje + " - Localidad";
}
if (document.form.provincia.value=="") {
mensaje = mensaje + " - Provincia";
}
if (document.form.telefono.value=="") {
mensaje = mensaje + " - Telefono";
}
if (document.form.cp.value=="") {
mensaje = mensaje + " - Codigo Postal";
}
var goodEmail = document.form.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){
mensaje == "Se requiere que complete los siguientes campos:"
}else{
mensaje = mensaje + " - Direccion de Email Incorrecta";
}
if (mensaje == "Se requiere que complete los siguientes campos:") { 

        URL = "_post/post_compra.php" + "?dato=" + document.form.nombre.value + "~" + document.form.direccion.value + "~" + document.form.telefono.value + "~" + document.form.localidad.value + "~" + document.form.provincia.value + "~" + document.form.cp.value + "~" + document.form.email.value + "~" + document.form.FormaDePago.value + "~" + document.form.FormaDeContacto.value;


        day = new Date();
        id = day.getTime();
        document.form.nombre.value ="";
        document.form.direccion.value ="";
        document.form.localidad.value ="";
	document.form.telefono.value ="";        
	document.form.cp.value ="";
        document.form.provincia.value ="";
        document.form.email.value ="";

        var altura_popup=330;
        var anchura_popup=550; 
        
	var H = (screen.height - altura_popup) / 2; 
	var L = (screen.width - anchura_popup) / 2; 
	
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,height='+altura_popup+', width='+anchura_popup+', top='+H+', left='+L);");


}else {
alert(mensaje);
return false;
   }
}



