/**
 * Navigator Multimedia Scripts.
 * @author Chris Satterthwaite <chris@navigatormm.com.com>
 * @version 2.0
 * @copyright Copyright (c) 2008, Navigator Multimedia Inc
 */

var SiteFolder='1-web-standard/'; //Comment out when site is live//

/**
 * Sets On States for Main Navigation and Sub nav
 */ 
$(function(){SetDefault();});
function SetDefault(){
    var path = location.pathname.substring(1).replace(/1-web-standard\//,'');
    if ( !path ) return false;
	$('a[@href$="' + path + '"]').addClass('selected').parents().each(function(){$(this).children('a').addClass('selected');});
}; 

/**
 * jScrollPane Plugin
 * Builds Custom Scroll Bar to Any element that gets the class .scroll-pane
 */
 $(function()
 {
 	$('.scroll-pane').jScrollPane({scrollbarWidth:10, scrollbarMargin:10,showArrows:true});
 });

/**
 * Sets The #sidebar to the same height of the #maincontent 
 */
var _height=$('#maincontent').innerHeight();
$('#sidebar').css('height',_height);

/**
 * Acordian Menu Show One at a Time
 * .slideToggle values(slow, normal, fast)
 */
 $(document).ready(function() {
 $('.btEvent').click( function(){
							   if ($(this).html()=='Hide Event') $(this).addClass('tmp_hide');
							   $('.btEvent').html('Show Event');
							   if ($(this).html()=='Show Event') $(this).html('Hide Event');
							   else $(this).html('Show Event');
							   $('.tmp_hide').html('Show Event').removeClass('tmp_hide');
							   }
					  );
 
 $('.header:eq(0)').addClass('on');		
 $('.btEvent','.header:eq(0)').click();
 $('div#event> .txt:gt(0)').hide(); 
 $('div#event> .header').click(function() {
 $('.btEvent',$(this)).click();
 $(this).addClass('on')
 .siblings('.header').removeClass('on');
	var $nextDiv = $(this).next();
    var $visibleSiblings = $nextDiv.siblings('.txt:visible');

	if ($visibleSiblings.length ) {
      $visibleSiblings.slideUp('fast', function() {
        $nextDiv.slideToggle('fast');

      });
    } else {
       $nextDiv.slideToggle('fast');
    }
  });
});

/*Pop up
-----------------------------------------------------------------------------------------*/
$('#helpclick').click( function(){	

	window.open("help.php", "win", 'location=0,scrollbars=yes,resizable=yes,width=800,height=600');
    /*
    msgWindow=window.open(file='help.php',window='Display Planner Help','resizable=yes,width=800,height=600,scrollbars=yes,location=0');

    if(msgWindow.opener == null) msgWindow.opener = self;
		msgWindow.focus();
	*/
	}
);

/**
 * Lightbox 4.0
 * 
 */
$(function() {
  $('#gallery a').lightBox({
  	overlayBgColor: '#000000',
	overlayOpacity: 0.8,
	imageLoading: 'http://badger/1-web-standard/images/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: 'http://badger/1-web-standard/images/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: 'http://badger/1-web-standard/images/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: 'http://badger/1-web-standard/images/lightbox/lightbox-btn-next.gif',
	imageBlank:'http://badger/1-web-standard/images/lightbox/lightbox-blank.gif',
	containerResizeSpeed: 400,
	txtImage: 'Photo',
	txtOf: 'of',
	keyToClose: 'c',
	keyToPrev: 'p',
	keyToNext: 'n'
   });
});
