//**********************************************************************
//        COPYRIGHT ENDSLEIGH INSURANCE SERVICES LIMITED 2006
//**********************************************************************
//   PROJECT         :   insurance.net
//   LANGUAGE        :   Javascript
//   FILENAME        :   Helper.js
//   ENVIRONMENT     :   Microsoft Visual Studio
//**********************************************************************
//   FILE FUNCTION   :   
//   EXECUTABLE TYPE :   EXE/DLL
//   SPECIFICATION   :   None
//
//   RELATED DOCUMENTATION : None
//
//**********************************************************************
//   ABSTRACT        :   Supporting javascript for Motor Website
//                       
//   AUTHOR          :   J. Morgan        CREATION DATE : 01-June-2007
//
//**********************************************************************
//   BUILD INFORMATION   :   Endsleigh Build System
//   EXECUTABLE NAME     :   
//   MAIN ENTRY POINTS   :   
//
//   EVENTS              :   
//
//**********************************************************************
//   PVCS SECTION:
//   ~~~~~~~~~~~~~
//   PVCS FILENAME: $Logfile:   $
//   PVCS REVISION: $Revision:  $
//
//   $Log$
//
//**********************************************************************

//**********************************************************************
// Global Constants
//**********************************************************************

var PAGE_MESSAGE_SERVICE = "Message.aspx";

//**********************************************************************
// Helper functions
//**********************************************************************

//Show Progress Image function
function showProgressImage(showImgID, hideImgID) 
{
	//hide progress animation if not already hidden
	if (hideImgID != null)
	{
		if (document.getElementById(hideImgID))
		{
			document.getElementById(hideImgID).style.display = 'none';
		}
	}
			
	var imgSrc = document.getElementById(showImgID).src;
	
	
	// display appropriate animation
	document.getElementById(showImgID).style.display = 'block';
	// Causes animated gif to reload and start animation 
	setTimeout("document.getElementById('" + showImgID + "').src = '" + imgSrc + "'", 10);
}

////////////////////////////
//Help popup functionality//
////////////////////////////
var selectsHidden;

function displayPopUpHelp(icon, popUpID) 
{ 
	icon.style.cursor = 'pointer';

	// Set Pop Up text and display
	var popUp = document.getElementById(popUpID);
	popUp.style.display = 'block';
	popUp.style.position = 'absolute';
	popUp.style.zIndex = '9999';
	
	// Set Pop Up position below icon image
	var xPos = getAscendingLefts(icon);
	var yPos = getAscendingTops(icon);
	
	popUp.style.top = (yPos + (icon.height) + 1) + 'px';
	popUp.style.left = (xPos + (icon.height) + 1) + 'px';
	
	if ( scrollRequired(popUp) )
	{
		var newTop = parseInt(popUp.style.top.substr(0, (popUp.style.top.length - 2))) - parseInt(heightDiff) - 5;
		popUp.style.top = newTop + 'px';
	}
	
	// Hide selects overlapping pop up
	checkSelectOverlap(popUp);

	// Fade in pop up
	fadePopUp(popUp, 0, 100, 500);
}

function displayPopUpHelp2(icon, popUpID) 
{ 
	icon.style.cursor = 'pointer';

	// Set Pop Up text and display
	var popUp = document.getElementById(popUpID);
	popUp.style.display = 'block';
	popUp.style.position = 'absolute';
	popUp.style.zIndex = '9999';
	
	// Set Pop Up position below icon image
	var xPos = getAscendingLefts(icon);
	var yPos = getAscendingTops(icon);
	
	popUp.style.top = (yPos + (0) + 1) + 'px';
	popUp.style.left = (xPos + (82) + 1) + 'px';
	
	if ( scrollRequired(popUp) )
	{
		var newTop = parseInt(popUp.style.top.substr(0, (popUp.style.top.length - 2))) - parseInt(heightDiff) - 5;
		popUp.style.top = newTop + 'px';
	}
	
	// Hide selects overlapping pop up
	checkSelectOverlap(popUp);

	// Fade in pop up
	fadePopUp(popUp, 0, 100, 500);
}

//Ascertains the correct left position...
function getAscendingLefts(elem)
{
	if (elem == null)
		return 0;
	else
		return elem.offsetLeft + getAscendingLefts(elem.offsetParent);
}

//Ascertains the correct top position...
function getAscendingTops(elem)
{
	if (elem == null)
		return 0;
	else
		return elem.offsetTop + getAscendingTops(elem.offsetParent);
}

// Work out whether the pop up window when opened will be taller than the screen available
function scrollRequired(popUp)
{
    var scrollY, screenHeight;

    if (document.all) {
        if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
        else
            scrollY = document.documentElement.scrollTop;
    }
    else
        scrollY = window.pageYOffset;
    
    if ( document.all )
       screenHeight = document.documentElement.clientHeight;
    else
       screenHeight = window.innerHeight;
       
    var bottomPos = parseInt(popUp.style.top.substr(0, (popUp.style.top.length - 2))) + parseInt(popUp.clientHeight);
    var totalHeight = parseInt(scrollY) + parseInt(screenHeight);
    
    if ( bottomPos > totalHeight )
    {
        heightDiff = parseInt(bottomPos) - parseInt(totalHeight);
        return true;
    }
    else
        return false;
}

function fadePopUp(popUp, opacStart, opacEnd, millisec) 
{ 
    // Speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    // Set the opacity
    if ( opacStart < opacEnd ) {
		for(i = opacStart; i <= opacEnd; i++) { 
			setTimeout("setOpacity(" + i + ", '" + popUp.id + "')", (timer * speed)); 
			timer++; 
		} 
    }
    else {
		for(i = opacStart; i >= opacEnd; i--) { 
			setTimeout("setOpacity(" + i + ", '" + popUp.id + "')", (timer * speed)); 
			timer++; 
		}
    }
} 

// Function used to fade out a pop up control between start and end values over a given time period
function fadeOutPopUp(popUp, opacStart, opacEnd, millisec) 
{ 
    // Speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    // Set the opacity
    for(i = opacStart; i >= opacEnd; i--) { 
        setTimeout("setOpacity(" + i + ", '" + popUp.id + "')", (timer * speed)); 
        timer++; 
    } 
}

// Set the opacity of a pop up control
function setOpacity(opacity, popUpID) 
{  
    var popUp = document.getElementById(popUpID);
        
    // Set opacity values to work in all browsers
    popUp.style.opacity = (opacity / 100); 
    popUp.style.MozOpacity = (opacity / 100); 
    popUp.style.KhtmlOpacity = (opacity / 100); 
    popUp.style.filter = 'alpha(opacity=' + opacity + ')'; 
}

function hidePopUpHelp(popUp) 
{
	popUp = document.getElementById(popUp);
    popUp.style.opacity = (0); 
    popUp.style.MozOpacity = (0); 
    popUp.style.KhtmlOpacity = (0); 
    popUp.style.filter = 'alpha(opacity=0)'; 
    popUp.style.display = 'none';
    
    // Show select controls
    showSelects();
}

function hideStaticPopUpHelp(popUp) 
{
	popUp = document.getElementById(popUp);
    popUp.style.opacity = (0); 
    popUp.style.MozOpacity = (0); 
    popUp.style.KhtmlOpacity = (0); 
    popUp.style.filter = 'alpha(opacity=0)'; 
    popUp.style.display = 'none';
    
    // Show all select controls
    showAllSelects();
}

function showSelects() 
{
	// Show all select controls as they may have been hidden
	for ( var x = 0; x < selectsHidden.length; x++ ) {
		selectsHidden[x].style.visibility = 'visible';
	}
	
	selectsHidden.length = 0;
}

function showAllSelects()
{
	// Need to do this for when pop up is not closed using onmouseout
	var selects = new Array();
	selects = document.getElementsByTagName('SELECT');
	
	// Show all select controls as they may have been hidden
	for ( var x = 0; x < selects.length; x++ ) {
		selects[x].style.visibility = 'visible';
	}
}

// Check if the pop up control will overlap any select elements & hide them
function checkSelectOverlap(popUp) 
{
    selectsHidden = new Array();
    var selectControls = new Array();
    selectControls = document.getElementsByTagName('select');
    
    var popUpxPos = getAscendingLefts(popUp);
    var popUpyPos = getAscendingTops(popUp);

    for ( var x = 0; x < selectControls.length; x++ ) 
    {
        var selectControl = selectControls[x];
        
        var selectxPos = getAscendingLefts(selectControl);
              var selectyPos = getAscendingTops(selectControl);
              
              var selectxPosMax = selectxPos + selectControl.offsetWidth;
              var selectyPosMax = selectyPos + selectControl.offsetHeight;
        
        // Work out if select control sits within the dimensions of the pop up and hide if it does
        if ( selectxPos >= popUpxPos && selectxPosMax <= (popUpxPos + popUp.offsetWidth) ) {
            if (selectyPosMax >= popUpyPos && selectyPos <= (popUpyPos + popUp.offsetHeight) ) 
            {
				if (selectControl.style.visibility != 'hidden')
				{
					selectControl.style.visibility = 'hidden';
					selectsHidden[selectsHidden.length] = selectControl;
                }
            }
        }
    }  
}

// Hide / Display div elements based on radio button selection
function checkChanged(rad, divID, checkedValue) {			
	if ( rad.checked ) {
		if ( checkedValue == true ) {
			document.getElementById(divID).style.display = 'block';
		}
		else {
			document.getElementById(divID).style.display = 'none';
		}
	}
}

// Catches key down event and clicks relevant button
function checkEnter(e, buttonToClick) {
	var characterCode;

	if ( e && e.which ) {
		e = e;
		characterCode = e.which;
	}
	else {
		e = event;
		characterCode = e.keyCode;
	}

	if ( characterCode == 13 ) {
		e.returnValue = false;
		e.cancel = true;
		
		if (buttonToClick != '')
		{
			if ( document.getElementById(buttonToClick) ) {
				buttonToClick = document.getElementById(buttonToClick);
				buttonToClick.click();
			}
		}
	}
}

// Convert the text of an input control to Uppercase
function setUpperCase(inputControl) {
	var txt = inputControl.value;
	var newTxt = txt.toUpperCase();

	inputControl.value = newTxt;
}

// Validate against the most common forms of UK licence plate numbers
function validateUKRegNumber(inputID, quotePage) 
{
	setUpperCase(document.getElementById(inputID));

	var strReg = document.getElementById(inputID).value;
	
	var regNo = strReg.replace(" ", "");

	if ( regNo.length > 0 ) 
	{
		// Test all forms of UK number plate		
		var regExp1 = /\b[A-Z]{1}\d{1}[A-Z]{3}|[A-Z]{1}\d{2}[A-Z]{3}|[A-Z]{1}\d{3}[A-Z]{3}\b/
		var regExp2 = /\b[A-Z]{2}\d{1}|[A-Z]{2}\d{2}|[A-Z]{2}\d{3}|[A-Z]{2}\d{4}\b/
		var regExp3 = /\b[A-Z]{3}\d{1}|[A-Z]{3}\d{2}|[A-Z]{3}\d{3}|[A-Z]{3}\d{4}\b/
		var regExp4 = /\b[A-Z]{3}\d{1}[A-Z]{1}|[A-Z]{3}\d{2}[A-Z]{1}|[A-Z]{3}\d{3}[A-Z]{1}\b/
		var regExp5 = /\b\d{1}[A-Z]{1}|\d{1}[A-Z]{2}|\d{1}[A-Z]{3}\b/
		var regExp6 = /\b\d{2}[A-Z]{1}|\d{2}[A-Z]{2}|\d{2}[A-Z]{3}\b/
		var regExp7 = /\b\d{3}[A-Z]{1}|\d{3}[A-Z]{2}|\d{3}[A-Z]{3}\b/
		var regExp8 = /\b\d{4}[A-Z]{1}|\d{4}[A-Z]{2}|\d{3}[A-Z]{1}\d{3}|\d{4}[A-Z]{1}\d{3}|[A-Z]{2}\d{2}[A-Z]{3}\b/
		var regExp9 = /\b[A-Z]{1}\d{1}|[A-Z]{1}\d{2}|[A-Z]{1}\d{3}|[A-Z]{1}\d{4}\b/

		var isMatch1 = regExp1.test(regNo);
		var isMatch2 = regExp2.test(regNo);
		var isMatch3 = regExp3.test(regNo);
		var isMatch4 = regExp4.test(regNo);
		var isMatch5 = regExp5.test(regNo);
		var isMatch6 = regExp6.test(regNo);
		var isMatch7 = regExp7.test(regNo);
		var isMatch8 = regExp8.test(regNo);
		var isMatch9 = regExp9.test(regNo);

		// If we have a match perform postback
		if ( isMatch1 || isMatch2 || isMatch3 || isMatch4 || isMatch5 || isMatch6 || isMatch7 || isMatch8 || isMatch9 ) 
		{
			arrInput = [inputID];
			resetAlerts(arrInput);
			return true;
		}
		else 
		{
			if (!quotePage)
				alert('Please enter a valid UK registration number.');
			return false;
		}
	}
	else 
	{
		if (!quotePage)
			alert('Please enter a registration number.');
		return false;
	}
}

// Generate a random 32 bit GUID
function newGuid()
{
    var g = "{";
    for(var i = 0; i < 32; i++)
    g += Math.floor(Math.random() * 0xF).toString(0xF) + (i == 8 || i == 12 || i == 16 || i == 20 ? "-" : "")
    return g + "}";
}

// Used to validate non UK registration numbers.
function validateQRegNumber(inputID) {
	setUpperCase(document.getElementById(inputID));
	var strReg = document.getElementById(inputID).value;

	var regNo = strReg.replace(" ", "");

	if ( regNo.length > 0 ) {
		// If we have a match perform postback
		if ( regNo.substring(0,1) == 'Q' ) {
			return true;
		}
		else {
			alert('Please enter a valid registration number.');
			return false;
		}
	}
	else {
		alert('Please enter a registration number.');
		return false;
	}
}

//******************************************************************************************
// Restrict Key Strokes to Input Controls
//******************************************************************************************
// Restrict user entry to numbers only for an input control
function checkNum(e) 
{
	var characterCode;
	var isValid = false;

	if ( e && e.which ) 
	{
		e = e;
		characterCode = e.which;
	}
	else 
	{
		e = event;
		characterCode = e.keyCode;
	}
    
    // Allow numbers
    if ((characterCode >= 48) && (characterCode <= 57))
        isValid = true;
        
    // Allow Tab & Backspace
    if ((characterCode == 8) || (characterCode == 9))
        isValid = true;
    
    if (!isValid)
    {
        event.cancelBubble = true;
        event.returnValue = false;	
    }
}

// Restrict user entry to numbers + spaces only for an input control
function checkNumSpaces(e) 
{
	var characterCode;
	var isValid = false;

	if ( e && e.which ) 
	{
		e = e;
		characterCode = e.which;
	}
	else 
	{
		e = event;
		characterCode = e.keyCode;
	}
    
    // Allow numbers
    if ((characterCode >= 48) && (characterCode <= 57))
        isValid = true;
        
    // Allow Spaces, Tab & Backspace
    if ((characterCode == 32) || (characterCode == 8) || (characterCode == 9))
        isValid = true;
    
    if (!isValid)
    {
        event.cancelBubble = true;
        event.returnValue = false;	
    }
}

// Restrict user entry to numbers, letters and [-&,] characters only for an input control
function checkAlphaNum(e) 
{
	var characterCode;
	var isValid = false;

	if ( e && e.which ) 
	{
		e = e;
		characterCode = e.which;
	}
	else 
	{
		e = event;
		characterCode = e.keyCode;
	}
    
    // Allow numbers
    if ((characterCode >= 48) && (characterCode <= 57))
        isValid = true;
    
    // Allow upper case letters
    if ((characterCode >= 65) && (characterCode <= 90))
        isValid = true;
    
    // Allow lower case letters
    if ((characterCode >= 97) && (characterCode <= 122))
        isValid = true;
    
    // Allow the characters [-&, '] + Tab & Backspace
    if ((characterCode == 45) || (characterCode == 38) || (characterCode == 44) || 
        (characterCode == 32) || (characterCode == 39) || (characterCode == 8) ||
        (characterCode == 9))
        isValid = true;
    
    if (!isValid)
    {
        event.cancelBubble = true;
        event.returnValue = false;	
    }
}

// Restrict user entry to numbers, letters and spaces characters only for an input control
function checkAlphaNumPostcode(e) 
{
	var characterCode;
	var isValid = false;

	if ( e && e.which ) 
	{
		e = e;
		characterCode = e.which;
	}
	else 
	{
		e = event;
		characterCode = e.keyCode;
	}
    
    // Allow numbers
    if ((characterCode >= 48) && (characterCode <= 57))
        isValid = true;
    
    // Allow upper case letters
    if ((characterCode >= 65) && (characterCode <= 90))
        isValid = true;
    
    // Allow lower case letters
    if ((characterCode >= 97) && (characterCode <= 122))
        isValid = true;
    
    // Allow the characters [-&, '] + Tab & Backspace
    if ((characterCode == 32) || (characterCode == 8) || (characterCode == 9))
        isValid = true;
    
    if (!isValid)
    {
        event.cancelBubble = true;
        event.returnValue = false;	
    }
}

//******************************************************************************************
// Attach Event Handlers to Elements
//******************************************************************************************
function addEvent(obj, type, fn)
{
	if (obj.addEventListener)
		obj.addEventListener(type, fn, false);
	else if (obj.attachEvent)
		obj.attachEvent("on" + type, fn);
}


//******************************************************************************************
// Code for sliding div's into view.
//******************************************************************************************

//Variables.
var slidingPanelOriginalHeight = 0;
var cancelSlideID;

//Constants.
var SLIDING_ELEMENT_INCREMENT = 10;  //Higher is faster.
var SLIDING_ELEMENT_TIMEOUT = 30;  //Lower is faster.

//Slide's an element into view.
function slideElement(slidingPanel, slidingContent, slideToHeight)
{
	try
	{			
		var slidingPanel = document.getElementById(slidingPanel);
		var slidingContent = document.getElementById(slidingContent);
		
		if (slidingContent.style.display == 'block')
		{
			//Do nothing as it's already visible.
		}
		else
		{	
			var height = 0;
			
			if (slidingPanelOriginalHeight == 0)
			{
				slidingPanel.style.display = 'block';
				slidingPanelOriginalHeight = slideToHeight;
				height = 0;
			}
			else
				height = slidingPanel.offsetHeight;
			
			// Set the element height
			var currentHeight = parseInt(height) + parseInt(SLIDING_ELEMENT_INCREMENT);
			slidingPanel.style.height = currentHeight + 'px';
			
			// Work out if further sliding is required
			if (currentHeight >= slidingPanelOriginalHeight)
			{
				slidingPanel.style.height = 'auto';
				slidingPanelOriginalHeight = 0;
				slidingPanel.style.height	
				slidingContent.style.display = 'block';
			}
			else
				cancelSlideID = setTimeout('slideElement("' + slidingPanel.id + '", "' + slidingContent.id + '", ' + slideToHeight + ')', SLIDING_ELEMENT_TIMEOUT);
		}
	}
	catch (e)
	{
	}
}

//Cancels the slide and returns the panel back to its original state.
function cancelSlide(slidingPanel, slidingContent)
{
	try
	{
		slidingPanel = document.getElementById(slidingPanel);
		slidingContent = document.getElementById(slidingContent);
		slidingPanel.style.height = '';
		slidingPanel.style.display = 'none';
		slidingContent.style.display = 'none';
		slidingPanelOriginalHeight = 0;
		clearTimeout(cancelSlideID);
	}
	catch (e)
	{
	}
}

//******************************************************************************************
// Validation helper functions
//******************************************************************************************
function addValidationItem(validationSummaryList, validationItemText)
{
	validationSummaryList = document.getElementById(validationSummaryList);
	
	// Create list item
	var validationItem = document.createElement('li');
	validationItem.innerHTML = validationItemText;
	
	// Add to validation summary unordered list
	validationSummaryList.appendChild(validationItem);
}

//******************************************************************************************
// ImageButton MouseOver Effects = Correction of PNG Images
//******************************************************************************************
var arrButtonMouseOvers = new Array();
var arrButtonMouseOversPNG = new Array();
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function processElements()
{
    setUpMouseOvers();
    correctPNGImages();
}

function setUpMouseOvers(e)
{
    var arrInputs = document.getElementsByTagName('input');
    
    for(var x = 0; x < arrInputs.length; x++)
    {
        var img = arrInputs[x];

        if (img.type != 'undefined')
            if (img.type == 'image')
            {
                if ((version >= 5.5) && (version < 7) && (img.src.toLowerCase().indexOf('.png') > -1))
                    new buttonMouseOverPNG(img);
                else
                    new buttonMouseOver(img);
            }
    }
}

function buttonMouseOver(obj) 
{
    // If the objects already in the array, leave it
    for (var i = 0; i < arrButtonMouseOvers.length; i++) 
        if (obj == arrButtonMouseOvers[i].obj) 
            return;

    // Assign image object to this object and create image objects
    this.obj = obj;
    this.off = new Image();
    this.off.src = obj.src;
    this.on = new Image();

    // Use regex to create the on image SRC and assign to this object
    if (this.off.src.toLowerCase().indexOf('_off') > -1) 
    {
        var onSrc = this.off.src.replace(/_[Oo][Ff]{2}/, "_On");
        this.on.src = onSrc;
    }
    else
        return;

    // Assign this object to a variable so we can assign it in functions below
    var thisObject  = this;

    // Create event handlers to change the image on mouse over
    var fnMouseOver = function() { obj.src = thisObject.on.src;  };
    var fnMouseOut = function() { obj.src = thisObject.off.src;  };
    
    addEvent(obj, "mouseover", fnMouseOver);
    addEvent(obj, "mouseout", fnMouseOut);

    // Put this object into the rollovers array
    arrButtonMouseOvers[arrButtonMouseOvers.length] = this;
}

function buttonMouseOverPNG(img)
{
    if (img.src.toLowerCase().indexOf('_off') > -1) 
    {   
        var imgSrc = img.src;
        var imageName = imgSrc.substring(imgSrc.lastIndexOf("/") + 1);
        img.src = imgSrc.replace(imageName, "spacer.gif");
        
        img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +  imgSrc + "', sizingMethod='image')"
        
        var offImg = new Image();
        offImg.style.filter = img.style.filter;
        
        var onImg = new Image();
        onImg.style.filter = img.style.filter.replace(/_[Oo][Ff]{2}/, "_On");

        // Assign image object to this object and create image objects
        this.obj = img;
        this.off = offImg;
        this.on = onImg;

        // Assign this object to a variable so we can assign it in functions below
        var thisObject  = this;

        // Create event handlers to change the image on mouse over
        var fnMouseOver = function() { img.style.filter = thisObject.on.style.filter;  };
        var fnMouseOut = function() { img.style.filter = thisObject.off.style.filter;  };
        
        addEvent(img, "mouseover", fnMouseOver);
        addEvent(img, "mouseout", fnMouseOut);

        // Put this object into the rollovers array
        arrButtonMouseOversPNG[arrButtonMouseOversPNG.length] = this;
    }
}

function correctPNGImages()
{
    if ((version >= 5.5) && (version < 7))
    {
        var images = new Array();
        images = document.getElementsByTagName('IMG');
        var pngImages = new Array();

        //Identify the png images.
        for (var x = 0; x < images.length; x++)
        {
            var img = images[x];

            if (img.src.indexOf('.png') > -1)
            {
                if (img.src.toLowerCase().indexOf('_off') == -1)
                {
                    pngImages[pngImages.length] = img;
                }
            }
        }

        //Process the png images.
        for (var x = 0; x < pngImages.length; x++)
        {
            var imgID = (pngImages[x].id) ? "id='" + pngImages[x].id + "' " : ""
            var imgClass = (pngImages[x].className) ? "class='" + pngImages[x].className + "' " : ""
            var imgTitle = (pngImages[x].title) ? "title='" + pngImages[x].title + "' " : "title='" + pngImages[x].alt + "' "
            var imgStyle = "display:inline-block;" + pngImages[x].style.cssText
            if (pngImages[x].align == "left") imgStyle = "float:left;" + imgStyle
            if (pngImages[x].align == "right") imgStyle = "float:right;" + imgStyle
            if (pngImages[x].parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
                    + " style=\"" + "width:" + pngImages[x].offsetWidth + "px; height:" + pngImages[x].offsetHeight + "px;" + imgStyle + ";"
                    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                    + "(src=\'" + pngImages[x].src + "\', sizingMethod='image');\"></span>"
            pngImages[x].outerHTML = strNewHTML
        }
    }
}

//******************************************************************************************
// Set up MouseOver effects for all buttons on the page + Fix PNG images
//******************************************************************************************
addEvent(window, "load", processElements);