function help_popup(str, path)
{
    mywindow = window.open(path+"/viewpopup.php?str=" + str + "","mywindow","location=1,status=1,scrollbars=1,width=500,height=300");
    mywindow.moveTo(350,50);	
}

function trimAll(sString) 
{ 
	while (sString.substring(0,1) == ' ') 
    { 
       sString = sString.substring(1, sString.length); 
    } 
    
	while (sString.substring(sString.length-1, sString.length) == ' ') 
    { 
       sString = sString.substring(0,sString.length-1); 
    } 
	return sString; 
}
			
function searchresult()
{
 	var l_searchtext =document.getElementById("txtsearch");
 	l_searchtext.value=trimAll(l_searchtext.value);
	if (l_searchtext.value == "")
	{
		alert("Enter Text for Search");	
		return false;
	}
	else
	{	
		document.forms['form1'].action = "exam/searchstudent_exam_prep.php?txtsearch="+l_searchtext.value;            
	    document.forms['form1'].submit(); 						
	}
}

function searchKeyPress(e)
{ 	
		if (window.event) { e = window.event; } 
	    if (e.keyCode == 13) 
	    { 
	//		alert("test");
			var l_searchtext =document.getElementById("txtsearch");
 			l_searchtext.value=trimAll(l_searchtext.value);
			
			if(l_searchtext.value == "")
			{
				alert("Enter Text for Search");	
				return false;
			}
			else
			{				
				document.forms['form1'].action = "exam/searchstudent_exam_prep.php?txtsearch="+l_searchtext.value;            
			    document.forms['form1'].submit(); 	
			}
	    } 
}


		function trimAll(sString) 
        { 
            while (sString.substring(0,1) == ' ') 
            { 
            sString = sString.substring(1, sString.length); 
            } 
            while (sString.substring(sString.length-1, sString.length) == ' ') 
            { 
            sString = sString.substring(0,sString.length-1); 
            } 
        return sString; 
        }
    
function validatespace(s) 
{
    var txt = trimAll(s.value);
    if (txt == "")
    {
     	s.value = "";		
        alert("Spaces are not allowed.");
        return false;
    }       
}

function avoidspace(s)
{
	var invalid = " "; // Invalid character is a space
	// check for spaces
	if( s.value.indexOf(invalid) > -1 ) 
	{
	 	s.value = "";
		s.focus();   
		alert("Sorry, spaces are not allowed.");
		return false;
	}
}

function studentlist(sid, path)
{
	 	//alert("this is test"+path);		
	    mywindow = window.open (path+"/viewstudents.php?sid=" + sid + "","mywindow","location=1,status=1,scrollbars=1,width=200,height=300");
	    mywindow.moveTo(350,50);	
}
	
function UserList(val)
{
		//alert("This is an anchor test");
	 	var id = val;
	    mywindow = window.open ("http://202.53.66.20/SampleASP/Tutoronline/Userlist.aspx?id=" + id + "","mywindow","location=1,status=1,scrollbars=1,width=750,height=500");
	    mywindow.moveTo(0,0);		
}

function CourseList(val)
{
		//alert("This is an anchor test");
	 	var id = val;
	    mywindow = window.open ("http://202.53.66.20/SampleASP/Tutoronline/Courselist.aspx?id=" + id + "","mywindow","location=1,status=1,scrollbars=1,width=700,height=500");
	    mywindow.moveTo(0,0);		
}

function StProfile(val)
{	 	
	 	/*	var id = val;
	    mywindow = window.open (""+path+"StudentProfile.aspx?id="+id+"","mywindow","location=1,status=1,scrollbars=1,width=700,height=500");
	    mywindow.moveTo(0,0);	*/
	    window.location="http://202.53.66.20/LiveTutor/student/studentprofile.php";
}

// To move next,first,last,previous rows in upcomeing classes at tutor side
	var myid ;
	function checkajax(varstr)
    {
     	document.getElementById(myid).innerHTML = varstr;  
     	recId = "";
    }
    
	function T_upcome_next(recId,bdate,cid)
    {
		myid = "TutorUpcome";
  		var reqURL = "next_Tutor_upcomeclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);
    }
    
    function T_upcome_pre(recId,bdate,cid)
    {
		myid = "TutorUpcome";
		var reqURL = "pre_Tutor_upcomeclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);    
    }
    
    function T_upcome_first(bdate)
    {  
     	myid = "TutorUpcome";
  		var reqURL = "first_Tutor_upcomeclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
	
	function T_upcome_last(bdate)
    {  
     	myid = "TutorUpcome";
  		var reqURL = "last_Tutor_upcomeclass.php?bdate="+bdate;
        submitajax(reqURL);
    }    
//End to move next,first,last,previous rows in upcomeing classes at tutor side    

// To move next,first,last,previous rows in completed classes at tutor side
	
	function T_completed_next(recId,bdate,cid)
    {
     	//alert("Test Next");
		myid = "TutorCompleted";
  		var reqURL = "next_Tutor_completedclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);
    }
    
    function T_completed_pre(recId,bdate,cid)
    {
     //	alert("Test Previous");
		myid = "TutorCompleted";
		var reqURL = "pre_Tutor_completedclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);   
    }
    
    function T_completed_first(bdate)
    {
	 	//alert("Test First");  
     	myid = "TutorCompleted";
  		var reqURL = "first_Tutor_completedclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
	
	function T_completed_last(bdate)
    {  
     //	alert("Test last");
     	myid = "TutorCompleted";
  		var reqURL = "last_Tutor_completedclass.php?bdate="+bdate;
        submitajax(reqURL);
    }    
//End to move next,first,last,previous rows in completed classes at tutor side    

// To move next,first,last,previous rows in upcomeing classes at student side	
	function ST_upcomeing_next(recId,bdate,cid)
    {
     	//alert("Test Next");
		myid = "StudentUpcome";
  		var reqURL = "next_Student_upcomeclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);
    }
    
    function ST_upcomeing_pre(recId,bdate,cid)
    {
     //	alert("Test Previous");
		myid = "StudentUpcome";
		var reqURL = "pre_Student_upcomeclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);   
    }
    
    function ST_upcomeing_first(bdate)
    {
	 	//alert("Test First");  
     	myid = "StudentUpcome";
  		var reqURL = "first_Student_upcomeclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
	
	function ST_upcomeing_last(bdate)
    {  
     	//	alert("Test last");
     	myid = "StudentUpcome";
  		var reqURL = "last_Student_upcomeclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
//End to move next,first,last,previous rows in upcomeing classes at student side    

// To move next,first,last,previous rows in upcomeing classes at student side	
	function ST_completed_next(recId,bdate,cid)
    {
     	//alert("Test Next");
		myid = "StudentCompleted";
  		var reqURL = "next_Student_completedclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);
    }
    
    function ST_completed_pre(recId,bdate,cid)
    {
     //	alert("Test Previous");
		myid = "StudentCompleted";
		var reqURL = "pre_Student_completedclass.php?cid="+cid+"&rid="+recId+"&bdate="+bdate;
        submitajax(reqURL);   
    }
    
    function ST_completed_first(bdate)
    {
	 	//alert("Test First");  
     	myid = "StudentCompleted";
  		var reqURL = "first_Student_completedclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
	
	function ST_completed_last(bdate)
    {  
     	//	alert("Test last");
     	myid = "StudentCompleted";
  		var reqURL = "last_Student_completedclass.php?bdate="+bdate;
        submitajax(reqURL);
    }
//End to move next,first,last,previous rows in upcomeing classes at student side    