function newCenterWindow(page, name, w, h) {
	var t = Math.round((screen.height / 2) - (h / 2));
	var l = Math.round((screen.width / 2) - (w / 2));
	
	nw = window.open(page, name, 'width='+w+',height='+h+',status=no,resizable=no,top='+t+',left='+l);
	setTimeout('nw.focus();',250);
	}


function CheckEmail(formelem) {
	arrInvalidCharacters = new Array("?","#","$","%","^","&","*","(",")","!","~","[","]","{","}","\\","'","`",":",";","'","<",">",",","/","\\",")","+","=","|")
	var bValid = true;
	for (i = 0; i < arrInvalidCharacters.length; i++) {
		if (formelem.value.indexOf(arrInvalidCharacters[i]) != -1) {
			bValid = false;
			break;
			}
		}
	if (formelem.value == "" || formelem.value.indexOf("@") == -1 || formelem.value.indexOf(".") == -1) {
		bValid = false;
		}
	return bValid;
	}


function onSuscribe() {
	frm = document.suscribeform;
	if (frm.email.value == "") {
		alert('Debe capturar un correo electronico');
		frm.email.focus();
		return false;
		}

	if (!CheckEmail(frm.email)) {
		alert('Debe capturar un correo electronico valido\n\nEjemplo: soporte@formato.com.mx');
		frm.email.focus();
		return false;
		}
	newCenterWindow('/cgi/suscribe.cgi?email='+frm.email.value, 'popup', 300, 150);
	}

function chkStatus() {
	frm = document.checksupport;

	if (frm.Customer.value == "") {
		alert('Debe capturar su clave de cliente');
		frm.Customer.focus();
		return false;
		}

	if (frm.Folio.value == "") {
		alert('Debe capturar su folio de soporte');
		frm.Folio.focus();
		return false;
		}


//	newCenterWindow('/cgi/support.cgi?Cst='+frm.Customer.value+'&Fol='+frm.Folio.value, 'popup', 300, 150);
	window.location = '/cgi/support.cgi?Cst='+frm.Customer.value+'&Fol='+frm.Folio.value
	}

function padThis(_obj,_pad) {
	if(!_obj.size)return; /* this must be specified! */

	if(_obj.value.length == 0) {
		return true;

		}

	/* make it long enough */
	while(_obj.value.length<=_obj.size) {
		_obj.value=""+_pad+_obj.value;
		}

	/* remove 1st character if it is the pad character and its too long */
	while(_obj.value.length>_obj.size && _obj.value.split("")[0]==_pad) {
		_obj.value=_obj.value.substr(1,_obj.value.length);
		}
	}

function FolFormat(e) {
	if (event.keyCode > 96 && event.keyCode < 123)
		event.keyCode = event.keyCode - 32;

	if (event.keyCode == 241)
		event.keyCode = 209;
			
	if ((event.keyCode < 65 || event.keyCode > 90) && (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode != 13) && (event.keyCode != 45) && (event.keyCode != 209))
		event.returnValue = false;
	}


/*
#-- QUITAR ESTE COMENTARIO
document.write('  <table width="750" style="border: 1px solid #96B0CD;">');
document.write('  <form name="checksupport">');
document.write('    <tr> ');
document.write('      <td rowspan="3" width="524" align="center" valign="top" class="menucell"><img src="/images/support.jpg"></td>');
document.write('      <td class="menucell" width="126" align="right"><font class="bottomfont">CLAVE DE CLIENTE:&nbsp;</font></td><td class="menucell" width="100"><input type="text" name="Customer" maxlength="5" size="5" class="itext" onChange="padThis(this,\'0\')"></td>');
document.write('    </tr>');
document.write('    <tr> ');
document.write('      <td class="menucell" align="right"><font class="bottomfont">FOLIO DE SOPORTE:&nbsp;</font></td><td class="menucell"><input type="text" name="Folio" maxlength="15" size="10" class="itext" onKeyPress="FolFormat(0)"></td>');
document.write('    </tr>');
document.write('    <tr> ');
document.write('      <td colspan="2" class="menucell" align="center"><input type="button" value="Revisar" class="ibutton" onClick="chkStatus()"></td>');
//document.write('          <input type="button" value="Ayuda" class="ibutton" onClick="showHelp()">');
document.write('    </tr>');
document.write('  </form>');
document.write('  </table>');
document.write('  <br> ');
#-- QUITAR ESTE COMENTARIO
*/

/*
document.write('  <table width="750">');
document.write('  <form name="suscribeform">');
document.write('    <tr> ');
document.write('      <td width="240" class="titlecell" align="center"><font class="suscribefont">¿ deseas recibir ofertas a tu correo ?</font></td>');
document.write('      <td width="200" align="center"><font class="bottomfont">&nbsp;&nbsp;INSCRIBETE A NUESTRAS OFERTAS</font></td>');
document.write('      <td width="320" align="right" valign="top">');
document.write('          <input type="text" name="email" class="itext" size="30">');
document.write('          <input type="button" value="Suscribirme" class="ibutton" onClick="onSuscribe()">');
document.write('      </td>');
document.write('    </tr>');
document.write('  </form>');
document.write('  </table>');
document.write('  <br> ');
*/

document.write('  <table width="750">');
document.write('    <tr> ');
document.write('      <td colspan="3" class="sbotcell" height="2"></td>');
document.write('    </tr>');
document.write('    <tr> ');
document.write('      <td width="15" class="sbotcell">&nbsp;</td>');
document.write('      <td class="cbotcell" align="center">&copy;2002 Formato Computacion.<br>Calle A. Flores y A. Cano, Los Mochis, Sinaloa, Mexico.<br>Tels: (668) 818 0068<br>Email: <a href="mailto:ventas@formato.com.mx" class="menuleft">ventas@formato.com.mx</a><br></td>');
document.write('      <td width="15" class="sbotcell">&nbsp;</td>');
document.write('    </tr>');
document.write('    <tr> ');
document.write('      <td colspan="3" class="sbotcell" height="2"></td>');
document.write('    </tr>');
document.write('  </table>');
