/*

	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()
{
	var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
sPage = sPage.substring(0, sPath.indexOf('.')-1);

	//thunder.client.project.flashReplace();
	//thunder.client.modify.rollImages();
	//thunder.client.modify.linkOptions();
	//thunder.client.modify.tabSet();
	thunder.client.modify.treeMenu(false);
	//thunder.client.modify.treeMenu(false, [thunder.client.modes.separatorTreeMenu]);
	//thunder.client.modify.treeMenu(false, [thunder.client.modes.imageTreeMenu]);
	//thunder.client.modify.selfLabelFields();
	//thunder.client.modify.requireFields();
	//thunder.client.modify.dropSelector(true);
	thunder.client.modify.scrollFeature(396, 10000, 500);
	$(window).load( function(){ $('.thunder-scroll-feature').css("visibility", "visible"); });
	thunder.client.workarounds.alphaImages();
	thunder.client.workarounds.labelAsBrowser();
	if(sPage != ""){
		$(".hex-" + sPage).children(".hex-on").removeClass("hex-on");
		//$(".hex-" + sPage).children(".hex-title").css("display", "block");
	}
	$('.hex-on').css('opacity', 0).mouseover(thunder.client.project.hexOver).mouseout(thunder.client.project.hexOut);
	if(!thunder.client.workarounds.isIE6)
	{
		thunder.client.project.homeShadow = $('.home-shadow');
		thunder.client.project.homeShadow.css({display: 'block', height: thunder.client.project.homeShadow.parent().height() + 50, width: thunder.client.project.homeShadow.parent().width() + 50});
	}
	//thunder.client.workarounds.isIE6
	$('.thunder-dropdown').each(thunder.client.project.ddInit);
	$('.close-video').click(thunder.client.project.videoOut);
	$('.photoRotate').cycle({fx: 'fade', timeout: 3000, delay: -1000, sync: true, pause: true});
}

thunder.client.project.ddInit = function()
{
	$(this).css({left: -52+($(this).parent().children('.nav-head').width()/2)});
}

thunder.client.project.hexOver = function() { $(this).animate({opacity:1}, {duration: 500, queue: false}).parent().children('.hex-title').css('display','block'); }
thunder.client.project.hexOut = function() { $(this).animate({opacity:0}, {duration: 500, queue: false}).parent().children('.hex-title').css('display','none'); }

thunder.client.project.videoOut = function()
{
	$('.video-over-top').css({display: 'none'});
	$('.video-embed').html('');
}

thunder.client.project.videoIn = function()
{
	$('.video-over-top').css({display: 'block'});
	$('.background-shade').css({opacity: 0.7});
	$('.video-holder').css({left: ($(window).width() / 2) - 250, top: ($(window).height() / 2) - 150});

	$('.video-embed').flash(
		{
			swf: 'flash/video.swf',
			width: 537,
			height: 302,
			allowFullScreen: true,
			allowScriptAccess: 'always',
			hasVersion: 9,
			wmode: 'transparent',
			flashvars: {
				basePath: ''
			}
		}
	);
}

$(thunder.client.project.pageLoaded);
