//*********Portal Messages are defined here**************** 
//***************Start - Common To All portals
  //Common messages for all portals(secure or non secure) are added here
  //Include HTML content between two single quotes of document.writeln
  //If the HTML text contains single quote, escape it with a back slash (like : We\'re sorry)
  //Uncomment these lines and change the text to add messages for all portals
//var _ServerInstance = "YOU ARE ACCESSING PWEB1";
var _ServerInstance = "";
//var _MessageForAllPortals = "Maintenance will be performed on all HAP Internet applications from 10am - 2pm on Friday, November 20. You may also experience intermittent delays and may be asked to log back in. We apologize for any inconvenience.";
var _MessageForAllPortals = "Maintenance will be performed on all HAP Internet applications from 10am - 2pm on Friday, November 20. You may also experience intermittent delays and may be asked to log back in. We apologize for any inconvenience.";

//Message common to all (secure or non secure portals) (Member, Employer, Provider & Internal)
function displayMessageForAllPortals() {
  _MessageForAllPortals = getHTMLWrapper(_MessageForAllPortals);
  _ServerInstance = getHTMLWrapper(_ServerInstance);
  document.writeln(_MessageForAllPortals); 
  document.writeln(_ServerInstance);  
}

//Message common to all non secure portals (Member, Employer, Provider & Internal)
function displayMessageForAllNonSecurePortalsOnly() {
  document.writeln('');
}

//Message common to all secure portals (Member, Employer, Provider & Internal)
function displayMessageForAllSecurePortalsOnly() {
  //document.writeln('');
  //document.writeln('<p class="appDownMessage">HAP SYSTEM MAINTENANCE</p>');
  //document.writeln('<ul>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Maintenance will be performed on all HAP Internet applications from 11am - 1pm on Wednesday, June 10. You may also experience intermittent delays and may be asked to log back in. We apologize for any inconvenience.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">The HAP website will be unavailable starting at 11:00 p.m. Saturday, August 16.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Both the applications and the website will be back up at approximately 12:00 noon Sunday, August 17.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">See the hot topic below for details.</span>');
  //document.writeln('</li>');
  //document.writeln('</ul>');
}
//*************End - Common To All portals

//***************Start - Member portal
//Message for member non secure portal only 
function displayMessageForMemberNonSecurePortalOnly() {
   document.writeln('');
}

//Message for member secure portal only
function displayMessageForMemberSecurePortalOnly() {
  //document.writeln('<p class="appDownMessage">HAP Core Processing System Update Scheduled</p>');
  //document.writeln('<ul>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">PCP Select, Address Change and Request ID Card will not be available beginning 9:00 pm, Thursday, May 22 until 5:00 pm, Sunday May 25.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Gotta Bill, Customer Message Center and Coordination of Benefits will not be available beginning 2:00 pm Saturday, May 24 until 5:00 pm, Sunday May 25.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Login and all applications will be unavailable beginning 10 am, Sunday, May 25 until 5:00 pm.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">See the hot topic below for details.</span>');
  //document.writeln('</li>');
  //document.writeln('</ul>');
}//function

//Message for all member portals(secure and non secure) 
function displayMessageForAllMemberPortals() {
 var _MessageForAllMemberPortals = "";
  //var _MessageForAllMemberPortals = "Customer Message Center will be unavailable on Wednesday, August 29th, from 8pm - 11pm due to maintenance.  We apologize for any inconvenience.";
  _MessageForAllMemberPortals = getHTMLWrapper(_MessageForAllMemberPortals);
  document.writeln(_MessageForAllMemberPortals); //HTML content between single quotes
}
//***************End - Member portal

//***************Start - Agents portal
//Message for member non secure portal only 
function displayMessageForAgentNonSecurePortalOnly() {
  document.writeln(''); //HTML content between single quotes
}

//Message for agents secure portal only
function displayMessageForAgentSecurePortalOnly() {
  //document.writeln('<p class="appDownMessage">HAP Core Processing System Update Scheduled</p>');
  //document.writeln('<ul>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">The Employer Enrollment Application and Request ID Card will be unavailable from 9:00 pm, Thursday, May 22 to 5:00 pm, Sunday, May 25.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Login and all applications will be unavailable between the hours of 10 AM and 5 PM Sunday, May 25th.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">See the hot topic below for details.</span>');
  //document.writeln('</li>');
  //document.writeln('</ul>');
}//function 

//Message for all member portals(secure and non secure) 
function displayMessageForAllAgentPortals() {
	var _MessageForAllAgentPortals = "";
  _MessageForAllAgentPortals = getHTMLWrapper(_MessageForAllAgentPortals);
  document.writeln(_MessageForAllAgentPortals); //HTML content between single quotes
}
//***************End - Agent portal

//***************Start - Provider portal
//Message for provider non secure portal only 
function displayMessageForProviderNonSecurePortalOnly() {
  document.writeln(''); //HTML content between single quotes
}

//Message for provider secure portal only
function displayMessageForProviderSecurePortalOnly() {
	
	//var _MessageForProviderSecurePortalOnly = "";
  //_MessageForProviderSecurePortalOnly = getHTMLWrapper(_MessageForProviderSecurePortalOnly);
  //document.writeln(_MessageForProviderSecurePortalOnly);  
	
  //document.writeln('<p class="appDownMessage">HAP Core Processing System Update Scheduled</p>');
  //document.writeln('<ul>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Provider On-line appeals, Claim Error Correction and Provider Data Update Applications will not be available from 9:00 pm, Thursday, May 22 to 5:00 pm, Sunday, May 25.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Login and all applications will be unavailable between the hours of 10 AM and 5 PM Sunday, May 25th.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">See the hot topic below for details.</span>');
  //document.writeln('</li>');
  //document.writeln('</ul>');
}//function

//Message for all provider portals(secure and non secure) 
function displayMessageForAllProviderPortals() {
        var _MessageForAllProviderPortals = "";
	//var _MessageForAllProviderPortals = "The Provider Data Update application will be unavailable through Monday, October 5 due to system maintenance.";
  _MessageForAllProviderPortals = getHTMLWrapper(_MessageForAllProviderPortals);
  document.writeln(_MessageForAllProviderPortals);
}
//***************End - Provider portal

//***************Start - Employer portal
//Message for employer non secure portal only 
function displayMessageForEmployerNonSecurePortalOnly() {
  document.writeln(''); //HTML content between single quotes
}

//Message for employer secure portal only
function displayMessageForEmployerSecurePortalOnly() {
  //document.writeln('<span class="appDownMessage">');
  //document.writeln('As the result of a recent systems upgrade, eBilling is temporarily unavailable.<BR>');
  //document.writeln('You can be assured, that your invoice(s) will generate on their scheduled day and your copy of the invoice will be mailed as usual.<BR>');
  //document.writeln('We apologize for any inconvenience the unavailability of eBilling may cause.  During the time the online system is unavailable, please contact the Reconciliation Specialist listed on your invoice should you have any questions and/or issues related to the invoice that need resolution.');
  //document.writeln('</span><p>');
}//function

//Message for all employer portals(secure and non secure) 
function displayMessageForAllEmployerPortals() {
  var _MessageForAllEmployerPortals="";
  //var _MessageForAllEmployerPortals = "Employer Enrollment will be unavailable on June 8th from 10am until 2pm for maintenance.  We apologize for any inconvenience.";
  _MessageForAllEmployerPortals = getHTMLWrapper(_MessageForAllEmployerPortals);
  document.writeln(_MessageForAllEmployerPortals); //HTML content between single quotes
}
//***************End - Employer portal

//***************Start - Internal portal
//Message for internal non secure portal only 
function displayMessageForInternalNonSecurePortalOnly() {
  document.writeln('');
}

//Message for internal secure portal only
function displayMessageForInternalSecurePortalOnly() {
 document.writeln(''); //HTML content between single quotes
}

//Message for all internal portals(secure and non secure) 
function displayMessageForAllInternalPortals() {
	var _MessageForAllInternalPortals = "";

  _MessageForAllInternalPortals = getHTMLWrapper(_MessageForAllInternalPortals);
  document.writeln(_MessageForAllInternalPortals);
}
//***************End - Internal portal

//***************Start - payor portal
//Message for payor non secure portal only 
function displayMessageForPayorNonSecurePortalOnly() {
  document.writeln('');
}

//Message for payor secure portal only
function displayMessageForPayorSecurePortalOnly() {
  //document.writeln('<p class="appDownMessage">HAP Core Processing System Update Scheduled</p>');
  //document.writeln('<ul>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">Login and all applications will be unavailable between the hours of 10 AM and 5 PM Sunday, May 25th.</span>');
  //document.writeln('</li>');
  //document.writeln('<li>');
  //document.writeln('<span class="sm-red">See the hot topic below for details.</span>');
  //document.writeln('</li>');
  //document.writeln('</ul>');
}//function

//Message for all payor portals(secure and non secure) 
function displayMessageForAllPayorPortals() {
      var _MessageForAllPayorPortals = "";
	var _MessageForAllPayorPortals = "All HAP offices will be closed December 30, 2005 - Monday, January 2, 2006 in order for our employees to celebrate the holidays with their families. From all of us at HAP - Happy Holidays and a Healthy New Year to You and Your Family.";

  _MessageForAllPayorPortals = getHTMLWrapper(_MessageForAllPayorPortals);
  document.writeln(_MessageForAllPayorPortals);
}
//***************End - Payor portal

//*************Begin - Guests

//Common to all guest portals
function displayMessageForAllGuestPortals() {
   //var _MessageForAllGuestPortals = "";
   var _MessageForAllGuestPortals = "<p class=\"sm-red\">All online service tutorials require PowerPoint installed on your computer. Windows users without PowerPoint can download a free PowerPoint Viewer from Microsoft's web site by clicking <a href=\"http://www.microsoft.com/downloads/details.aspx?FamilyID=d1649c22-b51f-4910-93fc-4cf2832d3342&DisplayLang=en\">here</a>.</p>";
  //_MessageForAllGuestPortals = getHTMLWrapper(_MessageForAllGuestPortals);
  document.writeln(_MessageForAllGuestPortals);  
  //document.writeln('');
}

//Guest member portal only
function displayMessageForGuestMemberPortal() {
 document.writeln(''); //HTML content between single quotes
}

//Guest provider portal only
function displayMessageForGuestProviderPortal() {
 document.writeln(''); //HTML content between single quotes
}

//Guest employer portal only
function displayMessageForGuestEmployerPortal() {
 document.writeln(''); //HTML content between single quotes
}

//Guest agent portal only
function displayMessageForGuestAgentPortal() {
 document.writeln(''); //HTML content between single quotes
}

//Guest payor portal only
function displayMessageForGuestPayorPortal() {
 document.writeln(''); //HTML content between single quotes
}
//*************End - Guests

function getHTMLWrapper(sMessage) {
	if(sMessage == "" || sMessage == null) {
		return "";	
	} else {
		sMessage = replaceBackSingleQuote(sMessage);
		var sStartTag = "<p class=\"appDownMessage\">";
		var sEndTag = "</p>";
		sMessage = sStartTag + sMessage +	sEndTag;
		return sMessage;
	}
}


function replaceBackSingleQuote(sString) {
 	var oRegExp = /`/;
 	sString = sString.replace(oRegExp,"'");
 	var intval = sString.search(oRegExp);
 	if(intval == -1) {
		return sString;
	} else {
		return replaceBackSingleQuote(sString);
	}//end if
}//end function
//Message for IRA Home Page 
function displayMessageForIRAHomePage() {
  //document.writeln('<p class="appDownMessage">The IRA application will be unavailable from 7:00 - 8:00 pm on Thurday, January 15.  We apologize for any inconvenience.</p>');  
}

function displayApplicationWarning(){
        //"yes" to display message and "no" to not to display message
        var displayMessage = "yes";
        //var displayMessage = "no";

        //Implementaion time in "YYYY/MM/DD HH:MI:SS" format
        var implementationDateTime = "2009/11/20 12:10:00";

        //The following variable is to display message before implementation time in minutes.
        var DISPLAY_MSG_B4_IMPL = 30;

        //This snippet is to avoid display of this mesage for ICT
        var url = ""+window.location;
        var oRegExp = /\/ict\//;
        var isIct = url.search(oRegExp);

        if (displayMessage == "yes" && isIct == -1) {
                DTnow = new Date();

                implementationTime = new Date(implementationDateTime);
                var minutesRemaining = (implementationTime - DTnow)/60000;

                //alert("implementationTime:"+implementationTime+";DTnow:"+DTnow+";minutesRemaining:"+minutesRemaining);

                if(minutesRemaining < DISPLAY_MSG_B4_IMPL && minutesRemaining > 0){
                    alert("Due to maintenance activity,Please close the browser and log back again.Sorry for the inconvenience!");

                }
        }
}
