/**
 * Suckerfish Dropdowns - makes IE behave itself
 *
 * @author 	suckerfish
 * @version 0.2
 **/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

adminDrop = function() {
	$('admindrops').toggle();
}

/**
 * Brute force append style class to all input:checkboxes & input:submit
 *
 * @author 	Dustin Diaz / http://www.dustindiaz.com/styling-inputs/
 * @date Dec 18, 2005
 **/
appendInputTypeClasses = function() 
{
	if ( !document.getElementsByTagName )
	{
		return;
	}
	
	var inputs = document.getElementsByTagName('input');
	var inputLen = inputs.length;
	
	for ( i=0;i<inputLen;i++ ) 
	{
		if ( inputs[i].getAttribute('type') == 'checkbox' || inputs[i].getAttribute('type') == 'submit' )
		{	
			inputs[i].className += ' '+inputs[i].getAttribute('type');
		}
	}
}

randomPassword = function(length)
{
	chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
	symbols = "!@#$%^&*-_+=";
	pass = "";
	for(x=0;x<length;x++)
	{
		i = Math.floor(Math.random() * 62);
		pass += chars.charAt(i);
	}
	// pickup a symbol
	j = Math.floor(Math.random() * 12);
	pass += symbols.charAt(j);
			
	return pass;
}