﻿function navOnOff(id, action) {
	var oNav = document.getElementById(id);
	
	if (oNav) {
		if (action == 'over') {
			oNav.className = 'navOver';
		} else {
			oNav.className = 'navNormal';
		}
	}
}

function selectDeselectRow(rowId) {
	var oRow = document.getElementById(rowId);
	
	if (oRow) {
		if (oRow.className == 'dataList_row_0' || oRow.className == 'dataList_row_1') {
			oRow.className = 'dataList_row_selected';
		} else {
			//Set back to normal row state
			var normalRowState = oRow.getAttribute('normalRowState');
			
			if (normalRowState == 'off') {
				oRow.className = 'dataList_row_0';
			} else {
				oRow.className = 'dataList_row_1';
			}
		}
	}
}

function openWindow(url, windowName, width, height) {
	if(screen.width){
		var winl = (screen.width - width) / 2;
		var wint = (screen.height - height) / 2;
	} else{
		winl = 0;
		wint = 0;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	
	var settings = '';
	
	settings += 'height=' + height + ',';
	settings += 'width=' + width + ',';
	settings += 'top=200,left=200,';
	settings += 'directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes';
	
	var win = window.open(url, windowName, settings);
	
	return win;
}

function setOpacity (obj, value) {
	if (!obj) { return; }
	
	obj.style.opacity = value / 10;
	obj.style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function SetupJSCalendar(inputField, triggerButton, yearRange) {
	Calendar.setup({
	        inputField     :  inputField
	        ,button        :  triggerButton
	        ,ifFormat      :  "%m/%e/%Y"
			,daFormat      :  "%A, %B %d, %Y"
			,align         :  "Br"
			,range         :  yearRange.split(",")
			,weekNumbers   :  false
			,cache         :  true
	    });
}
