// jquery calls

$(document).ready(function() {

  
	$("#pinkBox").hover(
					function(){
						$(this).css("cursor","pointer");
						$("#header h1").css("text-decoration","underline");
						$("#pinkBox p a").css("text-decoration","underline");
					},
					function(){
						$(this).css("cursor","default");
						$("#header h1").css("text-decoration","none");
						$("#pinkBox p a").css("text-decoration","none");
					}
				);
 
	$("#pinkBox").click( function() {
	window.open('http://www.patronmailuk.com/bnmailweb/PatronSetup?oid=90','patron_signup','height=500,width=640,scrollBars=1,resizable=0');
	});
	
	// set homepage boxes to have highlight
	$("div.highlightBox").css('background','#d5e5f6');
	$("div.highlightBox").bind("mouseover",addFade);
	
	function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
		var delta = maxValue - minValue;
		var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
		return Math.ceil(stepp)
	}
	function addFade() {
			doBGFade(this,[150,201,255],[213,229,246],'#d5e5f6',75,20,4);
		}
	function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) {
		if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
		var actStep = 0;
		elem.bgFadeInt = window.setInterval(
			function() {
				elem.style.backgroundColor = "rgb("+
					easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
					easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
					easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
				actStep++;
				if (actStep > steps) {
				elem.style.backgroundColor = finalColor;
				window.clearInterval(elem.bgFadeInt);
				}
			}
			,intervals)
	}
	
	
});





function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
     oldonload();
     func();
    }
  }
}

