	/******************************************************************************************************
	 *					 			Code for ajax stuff of homepage
	 * Created on Nov 15, 2008
	 *
	 * @author 	
	 * @company WebMeridian Technologies
	 * @contact www.webmeridian.com
	 * @copyright 2008 All Rights Reserved. Company confidential.
	 *
	 ******************************************************************************************************/

	var ajaxTimeOut;
	var ajaxTime = 900000;	
	var docDepotTimeOut;
	var dvdPubTimeOut;
	
	/**
	  * get document updates
	  */ 
	function getDocUpdatesAjax() 
	{
		var clsname = "docupdate";

		var list = getElementsByClass(clsname, document, "div");
		
		if( list.length == 0 )
		{
			clearTimeout (ajaxTimeOut);
		} else
		{
			for ( var i = 0 ; i < list.length ; i++ )
			{
				divobj = list[i];
				
				var code = divobj.getAttribute('code');
				var updateDivId = clsname;
				
				var httpService = new HTTPService();
				var reqURL = "document_updates_ajax.php";
				httpService.serverAction ( "GET", reqURL, true, "xml=", updatePortletContent, {'id':updateDivId } );
				httpService = null;
			}
			ajaxTimeOut = setTimeout ( 'getDocUpdatesAjax()', ajaxTime );
		}
	}


	/**
	  * get document statistics
	  */ 
	function getDocStatsAjax() 
	{
		var clsname = "docstat";

		var list = getElementsByClass(clsname, document, "div");
		
		if( list.length == 0 )
		{
			clearTimeout (ajaxTimeOut);
		} else
		{
			for ( var i = 0 ; i < list.length ; i++ )
			{
				divobj = list[i];
				
				var code = divobj.getAttribute('code');
				var updateDivId = clsname;
				
				var httpService = new HTTPService();
				var reqURL = "document_stats_ajax.php";
				httpService.serverAction ( "GET", reqURL, true, "xml=", updatePortletContent, {'id':updateDivId } );
				httpService = null;
			}
			ajaxTimeOut = setTimeout ( 'getDocStatsAjax()', ajaxTime );
		}
	}


	/**
	  * get document depot
	  */ 
	function getDocDepotAjax() 
	{
		var clsname = "docdepot";

		var list = getElementsByClass(clsname, document, "div");
		
		if( list.length == 0 )
		{
			clearTimeout (docDepotTimeOut);
		} else
		{
			for ( var i = 0 ; i < list.length ; i++ )
			{
				divobj = list[i];
				
				var updateDivId = clsname;
				
				var httpService = new HTTPService();
				var reqURL = "document_depot_ajax.php";
				httpService.serverAction ( "GET", reqURL, true, "xml=", updatePortletContent, {'id':updateDivId } );
				httpService = null;
			}
			docDepotTimeOut = setTimeout ( 'getDocDepotAjax()', 90000 );
		}
	}

	/**
	  * get document depot
	  */ 
	function getDVDPubAjax() 
	{
		var clsname = "dvdpub";

		var list = getElementsByClass(clsname, document, "div");
		
		if( list.length == 0 )
		{
			clearTimeout (dvdPubTimeOut);
		} else
		{
			for ( var i = 0 ; i < list.length ; i++ )
			{
				divobj = list[i];
				
				var code = divobj.getAttribute('code');
				var updateDivId = clsname;
				
				var httpService = new HTTPService();
				var reqURL = "dvd_publications_ajax.php";
				httpService.serverAction ( "GET", reqURL, true, "xml=", updatePortletContent, {'id':updateDivId } );
				httpService = null;
			}
			dvdPubTimeOut = setTimeout ( 'getDVDPubAjax()', 90000 );
		}
	}

	/* Apr 22, 2009 - WebMeridian rename this method from 'updateLatestNewsAjx()' to 'updatePortletContent()' */
	/*				  for reusability */
	/**
	  *=-----------------------------------------------------------=
	  * updatePortletContent
	  *=-----------------------------------------------------------=
	  * Update portlet content
	  */
	function updatePortletContent(newContent, opt) 
	{
		if( opt )
		{
			if( opt.id )
			{
				document.getElementById(opt.id).innerHTML = newContent;
			}
		}	
	}
	
