/* FW100.r1 */
/* (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_cntr-v").length > 0) {
//		ddsmoothmenu.init({
//			mainmenuid: "menu_cntr-v", //menu DIV id
//			orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
//			classname: 'nav_menu-v', //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-v", rootPath+"shw_menu/nav_menu-v.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: 0, // [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() {
			$(this).stop(true, true).animate({color:"#4E3419"}, 500);
		}, 
		function() {
			 $(this).stop(true, true).animate({color:"#646C4E"}, 500);
		}
	);
//	$('.fadeCol').live('mouseover mouseout', function(event) {
//	  if (event.type == 'mouseover') {
//				if ($(this).parent().hasClass('slctd')) { return false; }
//				else { $(this).stop(true, true).animate({color:"#039"}, 500); }
//	  } else {
//				if ($(this).parent().hasClass('slctd')) { return false; }
//				else { $(this).stop(true, true).animate({color:"#000"}, 500); }
//	  }
//	});	
	$(".fadeBodyCol").hover( 
		function() {
			$(this).stop(true, true).animate({color:"#000"}, 500);
		}, 
		function() {
			$(this).stop(true, true).animate({color:"#646C4E"}, 500);
		}
	);
	//set up menu link animations
	$(".menuFtrFade").hover( 
		function() { 
			$(this).stop(true, true).animate({color:"#646C4E"}, 500);
			//$(this).children("div").stop(true,true).fadeTo(750, 0.75);
		}, 
		function(){
			$(this).stop(true, true).animate({color:"#4E4212"}, 500);
			//$(this).children("div").stop(true,true).fadeTo(750, 0);
		}
	);
	
//		$(".menuFade > a").hover( 
//			function() {
//				//if ($(this).parent().hasClass('slctd')) { return false; }
//				//else { $(this).stop(true, true).animate({color:"#900"}, 500); }
//				$(this).stop(true, true).animate({color:"#900"}, 500);
//			}, 
//			function() {
//				//if ($(this).parent().hasClass('slctd')) { return false; }
//				//else { $(this).stop(true, true).animate({color:"#99F"}, 500); }
//				$(this).stop(true, true).animate({color:"#99F"}, 500);
//			}
//		);

	if ($('#button1').length > 0) {
		$('#button1').hover(
			function() {//over
				$('#button1 > .button_over').stop(true,true).fadeIn(500);
				$('#button1 > .button_out').stop(true,true).fadeOut(500);
			},
			function() {//out
				$('#button1 > .button_over').stop(true,true).fadeOut(500);
				$('#button1 > .button_out').stop(true,true).fadeIn(500);
			}
		);	
	}
	if ($('#button2').length > 0) {
		$('#button2').hover(
			function() {//over
				$('#button2 > .button_over').stop(true,true).fadeIn(500);
				$('#button2 > .button_out').stop(true,true).fadeOut(500);
			},
			function() {//out
				$('#button2 > .button_over').stop(true,true).fadeOut(500);
				$('#button2 > .button_out').stop(true,true).fadeIn(500);
			}
		);	
	}
	
	// INIT SLIDESHOW
	if ($('#ss_cntr').length > 0) {
		ss_init();
	}
	
	
	// secondary vertical 'menu'
	if ($('#q_menu_hdr').length > 0) {
		$('#q_menu_hdr').click(function(){
				$('#q_menu_cntr').slideToggle(500);
				($('#q_menu_arw').attr('src').match('_up')) ? $('#q_menu_arw').attr('src',rootPath+'img/q_menu_down.gif') : $('#q_menu_arw').attr('src',rootPath+'img/q_menu_up.gif');
				//($('#q_menu_cntr').style('display').match('none')) ? $('#q_menu_arw').attr('src',rootPath+'img/q_menu_down.gif') : $('#q_menu_arw').attr('src',rootPath+'img/q_menu_up.gif');
		});
	}







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

