var i=0;
var imgArray = new Array(38);

function imagePreloader() {
	for (i=0; i<13; i++)	{
		imgArray[i] = new Image();
		imgArray[i].src="./images/btnE" + i + ".jpg";
		
		imgArray[i+13] = new Image();
		imgArray[i+13].src="./images/btnH" + i + ".jpg";
		
		imgArray[i+26] = new Image();
		imgArray[i+26].src="./images/btnC" + i + ".jpg";
		
		//imgArray[i+33] = new Image();
		//imgArray[i+33].src="./images/btnD" + i + ".jpg";
	}
}

function setEnabled(p_Index) {
	document.images['btn' + p_Index].src = imgArray[p_Index].src; 
}

function setHover(p_Index) {
	document.images['btn' + p_Index].src = imgArray[p_Index + 13].src;
}

function setClicked(p_Index) {
	document.images['btn' + p_Index].src = imgArray[p_Index + 26].src;
}

//function setDisabled(p_Index) {
//	document.images['btn' + p_Index].src = imgArray[p_Index + 33].src;
//}

function ValidateSignIn(p_form) {
	with (p_form) {

		if (ValidateInput(p_username) == false || ValidateInput(p_password) == false) {
			return false;
		} else {
			return true;
		}
	}
}

function ValidateInput(p_input) {
	with (p_input) {
		if (value == null || value == "") {
			return false;
		} else {
			return true;
		}
	}
}

function SubmitOnEnter(SigninField, e) {
	var keycode;
	if (window.event) {
		keycode = window.event.keyCode;
	} else if (e) {
		keycode = e.which;
	} else {
		return true;
	}

	if (keycode == 13) {
		SigninField.form.submit();
		return false;
	} else { 
		return true;
	}
}

function wopen(url, name, w, h) {
	w += 32;
	h += 96;
	var win = window.open(url,
						  name, 
						  'width=' + w + 
						', height=' + h + 
						', location=no' +
						', menubar=no' +
						', status=no' + 
						', toolbar=no' + 
						', scrollbars=no' +
						', resizable=no');
	win.resizeTo(w, h);
	win.focus();
}

function ustatus() {
	document.getElementById('waitmessage').style.visibility = 'visible'; 
	document.UploadFile.fUpload.disabled = true;
	document.UploadFile.submit();
	return true;
}
