﻿function showLearnMorePopup()
{
    var popup = getElementById("StylistPopupPanel");
    popup.style.display = "block";
}

function hideLearnMorePopup()
{
    var popup = getElementById("StylistPopupPanel");
    popup.style.display = "none";
}

function showHolidayWorksheetPopup()
{
    var popup = getElementById("HolidayWorksheetPopupPanel");
    popup.style.display = "block";
}

function hideHolidayWorksheetPopup()
{
    var popup = getElementById("HolidayWorksheetPopupPanel");
    popup.style.display = "none";
}

function getElementById(id)
{
    var el = null;
    
    el = document.getElementById(id);
    
    if (el != null)
    {
        return el;
    }

    el = document.getElementById("ctl00_" + id);
           
    if (el != null)
    {
        return el;
    }
                
    el = document.getElementById("ctl00_MiddlePanelContent_" + id);    
    
    return el;
}


// Left-trim whitespace.
// s: String value to trim.
// Returns: Trimmed value.
function LeftTrim(s) 
{
	return s.replace( /^\s*/, "" )
}

// Right-trim whitespace.
// s: String value to trim.
// Returns: Trimmed value.
function RightTrim(s) 
{
	return s.replace( /\s*$/, "" );
}

// Trim whitespace from left and right sides.
// s: String value to trim.
// Returns: Trimmed value.
function Trim(s) 
{
	return RightTrim(LeftTrim(s));
}

// This function converts a text string and removes all non-numeric characters.
// text: String to convert.
// allowDecimal : boolean to allow decimal character
// Returns: Numeric version of string.
function RemoveNonNumericCharacters(text, allowDecimal)
{
    var newText = "";
    
    var allowedChars = "0123456789" + (allowDecimal == null || allowDecimal ? "." : "");
    
    if (text != null && text.length > 0) 
    {
        for (var i = 0; i < text.length; i++)
        {
			var c = text.substring(i, i + 1);
						
			if (allowedChars.indexOf(c) != -1)
			{
				newText = newText + c;
			}        
        }
        
    }
    
    return newText;
}


