//
// Common Javascript variables for the content management system
// Common variables for the site should go into the config.xml file for the site
//
var cms_wrapload=0;
//
// List of common web browers
//
// By setting the variables to true and false we can determine which browser is being used and the rendering enigines being used
//
// Browers are split in two groups:
//					Mozilla					Opera
//						|
//				Gecko-----------IE
//				  |
//		Firefox--------Webkit
//			|			  |
// Flock---- Netscape   Safari
//						  |
//						Chrome
var cms_browser = {
	mozilla: navigator.userAgent.indexOf('Mozilla') > -1,
		gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1,
			firefox: navigator.userAgent.indexOf('Firefox') > -1,
				flock: navigator.userAgent.indexOf('Flock') > -1,
				netscape: navigator.userAgent.indexOf('Navigator') > -1,
			webkit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
				safari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/),
					chrome: navigator.userAgent.indexOf('Chrome') > -1,
		ie: !!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1),
	opera: navigator.userAgent.indexOf('Opera') > -1	
	};
//
// Establish height and width of browser area
//
var cms_height = 0;
var cms_width = 0;
if (cms_browser.ie)
{
	if(document.documentElement.clientHeight)
	{
		cms_height = document.documentElement.clientHeight;
	}
	else
	{
		if(document.body.clientHeight)
		{
			cms_height = document.body.clientHeight;
		}
	}
	if(document.documentElement.clientWidth)
	{
		cms_width = document.documentElement.clientWidth;
	}
	else
	{
		if(document.body.clientWidth)
		{
			cms_width = document.body.clientWidth;
		}
	}
}
else
{
	cms_height = window.innerHeight;
	cms_width = window.innerWidth;
}
//
// Establish connection to config.xml file on server 
//
var cms_xmlDoc;
//
// Try using XMLDOM first if that fails then use
//
	try //Internet Explorer
	{
		cms_xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	}
	catch(e)
	{
		try //Firefox, Mozilla, Opera, etc.
	    {
	   		cms_xmlDoc=document.implementation.createDocument("","",null);
	    }
		catch(e)
    	{
    	}
  	}
	cms_xmlDoc.async=false;
	try //Internet Explorer
	{
		cms_xmlDoc.load("/config/config.xml");
	}
	catch(e)
	{
		cms_xmlDoc = null;
		try
		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
  			// Internet Explorer
  			try
  			{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  			}
  			catch (e)
  			{
    			try
    			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    			}
    			catch (e)
    			{
      				alert("Your browser does not support AJAX!");
    			}
  			}
		}
		xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){cms_xmlDoc=xmlHttp.responseXML.documentElement;}}
		xmlHttp.open("GET","/config/config.xml",true);
		xmlHttp.send(null);	
  	}