var sliderHeight="";			// these need to be defined globally so 
var divToSlide="";		// javascript doesn't "forget" them when
var fullSlideHeight="";		// calling a setTimeout

// USER DEFINABLE VARIABLES
var sliderSpeed= 30;			// time between frames.  10 is really fast. 100 is really slow.
var sliderAccel=1.8;			// Acceleration frames.  From "many" 1.1 to a "few" fast 3.	
var posT = 76;


function SlidingOpen(height) {
	try {		
		if (height<=fullSlideHeight) {					// if we're not done sliding
			/*document.getElementById(divToSlide).style.paddingTop = (fullSlideHeight - height) + 'px'; //Modified by Gift
			document.getElementById(divToSlide).style.height = height+'px';	// set the new height 
			if (height<(fullSlideHeight/2)) {				// accelerate up for the first half
				sliderHeight=Math.round(height*sliderAccel)+1;	
			}
			else {
				sliderHeight=fullSlideHeight-Math.round((fullSlideHeight-height)/sliderAccel)+1;	// decelerate for the second half
			}
			setTimeout("SlidingOpen(sliderHeight)",sliderSpeed);	// call next slide height*/
			
			document.getElementById(divToSlide).style.paddingTop = (fullSlideHeight - height) + 'px'; //Modified by Gift
			//document.getElementById(divToSlide).style.height = height+'px';	// set the new height 
			if (height<(fullSlideHeight/2)) {				// accelerate up for the first half
				sliderHeight=Math.round(height*sliderAccel)+1;	
			}
			else {
				sliderHeight=fullSlideHeight-Math.round((fullSlideHeight-height)/sliderAccel)+1;	// decelerate for the second half
			}
			setTimeout("SlidingOpen(sliderHeight)",sliderSpeed);	// call next slide height
		}
		else {
			if (document.getElementById('txtUserName') && sliderHeight != "") document.getElementById('txtUserName').focus();

			document.getElementById(divToSlide).style.height = "auto";	// set the final height 
			sliderHeight="";			// reset the global vars when done
			divToSlide="";
			fullSlideHeight="";
		}
	} catch (e) { }
}

function SlideOpen(objId) {							// slides open given div id
	try {
		document.getElementById(objId).style.overflow = 'hidden';	// in case the user forgot
		//document.getElementById(objId).style.height = '25px';		// start opening at 1px high
		//document.getElementById(objId).style.display = 'block';		// make it visible
		fullSlideHeight = document.getElementById(objId).scrollHeight;		// set the final height globally
		divToSlide = objId;											// define div ID global
		SlidingOpen( posT );												// slide divToSlide open
		return;
	} catch (e) { }
}

function SlidingClosed(height) {	//  given next height
	try {
		document.getElementById(divToSlide).style.paddingTop = (fullSlideHeight - height) + 'px';	// set the new height	
		if (height>0 && (fullSlideHeight - height) < posT) {
			if (height>(fullSlideHeight/2)) {								// accelerate the first half
				sliderHeight=Math.round(fullSlideHeight-(fullSlideHeight*sliderAccel)+(height*sliderAccel))-1;
				if (sliderHeight<(fullSlideHeight/2)) {							// to make sure cut off point is at 1/2 way
					sliderHeight=Math.round(fullSlideHeight/2)-1;
				}
			}
			else {
				sliderHeight=Math.round(height/sliderAccel)-1;					// decelerate the second
			}
			//alert(sliderHeight)
			setTimeout("SlidingClosed(sliderHeight)",sliderSpeed);			// call next slide height
		}
		else {
			document.getElementById(divToSlide).style.paddingTop = posT + 'px';
			sliderHeight="";			// reset the global vars when done
			divToSlide="";
			fullSlideHeight="";
		}
		/*if (height>0) {											// if we're not done closing

			if (height>(fullSlideHeight/2)) {								// accelerate the first half
				sliderHeight=Math.round(fullSlideHeight-(fullSlideHeight*sliderAccel)+(height*sliderAccel))-1;
				if (sliderHeight<(fullSlideHeight/2)) {							// to make sure cut off point is at 1/2 way
					sliderHeight=Math.round(fullSlideHeight/2)-1;
				}
			}
			else {
				sliderHeight=Math.round(height/sliderAccel)-1;					// decelerate the second
			}
			setTimeout("SlidingClosed(sliderHeight)",sliderSpeed);			// call next slide height
		}
		else {
			sliderHeight="";			// reset the global vars when done
			divToSlide="";
			fullSlideHeight="";
		}*/
	} catch (e)	{ }
}

function SlideClosed(objId) {							// slides closed given div id
	try {		
		if (document.getElementById(objId).style.display == 'none') {	// if it's already closed
			return;
		}
		document.getElementById(objId).style.overflow = 'hidden';	// in case the user forgot
		fullSlideHeight=document.getElementById(objId).scrollHeight;		// set the start height globally
		if (!fullSlideHeight) {												// for IE mac
			fullSlideHeight=document.getElementById(objId).offsetHeight;
		}

		//fullSlideHeight-=19;												// remove the padding from scrollHeight
		divToSlide=objId;											// define div ID global
		SlidingClosed(fullSlideHeight);									// slide divToSlide closed
		return;
	} catch (e)	{ }
}


function addEvent (obj, evType, fn){ 
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, false);
		return true;
	} else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}

addEvent( window, "load", function() {
	if (document.getElementById('txtUserName') ) document.getElementById('txtUserName').blur();
	if (document.getElementById('txtPassword') ) document.getElementById('txtPassword').blur();
});