// JavaScript Document

jQuery(function($){
   // Browser detection
   if ($.browser.msie) {
    $('body').addClass('msie msie' + $.browser.version.charAt(0));
   } else if ($.browser.mozilla) {
    $('body').addClass('mozilla');
   } else if ($.browser.webkit) {
    $('body').addClass('webkit');
   }
});

// colorbox function for images
jQuery(function($){
	$('a.pix').colorbox({
		opacity:	0.6,
		close:		''
	});
});

// colorbox function for press releases on home page
jQuery(function($){
	$('a.pressRel').colorbox({
		href:		$(this).attr('href'),
		width:		'1050px',
		height:		'95%',
		iframe:		true,
		opacity:	0.6,
		close:		'Close Window'
	});
});

// colorbox function for join mailing list link on home page
jQuery(function($){
	
	var ht;
	
	if($.browser.msie){
		ht = '570px';
	} else if ($.browser.webkit) {
		ht = '530px';
	} else {
		ht = '525px';
	}

	$('a.mailList').colorbox({
		href: 		'mailinglist.html',
		width:		'660px', 
		height:		ht, 
		iframe:		true,
		opacity:	0.6,
		close:		'Close Window'
	});
});

// colorbox function for join mailing list link on inner pages
jQuery(function($){
	
	var ht;
	
	if($.browser.msie){
		ht = '570px';
	} else if ($.browser.webkit) {
		ht = '530px';
	} else {
		ht = '525px';
	}

	$('a.mailListInner').colorbox({
		href: '../mailinglist.html',
		width:'660px', 
		height: ht, 
		iframe: true,
		opacity: 0.6,
		close:		'Close Window'
	});
});



// colorbox function for pay invoice link on client portal page
jQuery(function($){
	
	var ht;
	var wd = '660px';
	
	if($.browser.msie){
		ht = '580px';
		wd = '650px';
	} else {
		ht = '610px';
	}

	$('a.payInvoice').colorbox({
		href:		'PayInvoice.aspx',
		width:		wd, 
		height:		ht, 
		iframe:		true,
		opacity:	0.6,
		close:		'Close Window'
	});
});

// Primary Navigation interaction;
jQuery(function($){
// mouseover events;					
		function overMenu(){	
			$(this).parent().parent().siblings().children('div').stop(true).slideUp();
			$(this).parent().siblings('div.drop').stop(true).slideDown();
		}
		
		function offMenu(){
			$(this).parent().siblings('div.drop').stop(true).slideUp()
		}

		var settings = {
			sensitivity:	7,
			interval:		200,
			over:			overMenu,
			timeout:		3000,
			out:			offMenu
		};
		
		$("img.sou").hoverIntent(settings);
		$("img.ser").hoverIntent(settings);
		$("img.mar").hoverIntent(settings);
		$("img.pre").hoverIntent(settings);
});
