﻿function textMouseOn(textObj, newColor, mouseoverBold, mouseoverUnderline, mouseoverItalic)
{ 
	if(newColor)
	{
		textObj.style.color=newColor; 
	}
	if(mouseoverBold=='true')
	{
		textObj.style.fontWeight='bold';
	}
	else
	{
		textObj.style.fontWeight='normal';
	}
	if(mouseoverUnderline=='true')
	{
		textObj.style.textDecoration='underline';
	}
	else
	{
		textObj.style.textDecoration='none';
	}
	if(mouseoverItalic=='true')
	{
		textObj.style.fontStyle='italic';
	}
	else
	{
		textObj.style.fontStyle='normal';
	}
}  

function textMouseOff(textObj, newColor, bold, underline, italic)
{ 
	textObj.style.color=newColor; 
	if(bold=='true')
	{
		textObj.style.fontWeight='bold';
	}
	else
	{
		textObj.style.fontWeight='normal';
	}
	if(underline=='true')
	{
		textObj.style.textDecoration='underline';
	}
	else
	{
		textObj.style.textDecoration='none';
	}
	if(italic=='true')
	{
		textObj.style.fontStyle='italic';
	}
	else
	{
		textObj.style.fontStyle='normal';
	}
}

/*
--***********************************************************************************************
-- 	Open New Window
--***********************************************************************************************
*/

function PerformOpenNewWindow(p_sUrl, p_sWindowSettings)
{
    var wWindow = window.open(p_sUrl, "NewWindow", p_sWindowSettings);
    wWindow.name = "NewWindow";
}


/*
--***********************************************************************************************
-- 	QueryString Related
--***********************************************************************************************
*/

function PerformReplaceAll(source, lookFor, replaceWith)
{
    var sReturn = source;
    lowerCase = source.toLowerCase();
    lookForLower = lookFor.toLowerCase();
    while(lowerCase.indexOf(lookForLower) != -1)
    {
        posStart = lowerCase.indexOf(lookForLower);
        posEnd   = posStart + lookFor.length;
        lowerCase  = lowerCase.substring(0,posStart) + replaceWith + lowerCase.substring(posEnd, lowerCase.length);
        source = sReturn.substring(0,posStart) + replaceWith + sReturn.substring(posEnd, sReturn.length)
    }	
    return sReturn
}

function PerformGetQueryString()
{
    var sMatchedText;
    var sMatchedTextReplaced;
    var dQueryString = {};
    var sRegularExpression = /[?&]([^=]+)(?:=([^&]*))?/g;
    var sLocationSearch = unescape(location.search);
    while(sMatchedInfo = sRegularExpression.exec(sLocationSearch))
    {
        sMatchedText = sMatchedInfo[2];
        sMatchedTextReplaced = PerformReplaceAll(sMatchedText, "+", " ");
        dQueryString[sMatchedInfo[1]] = sMatchedTextReplaced;
    }
    return dQueryString;
}

