// stateNav.js
// v 0.8.4
// 2005-09-04
// leo@blixtsystems.com
// Part of statemanagement system for flash
// Full package available at:
// http://www.blixtsystems.com/index.html#page=download&pid=14&ss=pid
// Licensed under GNU GPL, see license.txt included with package for details
//

//
// parse the state back to Flash
//

function getState() {
  var url = window.document.location.hash;
	var params =  getStateFromURL(url)
  return params;
}


function makeObj(params) 
{
  var nameValues = params.split("&");
  var retObj = new Object;
  for(var i=0;i<nameValues.length;i++)
  {
    var nameValue= nameValues[i].split("=");
    retObj[nameValue[0]] = nameValue[1]
  }
  
  return retObj;
  
}

function getStateObj() {
  var url = window.document.location.hash;
	var params =  getStateFromURL(url);
  return makeObj(params);
  
}

function getStateFromURL(url){
  var params = url.indexOf("?") != -1 ?  new String(url.split("?")[1]) : new String(url.split("#")[1]);
  return params;
}

//
// Set the STATE in the BROWSER
// non IE browser use this javascript to update hash and title
//

function setState(stateStr, page) {
	document.location.hash=stateStr;
	document.title = siteName + " " + page;
}

/* IE
case "putHREF" window.Document.Location.Hash = args
case "putTitle" Document.Title = args
*/
