// *******************************************************************************************************************************************
//  global vars
// *******************************************************************************************************************************************

	// http request object 
	var oHttpRequest = null;
	
	/**
	 * Input element used for debug purposes
	 * @type {HTMLInputElement}
	 */
	var oDebugField;
	/**
	 * Anchor element used for debug purposes
	 * @type {HTMLAnchorElement}
	 */
	var oDebugGoToLink;
	
	
// *******************************************************************************************************************************************
//  Http request object 
// *******************************************************************************************************************************************

	// This function cretaes the XML Http Request according to the used browser
	function CreateXMLHttpRequest() {
		
		oHttpRequest = null;
		
		try{
			// Try to create request object. XMLHttpRequest is the request object used by 
			// Mozilla, Safari, Firefox, Opera and most non microsoft browsers
			oHttpRequest = new XMLHttpRequest();
			if (oHttpRequest.overrideMimeType) {
				oHttpRequest.overrideMimeType('text/xml');
			}
		} catch (e) {
			
			try {
				// Try to create request object supported by most microsoft browsers
				oHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				
				try {
					// However if the previous microsoft request object creation failed try this one
					oHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					oHttpRequest = null;
				}
			}
		}
		
		if (oHttpRequest == null) {
			alert('The XMLHTTP object can not be created !');
			return false;
		} else {
			return true;
		}
	}
	
	// This function creates an XML Http Request according to the used browser
	// and throws it
	function GetXMLHttpRequestObject() {
		
		var _oHttpRequest = null;
		
		try{
			// Try to create request object. XMLHttpRequest is the request object used by 
			// Mozilla, Safari, Firefox, Opera and most non microsoft browsers
			_oHttpRequest = new XMLHttpRequest();
			if (_oHttpRequest.overrideMimeType) {
				_oHttpRequest.overrideMimeType('text/xml');
			}
			
		} catch (e) {
			
			try {
				// Try to create request object supported by most microsoft browsers
				_oHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				
				try {
					// However if the previous microsoft request object creation failed try this one
					_oHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {
					_oHttpRequest = null;
				}
			}
		}
		
		if (_oHttpRequest == null) {
			alert('The XMLHTTP object can not be created !');
		}
		return _oHttpRequest;
	}
	
// *******************************************************************************************************************************************
//  Image functions
// *******************************************************************************************************************************************


	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
		
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

// *******************************************************************************************************************************************
// Ajax Debug function
// *******************************************************************************************************************************************


function InitAjaxDebugDataElements() {
	oDebugField = document.getElementById('fAjaxDebugField');
	oDebugGoToLink = document.getElementById("AjaxDebugGoToLink");
}

function SetAjaxDebugData (pUrl){
	/*
	var _sParams = '';
	var _arrSplitItems_1 = pUrl.split('?');
	var _arrSplitItems_2 = _arrSplitItems_1[1].split('&');
	
	_sParams += _arrSplitItems_1[0] + '&#13;&#10;';
	for (var j = 0; j < _arrSplitItems_2.length; j++){
		_sParams += _arrSplitItems_2[j] + '&#13;&#10;';
	}
	alert(_sParams);*/
	try{
		oDebugField.value = pUrl;
		oDebugGoToLink.href = pUrl;	
	} catch (e){e.message}
}


// *******************************************************************************************************************************************
// Newsletter
// *******************************************************************************************************************************************

function NewsletterSubscription(pAction){
	document.getElementById('hfNewsletterSubscriptionAction').value = pAction;
	document.getElementById('frmNewsletterSubscription').submit();
}