/*

	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);
	//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(960, 8000, 1000);
	thunder.client.workarounds.alphaImages();
	thunder.client.workarounds.labelAsBrowser();
	$(".thunder-tree-menu > .thunder-nav:last a").css("border-right", "1px solid #FFF");

	$(".nav-dropdown").each(function(){
		$(".thunder-nav:last a", this).css("border-bottom", "none");
		$(".thunder-nav", this).wrapAll("<div class='dd-column'></div>");
		$(".dd-column").append("<div class='clearer'></div>");

	});
	
	$(".subNav a").hover(function(){ $("img", this).addClass("subArrow"); }, function(){ $("img", this).removeClass("subArrow"); });
	$(".subNav a:last").css("border-bottom", "none");
	
	$(".thunder-tree-menu > .thunder-nav").mouseenter(function(){
		//15 = arrow width - dropdown left offset
		//$(".dd-arrow").css("left", ($(this).width()) / 2);												   
	});
	
	var count = 1;
	$('.slider > li').each(function(){
		$(this).append('<div class="count">' + count + '</div>');
		count +=1;
	});
	if($(".slider").length > 0){
		$('.slider').scrollIt({
				menuHeight: 273,
				menuWidth: 104,
				itemHeight: 51,
				itemWidth: 86,
				initialItem:0,
				itemMargin: 4,
				vertical:true
		});
	}
	thunder.client.project.popupfix();
}

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: ''
			}
		}
	);
}
thunder.client.project.popupfix = function()
{
	
	//fix the dealer locator stuff
	//alert('fixing');

	
}
$(document).ready(thunder.client.project.pageLoaded);
