﻿// JScript File
var posx;var posy;
//For TextBox Categorie Search
function ShowDiv(divid)
{

 try
  {
   if (document.layers) 
   {document.layers[divid].visibility="show";}
   else 
   {document.getElementById(divid).style.visibility="visible";}
   }catch(e)
   {
   
   }
}

function HideDiv(divid)
{
try
  {
       if (document.layers) 
       {document.layers[divid].visibility="hide";}
       else 
       {document.getElementById(divid).style.visibility="hidden";}
   }
   catch(e)
   {
    
   }
}


function ClearResultsText()
{   
try
  {
	// remove existing rows in results table
	var resultsdiv = document.getElementById("searchresults");
	var counter = resultsdiv.childNodes.length;
	for (var i = counter -1; i >= 0; i--)
	{
		resultsdiv.removeChild(resultsdiv.childNodes[i]);
	}
  }
  catch(e)
  {
    
  }
}

function LoadResults(searchterm)
{
try
  {
	
	if (searchterm.length == 0)
	{
		// if the input box is empty let's dump all the rows from the results table
		ClearResultsText();
		HideDiv("searchresults");
		return;
	}
	
	
	if (searchterm.length != 0)
	{
		
	// fetch results from server side
	// this is our actual ajax call
	Anthem_InvokePageMethod('RetrieveRows',[searchterm] , LoadResultsCallback);
	}
 } 
  catch(e)
  {
    
  }
}

function LoadResultsCallback(result)
{
try
  {
	// the xmlhttprequest will return to this function.
 
	ShowDiv("searchresults");
	ClearResultsText();
	
	
	// callback results from Ajax call
	// we'll assign the inbound DataTable
	// to the items variable
	var items = result.value;
	    
	var count = items.Rows.length;
	// we'll create a table object in the DOM
	var divResults = document.getElementById("searchresults");
	var tblTable = document.createElement("table");
	var tablebody = document.createElement("tbody");
	var tablerow, tablecell, tablenode;
    //    divResults.focus();
	/*For Close Button*/
    	tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
    		    
//		var link=document.createElement("a");
//		link.setAttribute("title","done");
//        link.setAttribute("href",'JavaScript:void(0);');
//        
//        var textNode=document.createTextNode("[X]");
//        link.appendChild(textNode);
//		tablecell.onmouseover = function(){this.className='mouseOver';};
//		tablecell.onmouseout = function(){this.className='mouseOut';};
//		tablecell.setAttribute("border", "0");
//		tablecell.onclick = function(){ReplaceInput(this);};
//    	//tablecell.style.width="100px";
//    	tablecell.align='right';
//		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
		divResults.appendChild(tblTable);
		
	// loop through each of the rows in the DataTable
	for (var i = 0; i < count; i++)
	{
		var currenttext = items.Rows[i].Description;
		
		// we'll create each table row and append it to the
		// table body
		tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
		
		// build the cell attributes and functions
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "1");
		
		tablecell.onclick = function(){ReplaceInputTest(this);};
		tablenode = document.createTextNode(currenttext);
		tablecell.appendChild(tablenode);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
	}
	
	    // add the table body to the table
	    tblTable.appendChild(tablebody);
	    // add the table to the div tag
	    divResults.appendChild(tblTable);
	  
  }
  catch(e)
  {
    
  }
}

function ReplaceInputTest(tablecell)
{
try
  {
	// swap Input box value with the value selected by
	// the users mouse click           
	var inputbox = document.getElementById("ctl00_contentMatch_txtSubject");
	inputbox.value = tablecell.firstChild.nodeValue;
	ClearResultsText();
	HideDiv("searchresults");
 }catch(e)
 {
 
 }
}


	
//For Categories
var CatID=null;
var SubID=null;
function ShowDivCat(divid)
{
  try
  {
       if (document.layers) 
       {document.layers[divid].visibility="show";}
       else 
       {document.getElementById(divid).style.visibility="visible";}
   }
   catch(e)
   {
    
   }
}

function HideDivCat(divid)
{
 try
  {
       if (document.layers) 
       {document.layers[divid].visibility="hide";}
       else 
       {document.getElementById(divid).style.visibility="hidden";}
   }
   catch(e)
   {
    
   }
}

function BodyLoad()
{
try
  {
    HideDivCat("searchresults");
   }catch(e)
   {
   
   } 

}

function ClearResults()
{   
try
  {
	    // remove existing rows in results table
	    var resultsdiv = document.getElementById("dvGetSubjects");
	    var counter = resultsdiv.childNodes.length;
	    for (var i = counter -1; i >= 0; i--)
	    {
		    resultsdiv.removeChild(resultsdiv.childNodes[i]);
	    }
   }
   catch(e)
   {
    
   }
}


function LoadSubjects(CategoriesID,e)
{
try
  {
   
    //var brVer=navigator.appVersion; 
    
    if (navigator.appVersion.indexOf("MSIE")!=-1)
    {
    temp=navigator.appVersion.split("MSIE")
    version=parseFloat(temp[1])
    
    if (version<6)
        return;
    }

    
   if(navigator.userAgent.indexOf("Firefox")!=-1){
    var versionindex=navigator.userAgent.indexOf("Firefox")+8
    /*if (parseInt(navigator.userAgent.charAt(versionindex))<5)
        return; */
        temp=navigator.appVersion.split("Firefox")
        version=parseFloat(temp[0])
        if(version<5)
            return;
        
    }
        
        
    if(navigator.userAgent.indexOf("Opera")!=-1)
    {
    var versionindex=navigator.userAgent.indexOf("Opera")
    temp=navigator.appVersion.split("Opera")
        version=parseFloat(temp[0])
        if(version<9.22)
            return;
    
    if (parseInt(navigator.userAgent.charAt(versionindex))<8)
            return;
    }    
    
 
	if (CategoriesID.length == 0)
	{
		// if the input box is empty let's dump all the rows from the results table
		ClearResults();
		HideDiv("dvGetSubjects");
		return;
	}
	
	if (navigator.appName=="Netscape"&&parseFloat(navigator.appVersion)<=4.7)
        return;
	

posx=0;posy=0;

var ev=(!e)?window.event:e;//IE:Moz

if (ev.pageX)
{//Moz
    posx=ev.pageX;// +window.pageXOffset;
    posy=ev.pageY;// +window.pageYOffset;
}
else if(ev.clientX)
{//IE
    posx=ev.clientX +document.documentElement.scrollLeft;
    posy=ev.clientY + document.documentElement.scrollTop;
}
else{return false}//old browsers


	CatID=CategoriesID;
	SubID=this.SubID;
	var resultsdiv = document.getElementById("dvGetSubjects");
	resultsdiv.style.position='absolute';
    //document.onmousemove=getMouse;
	resultsdiv.style.left=(posx + 15) + 'px';
	resultsdiv.style.top=(posy - 20) + 'px';
	
	// fetch results from server side
	// this is our actual ajax call
	
	if (CategoriesID.length != 0)
	{
	
	Anthem_InvokePageMethod('fnGetSubjects',[CategoriesID] , LoadSubjectsCallback);	
	//alert(LoadSubjectsCallback);
	}
    }
    catch(e)
    {
        
    }
}

function LoadSubjectsCallback(result)
{
	// the xmlhttprequest will return to this function.
    try
    {
	
	   alert();
	    ShowDivCat("dvGetSubjects");
	    ClearResults();
    	
	    // callback results from Ajax call
	    // we'll assign the inbound DataTable
	    // to the items variable
	    var items = result.value;
	    var count = items.Rows.length;
	    
//	    // we'll create a table object in the DOM
	    var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode;
    	var iRowCount=0;
    	
    	
//    	/*For Close Button*/
    	tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
    		    
		var link=document.createElement("a");
		link.setAttribute("title","Close");
        link.setAttribute("href",'JavaScript:void(0);');
        
        var textNode=document.createTextNode("[X]");
        link.appendChild(textNode);
		tablecell.onmouseover = function(){this.className='mouseOver';};
		//tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	//tablecell.style.width="100px";
    	tablecell.align='right';
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
		 divResults.appendChild(tblTable);
	    // loop through each of the rows in the DataTable
	    for (iRowCount = 0; iRowCount < count; iRowCount++)
	    {
		    var currenttext = items.Rows[iRowCount].Description;
    		SubID=items.Rows[iRowCount].ID;
    		
		    // we'll create each table row and append it to the
		    // table body
		    
		    if(iRowCount < 5)
		    {
		        tablerow = document.createElement("tr");
		        tablecell = document.createElement("td");
    		    
			    var link=document.createElement("a");
			    //link.setAttribute("title","test");
                link.setAttribute("href","Categories/SubjectTutor.aspx?EID=" + CatID + "&SID=" + SubID);
                var textNode=document.createTextNode(currenttext);
                link.appendChild(textNode);
			    tablecell.onmouseover = function(){this.className='mouseOver';};
			    //tablecell.onmouseout = function(){this.className='mouseOut';};
			    tablecell.setAttribute("border", "0");
			    tablecell.onclick = function(){ReplaceInput(this);};
    			
			    tablecell.appendChild(link);
		        tablerow.appendChild(tablecell);
		        tablebody.appendChild(tablerow);
		    }
		    
	    }
	    
	    // add the table body to the table
	    tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
	    MoreRow();
	    //divResults.appendChild(link);
	  }catch(E)
	  {
	    //alert(E.Value);
	  }
    }
    
    function MoreRow()
    {
        var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode;
	    
	     tablerow = document.createElement("tr");
		 tablecell = document.createElement("td");
    		    
		var link=document.createElement("a");
		//link.setAttribute("title","test");
        link.setAttribute("href","Categories/Get_Categories.aspx?Categories=" + CatID);
        var textNode=document.createTextNode("more>>");
        link.appendChild(textNode);
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }
    
    function MoreRowTXT()
    {
        var divResults = document.getElementById("searchresults");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode;
	    
	     tablerow = document.createElement("tr");
		 tablecell = document.createElement("td");
    		    
		var link=document.createElement("a");
		//link.setAttribute("title","test");
        link.setAttribute("href","#");
        var textNode=document.createTextNode("more>>");
        link.appendChild(textNode);
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }
     function CloseDIV()
    {
        var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode,tablecell1;
	    
	    tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
    		    
		var link=document.createElement("a");
		link.setAttribute("title","Close");
        link.setAttribute("href","#");
        var textNode=document.createTextNode("X");
        link.appendChild(textNode);
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	tablecell.style.width="100px";
    	tablecell.align='right';
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		
		tblTable.border='1';
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }

function ReplaceInput(tablecell)
{
	try
	{
	    
	    ClearResults();
	    HideDivCat("dvGetSubjects");
	}
	catch(E)
	{
	  //alert(E.value);
	}
	
}

function hideread()
 {
 try
  {
 	document.getElementById("dvGetSubjects").style.display="none";	
  }catch(E)
  {
    //alert(E.Value);
  }
 }


function ShowDiv(divid)
{
  try
  {
   if (document.layers) 
   {document.layers[divid].visibility="show";}
   else 
   {document.getElementById(divid).style.visibility="visible";}
   }
   catch(e)
   {
    
   }
}

function HideDiv(divid)
{

try
  {
   if (document.layers) 
   {document.layers[divid].visibility="hide";}
   else 
   {document.getElementById(divid).style.visibility="hidden";}
  }
  catch(e)
  {
  
  }
}

function BodyLoad()
{
try
  {
    HideDiv("searchresults");
    HideDiv("dvGetSubjects");
    // set focus to the input box
    //document.form2.txtSubject.focus();
    //var resultsdiv = document.getElementById("ctl00_txtSubject");
    //resultsdiv.focus();
}catch(e)
{

}
}

function ClearResultsText()
{

try
  {   
	// remove existing rows in results table
	var resultsdiv = document.getElementById("searchresults");
	var counter = resultsdiv.childNodes.length;
	for (var i = counter -1; i >= 0; i--)
	{
		resultsdiv.removeChild(resultsdiv.childNodes[i]);
	}
	
	}
	catch(e)
	{
	
	}
}

function LoadResults(searchterm)
{

try
  {
	if (searchterm.length == 0)
	{
		// if the input box is empty let's dump all the rows from the results table
		ClearResultsText();
		HideDiv("searchresults");
		return;
	}
	
	if (searchterm.length != 0)
	{
	// fetch results from server side
	// this is our actual ajax call
	Anthem_InvokePageMethod('RetrieveRows',[searchterm] , LoadResultsCallback);
	}
 }
 catch(e)
 {
   
 }

}
function LoadResultsCallback(result)
{

	// the xmlhttprequest will return to this function.
    try
    {

	ShowDiv("searchresults");
	ClearResultsText();
	
	// callback results from Ajax call
	// we'll assign the inbound DataTable
	// to the items variable
	var items = result.value;
	
	var count = items.Rows.length;
	// we'll create a table object in the DOM
	var divResults = document.getElementById("searchresults");
	var tblTable = document.createElement("table");
	var tablebody = document.createElement("tbody");
	var tblStyle = document.createElement("Style");
	var tablerow, tablecell, tablenode;
//	
//    var v=document.createElement('div'); 
//    v.setAttribute('id','MED_VIEW'); 
//    v.style.position='absolute';
//    v.style.backgroundImage="url(submenubg2.gif)"; 
    
	// loop through each of the rows in the DataTable
	for (var i = 0; i < count; i++)
	{
		var currenttext = items.Rows[i].Description;
		
		// we'll create each table row and append it to the
		// table body
		tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
			// build the cell attributes and functions
			tablecell.onmouseover = function(){this.className='mouseOver';};
			tablecell.onmouseout = function(){this.className='mouseOut';};
			tablecell.setAttribute("border", "0");
			tablecell.onclick = function(){ReplaceInputTest(this);};
			//tablecell.style="cursor:hand";
		tablenode = document.createTextNode(currenttext);
		tablecell.appendChild(tablenode);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		
	}

	tblTable.appendChild(tablebody);
//	tblTable.appendChild(v);
	// add the table to the div tag
	divResults.appendChild(tblTable);
	}
	catch(e)
	{
	    
	}
}

function ReplaceInputTest(tablecell)
{
   try
   {
	    // swap Input box value with the value selected by
	    // the users mouse click           
	    var inputbox = document.getElementById("ctl00_contentMatch_txtSubject");
	    inputbox.value = tablecell.firstChild.nodeValue;
	    ClearResultsText();
	    HideDiv("searchresults");
	}
	catch(e)
	{
	    
	}
}

			
	//For Categories
		
		var CatID=null;
		var SubID=null;
function ShowDivCat(divid)
{
try
  {
       if (document.layers) 
       {document.layers[divid].visibility="show";}
       else 
       {document.getElementById(divid).style.visibility="visible";}
  }catch(e)
  {
  
  }
}

function HideDivCat(divid)
{
try
  {
   if (document.layers) 
   {document.layers[divid].visibility="hide";}
   else 
   {document.getElementById(divid).style.visibility="hidden";}
  }
  catch(e)
  {
  
  }
}

function BodyLoadTest()
{
try
  {
    HideDivCat("searchresults");
    // set focus to the input box
    //document.form2.txtSubject.focus();
    //var resultsdiv = document.getElementById("ctl00_txtSubject");
    //resultsdiv.focus();
  }
  catch(e)
  {
    
  }
}

function ClearResults()
{   
try
  {
	// remove existing rows in results table
	var resultsdiv = document.getElementById("dvGetSubjects");
	var counter = resultsdiv.childNodes.length;
	for (var i = counter -1; i >= 0; i--)
	{
		resultsdiv.removeChild(resultsdiv.childNodes[i]);
	}
  }
  catch(e)
  {
  
  }
}

function LoadSubjects1(CategoriesID,left,top)
{
try
  {
	if (CategoriesID.length == 0)
	{
		// if the input box is empty let's dump all the rows from the results table
		ClearResults();
		HideDiv("dvGetSubjects");
		return;
	}
	
	if (CategoriesID.length != 0)
	{
	CatID=CategoriesID;
	SubID=this.SubID;
	var resultsdiv = document.getElementById("dvGetSubjects");
	resultsdiv.style.position='absolute';
	resultsdiv.style.left=left +'px';
	resultsdiv.style.top=top + 'px';
	
	// fetch results from server side
	// this is our actual ajax call
	Anthem_InvokePageMethod('fnGetSubjects',[CategoriesID] , LoadSubjectsCallback);
	}
  }catch(e)
  {
    
  }

}
function LoadSubjectsCallback(result)
{
	// the xmlhttprequest will return to this function.
    try
    {
	    ShowDivCat("dvGetSubjects");
	    ClearResults();
    	
	    // callback results from Ajax call
	    // we'll assign the inbound DataTable
	    // to the items variable
	    var items = result.value;
	    var count = items.Rows.length;
	    
//	    // we'll create a table object in the DOM
	    var divResults = document.getElementById("dvGetSubjects");
	    var divStyle = document.createElement("style");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode,tablecellBlank,tablecellClose;
    	var iRowCount=0;
    	
//    	var mystyle = document.createElement("style");
//        mystyle.type = "text/css";
//        //mystyle.addRule = "font-family: verdana; font-size: 10pt; color: red";
//        mystyle = head.appendChild(mystyle); 
            
    	//<a href='javascript:void(0)' onclick='javascript:hideread()' ><img src="images/close_icon.gif" border='0'></a>
//    	/*For Close Button*/
//    	tablerow = document.createElement("tr");
//		tablecellClose = document.createElement("td");
//    		    
//		var link=document.createElement("a");
//		link.setAttribute("title","test");
//        link.setAttribute("href",'JavaScript:void(0);');
//        
//        var textNode=document.createTextNode("[X]");
//        link.appendChild(textNode);
//		tablecellClose.onmouseover = function(){this.className='mouseOver';};
//		tablecellClose.onmouseout = function(){this.className='mouseOut';};
//		tablecellClose.setAttribute("border", "0");
//		tablecellClose.onclick = function(){ReplaceInput(this);};
//    	tablecellClose.style.width='10%';
//    	//tablecell.align='right';
//    	tablerow.style.bgcolor='red';
//		tablecellClose.appendChild(link);
//		tablerow.appendChild(tablecellClose);
//		tablebody.appendChild(tablerow);
//		tblTable.appendChild(tablebody);
//		 
//		 tblTable.setAttribute("border", "1");
//		 divResults.appendChild(tblTable);
       MoreCloseRow();
	    // loop through each of the rows in the DataTable
	    for (iRowCount = 0; iRowCount < count; iRowCount++)
	    {
		    var currenttext = items.Rows[iRowCount].Description;
    		SubID=items.Rows[iRowCount].ID;
    		
		    // we'll create each table row and append it to the
		    // table body
		    
		    if(iRowCount < 5)
		    {
		        tablerow = document.createElement("tr");
		        tablecell = document.createElement("td");
		        
		        /*For Blank Cell*/
		        tablecellBlank = document.createElement("td");
    	        tablecellBlank.setAttribute("border", "0");
    	 
			    var link=document.createElement("a");
			    //link.setAttribute("title","test");
                link.setAttribute("href","Categories/SubjectTutor.aspx?EID=" + CatID + "&SID=" + SubID);
                link.style.textDecoration="None";
                link.style.color="#254c4c";
                //link.style.color="black";
                //link.style.fontSize="8pt";
                var textNode=document.createTextNode(currenttext);
                link.appendChild(textNode);
			    tablecell.onmouseover = function(){this.className='mouseOver';};
			    tablecell.onmouseout = function(){this.className='mouseOut';};
			    tablecell.setAttribute("border", "0");
			    tablecell.onclick = function(){ReplaceInput(this);};
    			tablecellBlank.style.width='10%';
    			tblTable.style.align='center';
    			tblTable.setAttribute("border", "0");
    			tblTable.style.width='100%';
    			tablerow.appendChild(tablecellBlank);
			    tablecell.appendChild(link);
		        tablerow.appendChild(tablecell);
		        tablebody.appendChild(tablerow);
		    }
		    
	    }
	    
	    // add the table body to the table
	    tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
	    MoreRow();
	    //divResults.appendChild(link);
	  }catch(E)
	  {
	    //alert(E.Value);
	  }
    }
    
    function MoreRow()
    {
        var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode,tablecellB;
	    
	     tablerow = document.createElement("tr");
		 tablecell = document.createElement("td");
		 tablecellB = document.createElement("td");
		
    	
		var link=document.createElement("a");
		//link.setAttribute("title","Close");
        link.setAttribute("href","Categories/Get_Categories.aspx?Categories=" + CatID);
        link.style.textDecoration="None";
        var textNode=document.createTextNode("more>>");
        link.appendChild(textNode);
        link.style.color="#4b3f33";
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	tblTable.setAttribute("border", "0");
    	 
    	 
    	 tablecellB.setAttribute("border", "0");
    	//var textNode=document.createTextNode('<br/>'); 
    	tablecellB.style.width='90%';
    	//tablecellB.appendChild(textNode); 
    	tablerow.appendChild(tablecellB);  	
		tablecell.appendChild(link);
				
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }
    
    
    function MoreCloseRow()
    {
        var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode,tablecellB;
	    
	     tablerow = document.createElement("tr");
		 tablecell = document.createElement("td");
		 tablecellB = document.createElement("td");
		
    	
		var link=document.createElement("a");
		link.setAttribute("title","Close");
        link.setAttribute("href","JavaScript:void(0);");
        var textNode=document.createTextNode("[X]");
        link.appendChild(textNode);
        link.style.textDecoration="None";
        link.style.color="#4b3f33";
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	tblTable.setAttribute("border", "0");
    	tblTable.setAttribute("align", "right");
    	 
    	 
    	 tablecellB.setAttribute("border", "0");
    	//var textNode=document.createTextNode('<br/>'); 
    	tablecellB.style.width='90%';
    	//tablecellB.appendChild(textNode); 
    	tablerow.appendChild(tablecellB);  	
		tablecell.appendChild(link);
				
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }
    
    
     function CloseDIV()
    {
        var divResults = document.getElementById("dvGetSubjects");
	    var tblTable = document.createElement("table");
	    var tablebody = document.createElement("tbody");
	    var tablerow, tablecell, tablenode,tablecell1;
	    
	    tablerow = document.createElement("tr");
		tablecell = document.createElement("td");
    		    
		var link=document.createElement("a");
		//link.setAttribute("title","test");
        link.setAttribute("href","#");
        
        //link.style.text-decoration='None';
        var textNode=document.createTextNode("[X]");
        link.appendChild(textNode);
		tablecell.onmouseover = function(){this.className='mouseOver';};
		tablecell.onmouseout = function(){this.className='mouseOut';};
		tablecell.setAttribute("border", "0");
		tablecell.onclick = function(){ReplaceInput(this);};
    	tablecell.style.width="100px";
    	tablecell.align='right';
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		
		tblTable.border='1';
		tablecell.appendChild(link);
		tablerow.appendChild(tablecell);
		tablebody.appendChild(tablerow);
		tblTable.appendChild(tablebody);
	   // add the table to the div tag
	    divResults.appendChild(tblTable);
    }

function ReplaceInput(tablecell)
{
	try
	{
	 // alert(tablecell.firstChild.nodeValue);
	    ClearResults();
	    HideDivCat("dvGetSubjects");
	}
	catch(E)
	{
	  //alert(E.value);
	}
	
}

function hideread()
 {
 try
  {
 	document.getElementById("dvGetSubjects").style.display="none";	
  }catch(E)
  {
    //alert(E.Value);
  }
 }
