 var http_request = false;
 var TableName;
 var Div1; 
 var Div2;
 var url2;
 var ClaimsView="1";
 var SelectedClicked = false;
 var DeSelectedClicked = false;
 //================================================================================================================
 function PageChronicAuthorizationList(thisElement, Page)
 {
    TableName = "chronicauthtable";
    ClaimsView="1";
    var URLstr = "cmsAjax.aspx?Action=PagingChronicAuths&PageNumber=" + Page ;
    RunAjax(URLstr, 'claimsresults');
    DisplayPageNumber ( thisElement ); 
 }
 //==================================================================================================================
 function PageHospAuthProviderList(thisElement, Page,ProviderTotal)
 {
    TableName = "HOSPITALAUTH";
    ClaimsView="2";
    var URLstr = "cmsAjax.aspx?Action=PagingProviderListOnHospAuth&PageNumber=" + Page ;
    RunAjax(URLstr, 'claimsresults');
    DisplayPageNumber ( thisElement ); 
 }
 //=================================================================================================================
 function PageClaimsResultList(thisElement, Page,MemberNumber,FromDate,TillDate,StatusList,DependentsList,ProviderCount,ViewType)
 {
    TableName = "ClaimsOutput";
    var url = "cmsAjax.aspx?Action=PagingListOnClaimSearch&PageNumber=" + Page +"&Member=" + MemberNumber + "&FromDate=" + FromDate + "&TillDate=" + TillDate + "&ClaimStatusList=" + StatusList + "&DependentsList=" + DependentsList + "&OutputView=" + ViewType;
    document.getElementById ('ProcesingClaimsPage').style.display ='block';
    document.getElementById('overlay').style.display = 'block'; 
    RunAjax(url, 'claimsresults');
    DisplayPageNumber ( thisElement);   
 }
 //=============================================================================================
 function  ProcessRequestCard(SuccessMessage,ErrorMessage)
 {
    TableName = "CardRequestdiv";
    document.getElementById ('ProcesingClaimsPage').style.display ='block';
    document.getElementById('overlay').style.display = 'block';
    RunAjax("CMSAjax.aspx?Action=ProcessCardRFequest&Error="+ErrorMessage +"&SuccessMsg="+SuccessMessage ,'cardrequest')
 }
 //==============================================================================================
 function cardrequest(AjaxResponse)
 {
    document.getElementById ('ProcesingClaimsPage').style.display ='none';
    document.getElementById('overlay').style.display = 'none';
    document.getElementById ('CardRequestdiv').innerHTML = AjaxResponse;
 }
 //==============================================================================================
 function ShowMedicineDetails (NappiCode)
 {
    if(document.getElementById ( 'MedicineDetails' ).style.display == 'none')
    {
        TableName = "MedicineDetails";
        RunAjax("CMSAjax.aspx?Action=getMedicineDetails&NappiCode=" + NappiCode ,'OUTPUTRESULTS')
        document.getElementById ('MedicineDetails').style.display = 'block';
    }
    else if(document.getElementById ( 'MedicineDetails' ).style.display == 'block')
    {
       document.getElementById ('MedicineDetails').innerHTML ="";
       document.getElementById ('MedicineDetails').style.display = 'none';
    }
 }
//================================================================================================================ 
 function OUTPUTRESULTS(AjaxResponse)
 {
    document.getElementById (TableName).innerHTML = AjaxResponse;
 }
 
  function OUTPUTRESULTSForm(AjaxResponse)
 {
    document.getElementById (TableName).innerHTML = AjaxResponse;
    document.getElementById ('ProcesingRequest').style.display ='none';
 }
 //================================================================================================================
 function ProviderDetails(ProviderNumber)
 {
   if(document.getElementById ( 'ProvDetails' ).style.display == 'none')
    {
        TableName = "ProvDetails";
        RunAjax("CMSAjax.aspx?Action=getProviderDetails&ProviderNumber=" +ProviderNumber ,'OUTPUTRESULTS')
        document.getElementById ('ProvDetails').style.display = 'block';
    }
    else if(document.getElementById ( 'ProvDetails' ).style.display == 'block')
    {
       document.getElementById ('ProvDetails').innerHTML ="";
       document.getElementById ('ProvDetails').style.display = 'none';
    }
 }

var PrimaryElement;
var PrimaryElementType;
var SecondaryElement;
var SecondaryElementType;
//================================================================================================================
function DisplayPageNumber(ThisElement )
{
   var ChildrenOfParent = ThisElement.parentNode.childNodes; 
  
   for ( var i = 0; i < ChildrenOfParent.length; i ++ )
        {
            if ( ChildrenOfParent[i].id == "" )  
                {
                    ChildrenOfParent[i].className = "PagingNorm";
                } 
        }
   ThisElement.className = "PagingHigh";
   
}
//================================================================================================================
function CountDependants( thisCheckbox )
{
	var dependentamt= 0;
	for (var i= 0; i < document.getElementsByName('depents').length; i++ )
	{
		if ( document.getElementsByName('depents')[i].checked == true) 
		dependentamt++;
		
	}

	if ( dependentamt> 10 )
	{
	  document.getElementById('dependentcounterr').innerHTML ="YOU CAN ONLY SELECT A MAXIMUM OF 10 PATIENTS";					
	  thisCheckbox.checked = false;
	}
    else
    {
      document.getElementById('dependentcounterr').innerHTML = "";
    }
}
//==============================================================================================================
function PageThroughDefaultClaimsSearch( thisElement, ProviderNumber,Page,MemberNumber,FromDate,TillDate,StatusList,DependList,TotalPages)
{
   TableName = ProviderNumber;
   RunAjax("CMSAjax.aspx?Action=PageDefaultClaimsByProvider&Page="+Page +"&Provider="+ProviderNumber+"&Member="+MemberNumber+"&StartDate="+FromDate+"&EndDate="+TillDate+"&StatusList="+StatusList+"&DependentList="+DependList, 'claimsresults');

   DisplayPageNumber ( thisElement ); 
   
}
//==============================================================================================================
function PageClaimsStatement(thisElement, PageNumber,TotalCount)
{
    RunAjax("CMSAjax.aspx?Action=PageClaimsStatementDisplay&PageNumba=" + PageNumber,'cliamsstatementresults');   
    DisplayPageNumber ( thisElement ); 
}
//===============================================================================================

function claimsresults (AJAXresponse)
{
   document.getElementById (TableName).innerHTML = AJAXresponse;
   
   if(ClaimsView == "2")
   {
      
       document.getElementById (TableName).parentNode.style.height = document.getElementById (TableName).parentNode.scrollHeight + "px";
       
       if (document.getElementById (TableName).parentNode.id !="main")
       {
            ResetAccordionElementLength (document.getElementById (TableName).parentNode.id);
       }
       else
       {
        ColapseAllAccordians ('Surrounder')
       }
   }
   initLytebox(); 
   document.getElementById ('ProcesingClaimsPage').style.display ='none';
    document.getElementById('overlay').style.display = 'none'; 
}
//==============================================================================================
function cliamsstatementresults(AJAXresponse)
{
     document.getElementById ('CLAIMSSTATEMENT').innerHTML = AJAXresponse;
     initLytebox(); 
}
//=============================================================================================
function DisplayClaimsFromClaimsStatement(ReferenceNo,Cycl,stat)
{
    if(document.getElementById ( ReferenceNo ).style.display == 'none')
    {
        TableName = ReferenceNo;
        RunAjax("CMSAjax.aspx?Action=RenderOutAjaxCallResult&ReferenceNumba=" + ReferenceNo +"&Cycl=" + Cycl + "&Stat=" + stat,'RenderOutAjaxCallResult')
        document.getElementById (ReferenceNo).style.display = 'block';
    }
    else if(document.getElementById ( ReferenceNo ).style.display == 'block')
    {
       document.getElementById (ReferenceNo).innerHTML ="";
       document.getElementById (ReferenceNo).style.display = 'none';
    }
}
//=============================================================================================
function RenderOutAjaxCallResult(AJAXresponse)
{
   document.getElementById (TableName).innerHTML = AJAXresponse;
   initLytebox(); 
}
//=============================================================================================
function PAGETHRUCLAIMSINCLAIMSSTATEMENT(thisElement,Page,Cycl,Stat,RefenceNo,TotalCount)
{
  TableName = RefenceNo;

  RunAjax("CMSAjax.aspx?Action=PAGETHRUCLAIMSINCLAIMSSTATEMENT&Page=" + Page + "&Cycl=" +Cycl + "&Stat="+Stat,'claimsresults');
  DisplayPageNumber ( thisElement );
}
//=============================================================================================
function PageHospitalAuth (thisElement, Page,ProviderNumber,MemberNumber,NoOfPages)
{
  TableName = ProviderNumber;
  ClaimsView ="2";
  RunAjax("CMSAjax.aspx?Action=PageHospitalAuth&Page=" + Page + "&Doc=" +ProviderNumber+ "&Mem="+MemberNumber,'claimsresults');
  DisplayPageNumber ( thisElement );

}
//============================================================================================
function ShowMemberBenefits(dependant, year)
{
    document.getElementById ('ProcesingClaimsPage').style.display ='block';
    document.getElementById('overlay').style.display = 'block';
    RunAjax("CMSAjax.aspx?Action=ShowMemberBenefits&Year=" + year+"&dependant="+dependant,'displaybenefitspage')
 
}
//===========================================================================================
function displaybenefitspage(AJAXResponse)
{  
   document.getElementById ('ProcesingClaimsPage').style.display ='none';
   document.getElementById('overlay').style.display = 'none';
   document.getElementById( 'benefitsdiplay' ).innerHTML = AJAXResponse;
}
//===========================================================================================
function DisplayClaimssFromBenefitUsage(Member,btn,rule,outdiv,fromdt,todt,patient)
{
    
    if(document.getElementById ( outdiv ).style.display == 'none')
    { 
       document.getElementById( outdiv ).innerHTML = rule;
       document.getElementById (outdiv ).style.display = 'block';
    }
    else if(document.getElementById ( outdiv ).style.display == 'block')
    {
       document.getElementById (outdiv ).innerHTML ="";
       document.getElementById (outdiv ).style.display = 'none';
    }
}
//============================================================================================
function DisplayCommunicationType(CommunicationMethod,OutputArea)
{
  
  if(document.getElementById ( OutputArea ).style.display == 'none')
  {    TableName = OutputArea;
       RunAjax("CMSAjax.aspx?Action=DisplayCommunicationType&CommunicationMethod=" + CommunicationMethod,'RenderOutAjaxCallResult') 
       document.getElementById (OutputArea ).style.display = 'block';
  }
  else if(document.getElementById ( OutputArea ).style.display == 'block')
  {
       document.getElementById (OutputArea ).innerHTML ="";
       document.getElementById (OutputArea ).style.display = 'none';
  }
  
}
//============================================================================================
function ProcessClaimSearch()
{
  var c_value = "";
  var url = "CMSAjax.aspx?Action=DefaultSearchClaims"
  url2 = "CMSAjax.aspx?Action=POPULATEPROVPAGING";
  var PatientCount=0;
  
   for (var i=0; i < document.getElementsByName('depents').length; i++)
   {
      if (document.getElementsByName('depents')[i].checked == true)
      {
         c_value = c_value + "&DependCode="+document.getElementsByName('depents')[i].value;
      }
   }
   if(c_value=="")
   {
     document.getElementById('dependentcounterr').innerHTML ="Please select a minumum of 1 patient.";
     return;
   }
   else
   {
       document.getElementById('dependentcounterr').innerHTML ="";
       var status="";
        for (var a=0; a < document.getElementsByName('status').length; a++)
       {
       if (document.getElementsByName('status')[a].checked == true)
          {
            //PatientCount++;
            status = status + "&Status="+document.getElementsByName('status')[a].value;
          }
       }
       
       if(status!="")
       {
            document.getElementById('dependentcounterr').innerHTML="";
            
            var view = "";
            
            if(document.getElementById ('viewtypeA').checked)
            {
                view = "&OutputView=1";
                ClaimsView = "1";
            }
            if(document.getElementById ('viewtypeB').checked)
            {
                view = "&OutputView=2";
                ClaimsView = "2";
            }
            
            url = url + c_value + status + "&FromDate=" + document.getElementById('FromDate').value + "&TillDate=" + document.getElementById('ToDate').value + "&Page=1" + view;
            url2= url2 + c_value + status + "&FromDate=" + document.getElementById('FromDate').value + "&TillDate=" + document.getElementById('ToDate').value + "&Page=1" + view;
             
            //REMOVE DEFAULT SEARCH RESULTS
            document.getElementById ('ClaimsOutput').innerHTML = "";
            
            //REMOVE DEFAULT PROVIDER PAGING RESULTS
            document.getElementById ('ProvPaging').innerHTML = "";
            
             //REMOVE DEFAULT PROVIDER PAGING RESULTS
            //document.getElementById ('DisplayProvPaging').innerHTML = "";
            document.getElementById ('ProcesingClaimsPage').style.display ='block';
            document.getElementById('overlay').style.display = 'block';           
            RunAjax(url,'MemberOnlineDefaultClaimsSearch');
            
       }
       else
       {
            document.getElementById('dependentcounterr').innerHTML="Please select claim status."
            return;
       }
   }
}
//=============================================================================================
function ProcessContactDetails()
{
    var Validated = true;
    
    //DEFAULT ALL TO "DO NOT NOTIFY ME......"
    var PRTYPE1METH = "0";
    var PRTYPE2METH = "0";
    var PRTYPE3METH = "0";
    var PRTYPE4METH = "0";
    var PRTYPE5METH = "0";
    var SAVINGSAMT  = "0";
     
    //TELEPHONE NUMBER
    if(!RequiredFieldValidator('ContactDetailsFormValidation','TELNO','Please enter a Telephone Number.'))
    {
       Validated = false;
            return false;
    }
    if(!IsNumeric('ContactDetailsFormValidation','TELNO','You have entered an invalid Telephone Number. Only numeric characters are allowed'))
    {
        Validated = false;
            return false;
    }
    if(!ValidateFieldLenght('ContactDetailsFormValidation','TELNO','10','You have entered an invalid Telephone Number. Your Telephone Number must be 10 digits'))
    {
        Validated = false;
            return false;
    }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //CELLULAR NUMBER
    if(!IsNumeric('ContactDetailsFormValidation','CELLNO','You have entered an invalid Cellphone Number. Only numeric characters are allowed'))
    {
        Validated = false;
            return false;
    }
    if(!ValidateFieldLenght('ContactDetailsFormValidation','CELLNO','10','You have entered an invalid Cellphone Number. Your Cellular Number must be 10 digits'))
    {
        Validated = false;
            return false;
    }
    if(document.getElementById ('SMSBelowAmt'))//SAVINGS
    {
        if(document.getElementById ('SMSBelowAmt').childNodes[0].className  == "YesIndicator")
        {
            if(!RequiredFieldValidator('ContactDetailsFormValidation','CELLNO','Cell Number required for savings option.'))
            {
                Validated = false;
                return false;
            }
            PRTYPE1METH = "2";
            SAVINGSAMT = document.getElementById ('SMSLowestBalance').innerHTML.replace ("R","");
  
        }
    }
    if(document.getElementById ('SMSClaimProccess'))//processed claims
    {
        if(document.getElementById ('SMSClaimProccess').childNodes[0].className  == "YesIndicator")
        {
            if(!RequiredFieldValidator('ContactDetailsFormValidation','CELLNO','Cell Number reqiured for processed claims'))
            {
                Validated = false;
                return false;
            }
            PRTYPE2METH = "2";      
        }
    }
 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   
    //FAX NUMBER
    if(!IsNumeric('ContactDetailsFormValidation','FAXNO','Please enter a valid numeric Fax number. Only numeric characters are allowed'))
    {
        Validated = false;
            return false;
    }
    
    document.getElementById ("ContactDetailsFormValidation").innerHTML = "";
    if(document.getElementById ("FAXNO").value !="")
    {
        if(document.getElementById ("FAXNO").value.length > 13)
        {
            document.getElementById ("ContactDetailsFormValidation").innerHTML = "<div style='color: red'>You have entered an invalid Fax number. Your Fax number cannot be greater than 13 digits</div>";
            document.getElementById ("FAXNO").style.border="1px solid red";
            document.getElementById ("FAXNO").focus();    
            return false;
        }
    }
    document.getElementById ("FAXNO").style.border="1px solid #cccccc";
    /*if(!ValidateFieldLenght('ContactDetailsFormValidation','FAXNO','13','You have entered an invalid Fax number. Your Fax Number must be 13 digits'))
    {
        Validated = false;
            return false;
    }*/
//---------------------------------------------------------------------------------------------------------------------------------------------
    //EMAIL ADDRESS
    if(!IsValidEmail('ContactDetailsFormValidation','EMAIL','Email address format is invalid, please correct'))
    {
       Validated = false;
            return false;
    }
    if(document.getElementById ('EmailBelowAmt')) //Savings
    {
        if(document.getElementById ('EmailBelowAmt').childNodes[0].className == "YesIndicator")
        {
            if(!RequiredFieldValidator('ContactDetailsFormValidation','EMAIL','Your E-mail'))
            {
                Validated = false;
                return false;
            }
            PRTYPE1METH = "1";
            SAVINGSAMT = document.getElementById ('EmailLowestBalance').innerHTML.replace ("R","");
        }
    }
    if(document.getElementById ('EmailClaimProccess')) //Processed claims
    {
        if(document.getElementById ('EmailClaimProccess').childNodes[0].className  == "YesIndicator")
        {

            if(!RequiredFieldValidator('ContactDetailsFormValidation','EMAIL','You currently receive correspondence via E-Mail. <br>Please update you Communication Profile before removing your E-Mail address.'))
            {
                Validated = false;
                return false;
            }
            PRTYPE2METH = "1";
        }
    }
    if(document.getElementById ('EmailServiceEnhancements')) //Processed claims
    {
        if(document.getElementById ('EmailServiceEnhancements').childNodes[0].className == "YesIndicator")
        {

            if(!RequiredFieldValidator('ContactDetailsFormValidation','EMAIL','You currently receive correspondence via E-Mail. <br>Please update you Communication Profile before removing your E-Mail address.'))
            {
                Validated = false;
                return false;
            }
             //PRTYPE 1 METHOD = 1
            PRTYPE3METH = "1";
        }
    }
    if(document.getElementById ('EmailClaimsStatements')) //Savings
    {
        if ( document.getElementById ('EmailClaimsStatements').childNodes[0].className  == "YesIndicator" )
        {

            if(!RequiredFieldValidator('ContactDetailsFormValidation','EMAIL','You currently receive correspondence via E-Mail. <br>Please update you Communication Profile before removing your E-Mail address.'))
            {
                Validated = false;
                return false;
            }
             //PRTYPE 1 METHOD = 1
            PRTYPE4METH = "1";
        }
    }
    if(document.getElementById ('EmailClaimsStatements')) //Savings
    {
        if(document.getElementById ('EmailClaimsStatements').childNodes[0].className  == "YesIndicator")
        {

            if(!RequiredFieldValidator('ContactDetailsFormValidation','EMAIL','You currently receive correspondence via E-Mail. <br>Please update you Communication Profile before removing your E-Mail address.'))
            {
                Validated = false;
                return false;
            }
             //PRTYPE 1 METHOD = 1
            PRTYPE5METH = "1";
        }
    }
//------------------------------------------------------------------------------------------------------------------------------------------------   
    /*
       POSTAL ADDRESS
    */
   if(!RequiredFieldValidator('ContactDetailsFormValidation','AADDL1','Please supply your postal address.'))
    {
        Validated = false;
        return false;
    }
    if(document.getElementById ('AADDL1').value.length > 1  && document.getElementById ('APOSTCODE').value.length==0)
    {
        
        if(!RequiredFieldValidator('ContactDetailsFormValidation','APOSTCODE','Please enter a postal code'))
        {
            Validated = false;
            return false;
        }
    }
    
    if(!IsNumeric('ContactDetailsFormValidation','APOSTCODE','Please enter a valid numeric post code. Only numeric characters are allowed'))
    {
        Validated = false;
            return false;
    }
    
    if(document.getElementById ('PostClaimsStatements'))
    {
        if(document.getElementById ('PostClaimsStatements').childNodes[0].className == "YesIndicator")
        {
            if(!RequiredFieldValidator('ContactDetailsFormValidation','AADDL1','You currently receive correspondence via POST. <br>Please update you Communication Profile before removing your Postal address.'))
            {
                Validated = false;
                return false;
            }
            //PRTYPE 1 METHOD = 1
            PRTYPE4METH = "4";
        }
         
    }
    if(document.getElementById ('PostCorrespondancePostal'))
    {
        if(document.getElementById ('PostCorrespondancePostal').childNodes[0].className == "YesIndicator")
        {
            if(!RequiredFieldValidator('ContactDetailsFormValidation','AADDL1','You currently receive correspondence via POST. <br>Please update you Communication Profile before removing your Postal address.'))
            {
                Validated = false;
                return false;
            }
            PRTYPE5METH = "4";
        }
    }
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    /*
       RESIDENTIAL ADDRESS
    */
    if(document.getElementById ('PADDL1').value.length > 1  && document.getElementById ('PPOSTCODE').value.length==0)
    {
        
        if(!RequiredFieldValidator('ContactDetailsFormValidation','PPOSTCODE','Please enter a residential code'))
        {
            Validated = false;
            return false;
        }
    }
    
    if(!IsNumeric('ContactDetailsFormValidation','PPOSTCODE','Please enter a valid numeric post code. Only numeric characters are allowed'))
    {
        Validated = false;
            return false;
    }
//------------------------------------------------------------------------------------------------------------------------
   //BUSINESS ADDRESS
   if(document.getElementById ('PostClaimStatementsBusiness'))
    {
        if(document.getElementById ('PostClaimStatementsBusiness').childNodes[0].className == "YesIndicator")
        {
          PRTYPE4METH = "3";
        }
         //PRTYPE 1 METHOD = 1
            
    }
    if(document.getElementById ('PostCorrespondanceBusiness'))
    {
        if(document.getElementById ('PostCorrespondanceBusiness').childNodes[0].className == "YesIndicator")
        {
            PRTYPE5METH = "3";
        }
    }
//------------------------------------------------------------------------------------------------------------------------
    //UPDATE CONTACT DETAILS
    if(Validated)
    {
        //BUILD URL
        var url = "&A-ADD-L1=" + document.getElementById ('AADDL1').value + "&A-ADD-L2=" + document.getElementById ('AADDL2').value + "&A-ADD-L3=" + document.getElementById ('AADDL3').value +"&A-ADD-L4=" + document.getElementById ('AADDL4').value + "&A-POST-CODE="+document.getElementById ('APOSTCODE').value +"&P-ADD-L1=" + document.getElementById ('PADDL1').value+"&P-ADD-L2=" + document.getElementById ('PADDL2').value+"&P-ADD-L3=" + document.getElementById ('PADDL3').value+"&P-ADD-L4=" + document.getElementById ('PADDL4').value+ "&P-POST-CODE="+document.getElementById ('PPOSTCODE').value+ "&FAX="+document.getElementById ('FAXNO').value+ "&TELE="+document.getElementById ('TELNO').value+ "&CELLULAR="+document.getElementById ('CELLNO').value+ "&EMAILADD="+document.getElementById ('EMAIL').value + "&MAIL-TO-FLAG=" + ReadCookie("MAIL-TO-FLAG")+ "&B_SORT_FLD=" + ReadCookie("B_SORT_FLD")+ "&M_BR_EMP=" + ReadCookie("M_BR_EMP")+ "&M_TYPE=" + ReadCookie("Z-SCHEME");
        
        //INCLUDE MEMPROF DETAILS INTO QUERYSTRING
        
        if(PRTYPE1METH !="0")//SAVINGS ALLOWED
        {
            url = url +"&PRTYPE1=" + PRTYPE1METH + "&SAVINGSAMT=" + SAVINGSAMT;
        }
        url = url + "&PRTYPE2=" + PRTYPE2METH + "&PRTYPE3=" + PRTYPE3METH + "&PRTYPE4=" + PRTYPE4METH + "&PRTYPE5=" + PRTYPE5METH ;
        
        document.getElementById ('ProcesingClaimsPage').style.display = 'block';
        document.getElementById('overlay').style.display = 'block';
        RunAjax("CMSAjax.aspx?Action=MemberContactDetailsUpdate" + url,'MemberContactDetailsUpdate');
        
        
    }
        
}
function GEMSProcessContactDetails ()
{
    document.getElementById ('ProcesingClaimsPage').style.display = 'block';
    document.getElementById('overlay').style.display = 'block'; 
    if ( !ValidateProfileInputs ())
    {
        document.getElementById('overlay').style.display = 'none';
        window.scrollTo(0, 0);
        return false;
    }
    if ( !ValitateRequiredInputs () )
    {
        document.getElementById('overlay').style.display = 'none';
        window.scrollTo(0, 0);
        return false;
    } 
    var url = "";
    if ( FindElementOnorOff ( "EmailBelowAmt" ) )
        {
            url += "&MEMPROF1=1";
            if ( document.getElementById ('EmailLowestBalance'))
                {
                    url += "&savings=" + document.getElementById ('EmailLowestBalance').innerHTML.replace ("R","");
                }
        }
     else if ( FindElementOnorOff ( "SMSBelowAmt" ) )
        {
            url += "&MEMPROF1=2";
            if ( document.getElementById ('SMSLowestBalance'))
            {
                url += "&savings=" + document.getElementById ('SMSLowestBalance').innerHTML.replace ("R","");
            }
        }
     if ( FindElementOnorOff ( "EmailContributionStatements" ) )
        {
            url += "&MEMPROF3=1";
            if ( GetIndicatedLang ( "EmailContributionStatements" ))
                {
                    url += "X";
                }
        }
     else if ( FindElementOnorOff ( "PostContributionStatements" ) )
        {
            url += "&MEMPROF3=4";
            if ( GetIndicatedLang ( "PostContributionStatements" ))
                {
                    url += "X";
                }
            }
     else if (FindElementOnorOff("MobileContributionStatements")) 
        {
                url += "&MEMPROF3=2";
                if (GetIndicatedLang("MobileContributionStatements")) 
                {
                    url += "X";
                }
        }
     if ( FindElementOnorOff ( "EmailClaimStatments" ) )
        {
            url += "&MEMPROF4=1";
            if ( GetIndicatedLang ( "EmailClaimStatments" ))
                {
                    url += "X";
                }
        }
     else if ( FindElementOnorOff ( "PostClaimStatments" ) )
        {
            url += "&MEMPROF4=4";
            if ( GetIndicatedLang ( "PostClaimStatments" ))
                {
                    url += "X";
                }
            }
     else if (FindElementOnorOff("MobileClaimStatments")) 
        {
                url += "&MEMPROF4=2";
                if (GetIndicatedLang("MobileClaimStatments")) 
                {
                    url += "X";
                }
            }
     if ( FindElementOnorOff ( "EmailPersonalisedLetters" ) )
        {
            url += "&MEMPROF5=1";
            if ( GetIndicatedLang ( "EmailPersonalisedLetters" ))
                {
                    url += "X";
                }
        }
     else if ( FindElementOnorOff ( "PostPersonalisedLetters" ) )
        {
            url += "&MEMPROF5=4";
            if ( GetIndicatedLang ( "PostPersonalisedLetters" ))
                {
                    url += "X";
                }
        }
     if ( FindElementOnorOff ( "EmailNewsletters" ) )
        {
            url += "&MEMPROF6=1";
        }
     else if ( FindElementOnorOff ( "PostNewsletters" ) )
        {
            url += "&MEMPROF6=4";
        }
     if ( FindElementOnorOff ( "EmailOptionChange" ) )
        {
            url += "&MEMPROF7=1";
        }
     else if ( FindElementOnorOff ( "PostOptionChange" ) )
        {
            url += "&MEMPROF7=4";
        }
    var InputsArray = document.getElementsByTagName ("INPUT");
    for ( var i = 0; i < InputsArray.length; i ++ )
        {
            url += "&" + InputsArray[i].id + "=" + InputsArray[i].value;
        } 
    url += "&HomeLang=" + document.getElementById ("HomeLang").value + "&SpokenLang=" + document.getElementById ("SpokenLang").value + "&PreferedLang=" + document.getElementById ("PreferedLang").value;
    RunAjax("CMSAjax.aspx?Action=GEMSMemberContactDetailsUpdate" + url,"GEMSMemberContactDetailsUpdateReturn", "GEMSMemberContactDetailsError");

}

//============================================================================================
function ReadCookie(cookieName) 
{
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
//============================================================================================
function MemberContactDetailsUpdate(AJAXresponse)
{
    document.getElementById ('ProcesingClaimsPage').style.display = 'none';
    document.getElementById('overlay').style.display = 'none';
    document.getElementById('ContactDetailsFormValidation').innerHTML = AJAXresponse;

    scroll (0,0);
}
//============================================================================================
function GEMSMemberContactDetailsUpdateReturn(AJAXresponse)
{
    document.getElementById ('ProcesingClaimsPage').style.display = 'none';
    document.getElementById('overlay').style.display = 'none';
    if ( AJAXresponse == "" )
        {
            document.getElementById('ContactDetailsFormValidation').innerHTML = "<span style='color:black;'>Your profile has been successfully updated. <br /><br />Please be aware that the language choices will only come into effect in January 2013.<hr/></span>";
        }
    else
        {
            document.getElementById('ContactDetailsFormValidation').innerHTML = AJAXresponse;
        }
    scroll (0,0);
}
//============================================================================================
function GEMSMemberContactDetailsError(AJAXresponse)
{
    document.getElementById ('ProcesingClaimsPage').style.display = 'none';
    document.getElementById('overlay').style.display = 'none';
     document.getElementById('ContactDetailsFormValidation').innerHTML = "An Error occurred during the proccessing of this transaction. Please check your conectivity, or try again later.";
    scroll (0,0);
} 

function ProcessPinChange()
{
  
          //CURRENT PIN
          if(!RequiredFieldValidator('ErrorArea','CurrentPin','Please enter your current pin number'))
          {
            return false;
          }
         
         if(!IsNumeric('ErrorArea','CurrentPin','Your pin number can only be a numeric value'))
         {
            return false;
         }
             
         if(!ValidateFieldLenght('ErrorArea','CurrentPin','4','Your pin number must be 4 digits long'))
         {
            return false;
         }
        
        //NEW PIN
          if(!RequiredFieldValidator('ErrorArea','NewPin','Please enter your new pin number'))
          {
            return false;
          }
         
         if(!IsNumeric('ErrorArea','NewPin','Your pin number can only be a numeric value'))
         {
            return false;
         }
             
         if(!ValidateFieldLenght('ErrorArea','NewPin','4','Your pin number must be 4 digits long'))
         {
            return false;
         }
         
         //2nd PIN NUMBER VALIDATION
          if(!RequiredFieldValidator('ErrorArea','ConfirmPin','Please enter your new pin number'))
          {
            return false;
          }
         
         if(!IsNumeric('ErrorArea','ConfirmPin','Your pin number can only be a numeric value'))
         {
            return false;
         }
             
         if(!ValidateFieldLenght('ErrorArea','ConfirmPin','4','Your pin number must be 4 digits long'))
         {
            return false;
         }
         if(!CompareFieldData('ErrorArea','NewPin','ConfirmPin','Your new pin numbers do not match'))
         {
            return false;
         }
         document.getElementById ('ProcesingClaimsPage').style.display = 'block';
        document.getElementById('overlay').style.display = 'block';
         RunAjax("CMSAjax.aspx?Action=ChangemyPin&CurrentPin=" + document.getElementById ("CurrentPin").value + "&NewPin=" + document.getElementById ("NewPin").value + "&ConfirmPin=" + document.getElementById ("ConfirmPin").value,'MemberPinChange');
}
//==========================================================================================================
function MemberPinChange(AJAXresponse)
{
    document.getElementById ('ProcesingClaimsPage').style.display = 'none';
    document.getElementById('overlay').style.display = 'none';
    document.getElementById('ErrorArea').innerHTML = AJAXresponse;
}
//==================================================================================
function MemberOnlineDefaultClaimsSearch(AjaxaResponse)
{
    document.getElementById ('ProcesingClaimsPage').style.display ='none';
    document.getElementById('overlay').style.display = 'none'; 
    document.getElementById('ClaimsOutput').innerHTML = AjaxaResponse;
    RunAjax(url2,'POPULATEPAGINGAREA');
}
//====================================================================================

function POPULATEPAGINGAREA (AjaxResponse)
{
    document.getElementById('ProvPaging').innerHTML = AjaxResponse;
    if(AjaxResponse !="")
    {
        document.getElementById('ProvPaging').className = "paging";
    }
    else
    {
       document.getElementById('ProvPaging').className = "";
    }
    
    //document.getElementById('DisplayProvPaging').innerHTML ="";
    if(ClaimsView =="2")
    {
        ColapseAllAccordians ('Surrounder');
      
    }
      initLytebox();
}
//====================================================================================
function SelectAllCheckBoxes ( checkboxName, Checked )
{
    
    var CheckBoxes = document.getElementsByName ( checkboxName );
    if(checkboxName =="depents")
    {
        for ( var i = 0; i < CheckBoxes.length; i ++ )
        {
            if(i < 10)//AS MAX CAN ONLY BE 10
            {
                CheckBoxes[i].checked = Checked;
            }
            
        }
    }
    else
    {
        for ( var i = 0; i < CheckBoxes.length; i ++ )
        {
            if(i < 5)  //MAX OF 5 CLAIM STATUSES
            {
                CheckBoxes[i].checked = Checked;
            }
            
        }
    }
    CLEARNEW();
        
//        if(!SelectedClicked && Checked)
//        {
//            setTimeout ("SelectAllCheckBoxes ( '"+checkboxName+"', "+Checked+" )",1000);
//            SelectedClicked = true;
//        }
//        else
//        {
//            SelectedClicked = false;
//        }
        
        
//        if(!DeSelectedClicked && !Checked)
//        {
//            setTimeout ("SelectAllCheckBoxes ( '"+checkboxName+"', "+Checked+" )",1000);
//            DeSelectedClicked = true;
//        }
//        else
//        {
//            DeSelectedClicked = false;
//        }
}
//====================================================================================

function FoundationProviderResultList(Page,Province,Suburb,Town,Practice_no, Surname)
 {
    document.getElementById ('ProcesingRequest').style.display ='';
    document.getElementById ('ProcesingRequest').innerHTML = '<image src="/images/loading.gif" /><br/><br/>';
    scrollTo(0,0);
     TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=FoundationProviderResultList&Province="+Province+"&Page=" + Page +"&Suburb="+Suburb+"&Town="+Town+"&Practice_no="+Practice_no+"&Surname="+Surname
    RunAjax(url, 'foundationresults');
 }
 
 function FoundationProviderSearch()
 {
    document.getElementById ('ProcesingRequest').style.display ='';
    document.getElementById ('ProcesingRequest').innerHTML = '<image src="/images/loading.gif" /><br/><br/>';
     TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=FoundationProviderResultList&Page=1&Province=" + document.getElementById('ddlProv').value+"&Surname=" + document.getElementById('txtSurname').value+"&Suburb="+document.getElementById('ddlSuburb').value+"&Practice_no="+document.getElementById('txtName').value+"&town="+document.getElementById('ddlTown').value
    //alert(url);
    RunAjax(url, 'foundationresults');
 }

 function SAPPIProviderSearch() {
    document.getElementById('ProcesingRequest').style.display = '';
    document.getElementById('ProcesingRequest').innerHTML = '<image src="/images/loading.gif" /><br/><br/>';
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=SAPPIProviderSearchResultList&Page=1&Province=" + document.getElementById('ddlProv').value + "&Surname=" + document.getElementById('txtSurname').value + "&Suburb=" + document.getElementById('ddlSuburb').value + "&Practice_no=" + document.getElementById('txtName').value + "&town=" + document.getElementById('ddlTown').value
    //alert(url);
    RunAjax(url, 'foundationresults');
 }

 function FoundationProviderSearchBioKinetics() {
    document.getElementById('ProcesingRequest').style.display = '';
    document.getElementById('ProcesingRequest').innerHTML = '<image src="/images/loading.gif" /><br/><br/>';
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=FoundationProviderResultListBioKinetics&Page=1&Province=" + document.getElementById('ddlProv').value + "&Surname=" + document.getElementById('txtSurname').value + "&Suburb=" + document.getElementById('ddlSuburb').value + "&Practice_no=" + document.getElementById('txtName').value + "&town=" + document.getElementById('ddlTown').value
    //alert(url);
    RunAjax(url, 'foundationresults');
 }
 
function foundationresults (AJAXresponse)
{
    document.getElementById('search_results').style.visibility='visible';
   document.getElementById(TableName).innerHTML = AJAXresponse;
      initLytebox(); 
   //document.getElementById ('ProcesingClaimsPage').style.display ='none';
    document.getElementById('overlay').style.display = 'none'; 
    document.getElementById ('ProcesingRequest').style.display ='none';
    
}
//====================================================================================
function PolmedProviderResultList(Page,Province,Practice, Surname, max)
{
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=polmed_doctor_list&pg=" + Page +"&prv="+Province+"&prac="+Practice+"&snm="+Surname+"&max="+max;
    RunAjax(url, 'Polmedresults');
}
function PolmedProviderSearch(max)
{
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action=polmed_doctor_list&pg=1&prac=" + document.getElementById('txtName').value+"&prv="+document.getElementById('drpRegion').value+"&snm="+document.getElementById('txtSurname').value+"&max=" + max;
    RunAjax(url, 'Polmedresults');
}
function Polmedresults (AJAXresponse)
{
    document.getElementById(TableName).innerHTML = AJAXresponse;
    initLytebox();
    document.getElementById('overlay').style.display = 'none'; 
}
//GENERIC====================================================================================
function ProviderResultList(group, Page,Province,Practice, Name, Surname, max)
{
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action="+group+"&pg=" + Page +"&prv="+Province+"&prac="+Practice+"&nm="+Name+"&snm="+Surname+"&max="+max;
    RunAjax(url, 'Polmedresults');
}
function ProviderSearch(group, max)
{
    TableName = "ProviderList";
    var url = "cmsAjax.aspx?Action="+group+"&pg=1&prac=" + document.getElementById('txtPrac').value+"&prv="+document.getElementById('drpRegion').value+"&nm="+document.getElementById('txtName').value+"&max=" + max;
    RunAjax(url, 'Polmedresults');
}
//QUALSA GP NETWORK================================================================================
function ProviderByNetwork(network, page, max, province, town, suburb, provider)
{
    TableName = "qualsagpnw";
    var url = "cmsAjax.aspx?Action=ProviderByNetwork&nw="+network+"&pg=" + page +"&max=" + max + "&prv=" + province + "&twn=" + town + "&sbb=" + suburb + "&prov=" + provider;
    RunAjax(url, 'ProviderByNetworkResults');
}
//QUALSA ICON NETWORK================================================================================
function ProviderByNetworkBox(network, page, max, province, town, suburb, provider, id, box) {
    TableName = "qualsagpnw";
    var url = "cmsAjax.aspx?Action=ProviderByNetworkBox&nw=" + network + "&pg=" + page + "&max=" + max + "&prv=" + province + "&twn=" + town + "&sbb=" + suburb + "&prov=" + provider + "&bx=" + box;
    RunAjax(url, 'ProviderByNetworkResults');
}
function ProviderByNetworkResults (AJAXresponse)
{
    document.getElementById(TableName).innerHTML = AJAXresponse;
    initLytebox();
    document.getElementById('overlay').style.display = 'none'; 
}
function GetDocDetails(id)
{
    var url = "cmsAjax.aspx?Action=ProviderById&id="+id;
    RunAjax(url, 'GetDocDetailsResults');
}
//QUALSA ICON ...
function GetDocDetailsBox(id, box) {
    var url = "cmsAjax.aspx?Action=ProviderByIdBox&id=" + id + "&bx=" + box;
    RunAjax(url, 'GetDocDetailsResults');
}
function GetDocDetailsResults(AJAXresponse)
{
    SpawnLightBox(AJAXresponse, true);
}
function FilterSearch(action, id)
{
    if(action == 'sel_ntw_prv') {
        TableName = "ntw_twn";
        document.getElementById('sel_ntw_sbb').options.length=1;
        var url = "cmsAjax.aspx?Action=ProviderByNetworkFilter&act=2&prv="+id;
        RunAjax(url, 'ProviderByNetworkResults');
    } else if (action == 'sel_ntw_twn') {
        TableName = "ntw_sbb";
        var url = "cmsAjax.aspx?Action=ProviderByNetworkFilter&act=3&twn="+id;
        RunAjax(url, 'ProviderByNetworkResults');
    }
}
function FilterSearchSubmit(id)
{
    var provider = document.getElementById('txtPrac').value;
    var prv = document.getElementById('sel_ntw_prv').options[document.getElementById('sel_ntw_prv').selectedIndex].value;
    var twn = document.getElementById('sel_ntw_twn').options[document.getElementById('sel_ntw_twn').selectedIndex].value;
    var sbb = document.getElementById('sel_ntw_sbb').options[document.getElementById('sel_ntw_sbb').selectedIndex].value;
    ProviderByNetwork('QN', '1', '40', prv, twn, sbb, provider);
}
function FilterSearchSubmitBox(id, box) {
    var provider = document.getElementById('txtPrac').value;
    var prv = document.getElementById('sel_ntw_prv').options[document.getElementById('sel_ntw_prv').selectedIndex].value;
    var twn = document.getElementById('sel_ntw_twn').options[document.getElementById('sel_ntw_twn').selectedIndex].value;
    var sbb = document.getElementById('sel_ntw_sbb').options[document.getElementById('sel_ntw_sbb').selectedIndex].value;
    ProviderByNetworkBox('IN', '1', '40', prv, twn, sbb, provider, '', box);
}

//QUALSA GP NETWORK END====================================================================================
function PasswordReset()
{
    var i = document.getElementById("pwresetLst").selectedIndex;
    var val = document.getElementById("pwresetLst").options[i].value;

    TableName = "PasswordResetRslt";
    var url = "cmsAjax.aspx?Action=PasswordReset&acc=" + val;
    RunAjax(url, 'PasswordResetResults');
}
function PasswordResetResults (AJAXresponse)
{
    document.getElementById(TableName).innerHTML = AJAXresponse;
    initLytebox();
    document.getElementById('overlay').style.display = 'none'; 
}
//====================================================================================
function checkEnter(e)
{ 
    var characterCode 
    if(e && e.which)
    { 
        e = e
        characterCode = e.which 
    }   
    else
    {
        e = event
        characterCode = e.keyCode 
    }
    if(characterCode == 13)
    { 
        FoundationProviderSearch();
        return false 
    }
    else
    {
        return true 
    }
}

function checkEnterICD(e)
{ 
    var characterCode 
    if(e && e.which)
    { 
        e = e
        characterCode = e.which 
    }   
    else
    {
        e = event
        characterCode = e.keyCode 
    }
    if(characterCode == 13)
    { 
        ICDSearch('1');
        return false 
    }
    else
    {
        return true 
    }
}

function checkEnterFormulary(e)
{ 
    var characterCode 
    if(e && e.which)
    { 
        e = e
        characterCode = e.which 
    }   
    else
    {
        e = event
        characterCode = e.keyCode 
    }
    if(characterCode == 13)
    { 
        FormularySearch();
        return false 
    }
    else
    {
        return true 
    }
}



function FormularySearch()
 {
    if (document.getElementById("drpPlan").value=='')
    {
        document.getElementById("ErrorMessage").style.display='block';
        document.getElementById("ErrorMessage").innerHTML='Please select a Scheme Option';
    }
    else if (document.getElementById("drpDiagnosis").value=='0' )
    {
        document.getElementById("ErrorMessage").style.display='block';
        document.getElementById("ErrorMessage").innerHTML='Please select a Diagnosis / Illness';
    }
    else
    {    
        document.getElementById ('ProcesingRequest').style.display ='block';
        document.getElementById("ErrorMessage").innerHTML='';
        document.getElementById("ErrorMessage").style.visibility='hidden';
        TableName = "FormularyResults";
        var ddlDiag = document.getElementById("drpDiagnosis");
        var ddlPl = document.getElementById("drpPlan");
        var url = "cmsAjax.aspx?Action=FormularySearch&PlanName="+ddlPl.options[ddlPl.selectedIndex].text+"&Diagnosis=" + ddlDiag.options[ddlDiag.selectedIndex].text+"&DiagnosisICD=" + document.getElementById('drpDiagnosis').value+"&Plan="+document.getElementById('drpPlan').value
        RunAjax(url, 'OUTPUTRESULTSForm');
        
    }
 }
 
 function ICDSearch(Page)
 {
    if (document.getElementById("txtDiagnosis").value=='')
    {
        document.getElementById("ErrorMessage").style.display='block';
        document.getElementById("ErrorMessage").innerHTML='The description you entered is invalid or incorrectly spelt. Please re-enter the diagnosis / illness correctly';
    }
    else
    {
        document.getElementById ('ProcesingRequest').style.display ='block';
        document.getElementById("ErrorMessage").innerHTML='';
        document.getElementById("ErrorMessage").style.visibility='hidden';
        TableName = "FormularyResults";
        var url = "cmsAjax.aspx?Action=ICDSearch&Page="+Page+"&Diagnosis=" + document.getElementById('txtDiagnosis').value
        RunAjax(url, 'OUTPUTRESULTSForm');
    }
 }
 
 function ClearICDSearch()
 {
    document.getElementById("txtDiagnosis").value='';
    document.getElementById("FormularyResults").innerHTML="";
    document.getElementById("ErrorMessage").innerHTML="";
    document.getElementById("ErrorMessage").style.display='none';
 }
 
 function ClearFormularySearch()
 {
    document.getElementById("drpDiagnosis").selectedIndex=0;
    document.getElementById("drpPlan").selectedIndex=0;
    document.getElementById("FormularyResults").innerHTML="";
    document.getElementById("ErrorMessage").innerHTML="";
    document.getElementById("ErrorMessage").style.display='none';
 }

 function processFormularyPlan() {
     TableName = "Plan";
     //if (document.getElementById("drpPlan").value=='TB' || document.getElementById("drpPlan").value =='TA')
     //{   
     //    RunAjax("CMSAjax.aspx?Action=FormularyDiagnosisPrimecure", 'OUTPUTRESULTS');
     RunAjax("CMSAjax.aspx?Action=FormularyDiagnosis", 'OUTPUTRESULTS');
     //document.getElementById("lblIlness").innerHTML = 'Anatomical System:';
     document.getElementById("lblIlness").innerHTML = 'Diagnosis / Illness:';
     //document.getElementById("DisclaimerFRM").innerHTML = '<b>Disclaimer</b><br/>Please note that the formulary will be reviewed regularly by clinical and pharmaceutical advisors to ensure it complies with the latest industry norms for the treatment of these conditions. Prime Cure reserves the right to change medication on the formulary when important information comes to light that requires us to do so - for instance, new findings regarding safety of medicine.';
     //document.getElementById("NOTE").innerHTML = '';        
     //}
     //else
     //{
     //    RunAjax("CMSAjax.aspx?Action=FormularyDiagnosis", 'OUTPUTRESULTS');
     //    document.getElementById("lblIlness").innerHTML = 'Diagnosis / Illness:';
     //    document.getElementById("DisclaimerFRM").innerHTML = '<b>Disclaimer</b><br/>Depending on the specific scheme option, products included on this chronic medicines formulary will not attract a co-payment if authorised by Chronic Medicine Management for a disease on the CDL and obtained from the Designated Service Provider (where applicable). <b>Reimbursement will however be subject to the Chronic Medicine Management clinical guidelines and protocols and the Medicine Price List (MPL).</b>';
     //    document.getElementById("NOTE").innerHTML = '<br/><br/><b><u>Please note:</u></b><br/><br/>Non-preferred formulary products are also reimbursed without a co-payment, subject to reimbursement criteria, available funds and benefit design. However, all new treatments should, wherever possible, be commenced with preferred agents. Not only are these medicines generally the most cost-effective in their class, but they are also reimbursed unlimited on all options.  Where members have non-PMB benefits and/or where there are compelling indications, alternative agents for the treatment of CDL (Chronic Disease List) illnesses may be considered for pre-authorisation.';
     //}
 }

function makeRequest(url,div) {
       var RightNow = new Date ();
	   url = url + "&RightNow=" + RightNow.getTime();
	   if (window.XMLHttpRequest) { // Mozilla, Safari,...
           http_request = new XMLHttpRequest();
       } else if (window.ActiveXObject) { // IE
           http_request = new ActiveXObject("Microsoft.XMLHTTP");
       }
       http_request.onreadystatechange = alertContents;
       http_request.open('GET', url, false);
       http_request.send(null);

   }
