/*
JavaScript Functions


XHTML Strict and W3C DOM compliancy using getElementById()
*/

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

// Image Preloads
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		title1_off = newImage('cimages/title1.jpg');
		title1_on = newImage('cimages/title1_on.jpg');
		title2_off = newImage('cimages/title2.jpg');
		title2_on = newImage('cimages/title2_on.jpg');
		title3_off = newImage('cimages/title3.jpg');
		title3_on = newImage('cimages/title3_on.jpg');
		title4_off = newImage('cimages/title4.jpg');
		title4_on = newImage('cimages/title4_on.jpg');
		title5_off = newImage('cimages/title5.jpg');
		title5_on = newImage('cimages/title5_on.jpg');
		title6_off = newImage('cimages/title6.jpg');
		title6_on = newImage('cimages/title6_on.jpg');
		title7_off = newImage('cimages/title7.jpg');
		title7_on = newImage('cimages/title7_on.jpg');
		title8_off = newImage('cimages/title8.jpg');
		title8_on = newImage('cimages/title8_on.jpg');
		title9_off = newImage('cimages/title9.jpg');
		title9_on = newImage('cimages/title9_on.jpg');
		title10_off = newImage('cimages/title10.jpg');
		title10_on = newImage('cimages/title10_on.jpg')
		title11_off = newImage('cimages/title11.jpg');
		title11_on = newImage('cimages/title11_on.jpg');
		title12_off = newImage('cimages/title12.jpg');
		title12_on = newImage('cimages/title12_on.jpg');
		title13_off = newImage('cimages/title13.jpg');
		title13_on = newImage('cimages/title13_on.jpg');
		title14_off = newImage('cimages/title14.jpg');
		title14_on = newImage('cimages/title14_on.jpg');
		title15_off = newImage('cimages/title15.jpg');
		title15_on = newImage('cimages/title15_on.jpg');
		title16_off = newImage('cimages/title16.jpg');
		title16_on = newImage('cimages/title16_on.jpg');
		title17_off = newImage('cimages/title17.jpg');
		title17_on = newImage('cimages/title17_on.jpg');
		title18_off = newImage('cimages/title18.jpg');
		title18_on = newImage('cimages/title18_on.jpg');
		title19_off = newImage('cimages/title19.jpg');
		title19_on = newImage('cimages/title19_on.jpg');
		title20_off = newImage('cimages/title20.jpg');
		title20_on = newImage('cimages/title20_on.jpg')

		
		
		preloadFlag = true;
	}
}

// Fancy fade transistion on mouseover
var transitionToggle = 0;
function changeImages() {
	if (document.getElementById && (preloadFlag == true)) {
		for (var i = 0; i < changeImages.arguments.length; i += 2) {
			id = changeImages.arguments[i];
			name = changeImages.arguments[i + 1];
			document.getElementById(id).filters[0].Apply();
			// After setting Apply(), changes to the object are not displayed until Play() is called.
			if (transitionToggle) {
				transitionToggle = 0;
				document.getElementById(id).src = eval(name + ".src");
			}
			else {
				transitionToggle = 1;
				document.getElementById(id).src = eval(name + ".src");
			}
			document.getElementById(id).filters[0].Play();
		}
	}
}

// Mouseover highlight for button form elements
// Must see if "className" exists first, so older browsers don't choke.
function hov(loc,cls) {
	if(loc.className) loc.className=cls;
}
