/* FW100R3 */
/* (c)2010 SugarHill Works LLC - http://www.sugarhillworks.com */
/**
 * A simple querystring parser.
 * Example usage: var q = $.parseQuery(); q.fooreturns  "bar" if query contains "?foo=bar"; multiple values are added to an array. 
 * Values are unescaped by default and plus signs replaced with spaces, or an alternate processing function can be passed in the params object .
 * http://actingthemaggot.com/jquery
 *
 * Copyright (c) 2008 Michael Manning (http://actingthemaggot.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 **/
$.parseQuery = function(qs,options) {
	var q = (typeof qs === 'string'?qs:window.location.search), o = {'f':function(v){return unescape(v).replace(/\+/g,' ');}}, options = (typeof qs === 'object' && typeof options === 'undefined')?qs:options, o = $.extend({}, o, options), params = {};
	$.each(q.match(/^\??(.*)$/)[1].split('&'),function(i,p){
		p = p.split('=');
		p[1] = o.f(p[1]);
		params[p[0]] = params[p[0]]?((params[p[0]] instanceof Array)?(params[p[0]].push(p[1]),params[p[0]]):[params[p[0]],p[1]]):p[1];
	});
	return params;
}
var q = $.parseQuery();

// -- BEG SITE SETTINGS ----------------------------------------------------------------------------------------
$(function($){
	// SETTINGS FOR SITE-WIDE NAV MENU
	if ($("#menu_cntr_cntr").length > 0) {
		ddsmoothmenu.init({
			mainmenuid: "menu_cntr", //menu DIV id
			orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
			classname: 'nav_menu', //class added to menu's outer DIV
			showArrows: false, // will show arrows to indicate submenus. note the arrows load in the browser last.
			//customtheme: ["#1c5a80", "#18374a"],
			contentsource: ["menu_cntr_cntr", rootPath+"shw_menu/nav_menu.html"] //"markup" or ["container_id", "path_to_menu_file"]
		});
	}

	if ($("#menu_cntr_cntr2").length > 0) {
		ddsmoothmenu.init({
			mainmenuid: "menu_cntr", //menu DIV id
			orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
			classname: 'nav_menu', //class added to menu's outer DIV
			showArrows: false, // will show arrows to indicate submenus. note the arrows load in the browser last.
			//customtheme: ["#1c5a80", "#18374a"],
			contentsource: ["menu_cntr_cntr2", rootPath+"shw_menu/nav_menu_splash.html"] //"markup" or ["container_id", "path_to_menu_file"]
		});
	}

	// SETTINGS FOR GENERAL USE VERTICAL SCROLL PANES
	if ($('.scroll-pane').length > 0) {
		$('.scroll-pane').jScrollPane({
			scrollbarWidth: 7, // the width of the created scrollbar in pixels (defaults to 10)
			scrollbarMargin: 5, // [int] - the margin to leave to the left of the scrollbar in pixels (defaults to 5)
			//wheelSpeed [int] - controls how fast the mouse wheel makes the content scroll in pixels (defaults to 18)
			showArrows:true, // controls whether to display arrows for the user to scroll with (defaults to false)
			arrowSize: 0, // the height of the arrow buttons if showArrows=true (calculated from CSS if not provided)
			animateTo: true, // whether to animate when calling scrollTo and scrollBy (defaults to false)
			//dragMinHeight [int] - the minimum height to allow the drag bar to be (defaults to 0)
			//dragMaxHeight: 100, // [int] - the maximum height to allow the drag bar to be (defaults to 99999!)
			//animateInterval [int] - The interval in milliseconds to update an animating scrollPane (default 100)
			//animateStep [int] - The amount to divide the remaining scroll distance by when animating (default 3)
			//maintainPosition [boolean] - Whether the contents of the scroll pane maintains its position when you re-init it(so it doesn't scroll as you add more content) (default true)
			//scrollbarOnLeft [boolean] - Whether the scrollbar should appear on the left hand side of the panes content (make sure your CSS also reflects this)
			reinitialiseOnImageLoad: true // [boolean] - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded (defaults to false)
		});
	}
	
	// SET UP ROLLOVER ANIMATIONS
	$(".fadeCol").hover( 
		function() {
			if ($(this).parent().hasClass('slctd')) { return false; }
			else { $(this).stop(true, true).animate({color:"#694b04"}, 750); }
		}, 
		function() {
			if ($(this).parent().hasClass('slctd')) { return false; }
			else { $(this).stop(true, true).animate({color:"#000"}, 750); }
		}
	);
	$(".fadeBodyCol").hover( 
		function() {
			$(this).stop(true, true).animate({color:"#000"}, 750);
		}, 
		function() {
			$(this).stop(true, true).animate({color:"#694b04"}, 750);
		}
	);
	//set up menu link animations
	$(".fadeFtrCol").hover( 
		function() { 
			$(this).stop(true, true).animate({color:"#694b04"}, 750);
			//$(this).children("div").stop(true,true).fadeTo(750, 0.75);
		}, 
		function(){
			$(this).stop(true, true).animate({color:"#000"}, 750)
			//$(this).children("div").stop(true,true).fadeTo(750, 0);
		}
	);
	
	/*stickyfooter*/
//	if ($.browser.safari) {
//		$('#fullscr').css('margin','0 auto 0 auto');
//		$('#copy').css({padding:'15px 0 25px', height:'25px'}).appendTo('#ceibw');
//	}



	// SET UP VERTICAL POSITIONING ON INFO PAGES
	// Call this function to vertically center a content container its parent. Takes jq selectors as arguments.
//	function vCenter(content_cntr, parent_cntr) {
//		if ($(parent_cntr).height() === $(content_cntr).height()) {
//			var topPos = $(parent_cntr+' > p:first').css({paddingTop:'0', marginTop:'0'}).offset().top;
//			var btmPos = $(parent_cntr+' > p:last').css({paddingBottom:'0', marginBottom:'0'}).offset().top + $(parent_cntr+' > p:last').height();
//			var content_h = btmPos - topPos;
//			var newTopPos = Math.floor((($(parent_cntr).height() / 2) - (content_h / 2)));
//			$(content_cntr).css({paddingTop:newTopPos+'px'});
//		}
//	}
//	if ($("#info_cntr").length > 0) {
//		vCenter('#info', '.scroll-pane');
//	}
	
	
	// INIT SLIDESHOW
	if ($('#ss_cntr').length > 0) {
		ss_init();
	}
	

	
});
// -- END SETTINGS ----------------------------------------------------------------------------------------

