function checkClickIE4()
{
    if (event.button == 2)
    {
        return false;
    }
}

function checkClickNS4(e)
{
    if (document.layers || document.getElementById && !document.all)
    {
        if (e.which == 2 || e.which == 3)
        {
            return false;
        }
    }
}

function isHTTPAddressValid(strHTTPAddress) 
{
    var strURL  = new String(strHTTPAddress);
        strURL  = strURL.toLowerCase();
    
    if (strURL.indexOf(" ") != -1)
    {
        return false;
    }
    else if (strURL.indexOf("http://") == -1)
    {
        return false;
    }
    else if (strURL == "http://")
    {
        return false;
    }
    else if (strURL.indexOf("http://") > 0)
    {
        return false;
    }
    
    strURL = strURL.substring(7, strURL.length);
    
    if (strURL.indexOf(".") == -1)
    {
        return false;
    }
    else if (strURL.indexOf(".") == 0)
    {
        return false;
    }
    else if (strURL.charAt(strURL.length - 1) == ".")
    {
        return false;
    }
    
    if (strURL.indexOf("/") != -1)
    {
        strURL = strURL.substring(0, strURL.indexOf("/"));
        
        if (strURL.charAt(strURL.length - 1) == ".")
        {
            return false;
        }
    }
    
    if (strURL.indexOf(":") != -1)
    {
        if (strURL.indexOf(":") == (strURL.length - 1))
        {
            return false;
        }
        else if (strURL.charAt(strURL.indexOf(":") + 1) == ".")
        {
            return false;
        }
        
        strURL = strURL.substring(0, strURL.indexOf(":"));
        
        if (strURL.charAt(strURL.length - 1) == ".")
        {
            return false;
        }
    }
    
    return true;
}

function isHTTPSAddressValid(strHTTPSAddress) 
{
    var strURL  = new String(strHTTPSAddress);
        strURL  = strURL.toLowerCase();
    
    if (strURL.indexOf(" ") != -1)
    {
        return false;
    }
    else if (strURL.indexOf("https://") == -1)
    {
        return false;
    }
    else if (strURL == "https://")
    {
        return false;
    }
    else if (strURL.indexOf("https://") > 0)
    {
        return false;
    }
    
    strURL = strURL.substring(8, strURL.length);
    
    if (strURL.indexOf(".") == -1)
    {
        return false;
    }
    else if (strURL.indexOf(".") == 0)
    {
        return false;
    }
    else if (strURL.charAt(strURL.length - 1) == ".")
    {
        return false;
    }
    
    if (strURL.indexOf("/") != -1)
    {
        strURL = strURL.substring(0, strURL.indexOf("/"));
        
        if (strURL.charAt(strURL.length - 1) == ".")
        {
            return false;
        }
    }
    
    if (strURL.indexOf(":") != -1)
    {
        if (strURL.indexOf(":") == (strURL.length - 1))
        {
            return false;
        }
        else if (strURL.charAt(strURL.indexOf(":") + 1) == ".")
        {
            return false;
        }
        
        strURL = strURL.substring(0, strURL.indexOf(":"));
        
        if (strURL.charAt(strURL.length - 1) == ".")
        {
            return false;
        }
    }
    
    return true;
}

function openWindow(strURL, strName, intWidth, intHeight, strOptions, strPosition)
{
    var intTop  = 10;
    var intLeft = 10;
    
    if (strName == "")
    {
        strName = new String(Math.random() * 1000000000000000000);
    }
    
    if (strOptions == "")
    {
        strOptions = ",directories=no,location=no,menubar=no,resizable=yes,status=yes,scrollbars=yes,toolbar=no";
    }
    else if (strOptions == "none")
    {
        strOptions = "";
    }
    
    if (strPosition == "centre")
    {
        if (window.screen)
        {
            intTop      = (window.screen.availHeight - intHeight) / 2;
            intLeft     = (window.screen.availWidth  - intWidth)  / 2;
        }
    }
    else if (strPosition == "full")
    {
        if (window.screen)
        {
            intTop      = 0;
            intLeft     = 0;
            intHeight   = window.screen.availHeight;
            intWidth    = window.screen.availWidth;
        }
    }
    
    if (strOptions.charAt(0) == ",")
    {
        return window.open(strURL, strName, "left=" + intLeft + ",top=" + intTop + ",width=" + intWidth + ",height=" + intHeight + strOptions);
    }
    else
    {
        return window.open(strURL, strName, "left=" + intLeft + ",top=" + intTop + ",width=" + intWidth + ",height=" + intHeight + "," + strOptions);
    }
}


function divRoll(value, type, first) 

{

	if(type == 'on')

	{

		document.getElementById(value + 'Over').style.cursor = 'pointer';

		document.getElementById(value + 'Over').style.display = 'block';

		document.getElementById(value).style.display = 'none';

		document.getElementById(value + 'Over').style.paddingTop = '0px';

		

		if(first) {

			document.getElementById(value + 'Over').style.paddingLeft = '0px';

		} else {

			document.getElementById(value + 'Over').style.paddingLeft = '7px';

		}

		document.getElementById(value + 'Over').style.paddingRight = '8px';

		document.getElementById(value + 'Over').style.paddingBottom = '0px';

	}

	else

	{

		document.getElementById(value).style.display = 'block';

		document.getElementById(value + 'Over').style.display = 'none';

		document.getElementById(value + 'Over').style.paddingTop = '3px';

		

		if(first) {

			document.getElementById(value + 'Over').style.paddingLeft = '0px';

		} else {

			document.getElementById(value + 'Over').style.paddingLeft = '11px';

		}

		

		document.getElementById(value + 'Over').style.paddingRight = '11px';	

	}

}	

//// image replacement ////

// set variables

var imgOn = '';

var imgDir;

var imgOver = '-over';

/* cache images - listed as arguments in the function call */



//	 returns an image cache object
function imgCache() {

	this.onImgs = new Array(arguments.length);

	this.offImgs = new Array(arguments.length);

	for (i = 0; i < arguments.length; i++) {

		onImgs[arguments[i]] = new Image();

		offImgs[arguments[i]] = new Image();

		onImgs[arguments[i]].src = imgDir + arguments[i] + imgOver + '.gif';

		offImgs[arguments[i]].src = imgDir + arguments[i] + imgOn + '.gif';

	}

	return this;

}

// generic image rollover function

function imgChange(imgName, state) {

	if (state == 'on'){

		document[imgName].src = onImgs[imgName].src;

	}

	else {

		document[imgName].src = offImgs[imgName].src;

	}

}

function imgIdChange(imgId, imgName, state) {

	if (state == 'on'){

		document.getElementById(imgId).src = onImgs[imgName].src;

	}

	else {

		document.getElementById(imgId).src = offImgs[imgName].src;

	}

}

// generic image rollover function

function imgFormChange(elementName, state) {
	var elemNam = elementName;
	var x = document.getElementById(elemNam);
	if (state == 'on'){

		x.src = onImgs[elementName].src;
	}
	else {
		x.src = offImgs[elementName].src;
	}
}

function selectedIndexChange(value) {
	document.location = value;
}


function trimString(strIn)
{
    var strOut      = "";
    var intStart    = 0;
    var intEnd      = strIn.length;
    
    while ((intStart < intEnd) && (strIn.charAt(intStart) == ' '))
    {
        ++intStart;
    }
    while ((intEnd > 0) && (strIn.charAt(intEnd - 1) == ' '))
    {
        --intEnd;
    }
    
    if (intStart <= intEnd)
    {
        strOut = strIn.substring(intStart, intEnd);
    }
    else
    {
        strOut = "";
    }
    
    return strOut;
}

if (document.layers)
{
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = checkClickNS4;
}
else if (document.all && !document.getElementById)
{
    document.onmousedown = checkClickIE4;
}

document.oncontextmenu = new Function("return false");