window.addEvent('domready',function()
{
	fixPng();
	var strHref = document.location.href;
	if(strHref.indexOf('?page_id=13&email=') > -1)
	{
		//Get the email field and fill out the value
		if($('ne'))
		{
			var strEmail = strHref.substring((strHref.indexOf('email=')+6),strHref.length)
			strEmail = decodeURIComponent(strEmail);
			$('ne').value = strEmail;
		}
	}
	if($('newsletterFormMain'))
	{
		$('newsletterFormMain').addEvent('submit',function(e)
		{
			var objForm = this;
			var bolError = false;
			var reIsEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
			if($('nn').value.length == 0)
			{
				bolError = true;
			}
			if(!reIsEmail.test($('ne').value))
			{
				bolError = true;
			}
			if(bolError)
			{
				$('formError').style.display = 'block';
				return false;
			}
			
		});
	}
});

function fixPng()
{
	if (document.all && /MSIE (5\.5|6)/.test(navigator.userAgent) && document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule)
	{
		document.styleSheets[0].addRule('.png', 'behavior: url(js/iepngfix.htc)');
		document.styleSheets[0].addRule('#bodywrapper', 'behavior: url(js/iepngfix.htc)');
		document.styleSheets[0].addRule('#pageBottom', 'behavior: url(js/iepngfix.htc)');
		document.styleSheets[0].addRule('#pageRight', 'behavior: url(js/iepngfix.htc)');
	}
}
