/*

	Filename             sitewide.js
	Detail               Site functionality
	Author:              thunder::tech inc.
	License:             CLIENT is defined as the owner of online property from which this file resides or this code is referenced in.
						 ADDITIONAL PARTY is defined as anyone other than thunder::tech or CLIENT.
						 No right is granted to ADDITIONAL PARTY to sell, distribute, modify or otherwise transfer the following source code without explicit written permission by CLIENT or thunder::tech.

*/

/*  ================================
     Sitewide JavaScript
    ================================ */

thunder.client.project.pageLoaded = function()
{
	//thunder.client.project.flashReplace();
	//thunder.client.modify.rollImages();
	//thunder.client.modify.linkOptions();
	//thunder.client.modify.tabSet();
	//thunder.client.modify.treeMenu(false, true);
	thunder.client.modify.treeMenu(false, true, [thunder.client.modes.separatorTreeMenu]);
	//thunder.client.modify.treeMenu(false, true, [thunder.client.modes.imageTreeMenu]);
	thunder.client.modify.selfLabelFields();
	//thunder.client.modify.requireFields();
	//thunder.client.modify.dropSelector(true);
	//thunder.client.modify.scrollFeature(640, 3000, 500);
	if(thunder.client.workarounds.isIE6) $('.shadow').css('display', 'none');
	
	
}

var pwdfield, txtfield;

$(window).load(function() {
	$(".shadow-right").each( function() {
		$(this).css("height", ($(this).parent(".side-item-menu").height() + 10) + "px");							 
	});
	
	$(".event-pair:last").removeClass("top");
	
	pwdfield = "<input class='field' id='pwdtxt' type='password' value='' name='password' onkeypress='submitonenter(event);' />";
	txtfield = "<input class='field' type='text' value='password' name='password' onkeypress='submitonenter(event);' />";
	
	/*$(".passwordtxt").blur(function(){
		if($(this).attr("value") == "password"){
			$("#password").html(txtfield);
		}
	});*/
	$(".passwordtxt").focus(function(){
		if($(this).attr("value") == "password"){
			$("#password").html(pwdfield);
			setTimeout(function() { document.getElementById('pwdtxt').focus(); }, 10);
		}
	});
});

thunder.client.project.flashReplace = function()
{
	$('.flash-billboard').flash(
		{
			swf: 'flash/billboard.swf',
			height: 200,
			width: 800,
			allowFullScreen: true,
			allowScriptAccess: 'always',
			hasVersion: 9,
			wmode: 'transparent',
			flashvars: {
				basePath: ''
			}
		}
	);
}

function submitonenter(e)
{
	var keynum
	var keychar

	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}
	if(keynum == 13)
		document.login.submit();
}

$(thunder.client.project.pageLoaded);



gImages = new Array();
gImages[0] = "/images/home_rotating/jcuea_home_photo1.jpg";
gImages[1] = "/images/home_rotating/jcuea_home_photo2.jpg";
gImages[2] = "/images/home_rotating/jcuea_home_photo3.jpg";
gImages[3] = "/images/home_rotating/jcuea_home_photo4.jpg";

function canManipulateImages() {
	if (document.images)
		return true;
	else
		return false;
}
function loadSlide(imageURL) {
	if (gImageCapableBrowser) {
		document.slide.src = imageURL;
		return false;
	}
	else {
		return true;
	}
}
function nextSlide() {
	gCurrentImage = (gCurrentImage + 1) % gImages.length;
	loadSlide(gImages[gCurrentImage]);
}

function randomImage(is_index){
		var rand = Math.ceil(Math.random() * 3);
		document.write("<img src='/images/sub_rotating/jcuea_sub" + rand + ".jpg' alt='' class='subBanner' style='padding-right:18px;' />");
		document.write("<img src='/images/sub_rotating/jcuea_sub" + (rand + 1) + ".jpg' alt='' class='subBanner' /><div class='clearer'></div>");
		document.write("<div class='text'>");
}