// JavaScript Document

// this function is used to verify wether the user has entered valid email address or not and to verify that the password field is not empty
	function fnValidateLogin(){
		if(fnisEmail(document.frmLogin.frmEmail.value)==false){
			alert("Please enter a correct email address");
			document.frmLogin.frmEmail.focus();
			return false;
		}else if(fnStripSpace(document.frmLogin.frmPassword.value)==""){
			alert("Please enter the password");
			document.frmLogin.frmPassword.focus();
			return false;
		}
		
	}


function fnValidateRegistration(){
		obj=document.frmRegistration;
		if(fnStripSpace(obj.txtFName.value)==""){
			alert("Please enter your first name");
			obj.txtFName.focus();
			return false;
		}else if(fnStripSpace(obj.txtLName.value)==""){
			alert("Please enter your last name");
			obj.txtLName.focus();
			return false;
		}else if(fnStripSpace(obj.txtPword.value)==""){
			alert("Please enter your password");
			obj.txtPword.focus();
			return false;
		}else if(obj.txtPword.value!=obj.txtVPword.value){
			alert("Password does not match");
			obj.txtVPword.focus();
			return false;
		}else if(fnisEmail(obj.txtEmail.value)==false){
			alert("Please enter a valid email address");
			obj.txtEmail.focus();
			return false;
		}/*else if(fnStripSpace(obj.txtSection.value)==""){
			alert("Please enter your course section");
			obj.txtSection.focus();
			return false;
		}*/else if((obj.txtAvatar.value)==""){
			alert("Please select an avatar icon");
			obj.txtAvatar.focus();
			return false;
		}
		
	}
		
	<!-- Begin check for upload file type
extArray = new Array(".gif", ".jpg"); 
function LimitAttach(form, file) { 
		allowSubmit = false; 
		if (!file) return; 
		while (file.indexOf("\\") != -1) 
		file = file.slice(file.indexOf("\\") + 1); 
		ext = file.slice(file.indexOf(".")).toLowerCase(); 
		for (var i = 0; i < extArray.length; i++) { 
			if (extArray[i] == ext) { 
			allowSubmit = true; 
			break; 
			} 
		} 
		//if (allowSubmit) form.submit(); 
		if(allowSubmit){
		 return true;
		 } else { 
		alert("Please only upload images that end in types: " 
		+ (extArray.join(" ")) + "\n\nPlease select a new " 
		+ "image to upload and submit again."); 
		obj.txtAvatarFile.focus();
		return false;
		} 
	// End --> 
	}
	

//this function removes the empty spaces from the string passed to it.
//it slashes empty spaces on both sides of the string as well as in between the string also

function fnStripSpace(str){
	var strTemp="";
	for(intI=0;intI<str.length;intI++){
		if(str.charAt(intI)!=" "){
		strTemp=strTemp+str.substring(intI,intI+1)
		}
	}
	return strTemp
}

//checks for the validity of email address provided by the user.
//this function checks whether the user has entered @ symbol at first or at last.
//whether the user has entered '.' symbol at the beggining or at last.
//whether the @ symbol and '.' is together.

function fnisEmail(str){
	str=fnStripSpace(str);
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
    	return true;
 	}else{
		//alert("Please Enter Valid Email Address");
		return false;
	}
  
}


// There's got to be a better way to do this, but I'm having
// trouble passing parameters in function calls using setTimeout().
// I'll come back to this when I have time. Leo
//go to column 2
var x1 = 5;
function scroll1() {
     if (x1 < 562) {
         window.scroll(x1,0);
         x1 = x1 + 5;
         setTimeout('scroll1()',5);
         }
    else x1 = 5;
}
//back to column 1
 var x1b = 557;
function scrollback1() {
        if (x1b >= 0) {
           window.scroll(x1b,0);
           x1b = x1b - 5;
           setTimeout('scrollback1()',5);
           }
        else x1b = 557;
}

//back to column 1
 var xsb = 3348;
function scrollStart() {
        if (xsb >= 0) {
           window.scroll(xsb,0);
           xsb = xsb - 20;
           setTimeout('scrollStart()',1);
           }
        else xsb = 3348;
}



//go to column 3
var x2 = 562;
function scroll2() {
        if (x2 < 1120) {
                window.scroll(x2,0);
                        x2 = x2 + 5;
                        setTimeout('scroll2()',10);
                }
        else x2 = 562;
}

//back to column 2
var x2b = 1120;
function scrollback2() {
        if (x2b >= 557) {
                window.scroll(x2b,0);
                        x2b = x2b - 5;
                        setTimeout('scrollback2()',10);
                }
        else x2b = 1120;
}

//scroll to column 4
var x3 = 1120;
function scroll3(){
if(x3 < 1677){
	window.scroll(x3,0);
	x3 = x3 + 5;
	setTimeout('scroll3()',10);
	}
	else x3 = 1120;
}

//back to column 3
var x3b = 1677;
function scrollback3() {
        if (x3b >= 1120) {
                window.scroll(x3b,0);
                        x3b = x3b - 5;
                        setTimeout('scrollback3()',10);
                }
        else x3b = 1677;
}







var x4 = 1677;
function scroll4(){
	if(x4 < 2234){
	window.scroll(x4,0);
	x4 = x4 +5;
	setTimeout('scroll4()',10);
	} else x4 = 1677;
}

//back to column 4
var x4b = 2234;
function scrollback4() {
        if (x4b >= 1677) {
                window.scroll(x4b,0);
                        x4b = x4b - 5;
                        setTimeout('scrollback4()',10);
                }
        else x4b = 2234;
}


var x5 = 2234;
function scroll5(){
	if(x5 < 2791){
	window.scroll(x5,0);
	x5 = x5+5;
	setTimeout('scroll5()',10);
	} else x5 = 2234;
}
//back to column 4
var x5b = 2791;
function scrollback5() {
        if (x5b >= 2234) {
                window.scroll(x5b,0);
                        x5b = x5b - 5;
                        setTimeout('scrollback5()',10);
                }
        else x5b = 2791;
}




var x6 = 2791;
function scroll6(){
	if(x6 < 3348){
	window.scroll(x6,0);
	x6 = x6+5;
	setTimeout('scroll6()',10);
	} else x6 = 2791;
}
//back to column 4
var x6b = 3348;
function scrollback6() {
        if (x6b >= 2791) {
                window.scroll(x6b,0);
                        x6b = x6b - 5;
                        setTimeout('scrollback6()',10);
                }
        else x6b = 3348;
}
