var BullHorn = new Object();
function invokeValidation() {
	setTimeout('if (window[\'__bull_validate\']) {\nif (Page_ClientValidate) {\nPage_ClientValidate();\n}\nvalidationCss(false);\n}', 100);
}
function formValidationCss() {
	window['__bull_validate'] = true;
	validationCss(true);
}
function collapseScenery() {
	var container = dGetById('content_container');
	if (container) {
		if (container.style)
			container = container.style;
		container.padding = '0px';
	}
}
function updateInput(inputName, updateValue) {
	if (inputName && (updateValue || (updateValue == ''))) {
		var element = dGetById(inputName);
		if (element) {
			element.value = updateValue;
		}
	}
}
function booleanInput(inputName, updateValue, otherValue) {
	if (inputName && (updateValue || (updateValue == '')) && (otherValue || (otherValue == ''))) {
		var element = dGetById(inputName);
		if (element) {
			if (element.value != updateValue)
				element.value = updateValue;
			else
				element.value = otherValue;
		}
	}
}
function addToInput(inputName, updateValue) {
	updateInput(inputName, String(evaluateObject(inputName) + updateValue));
}
var newwindow;
function explain(url) {
	newwindow=window.open(url,'name','height=250,width=250,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function validationCss(shouldFoxus) {
	var spans = window.document.getElementsByTagName('SPAN');
	var erroredElements = [];
	if (spans) {
		var ranIntoProblem = false;
		var counter = 0;
		for (counter = 0 ; counter < spans.length ; counter++) {
			var validationElement = spans[counter];
			var isInvalid = (String(validationElement.isvalid).toLowerCase() == 'false');
			if (!ranIntoProblem)
				ranIntoProblem = isInvalid;
			if (validationElement.controltovalidate) {
				if (isInvalid) {
					erroredElements[erroredElements.length] = validationElement.controltovalidate;
				} else {
					var errCount = 0;
					for (errCount = 0 ; errCount < erroredElements.length ; errCount++) {
						if (validationElement.controltovalidate == erroredElements[errCount]) {
							isInvalid = true;
						}
					}
				}
				var backupNode = validationElement.parentNode;

				var tempNode = validationElement.parentNode;
				while (true) {
					if (!tempNode) {
						break;
					} else {
						if (tempNode.attributes) {
							if (tempNode.attributes['validation']) {
								if (String(tempNode.attributes['validation'].value).toLowerCase() == "true") {
									backupNode = tempNode;
									break;
								}
							}
						}
						tempNode = tempNode.parentNode;
					}
				}

				if (backupNode.style)
					backupNode = backupNode.style;
				backupNode.backgroundColor = ((isInvalid) ? ('#fcc380') : ('transparent')) ;
			}
		}
		var errorLabel = dGetById('midSpacedLowError');
		if (errorLabel) {
			if (errorLabel.style)
				errorLabel = errorLabel.style;
			errorLabel.display = ((ranIntoProblem) ? ('block') : ('none'));
		}
	}
	if (erroredElements && shouldFoxus) {
		if (erroredElements.length > 0) {
			var errControl = dGetById(erroredElements[0]);
			if (errControl) {
				try {
					errControl.focus();
				} catch (err) {
				
				}
			}
		}
	}
	return true;
}
function attachToForms() {
	var forms = window.document.getElementsByTagName('FORM');
	if (forms) {
		var counter = 0;
		for (counter = 0 ; counter < forms.length ; counter++) {
			var formItem = forms[counter];
			addEvent(formItem, 'submit', formValidationCss, false);
		}
	}
	var inputBoxes = window.document.getElementsByTagName('INPUT');
	if (inputBoxes) {
		var counter = 0;
		for (counter = 0 ; counter < inputBoxes.length ; counter++) {
			var inputItem = inputBoxes[counter];
			addEvent(inputItem, 'blur', invokeValidation, false);
			addEvent(inputItem, 'change', invokeValidation, false);
		}
	}
	inputBoxes = window.document.getElementsByTagName('SELECT');
	if (inputBoxes) {
		var counter = 0;
		for (counter = 0 ; counter < inputBoxes.length ; counter++) {
			var inputItem = inputBoxes[counter];
			addEvent(inputItem, 'blur', invokeValidation, false);
			addEvent(inputItem, 'change', invokeValidation, false);
		}
	}
	validationCss();
}
function addEvent(obj, evType, fn, useCapture) {
	if (obj) {
		if (obj.addEventListener){
			obj.addEventListener(evType, fn, useCapture);
			return true;
		} else if (obj.attachEvent) {
			var r = obj.attachEvent('on' + evType, fn);
			return r;
		}
	}
}
function limitNumber(e) {
	if (!e)
		e = window.event;
	var isNumeric = ((((e.keyCode >= 48) && (e.keyCode <= 57)) && (!e.shiftKey)) || ((e.keyCode >= 96) && (e.keyCode <= 105)) || ((e.keyCode >= 35) && (e.keyCode <= 40)) || (e.keyCode == 46) || (e.keyCode == 8) || (e.keyCode == 16) || (e.keyCode == 17) || (e.keyCode == 9) || (e.keyCode == 32))
	if (!isNumeric) {
		cancelBubble(e);
	}
}
function limitNumberDecimal(e) {
	if (!e)
		e = window.event;
	var isNumeric = ((((e.keyCode >= 48) && (e.keyCode <= 57)) && (!e.shiftKey)) || ((e.keyCode >= 96) && (e.keyCode <= 105)) || ((e.keyCode >= 35) && (e.keyCode <= 40)) || (e.keyCode == 46) || (e.keyCode == 8) || (e.keyCode == 16) || (e.keyCode == 17) || (e.keyCode == 9) || (e.keyCode == 32) || (e.keyCode == 110) || (e.keyCode == 190))
	if (!isNumeric) {
		cancelBubble(e);
	}
}
function cancelBubble(e) {
	e.cancelBubble = true;
	if (typeof e.stopPropagation == 'function')
		e.stopPropagation();

	e.returnValue = false;
	if (typeof e.preventDefault == 'function')
		e.preventDefault();
}
function dynamicExecute(url) {
	var scriptElement = document.createElement('SCRIPT');
	scriptElement.src = url;
	document.body.appendChild(scriptElement);
}
function sequentialExecute(url) {
	if (!window['_listOfPendingOperations'])
		window['_listOfPendingOperations'] = new Array();
	var operationLoop = 0;
	if (url) {
		var foundOperation = false;
		for (operationLoop = 0 ; operationLoop < window['_listOfPendingOperations'].length ; operationLoop++) {
			if (window['_listOfPendingOperations'][operationLoop] == url) {
				foundOperation = true;
				break;
			}
		}
		if (!foundOperation)
			window['_listOfPendingOperations'][window['_listOfPendingOperations'].length] = url;
	}
	if ((window['_listOfPendingOperations'].length > 0) && (!window['_alreadyPerformingOperation'])) {
		window['_alreadyPerformingOperation'] = true;
		var scriptElement = document.createElement('SCRIPT');
		scriptElement.src = window['_listOfPendingOperations'][0];
		document.body.appendChild(scriptElement);
		var tempArray = new Array();
		for (operationLoop = 1 ; operationLoop < window['_listOfPendingOperations'].length ; operationLoop++) {
			tempArray[operationLoop - 1] = window['_listOfPendingOperations'][operationLoop];
		}
		window['_listOfPendingOperations'] = tempArray;
		window['_alreadyPerformingOperation'] = false;
	} else {
		setTimeout('sequentialExecute()', 100);
	}
}
function updateFrames() {
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
	var FFextraHeight=getFFVersion>=0.1? 0 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
	var iTags = document.getElementsByTagName('IFRAME');
	var iLoop = 0;
	for (iLoop = 0 ; iLoop < iTags.length ; iLoop++) {
		try {
			var iFrame = iTags[iLoop];
			var frameHeight = iFrame.scrollHeight;
			var startX = Number(frameHeight);
			if (dGetById && (iFrame.style.height != '1px') && (iFrame.style.height != '0px') && (iFrame.name != 'Gofa')) {
				if (iFrame && !window.opera){
					iFrame.style.display='block';
					if (iFrame.contentDocument && iFrame.contentDocument.body.offsetHeight)
						frameHeight = iFrame.contentDocument.body.offsetHeight+FFextraHeight; 
					else if (iFrame.Document && iFrame.Document.body.scrollHeight)
						frameHeight = iFrame.Document.body.scrollHeight;
				}
			}
			if (((startX - frameHeight) > 20) || ((frameHeight - startX) > 20)) {
				if (frameHeight > 200) {
					iFrame.style.height = String(frameHeight) + 'px';
				}
			}
		} catch (ex) {
			//alert(ex.message);
		}
	}
}
function maxWidth() {
	var content_container = dGetById('content_container');
	if (content_container) {
		if (content_container.style)
			content_container = content_container.style;
		content_container.paddingLeft = '0px';
		content_container.paddingRight = '0px';
	}
}
function evaluateObject(objectAlpha) {
	var objectType = String(typeof(objectAlpha)).toLowerCase();
	if (objectType == 'undefined') {
		return '';
	} else if (objectType == 'string') {
		var tempAlpha = dGetById(objectAlpha);
		if (tempAlpha) {
			return tempAlpha.value;
		} else {
			return '';
		}
	}
}
function adjustStyle(id, styleName, styleValue) {
	eval('var styleObject = dGetById(\'' + String(id) + '\');\n	if (styleObject) {\n		if (styleObject.style)\n			styleObject = styleObject.style;\n		styleObject.' + String(styleName) + ' = \'' + String(styleValue) + '\';\n	}');
}
function catchEnterKey(e, methodName) {
	if (!e)
		e = window.event;
	var isEnterKey = (e.keyCode == 13);
	if (isEnterKey) {
		cancelBubble(e);
		if (methodName) {
			eval(String(methodName));
		}
	}
}
function nav_rollMe(padding, width, offPadd) {
	var hsn1 = dGetById('hsn1');
	if (hsn1) {
		adjustStyle('hsn1', 'paddingLeft', String(padding) + 'px');
		adjustStyle('hsn1', 'width', String(758 - padding) + 'px');
		adjustStyle('hsn1', 'display', 'block');
		adjustStyle('hsn2', 'width', String(width) + 'px');

		if (offPadd)
			padding = offPadd;

		adjustStyle('hsn3', 'paddingLeft', String(padding) + 'px');
		adjustStyle('hsn3', 'width', String(758 - padding) + 'px');
		adjustStyle('hsn3', 'display', 'block');
		adjustStyle('hsn4', 'width', String(758 - padding) + 'px');
	}
}
function refreshFrames() {
	updateFrames();
	clearTimeout(window['_IFR_UPD']);
	window['_IFR_UPD'] = setTimeout('refreshFrames()', 2000);
}
window['_IFR_UPD'] = setTimeout('refreshFrames()', 2000);
function updateCalendar(dayBoxName, monthBoxName, yearBoxName, updateBoxName, numer) {
	if (dayBoxName && monthBoxName && yearBoxName && updateBoxName) {
		var dayBox = dGetById(dayBoxName);
		var monthBox = dGetById(monthBoxName);
		var yearBox = dGetById(yearBoxName);
		var updateBox = dGetById(updateBoxName);
		if (!(dayBox && monthBox && yearBox)) {
			var prefix = 'ctl00_ContentPlaceHolder1_';
			dayBox = dGetById(prefix + dayBoxName);
			monthBox = dGetById(prefix + monthBoxName);
			yearBox = dGetById(prefix + yearBoxName);
			updateBox = dGetById(prefix + updateBoxName);
		}
		if (!(dayBox && monthBox && yearBox)) {
			var prefix = 'ctl00_ContentPlaceHolder1_UiAdditionalDriver_';
			dayBox = dGetById(prefix + dayBoxName);
			monthBox = dGetById(prefix + monthBoxName);
			yearBox = dGetById(prefix + yearBoxName);
			updateBox = dGetById(prefix + updateBoxName);
		}
		if (dayBox && monthBox && yearBox) {
			updateBox.value = (String(dayBox.value) + '/' + String(monthBox.value) + '/' + String(yearBox.value));
		}
	}
}
function clearDate(element) {
	if (element) {
		var eleVal = element.value
		if (eleVal) {
			eleVal = eleVal.toLowerCase();
			if ((eleVal == 'mm') || (eleVal == 'dd') || (eleVal == 'yyyy')) {
				element.value = '';
			}
		}
	}
}
function loginHeaderSlide() {
	var loginHeaderSlider = dGetById('loginHeaderSlider');
	if (loginHeaderSlider) {
		if (loginHeaderSlider.style)
			loginHeaderSlider = loginHeaderSlider.style;
		loginHeaderSlider.display = 'block';

		var mySlide = new Fx.Slide('loginHeaderSlider');

		$('loginHeaderToggle').addEvent('click', function(e){
			e = new Event(e);
			mySlide.toggle();
			e.stop();
		});

		$('loginHeaderHide').addEvent('click', function(e){
			e = new Event(e);
			mySlide.toggle();
			e.stop();
		});

		mySlide.hide();
	}
}
addEvent(window, 'load', loginHeaderSlide, false);
function dGetById(elementId) {
	try {
		return document.getElementById(String(elementId));
	} catch (err) {
		return null;
	}
}