/*

	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.modify.rollImages();
	//thunder.client.modify.linkOptions();
	//thunder.client.modify.tabSet();
	//thunder.client.modify.treeMenu();
	thunder.client.modify.selfLabelFields();
	thunder.client.modify.requireFields();
	if(document.getElementById('swf-banner')) thunder.client.project.swfBanner();
	if(document.getElementById('swf-menu')) thunder.client.project.swfMenu();
	$('.product-content-expand').click(thunder.client.project.productExpand);
	$('.mouse-image').mouseover(thunder.client.project.mouseImageOver).mouseout(thunder.client.project.mouseImageOut);
	//if($('#focus').length > 0) window.location.hash = '#focus';
}

thunder.client.project.mouseImageOver = function()
{
	$(this).children('img').css('display', 'block');
}

thunder.client.project.mouseImageOut = function()
{
	$(this).children('img').css('display', 'none');
}

thunder.client.project.productExpand = function()
{
	if($(this).parent().children('.product-show-hide').css('display')=='none')
	{
		$(this).parent().removeClass('chevron-left');
		$(this).parent().addClass('chevron-left-down');
		$(this).parent().children('.product-show-hide').css('display','block');
	}
	else
	{
		$(this).parent().removeClass('chevron-left-down');
		$(this).parent().addClass('chevron-left');
		$(this).parent().children('.product-show-hide').css('display','none');
	}
}

thunder.client.project.swfBanner = function()
{
	var so = new SWFObject('/flash/s-banner-6.swf', 'swf-header-banner', '955', '650', '9', '');
	so.addVariable('basePath', '');
	so.addVariable('details', 'details.aspx');
	so.addVariable('camaro', 'camaro.aspx');
	so.addVariable('mustang', 'mustang.aspx');
	so.addVariable('challenger', 'challenger.aspx');
	if(window.location.hash=='#debug-flash') so.addVariable('ttDebugMode', 'debugMode');
	so.addParam('quality', 'high');
	so.addParam('wmode', 'transparent');
	if(window.location.hash!='#no-flash') so.write('swf-banner');
}

thunder.client.project.swfMenu = function()
{
	var so = new SWFObject('/flash/s-header-5.swf', 'swf-header-menu', '955', '250', '9', '');
	so.addVariable('basePath', '/');
	so.addVariable('primary', thunder.client.project.pageIdentity('primary'));
	so.addVariable('secondary', thunder.client.project.pageIdentity('secondary'));
	so.addVariable('tertiary', thunder.client.project.pageIdentity('tertiary'));
	var photos = $('.mmx-split').find('.right-column').find('a');
	//if(photos.length>0) so.addVariable('href1', photos[0].getAttribute('href'));
	//if(photos.length>1) so.addVariable('href2', photos[1].getAttribute('href'));
	so.addParam('quality', 'high');
	so.addParam('wmode', 'transparent');
	if(window.location.hash!='#no-flash') so.write('swf-menu');
}

thunder.client.project.pageIdentity = function(idLevel)
{
	if(document.getElementById('identity-'+idLevel))
	{
		return document.getElementById('identity-'+idLevel).value;
	}
	else
	{
		return '';
	}
}

$(thunder.client.project.pageLoaded);

//***** SUBMISSION FORM**********//
$(document).ready(function() { 
    $('#contactform input').focus(function() {  
          $(this).removeClass("box").addClass("boxhit");  
          if (this.value == this.defaultValue){  
              this.value = '';  
          }  
          if(this.value != this.defaultValue){  
              this.select();  
          }  
    });
       
    $('#contactform input').blur(function() {  
          $(this).removeClass("boxhit").addClass("box");  
          if ($.trim(this.value == '')){  
              this.value = (this.defaultValue ? this.defaultValue : '');  
          }  
    }); 
}); 
