
/*
	Script: cputilV2.js
	- Implementation of AJAX call to render Command News resource.
*/

	/// <summary>
	/// load_url( url ) - Will pass the Command News Publisher link to the
	/// BC Women's Hospital display page.
	/// </summary>
	function load_url(url)
	{
		window.location.href = "news_stories.php?yws_path=" + url;
	}

	/// <summary>
	/// load_url() - Will use a AJAX (XMLHTTPRequest) request to obtain CommandNews
	/// resource and populate html formated text into resourceContent div.
	/// </summary>
	function getURL()
	{
		// Get Command News Publisher link from query string.
		var url = getParam('yws_path');
		
		//Set url for proxy AJAX call.
		var proxy = "proxy.php?yws_path=" + url;

		//Use AJAX call to query proxy file and return Command News Publisher content.
		var myAjax = new Ajax(proxy, {method: 'get', update: 'resourceContent', onComplete: complete });
		myAjax.request();	
	}

	/// <summary>
	/// getParam(param) - Will retrieve specified parameter from query string.
	/// </summary>
	function getParam(param) 
	{
		var query = window.location.search.substring(1); 
		var vars = query.split("&");

		for (var i=0;i<vars.length;i++)
		{
			var pair = vars[i].split("="); 

			if (pair[0] == param)
				return pair[1];
		}
  	} 


	/// <summary>
	/// complete() - Called on complete of AJAX request.
	/// </summary>
	function complete()
	{

	}
	