/***************************************************
Author: Brian Dausman
URL:	mybridgepoint.com
email:  bdausman@mybridgepoint.com
***************************************************/

jQuery.noConflict();

jQuery(window).load(function(){
	
////////////////////////////////////////
//member directory height 
////////////////////////////////////////
jQuery('#Category').change(function(){
    jQuery('.mainContent').css({ 'height' : 8500 });  
});

////////////////////////////////////////
//add alert to event reg page
////////////////////////////////////////
jQuery('.infoEventTable').append('<strong><u>You Must Add at Least One Person Before Registering</u></strong>');

////////////////////////////////////////
//intercept event reg. menu item
////////////////////////////////////////
jQuery('.memberDirectoryNullLink a').click(function(e){
    e.preventDefault();
    window.location = '/Site/MemberDirectory';
});

jQuery('.nullLink a').click(function(e){
    e.preventDefault();
    window.location = '/Site/EventCalendar';
});

/////////////////////
//gallery formatting
/////////////////////
jQuery('.galleryWrap img').css({ width : '', 'height' : 110 }); 

var src = '';

jQuery('.galleryWrap img').each(function() { 
    var href = jQuery(this).attr('src');  //get thumbnail source
    
    jQuery(this).wrap('<a href="' + href + '" rel="prettyPhoto" />');  //wrap in link with sourc from thumbnail    
});


jQuery('.galleryWrap a').prettyPhoto();

/////////////////////////////////////////
//rotator
/////////////////////////////////////////
jQuery('.rotator').cycle({
    timeout: 6000,
    pause: 1,
    cleartype: true,
    cleartypeNoBg: true
});

jQuery('.rotator2').cycle({
    timeout: 3000,
    pause: 1,
    cleartype: true,
    cleartypeNoBg: true
});

/////////////////////////////////////////
//alerts bar
/////////////////////////////////////////
jQuery('.alertsBar div ul').cycle({
    timeout: 6000
});

/////////////////////////////////////////
//member directory twirldown
/////////////////////////////////////////
jQuery('.twirl').click(function(){
    jQuery(this).next('.tabley').toggle();
});

/////////////////////////////////////////
//nav dropdowns
/////////////////////////////////////////
jQuery('.TopMenu').hover(function(){
    jQuery(this).find('.children').fadeIn();
},function(){
    jQuery(this).find('.children').fadeOut();
});
/////////////////////////////////////////
//sidebar dynamic styles
/////////////////////////////////////////
//move first small link below search field
jQuery('aside.sidebar small:first a').css({ 'padding-top' : 5 });
//extend down page
var contentHeight = jQuery('.mainContent').outerHeight();
var sideHeight = jQuery('aside.sidebar').outerHeight();

if(contentHeight < sideHeight){
    var mainHeight = jQuery('aside.sidebar').outerHeight() + 30;
    jQuery('.mainContent').css({ 'height' : mainHeight });
}else if(contentHeight > sideHeight){
    var mainHeight = jQuery('.mainContent').outerHeight() - 60;
    jQuery('aside.sidebar').css({ 'height' : mainHeight });
}


//if ie	
	jQuerybrowser = navigator.appName;
	if (jQuery.browser.msie && jQuery.browser.version.substr(0, 1) < 8) {
		jQuery('#upgrade').animate({bottom: "0", opacity: ".7"}, "slow");
		jQuery('#upgrade').hover(function(){
		jQuery(this).stop(true,true).animate({opacity: "1", bottom: "0"}, "slow");
	}, function() {
	  jQuery(this).stop(true,true).animate({opacity: ".3", bottom: "-30"}, "slow");
	});
	}
});
