function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}	
function checkForm(){
	//Prompt if missing userid and password
	if((document.login.username_login.value == "") && (document.login.password_login.value == ""))	{
		document.getElementById('login_err').innerHTML = "Please enter your username and password";
		document.login.username_login.focus();
		return false;
	}
	//Prompt if missing userid
	if(document.login.username_login.value == ""){
		document.getElementById('login_err').innerHTML = "Please enter your username";
		document.login.username_login.focus();
		return false;
	}	
	//Prompt if missing password
	if(document.login.password_login.value == "")	{
		document.getElementById('login_err').innerHTML = "Please enter your password";
		document.login.password_login.focus();
		return false;
	}
	return true;
} 

function videoPopUp() {
	// Determine how much the visitor had scrolled
	var scrolledX, scrolledY;
		if( self.pageYOffset ) {
		  scrolledX = self.pageXOffset;
		  scrolledY = self.pageYOffset;
		} else if( document.documentElement && document.documentElement.scrollTop ) {
		  scrolledX = document.documentElement.scrollLeft;
		  scrolledY = document.documentElement.scrollTop;
		} else if( document.body ) {
		  scrolledX = document.body.scrollLeft;
		  scrolledY = document.body.scrollTop;
		}
	
	// Determine the coordinates of the center of the page
	var centerX, centerY;
		if( self.innerHeight ) {
		  centerX = self.innerWidth;
		  centerY = self.innerHeight;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
		  centerX = document.documentElement.clientWidth;
		  centerY = document.documentElement.clientHeight;
		} else if( document.body ) {
		  centerX = document.body.clientWidth;
		  centerY = document.body.clientHeight;
		}
	
	var leftOffset = scrolledX + (centerX - 600) / 2;
	var topOffset = scrolledY + (centerY - 600) / 2;
	
	// Create popup
	var Vdiv = document.createElement("div");
	Vdiv.className='video_popup';
	Vdiv.id="video_popup";
	Vdiv.style.width="485px";
	Vdiv.style.height="445px";
	Vdiv.style.left = leftOffset + "px";
	Vdiv.style.top = topOffset + "px";
	
	var vGrayOut = document.createElement("div");
	vGrayOut.className='grayOut';
	vGrayOut.id='vGrayOut';
	
	var headerVDiv = document.createElement("div");
	headerVDiv.id="headerVDiv";
	headerVDiv.className="headerVDiv";
	headerVDiv.innerHTML= "<h3>a little about Chatfe...</h3>";
	
    var closeVButton = document.createElement("input");
	closeVButton.type="button";
	closeVButton.id="closeV";
	closeVButton.className="closebutton";
	closeVButton.setAttribute("onmouseover","this.className='closebuttonhover'");
	closeVButton.setAttribute("onmouseout","this.className='closebutton'")
    closeVButton.onclick = closeVPopUp;
	
    var bottomVDiv = document.createElement("div");
    bottomVDiv.id="bottomVDiv";
    bottomVDiv.className="bottomDiv";

	bottomVDiv.innerHTML = "<object width='445' height='364px'><param name='movie' value='http://www.youtube.com/v/Hj6kX1OJDq0&hl=en_US&fs=1&color1=0xFFFFFF&color2=0x999999&border=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/Hj6kX1OJDq0&hl=en_US&fs=1&color1=0x3a3a3a&color2=0x999999&border=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='445' height='364'></embed></object>";
	
	var Vpop = document.getElementById("videoPopup");
	
   	headerVDiv.appendChild(closeVButton);	
    Vdiv.appendChild(headerVDiv);
    Vdiv.appendChild(bottomVDiv);
	Vpop.appendChild(Vdiv);	
	Vpop.appendChild(vGrayOut);

}

function closeVPopUp() {
	var Vpopup = document.getElementById('video_popup');
	var Vgrayout = document.getElementById('vGrayOut');
	var Vwindow = Vpopup.parentNode;
	Vwindow.removeChild(Vpopup);
	Vwindow.removeChild(Vgrayout);
}
function putVideo() {
	document.getElementById('video_frame').innerHTML = "<iframe width='460px' height='400px' src='http://res.chatfe.com/vids/index.htm' scrolling='no' frameborder='0'></iframe>";
}



