/****************************************

	mLib, by Mark Willis.
	(C) 2009 Mark Willis of MLW Creative.
	
	mLib general functions
	
	*This file must be included first, before other mLib files*

****************************************/

function mAjaxQuery(mTarget, scriptTarget, addQuery)
{
	var d = new Date();
	var tsec = d.getSeconds();
	var ajaxRequest;
	try{ajaxRequest = new XMLHttpRequest(); } catch (e){try{ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try{ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){return true;}}}
	ajaxRequest.onreadystatechange = function()
	{
	if(ajaxRequest.readyState == 4){
		document.getElementById(mTarget).innerHTML = ajaxRequest.responseText;
	}
	}
	var query = addQuery.replace(/\[amp\]/g, '&');
	var queryString = scriptTarget + '?time=' + tsec + query;
	ajaxRequest.open("GET", queryString, true);
	ajaxRequest.send(null);
	return false;
}

var mFloatViewportWidth;
var mFloatViewportHeight;

function mBviewportScan()
{
if (typeof window.innerWidth != 'undefined')
{
	mFloatViewportWidth = window.innerWidth;
	mFloatViewportHeight = window.innerHeight;
}
// IE6
else if(typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
{
	mFloatViewportWidth = document.documentElement.clientWidth;
	mFloatViewportHeight = document.documentElement.clientHeight;
}
// even older IE :O
else
{
	mFloatViewportWidth = document.getElementsByTagName('body')[0].clientWidth;
	mFloatViewportHeight = document.getElementsByTagName('body')[0].clientHeight;
}
}

function mBTrackingMousePosition(e)
{
	// Thank you 'Marss' from Ukraine! :D
	e = e || window.event;
	if (e.pageX)
	{
		MouseX = e.pageX;
		MouseY = e.pageY;
		mBviewportScan();
		if(MouseX + 350 > mFloatViewportWidth){MouseX = MouseX - 300;}
		if(document.getElementById('mBubbleBlock').style.display == "block"){
			document.getElementById('mBubbleBlock').style.left = (MouseX + 10) + "px";
			document.getElementById('mBubbleBlock').style.top = (MouseY + 10) + "px";
		}
	}
	else
	{
		x = window.event.clientX+document.documentElement.scrollLeft;
		y = window.event.clientY+document.documentElement.scrollTop;
		mBviewportScan();
		if(x + 350 > mFloatViewportWidth){x = x - 300;}
		if(document.getElementById('mBubbleBlock').style.display == "block"){
			document.getElementById('mBubbleBlock').style.left = (x + 10) + "px";
			document.getElementById('mBubbleBlock').style.top = (y + 10) + "px";
		}
	}
	
}

// mSlide Settings
var mSlideable = 1;
var mSlideOpen = 0;
var mSlideWindow = 0;