// JavaScript Document

//VALIDATE CONTROLS 

            //VALIDATE USERID 

      function validateAndGo()

      {  

      if  (document.login_frm["loginID_fld"].value == "" )

      {

        alert("Por favor escriba el nombre de usuario")

        return false ;

      }//END validate user name controls 

       if  (document.login_frm["password_fld"].value == "" )

      {

        alert("Por favor escriba su clave")

        return false ;

      }//END validate password

              //VALIDATE TYPE OF USER 

       if  (document.login_frm["userType_fld"].value == "" )

      {

        alert("Please Select type of User ");

                        document.login_frm["userType_fld"].focus();

         return false ;    

      }//END validate login Company    

      //LOGINS 

     //IF DROP DOWN BOX SELECTED VALUE IS AGENT OR SUBAGENT AND 

     //AGENT OR SUB AGENT CONTAIN ALPHANUMERIC GO TO IHI 

         

      // IF AGENTID IS ALPHANUMERIC AND IT IS A PRODUCER WILL BE ASKED TO BE REDIRECTED TO THE OLD IHH PAGE 

      if ((  alphanumeric(document.login_frm["loginID_fld"].value)== true) && 

              (document.login_frm["userType_fld"].value == "1" ||document.login_frm["userType_fld"].value == "SUBAGENT"  ))

        { 

    

                          var resl = confirm('Usted va a ser dirigido a la página de Online Services de IHI '+ '\n' +' Por favor Oprima OK para continuar ó Cancel '  );

                          //USER HIT OK 

                          if ( resl == true )

                          {

                          // TO BE REMOVED AND GO TO THE IHI PAGE 

                          //alert("GO TO THE IHI PAGE HERE ");

                           authenticateIHI();

                          }

                          

        }//END LOG TO BUPA 

        else 

        {      

        //alert("LOGIN BUPA");

          authenticateBupa();  

        }//END LOG TO BUPA

      }// end validate and go 

      

                                    // description: receive a value and return true if it is alphanumeric else return false 


                        function alphanumeric(alphane)

                                    {

                                                //DECLARE VALUE TO GO THROUGH IT 

                                                var numaric = alphane;

                                                //VALUES FOR ALPHA AND NUMERIC 

                                                var alpha = false ;

                                    for(var j=0; j<numaric.length; j++)

                                                {

                                                            var alphaa = numaric.charAt(j);

                                                            var hh = alphaa.charCodeAt(0);

                                                            //IF CONTAINS ALPHA 

                                                 if ( (hh > 64 && hh<91) || (hh > 96 && hh<123))

                                                                        {

                                                                        alpha = true 

                                                                        }

                                                

                                                            }// END FOR 

                                                //AND ALPHA AND NUMERIC    

                                                // RETURN TRUE IF BOTH ARE TRUE                                                                

                                                return alpha ;

                                    }//END APLHANUMERIC

 

      

      <!-- AUTHENTICATE IHI HERE SPANISH -->      

              

                function authenticateIHI()

      {

                                     

                 var user =new String(document.login_frm["loginID_fld"].value);

                                     var lg = new String(document.login_frm["password_fld"].value );

                 document.login_frm.action =new String('http://producer.ihi.com/fdc/AmedexLogin.asp?agentId=' + user  + '&lan=sp'  + '&.lg=' + lg);

                     document.login_frm.submit(); 

      }//Finish IHI

      

    <!-- AUTHENTICATE BUPA HERE SPANISH -->

           function authenticateBupa()

      {

				//window.open('./systemUpgrade.html','Maintanence', 'width=973,height=590,menubar=no,status=no, location=no,toolbar=no,scrollbars=no');
               

                  var user =document.login_frm["loginID_fld"].value;

                                       document.login_frm["agentId"].value = user ;

                  var ran = new Date();

                                      var ranhash = new String(hex_md5(ran));

                                      var lg = new String(document.login_frm["password_fld"].value );

                                      var hash = new String(document.login_frm["password_fld"].value );

                                      //LANGUAGE

                                      document.login_frm["lan"].value = "sp";  

                  //PASSWORD TO BE DELETED WHEN REMOVE LIFE 

                  document.login_frm[".lg"].value = lg;

                                       hash =  hex_md5 (hash);

                                       var l = hex_md5(hash + ranhash);

                                       document.login_frm[".l"].value = l;

                                       document.login_frm[".r"].value = ranhash;

                                       document.login_frm[".f"].value = hex_md5(l);

                                                            

                                       //Language

                                       document.login_frm["lan"].value = "sp";    

                                       //USER TYPE 1-AGENT 2- AGENTASSISTAN 3--PH --4 --ADMIN  5--EMPLOYEE

                                       document.login_frm["cbUserType"].value = new String ( document.login_frm["userType_fld"].value ) ; 

                                        

              				 // document.loginForm.action ="http://localhost/WebIntegrationProject/test.aspx"

                      			// document.login_frm.action =new String("https://www.bupalatinamerica.com/OnlineServices/AOS/Login.aspx"); 
			  		// document.login_frm.action =new String("http://webtestsit/OnlineServices/AOS/Default.aspx"); 
			  		
		document.login_frm.action =new String("https://www.bupalatinamerica.com/OnlineServices/AOS/Login.aspx"); 
                document.login_frm.submit(); 
		//window.location = '/OnlineServices/AOS/DisablePage.htm'; 
      }//Finish Bupa

             

 

      

      <!-- start script here

               //function checkForm(form){

                          //if (form.frmUserid.value == "")

                          // {

                           //form.frmUserid.focus();

                                   // return false

                                  // }

                      //if (form.frmPassword.value == ""){

                                  //form.frmUserid.focus();

                                                //return false

                                    //}

                                               //return true

                           //} 

 

            function newPassword(text)

          {

                        document.Form.frmHiddenNewPassword.value = text;

           }

// end script here -->

function MM_showHideLayers() { //v9.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) 

  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}

function popUp(p){

if (p==1) {
test1=window.open("https://www.bupalatinamerica.com/ForgotPwd/ForgotPass.aspx","test1","toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=400,top=270,left=430"); 
} else if(p==2){
test1=window.open("https://www.bupalatinamerica.com/ForgotPwd/NewUserEn.aspx","test2","toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=400,top=270,left=230");
}else if(p==3){
window.open('http://www.amedex.com/skype/skype/callihi.aspx?lang=english&cid=AMEDEX','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=400,top=270,left=230');
}else if(p==4){
window.open('https://www.bupalatinamerica.com/ForgotPwd/ContactMe/ContactMe_Eng.aspx','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=400,top=270,left=230');
}else if(p==5){
window.open('https://www.bupalatinamerica.com/testimonials/videos/alinaGarcia.html','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=320,height=180,top=270,left=230');
}else if(p==6){
window.open('https://www.bupalatinamerica.com/testimonials/videos/kenneth.html','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=320,height=180,top=270,left=230');
}else if(p==7){
window.open('https://www.bupalatinamerica.com/videos/aleymi/aleymi.html','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=700,height=455,top=270,left=230');
}else if(p==8){
window.open('https://www.bupalatinamerica.com/videos/jmh/jmh.html','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=700,height=455,top=270,left=230');
}else if(p==9){
window.open('https://www.bupalatinamerica.com/testimonials/videos/estherDelgado.html','test3','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=320,height=180,top=270,left=230');
}else if(p==10){
window.open('product_guide/guide_spa/guide.html','GuiadeProductos','toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=960,height=610');
}else if(p==11){
window.open('product_guide/guide_eng/guide.html','ProductGuide','toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=960,height=610');
}
}

function resetVideo(divId) {  if (typeof(divId)=="string") { divId=document.getElementById(divId); }  if (divId.innerHTML) {    org=divId.innerHTML;    divId.innerHTML='';    divId.innerHTML=org;  }  return false;}

