var m_step = 1;
var m_interval = 200;
PulseOnLoadTrigger(PulseInitialize);

function PulseOnLoadTrigger(fnt)
{
	//alert("PulseOnLoadTrigger");

	if(typeof window.addEventListener != 'undefined')
	{
		//.. gecko, safari, konqueror and standard
		window.addEventListener('load', fnt, false);
	}
	else if(typeof document.addEventListener != 'undefined')
	{
		//.. opera 7
		document.addEventListener('load', fnt, false);
	}
	else if(typeof window.attachEvent != 'undefined')
	{
	 	//.. win/ie
	 	window.attachEvent('onload', fnt);
	}

	//** remove this condition to degrade older browsers
	else
	{
		//.. mac/ie5 and anything else that gets this far

	 	//if there's an existing onload function
	 	if(typeof window.onload == 'function')
	 	{
	 		//store it
	 		var existing = onload;

	 		//add new onload handler
	 		window.onload = function()
	 		{
	 			//call existing onload function
	 			existing();

	 			//call adsense_init onload function
	 			fnt();
	 		}
	 	}
	 	else
	 	{
	 		//setup onload function
	 		window.onload = fnt;
	 	}
	}
}

function PulseInitialize()
{
	//alert("PulseInitialize");

	setTimeout(PulseMain, m_interval);	
}

function PulseMain()
{
	//alert("PulseMain");

	var div1 = document.getElementById("PulseDiv1");
	var div2 = document.getElementById("PulseDiv2");
	var div3 = document.getElementById("PulseDiv3");
	var div4 = document.getElementById("PulseDiv4");

	//var color1 = "#336699";
	//var color2 = "#6699ff";
	//var color3 = "#99ccff";
	//var color4 = "#ffffff";

	//var color1 = "#99b0cc";
	//var color2 = "#b0cce0";
	//var color3 = "#cce0ff";
	//var color4 = "#ffffff";

	//var color1 = "#b0cce0";
	//var color2 = "#cce0f0";
	//var color3 = "#e0f0ff";
	//var color4 = "#ffffff";

	var color1 = "#cccccc";
	var color2 = "#e0e0e0";
	var color3 = "#f0f0f0";
	var color4 = "#ffffff";

	switch(m_step)
	{
		case 1:
			div1.style.backgroundColor = color1;
			div2.style.backgroundColor = color2;
			div3.style.backgroundColor = color3;
			div4.style.backgroundColor = color4;
			break;
		case 2:
			div1.style.backgroundColor = color4;
			div2.style.backgroundColor = color4;
			div3.style.backgroundColor = color4;
			div4.style.backgroundColor = color1;
			break;
		case 3:
			div1.style.backgroundColor = color4;
			div2.style.backgroundColor = color4;
			div3.style.backgroundColor = color1;
			div4.style.backgroundColor = color2;
			break;
		case 4:
			div1.style.backgroundColor = color4;
			div2.style.backgroundColor = color1;
			div3.style.backgroundColor = color2;
			div4.style.backgroundColor = color3;
			break;
	}

	m_step++;
	if (m_step == 5)
		m_step = 1;

	setTimeout(PulseMain, m_interval);	
}