/*

	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.project.tabCallback);
	//thunder.client.modify.treeMenu(false, true);
	thunder.client.modify.treeMenu(false, true, [thunder.client.modes.fadeHeadingsTreeMenu, thunder.client.modes.slideTreeMenu]);
	//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.project.feature = thunder.client.modify.scrollFeature(903, 5000, 1000, thunder.client.project.fadeCircles);
	$('.circle-fader').click(thunder.client.project.featureTo);
	thunder.client.workarounds.alphaImages();
	$('.widget-list').find('li').click(thunder.client.project.selectListItem);
	$('.thunder-feature-indicator').css('display', 'block');
	$('.print-page').css({display: "block", cursor: "pointer"}).click(function(){window.print();});
	$('.circle-over').css('opacity', 0);
}

thunder.client.project.featureTo = function()
{
	thunder.client.project.feature.changeTo($('.circle-fader').index(this));
}

thunder.client.project.fadeCircles = function(feature)
{
	$($('.circle-over')[feature.index]).animate({'opacity': 1}, {duration: 1000, queue: false});
	$($('.circle-over')[feature.previndex]).animate({'opacity': 0}, {duration: 1000, queue: false});
}

thunder.client.project.selectListItem = function()
{
	var listIndex = $('.widget-list').find('li').removeClass('widget-item-active').index(this);
	var contentItems = $('.widget-content-area').find('.widget-content').removeClass('widget-content-active');
	$(this).addClass('widget-item-active');
	$(contentItems[listIndex]).addClass('widget-content-active');
}

thunder.client.project.tabCallback = function(i)
{
	$('.thunder-tab').each(function() {
		if(this.getAttribute('thunder.markup:item')==i) $(this).each(thunder.client.utils.imageChanger('-off', '-on')); else $(this).each(thunder.client.utils.imageChanger('-on', '-off'));
	});
}

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.pageLoaded);



//search 
function SearchSite(box){
    //alert($(box).val());
      
    window.location ='/search.aspx?keywords=' + $(box).val();
  return false;
}
