﻿// JScript File
<!--

var nGlobalID1= null;


//------------
function findLayer( oDoc, sLayer) {
var i, oReturn;

	oReturn = null;
	if (navigator.userAgent.toUpperCase().indexOf('MSIE') < 0) {
        if (oDoc == null || oDoc.layers == null || sLayer == null || sLayer == '') return( oReturn);
        for (i=0; i<oDoc.layers.length && oReturn==null; i++) {
                if (String(oDoc.layers[i].name).toLowerCase() == String(sLayer).toLowerCase()) {
                        oReturn = oDoc.layers[i];
                }
                else {
                        oReturn = findLayer( oDoc.layers[i], sLayer);
                }
        }
	}
	else {
        if (oDoc == null || oDoc.all == null || sLayer == null || sLayer == '') return( oReturn);
        for (i=0; i<oDoc.all.length && oReturn==null; i++) {
                if (String(oDoc.all[i].id).toLowerCase() == String(sLayer).toLowerCase()) {
                        oReturn = oDoc.all[i];
                }
                else {
						if (oDoc.all[i] != null && (oDoc.all[i].tagName.toUpperCase() == 'DIV' || oDoc.all[i].tagName.toUpperCase() == 'SPAN')) {
                        oReturn = findLayer( oDoc.all[i], sLayer);
						}
                }
        }
	}
	return( oReturn);
}


//------------
function findForm( oDoc, sForm) {
var i, j, oReturn;

	oReturn = null;
	if (navigator.userAgent.toUpperCase().indexOf('MSIE') < 0) {
        if (oDoc == null || oDoc.layers == null || sForm == null || sForm == '') return( oReturn);
        for (i=0; i<oDoc.layers.length && oReturn==null; i++) {
                if (oDoc.layers[i].document.forms[sForm] != null) {
                        oReturn = oDoc.layers[i].document.forms[sForm];
                }
                else {
						oReturn = findForm( oDoc.layers[i], sForm);
                }
        }
	}
	else {
        if (oDoc == null || oDoc.all == null || sForm == null || sForm == '') return( oReturn);
        for (i=0; i<oDoc.all.length && oReturn==null; i++) {
                if (oDoc.all[i].name != null && oDoc.all[i].name.toLowerCase() == String(sForm).toLowerCase()) {
                        oReturn = oDoc.all[i];
                }
                else {
						if (oDoc.all[i] != null && (oDoc.all[i].tagName.toUpperCase() == 'DIV' || oDoc.all[i].tagName.toUpperCase() == 'SPAN')) {
                        oReturn = findForm( oDoc.all[i], sForm);
						}
                }
        }
	}
	return( oReturn);
}


//------------
function extendEvent( sEventName, oOrigEvent, sAddedCode) {
var oReturn;
var nPos;

//alert('extend');
	if (oOrigEvent == null) {
		oReturn = new Function( sAddedCode);
	}
	else {
		if (String(oOrigEvent).indexOf('function anonymous') == 0 || String(oOrigEvent).indexOf('function anonymous') == 1) {
			nPos = String(oOrigEvent).indexOf('{');
			oReturn = new Function( String(oOrigEvent).substr(nPos) + sAddedCode);
		}
		else if (String(oOrigEvent).indexOf('function '+sEventName) == 0 || String(oOrigEvent).indexOf('function '+sEventName) == 1) {
			nPos = String(oOrigEvent).indexOf('{');
			oReturn = new Function( 'event', String(oOrigEvent).substr(nPos) + sAddedCode);
		}
		else {
			oReturn = new Function( String(oOrigEvent) + sAddedCode);
		}
	}

//alert('return: ' + oReturn);
	return oReturn;
}



//--------------------
//
//This function expands the target layer to have the same outer edges (right and bottom)
//as the layer's parent
//Padding can be specified for either the width or the height, if desired
//If the padding for a dimension is null, then that dimension is skipped
//If a Left / Top position is null, then that dimension is skipped
//--------------------

function expandNNLayer( sLayer, nPadRight, nPadBottom) {
var oLayer;

	// If layer is not valid, then abort
//alert('expand ' + sLayer);
	if (sLayer == null || sLayer == '') return;
	oLayer = findLayer( window.document, sLayer);
//alert('exp layer ' + oLayer);
	if (oLayer == null) return;

	// If Navigator, then adjust accordingly
	if (navigator.userAgent.toUpperCase().indexOf('MSIE') < 0) {
		if (oLayer.parentLayer == window) {
//alert('exp window: ' + window.document.width + ', ' + window.document.height);
			if (nPadBottom != null) {
				oLayer.clip.height = window.document.height - oLayer.pageY - nPadBottom;
			}
			if (nPadRight != null) {
				oLayer.clip.width = window.document.width - oLayer.pageX - nPadRight;
			}
		}
		else {
//alert('exp parent: ' + oLayer.parentLayer.clip.width + ', ' + oLayer.parentLayer.clip.height);
			if (nPadBottom != null) {
				oLayer.clip.height = (oLayer.parentLayer.clip.height + oLayer.parentLayer.pageY) - oLayer.pageY - nPadBottom;
			}
			if (nPadRight != null) {
				oLayer.clip.width = (oLayer.parentLayer.clip.width + oLayer.parentLayer.pageX) - oLayer.pageX - nPadRight;
			}
		}
	}
//alert('exp layer ' + sLayer + ': ' + oLayer.clip.width + ', ' + oLayer.clip.height + ', ' + (oLayer.pageY+oLayer.clip.height));

	return;
}



//-----------
function deleteFromQueryString( sQueryString, sDeleteParameter) {

var sTempQuery = '';
var sStartChar = '';
var aTempArray;

	sTemp = sQueryString;
	if (sTemp.charAt(1) == '?') {
		sTemp = sTemp.substr(1);
		sStartChar = '?';
	}

	aTempArray = sTemp.split( '&');
	sTemp = '';
	for (nCount=0; nCount < aTempArray.length; nCount++) {
		if (aTempArray[nCount].toUpperCase().indexOf(sDeleteParameter.toUpperCase()) < 0) {
			if (nCount == 0 && sStartChar != '') {
				sTemp = sTemp + sStartChar;
			}
			else if (nCount > 0) {
				sTemp = sTemp + '&';
			}
			sTemp = sTemp + aTempArray[nCount]
		}
	}
	
	return( sTemp);
}

//-->



