function BrowserCheck()
{
	var bOk = 0;
	//check for ei4 or greater
	var ua = navigator.userAgent.toLowerCase();
	//alert(ua);
	var bIE = (ua.indexOf("msie") != -1);
	
	if (bIE)	// If IE
	{
		var IEVers = Number( ua.charAt(ua.indexOf("msie") + 5) );
		if(ua.indexOf("windows") == -1)// If not IE in windows.
		{
			alert("This website will only run Internet Explorer properly in Microsoft Windows.\nYour operating system is incompatible.");
		}
		else if(IEVers<5) // IF not version 5.
		{
			alert("This website must be viewed through Microsoft Internet\nExplorer version 5 or higher to function properly.  Your\ncurrent browser is incompatible.");
		}
		else
		{
			bOk = 1;
		}
	}
		else
		{

		// check for MAC.
		if(ua.indexOf("macintosh") != -1)// If MAC.
		{
			//alert("mac");
			if(ua.indexOf("intel") != -1)// If MAC.
			{
				alert("This website is not compatible with Intel Macs.");
			}
			else
			{
			if( ua.indexOf("mac os x") == -1) // IF not OS X.
			{
				alert("This website must be viewed through Mac OS X or higher to function properly.  Your\ncurrent operating system is incompatible.");
			}
			else
			{
				if( ua.indexOf("safari") == -1) // IF not safari.
				{
					alert("This website must be viewed Safari browser to function properly.  Your\ncurrent browser is incompatible.");
				}
				else
				{
					bOk = 1;
					//alert("ok");
				}
			}
			}
		}		
		else // neither mac nor windows, 
		{
			//alert(ua);
			alert("This website must be viewed through Microsoft Internet\nExplorer 5 or higher on Windows or Safari on Mac OS X.  Your system is incompatible.");
		}
		
	}
	
	return bOk;
}


function IsMac()
{
	var ua = navigator.userAgent.toLowerCase();
	var bMac = 0;
	var plugindir = "";
	
	// check for MAC.
	if(ua.indexOf("macintosh") != -1)// If MAC.
	{
		if( ua.indexOf("mac os x") != -1) // IF  OS X.
		{
			if( ua.indexOf("safari") != -1) // IF  safari.
			{
				//alert("is mac");
				bMac = 1;
			}
		}
	}
	//alert("leaving IsMac");
	return bMac;	
}


function CookieCheck()
{
	//check for cookie support
	document.cookie = "test_cookie_support=1";
	var cookiePattern = /test_cookie_support=1;*/;
	var match = document.cookie.match(cookiePattern);
	if ( ! match)
	{
		alert("This website relies on cookies to function properly.\nPlease turn cookies on in your browser in order\nto access the bonus material.");
	}
}


function popupfaq()
{
	var newwindow;
	var strUserId = '<?php print($userid) ?>';
	var strPid = '<?php print($cdkey_pid) ?>';
	var strURL = "http://www.cdpass.com/FAQ.php?uid=" + strUserId + "&pid=" + strPid;
	newwindow = window.open(strURL, "faqwindow", "scrollbars,resizable,dependent,HEIGHT=480,WIDTH=640");
	newwindow.focus();
}


