// *******************************************************************************************************************************************
//  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;
	};

// *******************************************************************************************************************************************
//  Misc
// *******************************************************************************************************************************************

	function initTips(className){
	
		var className = (typeof(className) == 'string')? '.'+className : '.Tips1';
	
		var _tips = $$(className).each(function(el){
			var tipContent	= el.title;
			var tipBulle	= tipContent.split('::');
			var tipTitle	= tipBulle[0];
			var tipText		= tipBulle[1];
			el.store('tip:title', tipTitle);
			el.store('tip:text', tipText);
		});
		
		var _tips = new Tips($$(className), {
			maxTitleChars : 75,
			onShow: function(tip) {
				tip.fade('in');
			},
			onHide: function(tip) {
				tip.fade('out');
			}
		});
	};

// *******************************************************************************************************************************************
//  initial js code to execute
// *******************************************************************************************************************************************

window.addEvent('domready', function() {
	// init tips
	initTips();
	/*
	var sliders = {};
	$$('.slide').each(function(el){
		sliders[el.id] = {obj:new Fx.Slide(el.id), status:0};
		sliders[el.id].obj.hide();
	});
	$$('.slide_switch').each(function(el){
		el.addEvent('click', function(e){
			try{
				var id = el.id.replace('_switch', '');
				if(sliders[id].status){
					sliders[id].obj.slideOut();
					sliders[id].status = 0;
					$(el.id + '_to_status_0').hide();
					$(el.id + '_to_status_1').show();
				} else {
					sliders[id].obj.slideIn();
					sliders[id].status = 1;
					$(el.id + '_to_status_0').show();
					$(el.id + '_to_status_1').hide();
				}
			} catch (e){}
		});
	});
	*/
	// init multiBox
	var initMultiBox = new multiBox({
		mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		container: $(document.body),//where to inject multiBox
		descClassName: 'multiBoxDesc',//the class name of the description divs
		//path: './Files/',//path to mp3 and flv players
		useOverlay: true,//use a semi-transparent background. default: false;
		maxSize: {w:700, h:500},//max dimensions (width,height) - set to null to disable resizing
		addDownload: false,//do you want the files to be downloadable?
		pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
		addRollover: false,//add rollover fade to each multibox link
		addOverlayIcon: false,//adds overlay icons to images within multibox links
		addChain: false,//cycle through all images fading them out then in
		recalcTop: true,//subtract the height of controls panel from top position
		addTips: false//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
	});

});