//////////////////////////////////////////////////////////////////////////////
//                      Show/Hide With a Slide Script                       //
//////////////////////////////////////////////////////////////////////////////
// 
// This little script allows you to create a section of content and hide it at
// the top of your screen for users to open and close as they wish.  This is
// particularly handy for things like login boxes, supplementary navigation
// and content enhancements like tips, tricks and interesting tidbits of
// information you don't need showcased within your regular content.
//
//
// CONTRIBUTORS:
//
// Original Creator:
//     Paul Hirsch
//     www.paulhirsch.com
//
// Tested by:
//     International Web Developers Network (IWDN)
//     www.iwdn.net - home page
//     www.iwdn.net/index.php - forums/community where testing took place
//
// Other Contributors:
//     Michaeljohn Clement - clued me in on offsetHeight - very handy!
//
//     ElectricStorm - (altered to pull out login pane from below the 
//						link instead of pull down from top of screen)
//
//
// LICENSE:
//
// This script is protected under General Public License (GPL).  Feel free to
// redistribute this script, so long as you do not alter any of the contents
// specifying authorship.  If you add to or modify this script, you may add
// your name to the "Other Contributors" list at the top of this script.  As
// a courtesy, please email me and let me know how you've improved my script!
// You may not profit from the direct sale of this script.  You may use this
// script in commercial endeavors however (i.e. as part of a commercial site).
//
// Email me here: http://www.paulhirsch.com/contact_me.php
//
// Copyright 2006, Paul Hirsch. All rights specified herein and within GPL
// documentation: http://www.gnu.org/licenses/gpl.txt
//
//
//////////////////////////////////////////////////////////////////////////////
// DO NOT TOUCH ANYTHING BELOW THIS LINE                                    //
// unless you know what the heck you're doing!                              //
//////////////////////////////////////////////////////////////////////////////

var Hide = 'loginpane';
var varHt = '';
var Ht = '';
var x = 0;
var y = 10;
var z = 1;
var Speed = 9;
var toHeight = 115;


window.onload = setup;


function setup() {

	if (document.getElementById(Hide)) {
		
		Ht = document.getElementById(Hide).offsetHeight;
		varHt = Ht;
	
		if (Speed == 1) { y = 100; z = 1; }
		if (Speed == 2) { y = 70; z = 1; }
		if (Speed == 3) { y = 40; z = 1; }
		if (Speed == 4) { y = 20; z = 1; }
		if (Speed == 5) { y = 10; z = 1; }
		if (Speed == 6) { y = 10; z = 2; }
		if (Speed == 7) { y = 10; z = 4; }
		if (Speed == 8) { y = 10; z = 7; }
		if (Speed == 9) { y = 10; z = 10; }
		
	}	
}


function toggle() {
		
	document.getElementById(Hide).style.height = varHt + 'px';
		
	if (x === 0) {	
		//if growing pane:
		
		varHt = varHt + z;
		
		if (varHt <= toHeight) {
			setTimeout('toggle()', y);
		}
					
		if (varHt > toHeight) {
			varHt = toHeight;
			document.getElementById(Hide).style.height = varHt + 'px';
			x = 1;
		}
		
	} else {
		//if shrinking pane:
			
		if ((varHt < z) && (varHt !== 0)) {
			varHt = 0;
		} 
		else {
			varHt = varHt - z;
		}
		
		if (varHt >= 0) {
			setTimeout('toggle()', y);
		}
		
		if (varHt < 0) {
			varHt = 0;
			x = 0;
		}
		
	}
	
}


