// FileName		: importxmlxsl.js
// Description	: necessary funtions for loading xslt processor
// Date			: 15-Apr-08
// Author		: Dominic and Arunachal

function loadXMLDoc(fname)
{
var xmlDoc="";
var x = navigator;
var browserdetails=x.userAgent;
var isie=-1;
var isfirefox=-1;
var issafari=-1;
isie=browserdetails.search(/MSIE/);
isfirefox=browserdetails.search(/Firefox/);
issafari=browserdetails.search(/Safari/);
try
{	if(isie != -1)
	{
	if (window.ActiveXObject)
	{
		var errorHappendHere = "Check Browser and security settings";
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		xmlDoc.load(fname);
		return(xmlDoc);
	}
	}
	else if(isfirefox != -1)
	{

	if (document.implementation && document.implementation.createDocument)
	{

		var errorHappendHere = "Error.";
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.async=false;
		xmlDoc.load(fname);
		return xmlDoc;		
	}
	}
	else if(issafari != -1)
	{
	if(window.XMLHttpRequest)
	{
		var errorHappendHere = "Error handling XMLHttpRequest request";
		var d = new XMLHttpRequest();
		d.open("GET",fname,false);
		d.send(null);
		xmlDoc=d.responseXML;
		return xmlDoc;
	}
	}
}
catch(e)
{
alert(e);
}
}

//This function is called on load of any html page to loa
function displayResult(getfile)
{
xml=loadXMLDoc("../data/sample.xml");
var xsl="";
if(getfile == "fileBlock")
{
	xsl=loadXMLDoc("../pages/fileblock.xsl");

}
else if(getfile == "filelist")
{
	xsl=loadXMLDoc("../pages/filelist.xsl");

}
else if(getfile == "segmentPage")
{
	xsl=loadXMLDoc("../pages/segmentPage.xsl");
}
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("includealldetails").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("includealldetails").appendChild(resultDocument);
  }
  var xmlallowdownload=xml.getElementsByTagName('allowdownload')[0].firstChild.data;
  if(xmlallowdownload=="YES")
  {
  var xmlgetfilenamepath=xml.getElementsByTagName('MediaUri');
  var filename=xmlgetfilenamepath[0].firstChild.data;
  filename=URLDecode(filename);
  var substringstart=filename.lastIndexOf("/");
  var moviename=filename.substr(substringstart+1);
  document.getElementById("download_btn").innerHTML="<a href='../pages/download.php?f="+moviename+"' title='Download'><img src='../images/download_btn.gif' alt='Download' /></a>";
  }
  if(getfile == "fileBlock")
  {
  	populategroupsegments(xml);
  }
}

function populategroupsegments(xml)
{
 var groupsegmentstring="";
 var xmlblock=xml.getElementsByTagName('TemporalDecomposition');
 var groupsegmentlength=xmlblock[0].childNodes.length;
 var flagcheck=0;
 var segmentliststring="";
 var completesegmentstring="";
 var segmentLast="";
 var segmentFirst="";
 var nogroup=0;
 for(igsn=0;igsn < groupsegmentlength;igsn++)
 {
	var checkNodeType=xmlblock[0].childNodes[igsn].nodeType;
	if(checkNodeType == 1)
	{
		var checkGroupOrSegment=xmlblock[0].childNodes[igsn].getAttribute("id");
		var checkgroupsegment=checkGroupOrSegment.search(/GRP/);
	 	if(checkgroupsegment != -1)
	 	{
	 		if(segmentliststring != "")
	 		{
	 			completesegmentstring="<p><span class='startNums'>"+segmentFirst+"</span>";
	 			if(segmentFirst != segmentLast)
	 			{
	 				completesegmentstring=completesegmentstring+"<br/><span class='endNums'>"+segmentLast+"</span></p></div>";
	 			}
	 			else
	 			{
	 				completesegmentstring=completesegmentstring+"</p></div>";
	 			}
	 			completesegmentstring="<div class='group'><div class='col1_large'>"+completesegmentstring+segmentliststring+"</div></div><div class='clearBox'></div></div>";
	 			if(groupsegmentstring != "")
	 			{
	 				groupsegmentstring=groupsegmentstring+completesegmentstring;
	 			}
	 			else
	 			{
	 				groupsegmentstring=completesegmentstring;
	 			}
	 			segmentliststring="";
	 			completesegmentstring="";
	 		}
	 		var groupidlength=parseInt(checkGroupOrSegment.indexOf("GRP-"));
	 		var getgroupid=parseInt(checkGroupOrSegment.substring(groupidlength+4));
	 		var showgroupid=CreateId(getgroupid+1);
	 		
	 		var getsegment=xmlblock[0].childNodes[igsn].getElementsByTagName('TemporalDecomposition');
	 		var checkNumberOfSegment=getsegment[0].childNodes.length;
	 		var getsegmentidstart=getsegment[0].childNodes[0].getAttribute("id");
	 		var getsegidstartlength=parseInt(getsegmentidstart.indexOf("SEG-"));
	 		var getsegidstart=parseInt(getsegmentidstart.substring(getsegidstartlength+4));
	 		var showsegmentidstart=CreateId(getsegidstart+1);
	 		groupsegmentstring=groupsegmentstring+"<div class='group'><div class='col1_large'><p><span class='groupNums' style='padding-right:5px;'><a href='groupBlock.html?groupname="+checkGroupOrSegment+"'>"+showgroupid+"</a></span><span class='startNums'>"+showsegmentidstart+"</span>";
	 		if(checkNumberOfSegment != 1)
	 		{
	 		var getsegmentidlast=getsegment[0].childNodes[checkNumberOfSegment-1].getAttribute("id");
	 		var getsegidlastlength=parseInt(getsegmentidlast.indexOf("SEG-"));
	 		var getsegidlast=parseInt(getsegmentidlast.substring(getsegidlastlength+4));
	 		var showsegmentidlast=CreateId(getsegidlast+1);
	 		if(showsegmentidlast != showsegmentidstart)
	 		{
	 			groupsegmentstring=groupsegmentstring+"<br/><span class='endNums'>"+showsegmentidlast+"</span>";
	 		}	
	 		}
	 		groupsegmentstring=groupsegmentstring+"</p></div><div class='col2_large'><div class='fileBlock'>";
	 		var segmentsstring="";
	 		for(isegmentcount=0;isegmentcount < checkNumberOfSegment;isegmentcount++)
	 		{
	 			var segmentid=getsegment[0].childNodes[isegmentcount].getAttribute("id");
	 			var segmenttitleexist=getsegment[0].childNodes[isegmentcount].childNodes[0].childNodes[0].childNodes[0].firstChild;
	 			var segmenttitle="";
	 			if(segmenttitleexist != null)
	 			{
	 				segmenttitle=getsegment[0].childNodes[isegmentcount].childNodes[0].childNodes[0].childNodes[0].firstChild.data;
	 			}
	 			else
	 			{
	 				segmenttitle="";
	 			}
	 			groupsegmentstring=groupsegmentstring+"<div class='imgBoxSeg' onMouseOver=\"overdiv=1; popLayer(this,\'"+segmentid+"\',\'"+segmenttitle+"\',2)\" onMouseOut=\"overdiv=0;setTimeout(\'hideLayer()\',2000)\">";
	 			groupsegmentstring=groupsegmentstring+"<a href='#' onclick=\"return GB_show('../pages/segmentvideos.php?segmentid="+segmentid+"',480,700)\">"
	 			var getSegmentImageexist=getsegment[0].childNodes[isegmentcount].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].firstChild;
	 			if(getSegmentImageexist != null)
	 			{
	 				var getSegmentImage=getsegment[0].childNodes[isegmentcount].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].firstChild.data;
	 				var getimageposition=getSegmentImage.indexOf("/");
	 				getSegmentImage=getSegmentImage.substring(getimageposition+1);
	 				groupsegmentstring=groupsegmentstring+"<img src='../thumbnails/"+getSegmentImage+"' width='100%' height='100%'/></a>";
	 			}
	 			else
	 			{
	 				groupsegmentstring=groupsegmentstring+"<img src='../thumbnails/transparent.png' width='100%' height='100%'/></a>";
	 			}
	 		    groupsegmentstring=groupsegmentstring+"</div>";
	 		}
	 			groupsegmentstring=groupsegmentstring+"</div></div><div class='clearBox'></div></div>";
	 			nogroup=1;
	 	}
	 	else
	 	{
	 		var getsegidlength=parseInt(checkGroupOrSegment.indexOf("SEG-"));
	 		var getsegid=parseInt(checkGroupOrSegment.substring(getsegidlength+4));
	 		var showsegmentid=CreateId(getsegid+1);
	 		var segmenttitle="";
	 		var segmenttitleexist=xmlblock[0].childNodes[igsn].childNodes[0].childNodes[0].childNodes[0].firstChild;
	 		if(segmenttitleexist != null)
	 		{
	 			segmenttitle=xmlblock[0].childNodes[igsn].childNodes[0].childNodes[0].childNodes[0].firstChild.data;
	 		}
	 		else
	 		{
	 			segmenttitle="";
	 		}
	 		var segmentImageExist=xmlblock[0].childNodes[igsn].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].firstChild;
	 		var segmentImage="";
	 		if(segmentImageExist != null)
	 		{
	 			segmentImage=xmlblock[0].childNodes[igsn].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].firstChild.data;
	 			var segmentimageposition=segmentImage.indexOf("/");
	 			segmentImage=segmentImage.substring(segmentimageposition+1);
	 		}
	 		else
	 		{
	 			segmentImage="";
	 		}
	 		if(segmentliststring == "")
	 		{
	 			segmentFirst=showsegmentid;
	 			segmentliststring="<div class='col2_large'><div  class='fileBlock'>";
	 		}
	 			segmentliststring=segmentliststring+"<div class='imgBoxSeg' onMouseOver=\"overdiv=1; popLayer(this,\'"+checkGroupOrSegment+"\',\'"+segmenttitle+"\',2)\" onMouseOut=\"overdiv=0; setTimeout(\'hideLayer()\',2000)\"><a href='#' onclick=\"return GB_show('../pages/segmentvideos.php?segmentid="+checkGroupOrSegment+"',480,700)\">";
	 			if(segmentImageExist != null)
	 			{
	 				segmentliststring=segmentliststring+"<img src='../thumbnails/"+segmentImage+"' width='100%' height='100%'/></a>";
	 			}
	 			else
	 			{
	 				segmentliststring=segmentliststring+"<img src='../thumbnails/transparent.png' width='100%' height='100%'/></a>";
	 			}
	 		segmentliststring=segmentliststring+"</div>";
	 		segmentLast=showsegmentid;
	 		nogroup=0;
	 	}
 	}
 }
 if(nogroup == 0)
 {
 	if(segmentliststring != "")
	{
		completesegmentstring="<p><span class='startNums'>"+segmentFirst+"</span>";
		if(segmentFirst != segmentLast)
		{
			completesegmentstring=completesegmentstring+"<br/><span class='endNums'>"+segmentLast+"</span></p></div>";
		}
		else
		{
			completesegmentstring=completesegmentstring+"</p></div>";
		}
		completesegmentstring="<div class='group'><div class='col1_large'>"+completesegmentstring+segmentliststring+"</div></div><div class='clearBox'></div></div>";
		if(groupsegmentstring != "")
		{
			groupsegmentstring=groupsegmentstring+completesegmentstring;
		}
		else
		{
			groupsegmentstring=completesegmentstring;
		}
		segmentliststring="";
		completesegmentstring="";
	}
 }
document.getElementById("groupsegmentdetails").innerHTML=groupsegmentstring;
}

function CreateId(getid)
{
	if(getid < 10)
	{
		return("000"+getid);
	}
	else if(getid < 100)
	{
		return("00"+getid);
	}
	else if(getid < 1000)
	{
		return("0"+getid);
	}
	else
	{
		return(getid);
	}
}


function insertfilename()
{
	var xmldom=loadXMLDoc("../data/sample.xml");
	var xmlgetfilenamepath=xmldom.getElementsByTagName('MediaUri');
	var filename=xmlgetfilenamepath[0].firstChild.data;
	filename=URLDecode(filename);
	var substringstart=filename.lastIndexOf("/");
	var substringend=filename.lastIndexOf(".");
	var finalfilename=filename.substr((substringstart+1),(substringend-(substringstart+1)));
	finalfilename=finalfilename.substr(0,60);
	document.getElementById("filename").innerHTML=finalfilename;
}

function URLDecode(encoded)
{
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};



function loadgroupvideos(videogroupid,checkiffileexist)
{
if(videogroupid=="undefined")
{
	document.location.href="fileBlock.html"
}
else
{
	if (window.ActiveXObject)
	{
		try
		{
		videogroupid=""+videogroupid;
		// instantiate and load the xml document
 		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.load("../data/sample.xml");	
		// instantiate and load the xsl document
		xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
		xslDoc.async = false;
		xslDoc.load("groupvideos.xsl");
		// prepare the xsl document for transformation
		docCache = new ActiveXObject("MSXML2.XSLTemplate");
		docCache.stylesheet=xslDoc;
		// instantiate the document processor and submit the xml document
		docProcessor = docCache.createProcessor();
		docProcessor.input = xmlDoc;
		docProcessor.addParameter("xsltvideogroupid",videogroupid,"");
		docProcessor.addParameter("xsltcheckiffileexist",checkiffileexist,"");
		// process the documents into html and submit to the passed div to the HMTL page
		docProcessor.transform();
		// divID.innerHTML = docProcessor.output;
		document.getElementById("divincludegroupdetails").innerHTML = docProcessor.output;
		}
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	else
	{
		try
		{
		// instantiate and load the xml document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","../data/sample.xml",false);
		docRequest.send(null);
		xmlDoc = docRequest.responseXML;
		// instantiate and load the xsl document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","groupvideos.xsl",false);
		docRequest.send(null);
		xslDoc = docRequest.responseXML;
		// instantiate the document processor and submit the xsl document
		docProcessor = new XSLTProcessor();
		docProcessor.importStylesheet(xslDoc);
		// add parameters to the xsl document
		docProcessor.setParameter(null, "xsltvideogroupid", videogroupid);
		docProcessor.setParameter(null, "xsltcheckiffileexist", checkiffileexist);
		// clear the passed div if anything was in it
		document.getElementById("divincludegroupdetails").innerHTML = "";
		// process the documents into html and submit to the passed div to the HMTL page
		docFragment = docProcessor.transformToFragment(xmlDoc, document);
		document.getElementById("divincludegroupdetails").appendChild(docFragment);
		}
		// catch any errors from the above code
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	
}
}

function loadsegmentvideos(videosegmentid,checkiffileexist)
{
if(videosegmentid=="undefined")
{
	document.location.href="fileBlock.html"
}
else
{
	if (window.ActiveXObject)
	{
		try
		{
		videosegmentid=""+videosegmentid;
		// instantiate and load the xml document
 		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.load("../data/sample.xml");	
		// instantiate and load the xsl document
		xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
		xslDoc.async = false;
		xslDoc.load("segmentvideos.xsl");
		// prepare the xsl document for transformation
		docCache = new ActiveXObject("MSXML2.XSLTemplate");
		docCache.stylesheet=xslDoc;
		// instantiate the document processor and submit the xml document
		docProcessor = docCache.createProcessor();
		docProcessor.input = xmlDoc;
		docProcessor.addParameter("xsltvideosegmentid",videosegmentid,"");
		docProcessor.addParameter("xsltcheckiffileexist",checkiffileexist,"");
		// process the documents into html and submit to the passed div to the HMTL page
		docProcessor.transform();
		// divID.innerHTML = docProcessor.output;
		document.getElementById("divincludesegmentdetails").innerHTML = docProcessor.output;
		}
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	else
	{
		try
		{
		// instantiate and load the xml document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","../data/sample.xml",false);
		docRequest.send(null);
		xmlDoc = docRequest.responseXML;
		// instantiate and load the xsl document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","segmentvideos.xsl",false);
		docRequest.send(null);
		xslDoc = docRequest.responseXML;
		// instantiate the document processor and submit the xsl document
		docProcessor = new XSLTProcessor();
		docProcessor.importStylesheet(xslDoc);
		// add parameters to the xsl document
		docProcessor.setParameter(null, "xsltvideosegmentid", videosegmentid);
		docProcessor.setParameter(null, "xsltcheckiffileexist", checkiffileexist);
		// clear the passed div if anything was in it
		document.getElementById("divincludesegmentdetails").innerHTML = "";
		// process the documents into html and submit to the passed div to the HMTL page
		docFragment = docProcessor.transformToFragment(xmlDoc, document);
		document.getElementById("divincludesegmentdetails").appendChild(docFragment);
		}
		// catch any errors from the above code
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	
}
}

function loadSegment(videosegmentid)
{
if(videosegmentid=="undefined")
{
document.location.href="fileBlock.html";
}
else
{
if (window.ActiveXObject)
	{
		try
		{
		videosegmentid=""+videosegmentid;
		// instantiate and load the xml document
 		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.load("../data/sample.xml");	
		// instantiate and load the xsl document
		xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
		xslDoc.async = false;
		xslDoc.load("segmentPage.xsl");
		// prepare the xsl document for transformation
		docCache = new ActiveXObject("MSXML2.XSLTemplate");
		docCache.stylesheet=xslDoc;
		// instantiate the document processor and submit the xml document
		docProcessor = docCache.createProcessor();
		docProcessor.input = xmlDoc;
		docProcessor.addParameter("xsltvideosegmentid",videosegmentid,"");
		// process the documents into html and submit to the passed div to the HMTL page
		docProcessor.transform();
		// divID.innerHTML = docProcessor.output;
		//document.getElementById("wrapper").innerHTML = docProcessor.output;
		document.write(docProcessor.output);
		}
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	else
	{
		try
		{
		// instantiate and load the xml document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","../data/sample.xml",false);
		docRequest.send(null);
		xmlDoc = docRequest.responseXML;
		// instantiate and load the xsl document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","segmentPage.xsl",false);
		docRequest.send(null);
		xslDoc = docRequest.responseXML;
		// instantiate the document processor and submit the xsl document
		docProcessor = new XSLTProcessor();
		docProcessor.importStylesheet(xslDoc);
		// add parameters to the xsl document
		docProcessor.setParameter(null, "xsltvideosegmentid", videosegmentid);
		// clear the passed div if anything was in it
		document.getElementById("wrapper").innerHTML = "";
		// process the documents into html and submit to the passed div to the HMTL page
		docFragment = docProcessor.transformToFragment(xmlDoc, document);
		document.getElementById("wrapper").appendChild(docFragment);
		}
		// catch any errors from the above code
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	var textkeywords="";
	var textwho="";
	var textwhat="";
	var textthread="";
	var textevent="";
	var textplace="";
	var texttime="";
	var xmldom=loadXMLDoc("../data/sample.xml");
	var xmlgetfilenamepath=xmldom.getElementsByTagName('TemporalDecomposition');
	var xmlgetDescription=xmldom.getElementsByTagName('Description');
	var xmldescription="";
	var numofdescription=xmlgetDescription[0].childNodes.length;
	for(iindexdescription=0;iindexdescription <= numofdescription;iindexdescription++)
	{
		var checkdescription=xmlgetDescription[iindexdescription].childNodes[0].tagName;
		if(checkdescription == "ClassificationScheme")
		{
			xmldescription=xmlgetDescription[iindexdescription].childNodes[0];
		}
	}
	var numberofsegrp=parseInt(xmlgetfilenamepath[0].childNodes.length);
	var iindexcheck=0;
	for(iindex=0;iindex < numberofsegrp;iindex++)
	{
		var checknodeexist=xmlgetfilenamepath[0].childNodes[iindex].nodeType;
		if(checknodeexist == 1)
		{
		var checkidexist=xmlgetfilenamepath[0].childNodes[iindex].getAttribute("id");
		var checkgroupexist=checkidexist.search(/GRP/);
		if(checkgroupexist != -1)
		{
			var getsegmentfromgroup=xmlgetfilenamepath[0].childNodes[iindex].getElementsByTagName('TemporalDecomposition');
			var checksegmentcount=getsegmentfromgroup[0].childNodes.length;
			for(iindexsegment=0;iindexsegment < checksegmentcount;iindexsegment++)
			{
				checkidexist=getsegmentfromgroup[0].childNodes[iindexsegment].getAttribute("id");
				if(checkidexist==videosegmentid)
				{
				xmlgetfilenamepath=getsegmentfromgroup;
				iindexcheck=iindexsegment;
				break;
				}
			}
		}
		else
		{
			iindexcheck=iindex;
		}
		if(checkidexist==videosegmentid)
		{
			var checktextannotationcount=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes.length;
			for(iindexnext=0;iindexnext < checktextannotationcount;iindexnext++)
			{
				var checkannotation=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].tagName;
				if(checkannotation=='TextAnnotation')
				{
				    var gettype=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].getAttribute("type");
				    if(((parseInt(gettype.indexOf(":literal"))) > 0) || ((parseInt(gettype.indexOf(":concept"))) > 0))
				    {
				    	if(textkeywords=="")
				    	{
				    		textkeywords=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}
				    	else
				    	{
				    		textkeywords+=", "+xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}	
				    }
				   var checkannotationlist=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].childNodes[0].tagName;
				   if(checkannotationlist=="StructuredAnnotation")
				   {
				    	var checkannotationattribute=xmlgetfilenamepath[0].childNodes[iindexcheck].childNodes[iindexnext].childNodes[0].childNodes[0].getAttribute("href");
				    	var checkindexof=(parseInt(checkannotationattribute.lastIndexOf(":who:")));
				    	if(checkindexof > 0)
				    	{
				    		var whoindex=checkannotationattribute.substr((checkindexof+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhoelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhoelement == "Characters")
				    			{
				    				if(whoindex <= 9)
				    				{
				    				var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    				for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    				{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    				}
				    				}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexwhat=(parseInt(checkannotationattribute.lastIndexOf(":whatobject:")));
				    	if(checkindexwhat > 0)
				    	{
				    		var whatindex=checkannotationattribute.substr((checkindexwhat+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatelement == "Objects")
				    			{
				    				if(whatindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexthread=(parseInt(checkannotationattribute.lastIndexOf(":why:")));
				    	if(checkindexthread > 0)
				    	{
				    		var whyindex=checkannotationattribute.substr((checkindexthread+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhyelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhyelement == "Threads")
				    			{
				    				if(whyindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexevent=(parseInt(checkannotationattribute.lastIndexOf(":whataction:")));
				    	if(checkindexevent > 0)
				    	{
				    		var whatactionindex=checkannotationattribute.substr((checkindexevent+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatactionelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatactionelement == "Events")
				    			{
				    				if(whatactionindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexplace=(parseInt(checkannotationattribute.lastIndexOf(":where:")));
				    	if(checkindexplace > 0)
				    	{
				    		var whereindex=checkannotationattribute.substr((checkindexplace+7));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhereelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhereelement == "Locations")
				    			{
				    				if(whereindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindextime=(parseInt(checkannotationattribute.lastIndexOf(":when:")));
				    	if(checkindextime > 0)
				    	{
				    		var whenindex=checkannotationattribute.substr((checkindextime+6));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhenelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhenelement == "Narrative Time")
				    			{
				    				if(whenindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    				    	
				    	}
				    	
				    }
				    
				  }
			break;	 
			}
			}
		}
		document.getElementById("spnKeyword").innerHTML=textkeywords.substr(0,90);
		document.getElementById("spnWho").innerHTML=textwho.substr(0,90);
		document.getElementById("spnWhat").innerHTML=textwhat.substr(0,90);
		document.getElementById("spnThread").innerHTML=textthread.substr(0,90);
		document.getElementById("spnEvent").innerHTML=textevent.substr(0,90);
		document.getElementById("spnWhere").innerHTML=textplace.substr(0,90);
		document.getElementById("spnTime").innerHTML=texttime.substr(0,90);
}
}



function loadGroup(videogrouptid)
{
if(videogrouptid=="undefined")
{
document.location.href="fileBlock.html";
}
else
{
	if (window.ActiveXObject)
	{
		try
		{
		videogrouptid=""+videogrouptid;
		// instantiate and load the xml document
 		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.load("../data/sample.xml");	
		// instantiate and load the xsl document
		xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
		xslDoc.async = false;
		xslDoc.load("groupBlock.xsl");
		// prepare the xsl document for transformation
		docCache = new ActiveXObject("MSXML2.XSLTemplate");
		docCache.stylesheet=xslDoc;
		// instantiate the document processor and submit the xml document
		docProcessor = docCache.createProcessor();
		docProcessor.input = xmlDoc;
		docProcessor.addParameter("xsltvideosegmentid",videogrouptid,"");
		// process the documents into html and submit to the passed div to the HMTL page
		docProcessor.transform();
		// divID.innerHTML = docProcessor.output;
		document.write(docProcessor.output);
		}
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	else
	{
		try
		{
		// instantiate and load the xml document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","../data/sample.xml",false);
		docRequest.send(null);
		xmlDoc = docRequest.responseXML;
		// instantiate and load the xsl document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","groupBlock.xsl",false);
		docRequest.send(null);
		xslDoc = docRequest.responseXML;
		// instantiate the document processor and submit the xsl document
		docProcessor = new XSLTProcessor();
		docProcessor.importStylesheet(xslDoc);
		// add parameters to the xsl document
		docProcessor.setParameter(null, "xsltvideosegmentid", videogrouptid);
		// clear the passed div if anything was in it
		document.getElementById("wrapper").innerHTML = "";
		// process the documents into html and submit to the passed div to the HMTL page
		docFragment = docProcessor.transformToFragment(xmlDoc, document);
		document.getElementById("wrapper").appendChild(docFragment);
		}
		// catch any errors from the above code
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	var textkeywords="";
	var textwho="";
	var textwhat="";
	var textthread="";
	var textevent="";
	var textplace="";
	var texttime="";
	var xmldom=loadXMLDoc("../data/sample.xml");
	var xmlgetfilenamepath=xmldom.getElementsByTagName('TemporalDecomposition');
	var xmlgetDescription=xmldom.getElementsByTagName('Description');
	var xmldescription="";
	var numofdescription=xmlgetDescription[0].childNodes.length;
	for(iindexdescription=0;iindexdescription <= numofdescription;iindexdescription++)
	{
		var checkdescription=xmlgetDescription[iindexdescription].childNodes[0].tagName;
		if(checkdescription == "ClassificationScheme")
		{
			xmldescription=xmlgetDescription[iindexdescription].childNodes[0];
		}
	}
	var numberofsegrp=parseInt(xmlgetfilenamepath[0].childNodes.length);
	for(iindex=0;iindex < numberofsegrp;iindex++)
	{
		var checknodeexist=xmlgetfilenamepath[0].childNodes[iindex].nodeType;
		if(checknodeexist == 1)
		{
		var checkidexist=xmlgetfilenamepath[0].childNodes[iindex].getAttribute("id");
		if(checkidexist==videogrouptid)
		{
			var checktextannotationcount=xmlgetfilenamepath[0].childNodes[iindex].childNodes.length;
			for(iindexnext=0;iindexnext < checktextannotationcount;iindexnext++)
			{
				var checkannotation=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].tagName;
				if(checkannotation=='TextAnnotation')
				{
				    var gettype=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].getAttribute("type");
				    if(((parseInt(gettype.indexOf(":literal"))) > 0) || ((parseInt(gettype.indexOf(":concept"))) > 0))
				    {
				    	if(textkeywords=="")
				    	{
				    		textkeywords=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}
				    	else
				    	{
				    		textkeywords+=", "+xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}	
				    }
				   var checkannotationlist=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].tagName;
				   if(checkannotationlist=="StructuredAnnotation")
				   {
				    	var checkannotationattribute=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].getAttribute("href");
				    	var checkindexof=(parseInt(checkannotationattribute.lastIndexOf(":who:")));
				    	if(checkindexof > 0)
				    	{
				    		var whoindex=checkannotationattribute.substr((checkindexof+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhoelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhoelement == "Characters")
				    			{
				    				if(whoindex <= 9)
				    				{
				    				var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    				for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    				{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    				}
				    				}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexwhat=(parseInt(checkannotationattribute.lastIndexOf(":whatobject:")));
				    	if(checkindexwhat > 0)
				    	{
				    		var whatindex=checkannotationattribute.substr((checkindexwhat+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatelement == "Objects")
				    			{
				    				if(whatindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexthread=(parseInt(checkannotationattribute.lastIndexOf(":why:")));
				    	if(checkindexthread > 0)
				    	{
				    		var whyindex=checkannotationattribute.substr((checkindexthread+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhyelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhyelement == "Threads")
				    			{
				    				if(whyindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexevent=(parseInt(checkannotationattribute.lastIndexOf(":whataction:")));
				    	if(checkindexevent > 0)
				    	{
				    		var whatactionindex=checkannotationattribute.substr((checkindexevent+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatactionelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatactionelement == "Events")
				    			{
				    				if(whatactionindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexplace=(parseInt(checkannotationattribute.lastIndexOf(":where:")));
				    	if(checkindexplace > 0)
				    	{
				    		var whereindex=checkannotationattribute.substr((checkindexplace+7));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhereelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhereelement == "Locations")
				    			{
				    				if(whereindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindextime=(parseInt(checkannotationattribute.lastIndexOf(":when:")));
				    	if(checkindextime > 0)
				    	{
				    		var whenindex=checkannotationattribute.substr((checkindextime+6));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhenelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhenelement == "Narrative Time")
				    			{
				    				if(whenindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    				    	
				    	}
				    	
				    }
				    
				  }
			break;	 
			}
			}
		}
		document.getElementById("spnKeyword").innerHTML=textkeywords.substr(0,90);
		document.getElementById("spnWho").innerHTML=textwho.substr(0,90);
		document.getElementById("spnWhat").innerHTML=textwhat.substr(0,90);
		document.getElementById("spnThread").innerHTML=textthread.substr(0,90);
		document.getElementById("spnEvent").innerHTML=textevent.substr(0,90);
		document.getElementById("spnWhere").innerHTML=textplace.substr(0,90);
		document.getElementById("spnTime").innerHTML=texttime.substr(0,90);
	}	
}


function loadGroup2(videogrouptid)
{
if(videogrouptid=="undefined")
{
	document.location.href="fileBlock.html";
}
else
{
	if (window.ActiveXObject)
	{
		try
		{
		videogrouptid=""+videogrouptid;
		// instantiate and load the xml document
 		xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.load("../data/sample.xml");	
		// instantiate and load the xsl document
		xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
		xslDoc.async = false;
		xslDoc.load("groupList.xsl");
		// prepare the xsl document for transformation
		docCache = new ActiveXObject("MSXML2.XSLTemplate");
		docCache.stylesheet=xslDoc;
		// instantiate the document processor and submit the xml document
		docProcessor = docCache.createProcessor();
		docProcessor.input = xmlDoc;
		docProcessor.addParameter("xsltvideosegmentid",videogrouptid,"");
		// process the documents into html and submit to the passed div to the HMTL page
		docProcessor.transform();
		// divID.innerHTML = docProcessor.output;
		//document.getElementById("wrapper").innerHTML = docProcessor.output;
		document.write(docProcessor.output);
		}
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	else
	{
		try
		{
		// instantiate and load the xml document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","../data/sample.xml",false);
		docRequest.send(null);
		xmlDoc = docRequest.responseXML;
		// instantiate and load the xsl document
		docRequest = new XMLHttpRequest();
		docRequest.open("GET","groupList.xsl",false);
		docRequest.send(null);
		xslDoc = docRequest.responseXML;
		// instantiate the document processor and submit the xsl document
		docProcessor = new XSLTProcessor();
		docProcessor.importStylesheet(xslDoc);
		// add parameters to the xsl document
		docProcessor.setParameter(null, "xsltvideosegmentid", videogrouptid);
		// clear the passed div if anything was in it
		document.getElementById("wrapper").innerHTML = "";
		// process the documents into html and submit to the passed div to the HMTL page
		docFragment = docProcessor.transformToFragment(xmlDoc, document);
		document.getElementById("wrapper").appendChild(docFragment);
		}
		// catch any errors from the above code
		catch(e)
		{
			alert("Error found in:"+e);
		}
	}
	var textkeywords="";
	var textwho="";
	var textwhat="";
	var textthread="";
	var textevent="";
	var textplace="";
	var texttime="";
	var xmldom=loadXMLDoc("../data/sample.xml");
	var xmlgetfilenamepath=xmldom.getElementsByTagName('TemporalDecomposition');
	var xmlgetDescription=xmldom.getElementsByTagName('Description');
	var xmldescription="";
	var numofdescription=xmlgetDescription[0].childNodes.length;
	for(iindexdescription=0;iindexdescription <= numofdescription;iindexdescription++)
	{
		var checkdescription=xmlgetDescription[iindexdescription].childNodes[0].tagName;
		if(checkdescription == "ClassificationScheme")
		{
			xmldescription=xmlgetDescription[iindexdescription].childNodes[0];
		}
	}
	var numberofsegrp=parseInt(xmlgetfilenamepath[0].childNodes.length);
	for(iindex=0;iindex < numberofsegrp;iindex++)
	{
		var checknodeexist=xmlgetfilenamepath[0].childNodes[iindex].nodeType;
		if(checknodeexist == 1)
		{
		var checkidexist=xmlgetfilenamepath[0].childNodes[iindex].getAttribute("id");
		if(checkidexist==videogrouptid)
		{
			var checktextannotationcount=xmlgetfilenamepath[0].childNodes[iindex].childNodes.length;
			for(iindexnext=0;iindexnext < checktextannotationcount;iindexnext++)
			{
				var checkannotation=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].tagName;
				if(checkannotation=='TextAnnotation')
				{
				    var gettype=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].getAttribute("type");
				    if(((parseInt(gettype.indexOf(":literal"))) > 0) || ((parseInt(gettype.indexOf(":concept"))) > 0))
				    {
				    	if(textkeywords=="")
				    	{
				    		textkeywords=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}
				    	else
				    	{
				    		textkeywords+=", "+xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].firstChild.data;
				    	}	
				    }
				   var checkannotationlist=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].tagName;
				   if(checkannotationlist=="StructuredAnnotation")
				   {
				    	var checkannotationattribute=xmlgetfilenamepath[0].childNodes[iindex].childNodes[iindexnext].childNodes[0].childNodes[0].getAttribute("href");
				    	var checkindexof=(parseInt(checkannotationattribute.lastIndexOf(":who:")));
				    	if(checkindexof > 0)
				    	{
				    		var whoindex=checkannotationattribute.substr((checkindexof+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhoelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhoelement == "Characters")
				    			{
				    				if(whoindex <= 9)
				    				{
				    				var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    				for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    				{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    				}
				    				}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwho=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":who:"))+5));
				    					if(getsubstringwho==whoindex)
				    					{
				    						if(textwho=="")
				    						{
				    							textwho=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwho+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexwhat=(parseInt(checkannotationattribute.lastIndexOf(":whatobject:")));
				    	if(checkindexwhat > 0)
				    	{
				    		var whatindex=checkannotationattribute.substr((checkindexwhat+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatelement == "Objects")
				    			{
				    				if(whatindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhat=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whatobject:"))+12));
				    					if(getsubstringwhat==whatindex)
				    					{
				    						if(textwhat=="")
				    						{
				    							textwhat=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textwhat+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexthread=(parseInt(checkannotationattribute.lastIndexOf(":why:")));
				    	if(checkindexthread > 0)
				    	{
				    		var whyindex=checkannotationattribute.substr((checkindexthread+5));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhyelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhyelement == "Threads")
				    			{
				    				if(whyindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhy=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":why:"))+5));
				    					if(getsubstringwhy==whyindex)
				    					{
				    						if(textthread=="")
				    						{
				    							textthread=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textthread+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexevent=(parseInt(checkannotationattribute.lastIndexOf(":whataction:")));
				    	if(checkindexevent > 0)
				    	{
				    		var whatactionindex=checkannotationattribute.substr((checkindexevent+12));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhatactionelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhatactionelement == "Events")
				    			{
				    				if(whatactionindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhataction=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":whataction:"))+12));
				    					if(getsubstringwhataction==whatactionindex)
				    					{
				    						if(textevent=="")
				    						{
				    							textevent=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textevent+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindexplace=(parseInt(checkannotationattribute.lastIndexOf(":where:")));
				    	if(checkindexplace > 0)
				    	{
				    		var whereindex=checkannotationattribute.substr((checkindexplace+7));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhereelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhereelement == "Locations")
				    			{
				    				if(whereindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhere=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":where:"))+7));
				    					if(getsubstringwhere==whereindex)
				    					{
				    						if(textplace=="")
				    						{
				    							textplace=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							textplace+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    	var checkindextime=(parseInt(checkannotationattribute.lastIndexOf(":when:")));
				    	if(checkindextime > 0)
				    	{
				    		var whenindex=checkannotationattribute.substr((checkindextime+6));
				    		var checktermlength=xmldescription.childNodes.length;
				    		for(indexterm=0;indexterm < checktermlength;indexterm++)
				    		{
				    			var checkwhenelement=xmldescription.childNodes[indexterm].childNodes[0].firstChild.data;
				    			if(checkwhenelement == "Narrative Time")
				    			{
				    				if(whenindex <= 9)
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[1].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					
				    					}
				    					}
				    				else
				    				{
				    					var gettremlength=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes.length;
				    					for(incrementtrem=0;incrementtrem < gettremlength;incrementtrem++)
				    					{
				    					var gettremattribute=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].getAttribute("termID");
				    					var getsubstringwhen=parseInt(gettremattribute.substr((gettremattribute.lastIndexOf(":when:"))+6));
				    					if(getsubstringwhen==whenindex)
				    					{
				    						if(texttime=="")
				    						{
				    							texttime=xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    						else
				    						{
				    							texttime+=", "+xmldescription.childNodes[indexterm].childNodes[2].childNodes[0].childNodes[incrementtrem].childNodes[0].firstChild.data;
				    						}
				    					}
				    					}
				    				}
				    			}
				    		}
				    	}
				    				    	
				    	}
				    	
				    }
				    
				  }
			break;	 
			}
			}
		}
		document.getElementById("spnKeyword").innerHTML=textkeywords.substr(0,90);
		document.getElementById("spnWho").innerHTML=textwho.substr(0,90);
		document.getElementById("spnWhat").innerHTML=textwhat.substr(0,90);
		document.getElementById("spnThread").innerHTML=textthread.substr(0,90);
		document.getElementById("spnEvent").innerHTML=textevent.substr(0,90);
		document.getElementById("spnWhere").innerHTML=textplace.substr(0,90);
		document.getElementById("spnTime").innerHTML=texttime.substr(0,90);
}
}

function loadcompletevideo(checkifvideoexist)
{
xml=loadXMLDoc("../data/sample.xml");
var xsl=loadXMLDoc("../pages/showcompletevideo.xsl");
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("wrapper").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("wrapper").appendChild(resultDocument);
  }
  insertfilename();
  var xmlgetfilenamepath=xml.getElementsByTagName('MediaUri');
  var filename=xmlgetfilenamepath[0].firstChild.data;
  filename=URLDecode(filename);
  var substringstart=filename.lastIndexOf("/");
  var moviename=filename.substr(substringstart+1);
  if(checkifvideoexist == "yes")
  {
  	document.getElementById("screen").innerHTML="<embed src='../video/"+moviename+"' width='695' height='370' autoplay='false' autostart='false' controller='true' bgcolor='#000000' CONTROLS='CONSOLE' KIOSKMODE='True' scale='aspect'/>";
  }
  else
  {
  	document.getElementById("screen").innerHTML="<img src='../FileImages/Seg-0.jpg' width='695' height='370'/>";
  }
}

