/* FUNCTIONALITY & ON-DEMAND DETAILS */



function BrowserDetect() {  //BROWSER DETECTION

	var browsername = "";
	var info = navigator.userAgent.toLowerCase();
	if (info.indexOf("msie") != -1) 
		browsername = "ie";
	else if (info.indexOf("mozilla") != -1)
		browsername = "firefox";
	else if (info.indexOf("safari") != -1)
		browsername = "safari";
	else if (info.indexOf("opera") != -1)
		browsername = "opera";
	else
		browsername = "unknown";

	return browsername;
}


function FuncWindow(viewdoc) {  //PAGE SECTION REQUEST
	var browser= BrowserDetect();
	if (browser = "firefox") 
		location.replace('egov.functionality.aspx?f='+viewdoc);
	else
		location.href('egov.functionality.aspx?f='+viewdoc);
	

}

function strReplace(str) { //Replace special character with ""
	var re = "/\#top\|\#bottom\/";
	return replace(str,"#", "");
	
}

function getValue(varname)
{
  // First, we load the URL into a variable
  var url = window.location.href;
  
  // Next, split the url by the ?
  var qparts = url.split("?");

  // Check that there is a querystring, return "" if not
  if (qparts.length == 0)
  {
    return "";
  }

  // Then find the querystring, everything after the ?
  var query = qparts[1];

  // Split the query string into variables (separates by &s)
  var vars = query.split("&");
  //var vars = strReplace(qsplit);
  

  // Initialize the value with "" as default
  var value = "";

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++)
  {
    // Split the variable by =, which splits name and value
    var parts = vars[i].split("=");
    
    // Check if the correct variable
    if (parts[0] == varname)
    {
      // Load value into variable
      value = parts[1];

      // End the loop
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");

  // Return the value
  return value;

}



function ExpandDocs(id) { //Display Functionality details on Functionality page //
	var doc = document.getElementById(id);
		if (doc.style.display == "none") {
			doc.style.display = "";
		}
		else {
			doc.style.display = "none";
		}
		
}