// JavaScript Document
$(document).ready(function () {
	$('LI.mainNavItem').hover(
		function() {
			
			$('a.mainNavLink',this).addClass('selected');
			$('div.dropdownExplore',this).show();
			var theHeight = $('.dropdownSubNav',this).height();
			$('.dropdownExplore',this).height(theHeight + 3);
		}, 
		function(){
			$('a.mainNavLink',this).removeClass('selected');
			$('div.dropdownExplore',this).hide();
		}
	);
	
	$("#sitkatrigger").hover(function() {
		$("#sitkamap").show();								  
	});
	
	
	
		
	/*$("#sitkamap, #sitkaMapCallout").mouseleave(function() {
		$("#sitkamap").hide();
	});*/
	
	$("#sitkamap .closebtn").click(function(){ $("#sitkamap").hide(); });
	
	$('#c2 .content img.borderDrop').each( function(index) {
		if($(this).attr('border') != -1 && $(this).attr('border') > 0) {
			$(this).css('border','solid 5px #ffffff').removeAttr('border');
			$(this).css('box-shadow', '0px 0px 3px #9f9f9f').removeAttr('box-shadow');
			$(this).css('web-kit-box-shadow', '0px 0px 3px #9f9f9f').removeAttr('web-kit-box-shadow');
						
			$(this).css('filter', 'progid:DXImageTransform.Microsoft.Shadow(color=#eeeeee,direction=0,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#dddddd,direction=90,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#dddddd,direction=180,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#eeeeee,direction=270,strength=3)').removeAttr('filter');
			$(this).css('ms-filter', 'progid:DXImageTransform.Microsoft.Shadow(color=#eeeeee,direction=0,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#dddddd,direction=90,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#dddddd,direction=180,strength=3) progid:DXImageTransform.Microsoft.Shadow(color=#eeeeee,direction=270,strength=3)').removeAttr('ms-filter');
		}
	});
	
	$('#c2 .content img').each( function(index) {
		if($(this).attr('border') != -1 && $(this).attr('border') > 0) {
			$(this).css('border','solid 5px #e0e0e0').removeAttr('border');
		}
	});
		$('#c2 .content img.borderBlack').each( function(index) {
		if($(this).attr('border') != -1 && $(this).attr('border') > 0) {
			$(this).css('border','solid 3px #000000').removeAttr('border');
		}
	});
	
	/*$('#c2 .content img').each( function(index) {
		//$(this).css('border','solid 1px red');
		//$(this).wrap('<div class="iWrapper" style="float:' + $(this).css("float") + '; width: ' + $(this).attr("width") + 'px;" />');
		var vMarge, hMarge, iHeight, iWidth, iAlign = ""; 
		
		if($(this).attr('height') != -1) {
			iHeight = "height: " + ($(this).attr('height') + 25) + "px; ";
		}
		
		if($(this).attr('width') != -1) {
			iWidth = "width: " + $(this).attr('width') + "px; ";
		}
		
		if($(this).attr('align') != -1) {
			iAlign = "float: " + $(this).attr('align') + "; ";
			$(this).removeAttr('align');
		}
		
		if($(this).attr('vspace') != -1) {
			vMarge = "margin-top: " + $(this).attr('vspace') + "px; margin-bottom: " + $(this).attr('vspace') + "px; ";
			$(this).removeAttr('vspace');
		}
		
		if($(this).attr('hspace') != -1) {
			vMarge = "margin-left: " + $(this).attr('hspace') + "px; margin-right: " + $(this).attr('hspace') + "px; ";
			$(this).removeAttr('hspace');
		}
		
		if($(this).attr('style') != -1){
			$(this).wrap('<div class="iWrapper" style="'+ iAlign + iHeight + iWidth + vMarge + hMarge + $(this).attr("style") + '" />').removeAttr('style');
		}
			
		$(this).after('<span class="imgCaption">' + $(this).attr('alt') + '</span>');
	});*/
	
	$.event.add(window,"load",shiftLure);
	$.event.add(window,"resize",shiftLure);		 
});

function shiftLure() {
	var w = $(window).width();
	$("#luredropdownHolder").css('right', (w < 1150) ? '-135px' : '40px');
	//$("#luredropdownHolder").css('right', (w < 900) ? ((Math.round(900 - w)) * 1) : '40px');
}

$(window).ready(function() {
	var c1Height = $('#c1').height();
	var c2Height = $('#c2').height();
	var c1c2Difference = c1Height - c2Height;
	
	if(c2Height < c1Height)
		$('#c2').css('min-height',c1Height + 31 + 'px'); // 31 account for c1 top-padding
	
	//alert('box1-' + c1Height + ', box2-' + c2Height + ' = ' + c1c2Difference);
	
	if(c1c2Difference >= 50 ){
		$('#c2').prepend('<div id="c2bottomFiller"><img src="/includes/images/shell/2Column_lower2_bg.png" /></div>');
		$('#c2 .content').css('position','relative');
	}	
});
