
	function expandContent( layer, img ) 
	{
	
		if ( $(layer).style.display == 'none' ) {
		
			showSection( layer );
			changeImage( img, '/media/images/minus.png' );
		
		} else {
		
			hideSection( layer );
			changeImage( img, '/media/images/plus.png' );
							
		}
	
	}

	function loadHelp( current_section )
	{

	//	alert( current_section );
/*
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;}
		settings='width=640,height=480,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
		win=window.open('/help/' + current_section,'help',settings);
*/

		openPopup( '/help/' + current_section, 640, 480 );

	}
			
	function print_page( url, get ) {		
		
		//alert( url + "?print=yes&" + get );
		openPopup( url + "?print=yes&" + get, 640, 480 );
		
	}
	
	function openPopup(page, width, height) { 
		OpenWin = this.open(page, "popup", "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
	} 
	
	function getSelectedVal( section ) {
		if ($(section))
			return $(section).options[$(section).selectedIndex].value;
		else
			alert( section + ' doesnt exist' );
	}


	function showSection( section ) {
		if ($(section))
			new Element.show( section );
		else
			alert( section + ' doesnt exist' );
	}

	function hideSection( section ) {
		if ($(section))
			new Element.hide( section );
		else
			alert( section + ' doesnt exist' );
	}

	function toggleSection( section ) {
		if ($(section))
			new Element.toggle( section );
		else
			alert( section + ' doesnt exist' );
	}

	function showSections( css_selector ) {
		
		all_layers = $$( css_selector );			
		for (var i = 0; i < all_layers.length; i++ ) {
			if (all_layers[i]) 
				new Element.show( all_layers[i] );
		}
		
	}
	
	function changeImage( section, image_src ) {
		if ($(section))
			$(section).src = image_src;
	}

	function changeClass( section, css_class ) {
		if ($(section))
			$(section).className = css_class;
	}
	
	function hideSections( css_selector ) {
		
		all_layers = $$( css_selector );			
		for (var i = 0; i < all_layers.length; i++ ) {
			if (all_layers[i])
				new Element.hide( all_layers[i] )
		}
		
	}
	
	function fadeSectionIn( section ) {
		if (!Element.visible( section  ))
			new Effect.Appear( section, { duration: 0.25 } );
	}
	function fadeSectionOut( section ) {
		if (Element.visible( section  ))
			new Effect.Fade( section, { duration: 0.35 } );
	}
	
	
	function foldSection( section ) {
		new Effect[Element.visible( section  ) ? 'BlindUp' : 'BlindDown'] ( section , {  duration: 0.5 });			
	}

	function foldSectionUp( section ) {
		new Effect['BlindUp']( section , { duration: 0.5});			
	}

	function foldSectionDown( section ) {
		new Effect['BlindDown']( section , { duration: 0.5});			
	}


	function updateSection( section, update_url ) {
		new Ajax.Updater(section, update_url, {  asynchronous:true, evalScripts:true, method:'get'});
	}
	
	function randomPassword( length ) {

		chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
		pass = "";
		
		for(x=0;x<length;x++) {
	    	i = Math.floor(Math.random() * 62);
			pass += chars.charAt(i);
		}
		return pass;
		
	}
	
