window.onload = attachFormHandlers;

function attachFormHandlers()
{	
	if(document.getElementById){
		
		var form = document.getElementById('form1') // get the form
	
		if (document.getElementsByTagName)//make sure were on a newer browser
		{		
			//assign all attricbutes to a tags within the styleswap id div
			as=document.getElementById('styleswap').getElementsByTagName('a');
			for (i=0;i<as.length;i++)
			{
				
				if(as[i])
				{
					link_click=function(){setActiveStyleSheet('text'); return false;};
					link_keypress=function(){return setActiveStyleSheet('text'); return false;};
					as[i].onclick=link_click;
					as[i].onkeypress=link_keypress;
				}
			}
			//assign all attricbutes to a tags within the text_styleswap id div
			as=document.getElementById('text_styleswap').getElementsByTagName('a');
			for (i=0;i<as.length;i++)
			{
				
				if(as[i])
				{
					link_click=function(){setActiveStyleSheet('default'); return false;};
					link_keypress=function(){return setActiveStyleSheet('default'); return false;};
					as[i].onclick=link_click;
					as[i].onkeypress=link_keypress;
				}
			}
		}
		
		
	}  
	
	/* run additional on load declarations and final function call */
	var cookie = readCookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
	
	/*next call the sifr function calls*/
	if(typeof sIFR == "function"){
		
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"body h1", sFlashSrc:"/content/flash/helvetica-neue-condensed-black.swf", sColor:"#92808C", sCase: "", sLinkColor:"#92808C", sBgColor:"", sHoverColor:"#92808C", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"", sWmode:"transparent"}));

		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"body h3.purple", sFlashSrc:"/content/flash/helvetica-neue-condensed-black.swf", sColor:"#92808C", sCase: "", sLinkColor:"#92808C", sBgColor:"", sHoverColor:"#92808C", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"", sWmode:"transparent"}));
	
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"body h3.orange", sFlashSrc:"/content/flash/helvetica-neue-condensed-black.swf", sColor:"#FFFFFF", sCase: "", sLinkColor:"#FFFFFF", sBgColor:"", sHoverColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"", sWmode:"transparent"}));
	
	
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"body h3.light_purple", sFlashSrc:"/content/flash/helvetica-neue-condensed-black.swf", sColor:"#FFFFFF", sCase: "", sLinkColor:"#FFFFFF", sBgColor:"", sHoverColor:"#FFFFFF", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"", sWmode:"transparent"}));
		
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"body p.title", sFlashSrc:"/content/flash/helvetica-neue-condensed-black.swf", sColor:"#F59C66", sCase: "", sLinkColor:"#F59C66", sBgColor:"", sHoverColor:"#F59C66", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"", sWmode:"transparent"}));
	};

}
