function addToOnLoad(func){	
	if (typeof(window.onload) != 'function'){
		//no existing functions in onLoad, just assing our func directly
		window.onload = func;
	}else{
		//functions exist already, so save a backup of the onload and call that plus our new func
		oldonload = window.onload;
		window.onload = function(){
			if(oldonload) oldonload();
			
			if(typeof(func) == 'function')
				func();
			else
				eval(func)();
		};
	}
}

function correctInlinePNGs(){
	for(var i=0; i<document.images.length; i++){
		var img = document.images[i];
		var imgName = img.src.toUpperCase();
		if(imgName.substring(imgName.length-3, imgName.length) == 'PNG'){
			var imgID = (img.id) ? "id='" + img.id + "' " : "";
			
			var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			
			var imgStyle = "display:inline-block;" + img.style.cssText;
			if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			img.outerHTML = strNewHTML;
			//alert(strNewHTML);
			i--;
		}
	}
}

function correctCSSPNGs(){
	var elements = YAHOO.util.Dom.getElementsByClassName('fixPNG');  
	for (var i=0; i<elements.length; i++)
	{
		var myURL = YAHOO.util.Dom.getStyle(elements[i],'background-image');
		myURL = myURL.substr(5,myURL.length-7);
		elements[i].style.background = '';
		elements[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+myURL+"')";
	
	}		
}

function correctAllPNGs(){
	correctInlinePNGs();
	correctCSSPNGs();
}

(document.all)?addToOnLoad(correctAllPNGs):null;


function clearForm(inputID){
	defaultValue = 'ENTER EMAIL';
	successValue = 'Email address added';
	emailField = document.getElementById(inputID);
	//alert(emailField.value);
	if(emailField.value == defaultValue || emailField.value == successValue){
		emailField.value = '';
	}
}
