	/**
	 * Javascript libraries to send the command to proxy
	 * This file will communicate to the flash proxy and return the data
	 * 
	 * @author Akbar Khrisna
	 * @copyright Copyright: Noterik B.V. 2009
	 * @access private
	 * @name /js/handler.js
	 * @version $Id: /js/handler.js,v 1.95 2009-05-19 12:33:26 khris Exp $ 
	 */
	
	/**
	 * Function to send command to the flash proxy
	 *
	 * @author Daniel Ockeloen
	 * @copyright Copyright: Noterik B.V. 2008
	 * @access private
	 * @param value1
	 * @param value2
	 * @version $Id: handler.js,v 1.431 2009-06-02 12:14:32 khris Exp $
	 */
	function sendToActionScript(value1,value2) 
	{
        try {
        	the_movie("player").sendToActionScript(value1,value2);
        } catch(error) {
        	alert (error)
        }
    }

	/**
	 * Function to send result to html page and load initial page
	 *
	 * @author Daniel Ockeloen
	 * @copyright Copyright: Noterik B.V. 2008
	 * @access private
	 * @param value
	 * @version $Id: handler.js,v 1.431 2009-06-02 12:14:32 khris Exp $
	 */
	function sendToJavaScript(value) 
	{
    	if (value.indexOf("ready")==0) 
    	{              
    		 // load the initial content
    		 if(firsttime == 'true') { this[startFunction](); firsttime = "false";} 
    	} 
    	else 
    	{
			// get the correct child
			var pos = value.indexOf("<");
			var target = value.substring(0,pos-1);
			var xml = stringToXML(value.substring(pos));
			var parts =target.split('/');				
			
			/* check for callback function, otherwise (default) template parser */
			if (parts.length > 3) {
				var fn = window[parts[3]];
				if(typeof fn !== 'function') {
       				return;
       			}
    			fn.apply(window, new Array(xml, target));
			} else {			
				var numresults = $(xml).find(type).length;	
				var scroll_length = numresults * 157; var scroll = scroll_length+"px";
				var returnedresult = $(xml).find('totalResultsReturned').text();
				var allresult = $(xml).find('totalResultsAvailable').text();
				var startresult = $(xml).find("start:first").text();
				
				
				// parse the result		
				parse(xml, parts[1], parts[2]);
				
				// set info
				if(type == "collection") {
					loadcollectionpresentation();
					highlightcollection();
				} else if(type == "presentation"){
					if(startresult == "0") { $('#start').html("1"); } else { $('#start').html(startresult); } 
					$('#limit').html(parseInt(returnedresult)+parseInt(startresult));
					$('#total').html(allresult);
					numpages = $(xml).find('numberofpages').text();
				}
			}
		}
 	}
