/*



Custom Functions

Uses http://www.vivabit.com/bollocks/2006/06/21/a-dom-ready-extension-for-prototype
*/
Event.onDOMReady(function(){
	init();
});
/*
	


This is the function that attached the Javascript functions to the page
*/
function init(){


	/*
	
	
	
	Nullify # links
	*/
	$$("a").each(function(node, i){

		node = $(node);

		if(node.href.indexOf("#") != -1){

			node.onclick = function(){

				this.blur();
				return false;

			}
		}

	});




	/*
	
	
	
	Forms
	*/
		/*
		
		
		
		Focus on an input
		*/
		$$("form input").each(function(node, i){
			node = $(node);
			node.onfocus = node.onblur = function(){
	
				if (node.hasClassName("focus")) {
					node.removeClassName("focus");
				} else {
					node.addClassName("focus");
				}
	
			}
	
		});

	IE_PNG_Hack();
	
}

/*

This function makes 32 bit PNG's with transparency work
*/	
function IE_PNG_Hack(){

	if (navigator.userAgent.indexOf("MSIE ") == -1){
		
		return false;
		
	} else {

		$$("img").each(function(node, i){
					
			var node = $(node);
			
			if (node.src.indexOf("png") == -1) {
				
				/*node.runtimeStyle.filter = "";*/
				
				return;
			}
			
			var oldSrc = node.src;
			
			node.src = "images/site/transparent.gif";
			
			node.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + oldSrc + "',sizingMethod='scale')";
			
		});
		
	}
	
}
