$(document).ready(function(){

	loadFlash();

	$('a[rel=external]').click(function(){
		window.open( $(this).attr('href') );
		return false;
	}); 



	$("h2,h3,h4").each(function(){

		var colour;
		
		if(ie)
		{

			var r = HexToR($(this).css('color'));
			var g = HexToG($(this).css('color'));
			var b = HexToB($(this).css('color'));
			
			colour = 'rgb(' + r + ', ' + g + ', ' + b + ')';

		
		} else {
		
			colour = $(this).css('color');
		
		}
	
	
		$(this).css({ 'backgroundImage' : 'url("/util/pngenius.php?width=' + $(this).css('width') + '&height=' + $(this).css('height') + '&size=' + $(this).css('fontSize') + '&colour=' + colour + '&trans=' + $(this).css('textTransform') + '&text=' + escape($(this).text()) + '")' });
	});


	$('.slides').innerfade({
		speed: 1500,
		timeout: 5000
	});


	$('.homeslides').innerfade({
		speed: 1000,
		timeout: 8000
	});



function loadFlash() {

	var flash_vars = {  };
	var params = {  };
	var attributes = {  };

	swfobject.embedSWF("/swf/banner.swf", "topflash", "100%", "100%", "9.0.0", "/s/stormx/website/swf/expressInstall.swf", flash_vars, params, attributes);

	swfobject.embedSWF("/swf/howitworks.swf", "howitworks", "100%", "100%", "9.0.0", "/s/stormx/website/swf/expressInstall.swf", flash_vars, params, attributes);

}






	
});



function HexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
function HexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
function HexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}