﻿/*
	HealthPartners 2010
	hp global js
*/
	
	// Giving Option iFrame
var iframeHeight=function(data) {
	$("iframe#giving-options-iframe").height(data);
};


$(document).ready(function() {

		// Giving Option iFrame
	if ($("iframe#giving-options-iframe").length > 0) {
		
		var params = window.location.href.split('?')[1].split('&');
		var type = params[0].toLowerCase();
		var id = params[1];
		var	target;
		if( params.length == 0 ) {
			type = "a";
			id = 12578;
		}
		if( type == "a" )
			base_url = "http://www.plan.gs/Article.do?orgId=5808&articleId=";
		else if( type == "g" )
			base_url = "http://www.plan.gs/GoalsGift.do?orgId=5808&categoryId=";
		else if( type == "q" )
			base_url = "http://www.plan.gs/Questionnaire.do?orgId=5808&questionnaireId=";
		else if( type == "c" )
			base_url = "http://www.plan.gs/CategoryDetailList.do?orgId=5808&categoryId=";
		target = base_url + id;
		$("iframe#giving-options-iframe").attr("src", target);	
	}
	
		// active navagation
	$("ul#navigation li a[href^='/"+window.location.href.split('/')[3]+'/'+window.location.href.split('/')[4]+"/'"+"]").addClass("active");

		// ie-roundies
	if ($.browser.msie && $.browser.version <= 8 ) {	
		DD_roundies.addRule('.bordered', '8px');
		DD_roundies.addRule('.light-bordered', '8px');
		DD_roundies.addRule('.container-header', '8px 8px 0 0');
		DD_roundies.addRule('.aside-header', '8px 8px 0 0');
		DD_roundies.addRule('.aside-body', '0 0 8px 8px');
		DD_roundies.addRule('#footer-navigation', '8px');
		DD_roundies.addRule('#logon-container', '4px');
		
		if ($.browser.version == 7 ) {
			window.setTimeout(function() {
				DD_roundies.addRule('ul#navigation', '0 0 8px 8px');
				DD_roundies.addRule('#navigation a#home', '0 0 0 8px');
				DD_roundies.addRule('#navigation a#foundation', '0 0 8px 0');
			}, 1700);
		}
		else {
			DD_roundies.addRule('ul#navigation', '0 0 8px 8px');
			DD_roundies.addRule('#navigation a#home', '0 0 0 8px');
			DD_roundies.addRule('#navigation a#foundation', '0 0 8px 0');
		}
	}
		// ie-roundies
	if ($.browser.msie && $.browser.version >= 7 && $.browser.version <= 8 ) {
		DD_roundies.addRule('.container-body', '0 0 8px 8px');
	}

		// Move the h1 title down when an #banner is present on the page
	if ($("#banner").length > 0 && $("#banner.transactions").length == 0) {
		$("h1").addClass("banner-title");
	}
	
		// Move the h1 title down when an #banner.transactions is present on the page
	if ($("#banner").length > 0 && $("#banner.transactions").length > 0) {
		$("h1").addClass("transactions-banner-title");
	}
	
		// YouTube Modal
	if ( !($.client.os == "iPad" || $.client.os == "iPhone") ) {
		$("a.youtube-modal").colorbox({iframe:true, innerWidth:725, innerHeight:445}).attr('href', function(i,h) {
			return h + ("?rel=0&amp;showinfo=0&amp;showsearch=0&amp;autoplay=1");
		});
	}
	
		// YouTube
	$("a.youtube").attr('href', function(i,h) {
		return h + ("?rel=0&amp;showinfo=0&amp;showsearch=0&amp;autoplay=0");
	});
	
		// Ledger
	$ ('ul.ledger li:odd, table.ledger tr:odd').addClass("ledger-color");
	
		// Promo hover
	$(".promo.hover").hover(function() {
		$(this).stop().animate({backgroundColor: "#f2f2f2"}, 200);
	}, function() {
		$(this).stop().animate({backgroundColor: "#fff"}, 200);
	});
	
		// Container Hover
	$(".container.hover").hover(function() {
    	$(this).stop().animate({backgroundColor: "#f2f2f2"}, 200);
	}, function() {
		$(this).stop().animate({backgroundColor: "#fff"}, 200);
	});
	
		// Primary Button Color Hover
	$(".button").hover(function() {
		$(this).stop().animate({backgroundColor: "#b11f73"}, 100);
	}, function() {
		$(this).stop().animate({backgroundColor: "#ec1490"}, 100);
	});

		// Secondary Button Color Hover
	$(".button.secondary").hover(function() {
    	$(this).stop().animate({backgroundColor: "#0c708c"}, 100);
	}, function() {
		$(this).stop().animate({backgroundColor: "#50b3cf"}, 100);
	});

		// Clear Button Color Hover
	$(".button.clear").hover(function() {
    	$(this).stop().animate({backgroundColor: "#999"}, 100);
	}, function() {
		$(this).stop().animate({backgroundColor: "#b3b3b3"}, 100);
	});
	
		// Navigation Button Color Hover
	$("ul#navigation a").hover(function() {
    	$(this).stop().animate({backgroundColor: "#bcbcbc"}, 100);
	}, function() {
		$(this).stop().animate({backgroundColor: "#dbdcdd"}, 100);
	});
	
	$("ul#navigation a.active").hover(function() {
    	$(this).stop().animate({backgroundColor: "#bcbcbc"});
	});
	
	
		// Table Data Hover
	$("table.data.hover tbody tr, table.data-results.hover tbody tr, table.data.ledger-hover tbody tr:odd, table.data-results.ledger-hover tbody tr:odd").hover(function() {
    	$(this).stop().animate({backgroundColor: "#eee"}, 200);
	}, function() {
		$(this).stop().animate({backgroundColor: "#fff"}, 300);
	});	
	
	$("table.data.ledger-hover tbody tr:even, table.data-results.ledger-hover tbody tr:even").hover(function() {
    	$(this).stop().animate({backgroundColor: "#eee"}, 200);
	}, function() {
		$(this).stop().animate({backgroundColor: "#f2f2f2"}, 300);
	});
	
		// Gecko 1.9.0 or less font-face override
	$.each($.browser, function(i, val) {
   		if(i=="mozilla" && $.browser.version.substr(0,5)<="1.9.0") {
	  		$("#home-banner h2").css({'font-size' : '19px'});
	  	}
 	});

});
