var javaErr = true;
var selectedObjected = null;
var msec1;
var sttime;
var msec1;
var myNum;
var content = null;
var content1 = null;
var container;
var obj;
var objForm = null;
var globalURI = '';
var JArray = new Array(); //@JSON notation
var global_document_id = '';
var global_document_name = '';
var sendForm = true;
var globalMessage = '';
var e;
var globalCounter=0;
var globalCounterSpecial=0;
var recursiveFunctionName = '';
var cedula_format;
var error_string = "";
var JErrors = new Array(); //@JSON notation
var loadProspectForm = false;
var objFormRegister = ((document.frm_register!=null)?objFormRegister=document.frm_register:objFormRegister=null);
function Page(){
this.language = 'en'; // default language
this.current = '';
this.objectType = "";
this.loadSourceNews = function(){
var URIs = "";
switch(parseInt(arguments[0])){
case 0:
URIs="finanznachrichten.htm";
break;
case 1:
URIs="yahooFinance.htm";
break;
case 2:
URIs="telcosIT.htm";
break;
case 3:
URIs="hugin.htm";
break;
case 4:
URIs="heraldBoston.htm";
break;
}
if(URIs.length>0){
URIs='news/'+URIs+'?sessionid='+request.sessionID();
content = document.getElementById('display:news');
content.innerHTML = '
 |
';
connector.mimeType = 'text/html';
connector.contentType = 'text/html;charset=UTF-8';
connector.loadXMLFile_0(URIs,'getPageInformation');
}
}
this.showDocument = function(){
if (document.getElementById("otrotitular").checked){
document.getElementById("IdDocument").style.display='';
}else{
document.getElementById("IdDocument").style.display='none';
}
}
this.showAlert = function(){
var alertText = arguments[0];
var obj = document.getElementById('floatingPanel');
obj.style.display = '';
obj = document.getElementById('alert:Message');
obj.innerHTML = alertText;
obj = document.getElementById('window:pane');
}
this.closeAlert = function(){
var obj = document.getElementById('floatingPanel');
obj.style.display = 'none';
}
this.saveRNC = function(){
var pid = arguments[0];
var objForm = document.forms[0];
var rnc = objForm.rnc.value;
var name = objForm.firstName.value;
var apellido = objForm.firstName.value//objForm.lastName.value;
var birthday = '01-01-1999';//objForm.birthday.value;
errorForm = false;
this.clearErrorRNC();
if(rnc.length==0){
content = document.getElementById('error:rnc');
content.innerHTML = skelet.showErrorMessageFloatingLeft('No puedes dejar este campo en blanco.');
errorForm = true;
}else if(rnc.length<5){
content = document.getElementById('error:rnc');
content.innerHTML = skelet.showErrorMessageFloatingLeft('El numero de RNC es invalido. Es demaciado corto.');
errorForm = true;
}else if(name==''){
content = document.getElementById('error:name');
content.innerHTML = skelet.showErrorMessageFloatingLeft('No puede dejar este campo en blanco.');
errorForm = true;
}else if(name.length<3){
content = document.getElementById('error:name');
content.innerHTML = skelet.showErrorMessageFloatingLeft('El escrito es demaciado corto.');
errorForm = true;
}else if(apellido==''){
content = document.getElementById('error:commercialName');
content.innerHTML = skelet.showErrorMessageFloatingLeft('no puede dejar este campo en blanco.');
errorForm = true;
}else if(apellido.length<3){
content = document.getElementById('error:commercialName');
content.innerHTML = skelet.showErrorMessageFloatingLeft('el texto escrito es demaciado corto.');
errorForm = true;
}
if(!errorForm){
try{
var URI = 'bitpage/savernc.php?rnc='+rnc+'&firstName='+name+'&lastName='+apellido+'&birthday='+birthday+'&sessionId='+request.sessionID();
content = document.getElementById('showDetail');
content.innerHTML = ' |
';
connector.mimeType = 'text/html';
connector.loadXMLFile_0(URI,'getPageInformation');
document.location.href = '#pageInt='+arguments[0];
}catch(ex){
alert('error : page.saveRNC() '+ex.description);
}
}
}
this.checkPassport = function(){
globalURI = "bitpage/checkPassport.php?DOCUMENT_ID=PASSPORT&DOCUMENT_NUMBER="+objForm.document_number.value+'&sessionID'+request.sessionID();
content1 = document.getElementById('error:passportNumber');
content1.style.display='';
//content.innerHTML = ' |
';
connector.mimeType = 'text/html';
connector.loadXMLFile_0(globalURI,'getPassportInformation');
}
this.changeColor = function(){
var obj = arguments[0];
var icolor = arguments[1];
obj.style.backgroundColor = icolor;
}
this.changeDisplayObject = function(){
if(eval('document.getElementById(\''+arguments[0]+'\')')!=null){
var obj = eval('document.getElementById(\''+arguments[0]+'\')');
obj.style.display= arguments[1];
}else{
alert('the object that are try to show is null.');
}
}
this.changePlanDisplay = function(){
switch(arguments[0]){
case "withONEBOX":
document.getElementById('tab_menu_plan').src='images/withONEBOX.jpg';
this.changeDisplayObject('table:withONEBOX','');
this.changeDisplayObject('table:withoutONEBOX','none');
document.getElementById('bono_withoutPlan').style.display='none';
document.getElementById('bono_withPlan').style.display='';
break;
case "withoutONEBOX":
document.getElementById('tab_menu_plan').src='images/withoutONEBOX.jpg';
this.changeDisplayObject('table:withONEBOX','none');
this.changeDisplayObject('table:withoutONEBOX','');
document.getElementById('bono_withoutPlan').style.display='';
document.getElementById('bono_withPlan').style.display='none';
break;
}
}
this.onlyAlphabeticValues = function(){
var objEvent = arguments[0];
var objText = arguments[1];
var string = objText.value;
newstring = string.replace(/[^a-z]+/gi,'');
objText.value = string;
}
this.onlyNumericValues = function(){
var objEvent = arguments[0];
var objText = eval(arguments[1]);
var string = objText.value;
newstring = string.replace(/[^0-9]/gi,''); //re = /\(?\d{3}\)?([-\/\.])\d{3}\1\d{4}/;
objText.value = newstring;
}
this.closeSpecialWindow = function(){
var obj = document.getElementById('objDiv');
obj.style.display='none';
}
this.loadDestiny = function(){
content = document.getElementById('boxDestinos');
content.innerHTML = ' |
';
var URI = '../xml/destiny.xml?sid='+request.sessionID();
connector.mimeType = 'text/xml';
connector.contentType = 'text/xml;charset=UTF-8';
connector.loadXMLFile_0(URI,'getArrayDestiny');
}
this.callSpeedTester = function(){
msgWindow=window.open('http://www.onemax.com/speedtest.net/index-php.html','Window1','scrollbars=no,menubars=no,location=no,toolbars=no,resizable=no,width=454,height=302,top=100,left=300');
}
this.sendMail = function(){
alert((document.getElementById('messageInformation:row')).length);
var table = document.getElementById("panel:coberture");
var rows = table.getElementsByTagName("tr");
this.cleanCaptions();
if((objForm.firstName.value).length==0){
document.getElementById('messageInformation:firstName').innerHTML = 'Informació requerida.';
//JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Debes indicar tu nombre.ir"}]}]};
}
if((objForm.lastName.value).length==0){
document.getElementById('messageInformation:lastName').innerHTML = 'Informació requerida.';
//JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Es necesario que indicar tu apellido.ir"}]}]};
}
if((objForm.idNumber.value).length==0){
document.getElementById('messageInformation:idNumber').innerHTML = 'Informació requerida. Ejemplo: 000-0000000-0';
//JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Es necesario que indiques tu número de cédula.ir"}]}]};
}else if((objForm.idNumber.value).length<13){
document.getElementById('messageInformation:idNumber').innerHTML = 'Informaci&ooacute; requerida. Ejemplo: 000-0000000-0';
//JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"2","value":"El número de cédula que acabas de colocar no es válido.ir"}]}]};
}
if((objForm.email.value).length==0){
document.getElementById('messageInformation:email').innerHTML = 'Informació requerida. Ejemplo: usuario@dominio.com';
//JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Debes indicar una dirección de email para contactarte.ir"}]}]};
}else{
var email = objForm.email;
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!filter.test(email.value)){
document.getElementById('messageInformation:email').innerHTML = 'Formato de email inválido. Ejemplo: usuario@dominio.com';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"5","value":"La dirección de email de contacto no es válida.ir"}]}]};
}
}
if((objForm.locationAddress.value).length==0){
document.getElementById('messageInformation:locationAddress').innerHTML = 'Información requerida.';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Es necesario que indiques la calle en la que recides.ir"}]}]};
}
if((objForm.ifloor.value).length==0){
document.getElementById('messageInformation:ifloor').innerHTML = 'Información requerida.';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Debes indicar el piso en el que recides si es un edificio.
en caso de ser una vivienda y no un edificio debes colocar 1.ir"}]}]};
}
if((objForm.crossingStreet.value).length==0){
document.getElementById('messageInformation:crossingStreet').innerHTML = 'Información requerida.';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Debes indicar con que calle hace esquina tu casa.ir"}]}]};
}
if((objForm.telephone.value).length==0){
document.getElementById('messageInformation:telephone').innerHTML = 'Información requerida. ejemplo (809)000-0000';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"Debes indicar un número de teléfono de contacto.ir"}]}]};
}else if((objForm.telephone.value).length<13){
document.getElementById('messageInformation:telephone').innerHTML = 'Formato inválido. ejemplo (809)000-0000';
JErrors[JErrors.length] = {"errordetail":[{"detail":[{"id":"1","value":"El número de teléfono que acabas de indicar no es correcto.ir"}]}]};
}
if(JErrors.length==0){
content = document.getElementById('showErrors');
content.innerHTML = '';
var URI = 'sendMail.php?v=true&'+request.constructQueryString(document.forms[0])+'&sessionID='+request.sessionID();
connector.mimeType = 'text/html';
connector.loadXMLFile_0(URI,'getPageInformation');
}else{
content = document.getElementById('showErrors');
//var errorOrganizer = "
";
//for(var i=0;i"+JErrors[i].errordetail[0].detail[0].value+"";
//}
//errorOrganizer += " |
";
//content.innerHTML = errorOrganizer;
}
JErrors = new Array();
}
this.speedRange = function(){
msec1 = new Number();
sttime=new Date();
msec1=sttime.getTime();
myNum = msec1;
content = document.getElementById('display:speed');
content.style.display='';
icontent = document.getElementById('icontent');
content.innerHTML = '
';
var URI = 'testFile.php?sessionID='+request.sessionID();
icontent.src=URI;
//connector.mimeType = 'text/html';
//connector.contentType = 'text/html';
//connector.loadXMLFile_0(URI,'getSpeedInformation');
}
this.cleanCaptions = function(){
document.getElementById('messageInformation:firstName').innerHTML = '';
document.getElementById('messageInformation:lastName').innerHTML = '';
document.getElementById('messageInformation:idNumber').innerHTML = '';
document.getElementById('messageInformation:email').innerHTML = '';
document.getElementById('messageInformation:locationAddress').innerHTML = '';
document.getElementById('messageInformation:ifloor').innerHTML = '';
document.getElementById('messageInformation:crossingStreet').innerHTML = '';
document.getElementById('messageInformation:telephone').innerHTML = '';
}
this.gotoFill = function(){
switch(arguments[0]){
case 'nombre':
objForm.firstName.focus();
break;
case 'apellido':
objForm.lastName.focus();
break;
case 'cedula':
objForm.idNumber.focus();
break;
case 'email':
objForm.email.focus();
break;
case 'address':
objForm.locationAddress.focus();
break;
case 'piso':
objForm.ifloor.focus();
break;
case 'esquina':
objForm.crossingStreet.focus();
break;
case 'telefono':
objForm.telephone.focus();
break;
}
}
}