$(document).ready(function(){

// sales team option 1
	$('.stateList a').click(function(){
		var state = $(this).attr('id');
		$('.regionInfo').hide();
		$('.' + state).show();
		return false;
	});

// sales team option 2
	$('#stateList').change(function(){
		var state = $(this).val();
		$('.regionInfo').hide();
		$('.' + state).show();
		return false;
	});

// Investment Teams Show Hide
/*
	if($('.fundGroup').size()) {
	
		$('.fundGroup:not(:first)').hide();

		$('.bioTrigger a').click(function(){
			var showDiv = $(this).attr('href');
			$('.fundGroup').hide();
			$(showDiv).show();
			
			return false;
		});

	}

*/











	// crosshair
	$('.crosshairBoth td').not(":first-child").bind('mouseenter',function(){cgvMouseOver(this)})
	$('.crosshairBoth td').not(":first-child").bind('mouseleave',function(){cgvMouseOut(this)})
	$('.crosshairBoth td:first-child').bind('mouseenter',function(){cgvLabelMouseOver(this)})
	$('.crosshairBoth td:first-child').bind('mouseleave',function(){cgvLabelMouseOut(this)})

	$('.crosshairHorizontal td').bind('mouseenter',function(){cgvLabelMouseOver(this)})
	$('.crosshairHorizontal td').bind('mouseleave',function(){cgvLabelMouseOut(this)})
	
	$('ul').each(function(){$(this).children('li:last').css('border','none')});
	
/*	
	$('#snp').livequery('change', function(event) { 
				var classVal = $('#snp').val();
        		$('#snap').load('http://sandbox.firsteaglefunds.com/inc/snap.php',{classVal:classVal});
   			});
*/
/*	$('.snapshotFilters a').click(function() {
		$('.snapshotFilters a').removeClass('active');
		$(this).addClass('active');
		
		var classVal = $(this).attr('id');
		$('#snap').load('http://sandbox.firsteaglefunds.com/inc/snap.php',{classVal:classVal});
		
		return false;
	});
*/	

	

		/* sales map */

    	var regions = new Object();
		regions['Northwest'] 	= ['Idaho','Nevada','Oregon','Washington'];
		regions['West Coast'] 	= ['California','Hawaii'];
		regions['Central'] 		= ['Arizona','Colorado','Kansas','Missouri','New Mexico'];
		regions['Southwest'] 	= ['Louisiana','Oklahoma','Texas'];
		regions['Midwest'] 		= ['Illinois','Iowa','Minnesota','Wisconsin'];
		regions['Great Lakes'] 	= ['Indiana','Kentucky','Michigan','Ohio'] ;
		regions['Southeast'] 	= ['North Carolina','South Carolina','Tennessee'];
		regions['Gulf'] 		= ['Alabama','Florida','Georgia'];
		regions['Mid-Atlantic'] = ['Maryland','New Jersey','Pennsylvania','Virginia','Washington D.C.'];
		regions['Northeast'] 	= ['Connecticut','Massachusetts','New York'];
		regions['Northeast Hybrid'] 	= ['Vermont','New Hampshire','Rhode Island'];
	
		for(x in regions){
        		for(y in regions[x])
    		{
    			$('area[title="'+regions[x][y]+'"]')
    				.attr('name',x.toLowerCase().replace(' ','').replace('-',''))
    				.css('cursor','pointer');
       		}
       	}
    	
    	$('area').unbind().bind
    	(
			'click',
			function()
			{
				var regionId = $(this).attr('name');
				if(regionId !== undefined){
					$('#'+regionId).show().siblings('.regionInfo').hide();
				} else {
					$('#blank').show().siblings('.regionInfo').hide();
				}
			}
    	);
    	
    /* end sales map */
	

	$('.snapTable').not(':first').hide();
	
	$('.filterTabs a').click(function(){
	
		$('.snapLoading').show();
	
		$(this).addClass('active').siblings().removeClass('active');
		$('.snapTable.'+$(this).attr('id')).show().siblings('.snapTable').hide();
		setTimeout("$('.snapLoading').hide()",250);
		return false;
	})
	
	$('.salesChargeFilters a').unbind().click(function() { // unbind to prevent clashes with above
	
		if($(this).is('.active')){
			return false;
			} else {
			$('#snap .snapLoading').show();
			}

		$('.dataTable').eq($(this).index()).show().siblings('.dataTable').hide();
	
//		$(".wo").toggle();
//		$(".w").toggle();
		
		$(this).siblings().removeClass('active');
		$(this).addClass('active');
		setTimeout("$('.snapLoading').hide()",250);

		return false;
	});	
	 			
   			
   	$(".signin").click(function(e) {
                e.preventDefault();
                $("fieldset#signin_menu").toggle();
                $(".signin").toggleClass("menu-open");
            });

            $("fieldset#signin_menu").mouseup(function() {
                return false
            });
            $(document).mouseup(function(e) {
                if($(e.target).parent("a.signin").length==0) {
                    $(".signin").removeClass("menu-open");
                    $("fieldset#signin_menu").hide();
                }
            });  

	$('.calendarDetails a').click(function(){
		$(this).parent().next('.calendarContent').slideToggle('fast');
		return false;
	});
	
	$('#sidebarLogin input#Email').focus(function(){
		if($.trim($(this).val())==$(this).attr('id')) {
			$(this).val("");
			$(this).removeClass("gray");
		}
	}).blur(function(){
		if($.trim($(this).val())=="") {
			$(this).val($(this).attr('id'));
			$(this).addClass("gray");
		}
	});
	
	$('#sidebarLogin input#Password').hide();
	$('#sidebarLogin input#fauxPassword').show();
	
	
	$('#sidebarLogin input#fauxPassword').focus(function(){
		$('#fauxPassword').hide();
        $('#Password').show();
        $('#Password').removeClass("gray");
        $('#Password').focus();
	});
	
	$('#sidebarLogin input#Password').blur(function(){
		if ($('#Password').attr('value') == '') {
			$('#Password').hide();
			$('#fauxPassword').show();
        }
	});
	
	$('.itemDelete').hover(function(){
		$(this).parents('tr').addClass('deleteHover');
	}, function() {
		$(this).parents('tr').removeClass('deleteHover');
	});
	
	$('.managerToggle a').click(function(){
		var activeDiv = '#' + $(this).attr('id') + '_team';
		$('.managerSet').hide();
		$(activeDiv).show();
		return false;
	});

});


	function confirmDelete(delUrl,delItem) { 
if (confirm("Are you sure you want to delete \"" +delItem+ "\" from the database?")) { 
document.location = delUrl; 
}
}






