function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	var c = c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : "; expires="+exdate.toGMTString())+'; path=/';
	document.cookie=c;
	if (!window.ie)
	{
		console.log(c);
	}
}

/*function outputFlash(src, width, height, img, version)
{
	if ((version == null) || (version == ''))
	{
		version = 5;
	}
	if((flashinstalled == 2) && (flashversion > version))
	{
		AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width',width,'height',height,'src',src,'quality','high','wmode','transparent','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie',src ); //end AC code
	} else
	{
		document.write('<img src="'+img+'" alt=""/>');
	}
}*/

window.addEvent('domready', function(){
	// logo opacity hover effect
	/*
	$$('td.icon a img').each(function(el){
		el.setOpacity(0.7);
		var fx = new Fx.Styles(el, {duration: 200, wait: false, transition: Fx.Transitions.Quad.easeOut});
		var tr = el.getParent().getParent().getParent();
		tr.addEvent('mouseenter', function(){
			fx.start({'opacity': 1});
		});
		tr.addEvent('mouseleave', function(){
			fx.start({'opacity': 0.7});
		});
	});
	*/
									 
	// back to top links
	var scroller = new Fx.Scroll(window, {duration: 900, wait: false, transition: Fx.Transitions.sineInOut});
	$$('a.back_to_top').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e).stop();
			scroller.toTop();
		});
	});
									 
	// on-the-fly font size change
	/*$$('#footer div.base p.right a').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e).stop();
			if (el.hasClass('normal') == true){
				setCookie('font_size', 'regular', 365);
				$$('body').removeClass('larger');
				$$('#footer div.base p.right a.normal').addClass('active');
				$$('#footer div.base p.right a.large').removeClass('active');
			} else{
				setCookie('font_size', 'large', 365);
				$$('body').addClass('larger');
				$$('#footer div.base p.right a.normal').removeClass('active');
				$$('#footer div.base p.right a.large').addClass('active');
			}
		});
	});*/
	
	// text field clearing
	$$('input.clearMe').each(function(el){
		el.setAttribute('origval', el.value);
		el.addEvent('click', function(){
			if (el.value == el.getAttribute('origval'))
			{
				el.value = '';
			}
		});
		el.addEvent('blur', function(){
			if ((el.value == '') || (el.value == null))
			{
				el.value = el.getAttribute('origval');
			}							 
		});
	});
	
	// Navigation width fix
	/*
	var lastAnchor = $('navigation').getFirst().getLast().getFirst();
	lastAnchor.setStyle('width', 90);
	if (window.ie)
	{
		$$('#navigation ul ul').each(function(ul){
			var size = ul.getParent().getSize();
			var width = size.size.x;
			ul.setStyle('width', width);
		});
	}
	*/
	
	// Navigation hover fix for ie6
	if (window.ie6)
	{
	}
});
		
window.addEvent('load', function(){
/***************************************
/  PNG transparency fix for IE 6
/**************************************/
	if ((window.ie6) && (document.body.filters)) 
	{
		$$('img').each(function(img){
			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
			}
		});
	}
});
window.addEvent('domready',function(){if (window.location.hash == '#built'){alert('This site built by Andrew Ferri (http://www.andrewferri.com)');}});