
var userAgent = navigator.userAgent.toLowerCase();
var isWindows = checkIt('win');

function checkSystem(){
	if (isWindows){
		var isMSIE = checkIt('msie');
		if(isMSIE){
			var isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
			if(isXPSP2){
				var mySystem = "WIN_IE_XP2";
			}else{
				var mySystem = "WIN_IE";
			}
		}else{
			var mySystem = "NOT_IE";
		}
	}else{
		var mySystem = "NOT_WIN";
	}
	return mySystem;
}

function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}

QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;
		}
	}
}

QueryString_Parse();

function checkIfInstalled(){
	var installationID = ReadCookie("minicliptoolbar_id");
	var clientid = QueryString("clientid");
	
	if(installationID > 0 || clientid == "main"){
		var alreadyInstalled = true;
	}else{
		var alreadyInstalled = false;
	}
	return alreadyInstalled;
}

function checkIt(string){
	place = userAgent.indexOf(string) + 1;
	thestring = string;
	return place;
}

function onlineInstallation(){
	var mySystem = checkSystem();
	var isInstalled = checkIfInstalled();

	if((mySystem == "WIN_IE")){
		onlineInstallation = true;
	}else{
		onlineInstallation = false;	
	}
	return onlineInstallation;
}

function sendToAFriend(){
	window.open('http://www.referralblast.com/cs/min/min1.asp?url=http://www.miniclip.com/toolbar','minWnd','width=290,height=460,scrollbars=no,menubar=no,resizable=no,name=test');
}

function checkDoCommand(){
	var doCommand = QueryString("do");
	return doCommand;
}

function showArrow(){
	document.getElementById("divArrow").style.visibility = "visible";
}