jQuery(document).ready(function(){
	try {
		Cufon.replace('h1,h2', { fontFamily: 'cambria' });
		Cufon.replace('.btn', { fontFamily: 'cambria', hover: true });
	} catch(err) {}
	
	jQuery('.totop').click(function () {
		scroll(0,0);
		return false;
	});
	jQuery('ul#menu > li > a, ul#menu > li.current_page_item > a').each(function () {
		jQuery(this).prepend('<span class="ca cl" /><span class="ca cr" />');
	});
	jQuery('ul#menu > li > ul').after(function () {
		jQuery(this).append('<span class="submenu-end" />');
	});
	jQuery('#menu a').mouseover(function () {
		jQuery(this).children('.ca').show();
	});
	jQuery('#menu a').mouseout(function () {
		jQuery(this).children('.ca').hide();
	});
	
	try {
		if (jQuery('#promo .video').size() > 1) {
			jQuery('#promo').after('<div id="promo_nav" />').cycle({ 
				fx:     'fade', 
				speed:  800, 
				timeout: 0, 
				pager:  '#promo_nav',
				cleartypeNoBg: true
			});
		}
	} catch(err) {}
	
	try {
		if (jQuery('#promo .promo').size() > 1) {
			jQuery('#promo').after('<div id="promo_nav" />').cycle({ 
				fx:     'fade', 
				speed:  800, 
				timeout: 8000, 
				pager:  '#promo_nav',
				cleartypeNoBg: true
			});
		}
		jQuery('#promo').mouseenter(function () { jQuery(this).cycle('pause'); });
		jQuery('#promo').mouseleave(function () { jQuery(this).cycle('resume'); });
	} catch(err) {}
	
	jQuery('#splash_location').css('background-image','url(images/bg-'+jQuery('#sidemenu > li.sidemenu_open').attr('rel')+'.png)');
	jQuery('#sidemenu > li > ul').hide();
	jQuery('#sidemenu > li.sidemenu_open > ul').show();
	jQuery('#sidemenu > li > h2').click(function () {
		if (jQuery(this).parents('li').hasClass('sidemenu_open')) {	
			return false;
		} else {
			jQuery('.sidemenu_open').removeClass('sidemenu_open')
			jQuery('#sidemenu > li > ul').animate({height: 'hide'}, 400);
			jQuery(this).parents('li').addClass('sidemenu_open')
			jQuery(this).parents('li').find('ul').animate({height: 'show'}, 400);
			jQuery('#splash_location').css('background-image','url(images/bg-'+jQuery(this).parents('li').attr('rel')+'.png)');
			return false;
		}
	});
	
	jQuery("#footer img").animate({opacity: .4});
	jQuery('#footer a img').mouseover(function () { jQuery(this).animate({ opacity: 1 }, 200); });
	jQuery('#footer a img').mouseout(function () { jQuery(this).animate({ opacity: .4 }, 200); });
	
	jQuery('select').msDropDown();
	
	jQuery('#staff li:even').each(function () {
		h = jQuery(this).height();
		hn = jQuery(this).next('li').height();
		(h>hn) ? jQuery(this).next('li').height(h) : jQuery(this).height(hn);
	});	
	
	jQuery('.fancybox, #gallery a, .gallery a').fancybox({
		'scrolling': 'no', 
		'titleShow': false, 
		'overlayOpacity':'.6',
		'overlayColor':'#000',
		onStart: function(currentArray, currentIndex){ 
			jQuery('.video iframe').hide();
			jQuery('#youtube iframe').hide();
		},
		onClosed: function(currentArray, currentIndex){ 
			jQuery('.video iframe').show();
			jQuery('#youtube iframe').show();
		}
	});	
	
	if ( jQuery.browser.opera ) {
	}		
	if ( jQuery.browser.msie ) {
		
		if (jQuery.browser.version == '6.0' || jQuery.browser.version == '7.0') {
		}
	} 	
	if ( /chrome/.test( navigator.userAgent.toLowerCase() ) ) {
	} 	
	if ( /safari/.test( navigator.userAgent.toLowerCase() ) ) {
	} 	
});
