/**
* === Script file created by mWCMS creator ===
* === 2007 ===
*
*/
//Print script
function doPrint(url) {
	var printWin = window.open('','print','height=600,width=570,location=no,menubar=no,resizable=no,scrollbars=yes,toolbar=no,top=30,left=30');
	var html = document.getElementById('site_content_body').innerHTML;
	var footer = document.getElementById('site_content_footer').innerHTML;
        printWin.document.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">');
	printWin.document.write('<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"><head>');
	printWin.document.write('<link rel=\"stylesheet\" href=\"../styles/mwcms.css\" type=\"text/css\" />');
	printWin.document.write('<style type=\"text/css\">#site_content_body table{font-family:Verdana,Arial;font-size:10px;} #site_content_footer .divider {width:300px;}</style>');
	printWin.document.write('<script type=\"text/javascript\" src=\"../scripts/mwcms.js\"></script>');
	printWin.document.write('<title>Print</title></head><body>');
	printWin.document.write('<div style=\"width:550px;\">');
	printWin.document.write('<div id=\"site_content_body\">');
	printWin.document.write('<div id=\"site_content_headpath\" style=\"width:540px;float:none;clerar:right;\">');
	printWin.document.write('<a href=\"javascript:window.print();\">Print</a>');
	printWin.document.write('</div>');
	printWin.document.write(html); //Original site_content_body contents
	printWin.document.write('</div>');
	printWin.document.write('<div id=\"site_content_footer\" style=\"width:540px;\">');
	printWin.document.write(footer);
	printWin.document.write('</div></div>');
	printWin.document.write('</body></html>');
	//printWin.location.reload();	
}
// Used in the navigation
function navigationHighLight (onoff, elmnt ) {
	if ( onoff == "on" ) {elmnt.style.background = "rgb(216,210,158)";}
	if ( onoff == "off" ) {elmnt.style.background = "rgb(255,255,255)";}
	window.status = elmnt.firstChild.href;
	elmnt.firstChild.onclick = function() {return false;} 	//Disable onclick event of links, the onclick of the div opens
						             	//the link href, se function navigationGotoLink(elmnt)		
}
function navigationOpenLink(url) {window.location.href = url;}
function navigationGotoLink(elmnt) {
	var link = elmnt.firstChild;
	if(link.target == "" || link.target == null) {
		navigationOpenLink(link);
	} else {
		window.open(link);
	}
}
//Used for Quicksearch form
function resetQSField(field) {field.value = "";field.style.color="rgb(0,0,0)";}
function doDominoSearch(id) {
	var q = document.getElementById(id).value;
	var url = "/paab/paab09.nsf/pages/search.html?Open&Query=" + q;
	window.location.href=url;
	
}
/**
*  getQueryString(var); is a generic function to get a specifick URL parameter,
*  just pass in the name of the name of the parameter you want to get
*   and the function will retrieve the value of the parameter.
*
*  i.e. URL: www.example.com/example.html&id=123
*       Function call: getQueryString('id'); returns '123'
*/
function getQueryString(variable) {
	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] == variable) {
			return pair[1];
		}
	} 
	return false;
}
/**
*  Generic XMLHTTP Request functions (Ajax calls).
*  initRequest(); initializes the XMLHTTP request object and returns it.
*  Different methods for different browsers, implemented with try/catch statments.
*  This function is called from within the execRequest('url','functionName','method'); function.
*
*  execRequest('url','functionName','method'); is a generic function that instanciates a
*  XMLHTTP object, performs the request using the URL and method from passed in the function arguments,
*  calls a function (defined in the function arguments) on every statechange.
*
*  i.e. Function call: execRequest('example.html','retrieveRequestResponse','GET');
*       will create a new XMLHTTP request object, retrieve the URL 'example.html' via a HTTP GET command
*       and on every statechange of the XMLHTTP request object call the function 'retrieveRequestResponse'
*       which in turn descides what to do with the response data from the XMLHTTP request.
*/
var ajaxRequest;
function initRequest() {
	try {
		//Set up a XMLHTTP Request for Firefox, Safari, Opera etc.
		ajaxRequest = new XMLHttpRequest();
	} catch (e) { //If it fails
		try {
			//Set up the XMLHTTP ActiveX object for Internet explorer
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				//Set up the XMLHTTP ActiveX object for Internet explorer
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				window.alert('Failed to create HTTP connection object');
				return false;
			}
		}
	}
	return ajaxRequest;
}
function execRequest(execUrl,execFunct,execMethod){
    /**
    *  execUrl =		The URL to make the request to. (i.e. http://www.example.com/example.html)
    *  execFunct =		The function wich to call on the onreadystatechange event of the XMLHTTP Object, if no
    *                		function name specified the function will display an error and return false.
    *  execMethod =  	Specifies the HTTP method to use (GET, POST, PUT, DELETE etc)
    */
    if (execFunct == null || execFunct == "") { alert('Error, no action function specified'); return false; }
    if (execMethod == null || execMethod == "") { execMethod = 'GET'; }
	ajaxRequest = initRequest();
	ajaxRequest.onreadystatechange = eval(execFunct);
	ajaxRequest.open(execMethod, execUrl, true);
	ajaxRequest.send(null);
}
//Example function for processing the XMLHTTP response data
function retrieveRequestResponseFTSearch() {
	if(ajaxRequest.readyState == 4)	{ //If ready state 4 (e.g. it has finished the request)
	/**
	*  This are all the ready states of an Ajax call
	*  0	The request is not initialized
    	*  1	The request has been set up
    	*  2	The request has been sent
    	*  3	The request is in process
    	*  4	The request is complete
	*/
		if(ajaxRequest.status == 200) { //If status is 200 (HTTP Status 200 = success)
			document.getElementById('search_results').innerHTML = ajaxRequest.responseText; 			//Write the response text to a specified HTML element
		}
	}  else {document.getElementById('search_results').innerHTML="Searching..."}
}
function retrieveRequestResponseSitemap() {
	if(ajaxRequest.readyState == 4)	{ //If ready state 4 (e.g. it has finished the request)
	/**
	*  This are all the ready states of an Ajax call
	*  0	The request is not initialized
    	*  1	The request has been set up
    	*  2	The request has been sent
    	*  3	The request is in process
    	*  4	The request is complete
	*/
		if(ajaxRequest.status == 200) { //If status is 200 (HTTP Status 200 = success)
			document.getElementById('sitemap_body').innerHTML = ajaxRequest.responseText; 					//Write the response text to a specified HTML element
		}
	}  else {document.getElementById('sitemap_body').innerHTML="Loading..."}
}
function openHomepage() {
	window.location.href="/paab/paab09.nsf/pages/index.html";
}
function redirect() {
	if(window.location.href.indexOf(".nsf/pages/") == -1)   {
		openHomepage();
	} else {
		return true;
	}
}

