// ========================================================================
//	TES JavaScripts Library V1.0
//	
//	File privacy.js
//	
//	Copyright (c) 2002-2005 John Wiley and Sons, Inc.
// ========================================================================
//Browser Privacy 
var s_popupsAllowed = true;
var s_cookiesAllowed = true;
var s_privacyChecked = false;

function checkBrowserPrivacy(in_webroot){
	var popupWin = window.open("" + in_webroot + "/shared/blank.uni", "popup", "height=100, width=100");
	if (popupWin == null) {
	  s_popupsAllowed = false;
	} else {
	  popupWin.close();
	}
	
	var s_cparam = "WileyPLUSChek=ok";
	document.cookie = s_cparam;
	if(document.cookie.indexOf(s_cparam) == -1 ){
		s_cookiesAllowed = false;
	}
	s_privacyChecked = true;
}


function browserPrivacyValidate(in_webroot){
	return true;
}

function browserPrivacyValidateOLD(in_webroot){
	var privacyErrorDetected = false;
	if(!s_privacyChecked){
		checkBrowserPrivacy(in_webroot);
	}
	
	if(!s_cookiesAllowed){
		privacyErrorDetected = true;
		if(!s_popupsAllowed){
			alert("Cookies are not enabled!\n\n"+
				"WileyPLUS uses a cookie to keep track of your current session as you log in and navigate through the site.\n"+
				"You must have cookies enabled to use WileyPLUS.\n\n\n\n"+
				
				"Pop-up Windows are not enabled!\n\n"+
				"Several features in WileyPLUS use pop-up windows to deliver content and messages to the user.\n"+
				"To use WileyPLUS properly, you must set your browser to allow pop-up windows for this site.");
		}
		else{
			privacyErrorDetected = true;
			var s_href = "" + in_webroot + "/shared/browsercheck.uni?popups=" + s_popupsAllowed + "&map;cookies=" + s_cookiesAllowed;
			if (isWindow("BROWSERCHECK"))
			{
				closeWindow("BROWSERCHECK");
			}
			var s_param = "width=520,height=400,resizable=yes,copyhistory=no,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no";
			createWindow(s_href, "BROWSERCHECK", s_param);
		}
	}
	else if(!s_popupsAllowed){
		alert("Pop-up Windows are not enabled!\n\n"+
			"Several features in WileyPLUS use pop-up windows to deliver content and messages to the user.\n"+
			"To use WileyPLUS properly, you must set your browser to allow pop-up windows for this site.");
	}
	return !privacyErrorDetected;
}



function browserPrivacyReport(in_webroot){
	var s_href = "" + in_webroot + "/shared/browsercheck.uni";
	if (isWindow("BROWSERCHECK"))
	{
		closeWindow("BROWSERCHECK");
	}
	var s_param = "width=520,height=400,resizable=yes,copyhistory=no,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no";
	createWindow(s_href, "BROWSERCHECK", s_param);
}


function browserPrivacyReportOLD(in_webroot){
	if(!s_privacyChecked){
		checkBrowserPrivacy(in_webroot);
	}
	
	if(!s_popupsAllowed){
			alert("Pop-up Windows are not enabled!\n\n"+
				"Several features in WileyPLUS use pop-up windows to deliver content and messages to the user.\n"+
				"To use WileyPLUS properly, you must set your browser to allow pop-up windows for this site.");
		}
		else{
			var s_href = "" + in_webroot + "/shared/browsercheck.uni?popups=" + s_popupsAllowed + "&map;cookies=" + s_cookiesAllowed;
			if (isWindow("BROWSERCHECK"))
			{
				closeWindow("BROWSERCHECK");
			}
			var s_param = "width=520,height=400,resizable=yes,copyhistory=no,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no";
			createWindow(s_href, "BROWSERCHECK", s_param);
		}
}
