//<script language="JavaScript">
//clientlib.js

function jumpInside(sel){
	location.href = sel.options[sel.selectedIndex].value;
}
 
function WM_netscapeCssFix() {
  /*
    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Taylor
    Author Email: taylor@wired.com
    Author URL: http://www.taylor.org/
    */

  // This part was inspired by Matthew_Baird@wayfarer.com
  // It gets around another unfortunate bug whereby Netscape 
  // fires a resize event when the scrollbars pop up. This 
  // checks to make sure that the window's available size 
  // has actually changed.
  if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  // This function checks to make sure the version of Netscape 
  // in use contains the bug; if so, it records the window's 
  // width and height and sets all resize events to be handled 
  // by the WM_netscapeCssFix() function.
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn();
var popupwin;
function exitPopUp(){
	var i = Math.random()*10;//likelihood of being solicited: 10%
	if(navigator.cookieEnabled && i < 1){//don't hit up cookieless browsers
		if(String(document.cookie).indexOf('exitpopup') == -1 &&
			String(location.hostname).indexOf('pcworld.com') != -1){
			//don't ask if already asked in last 60 days;
			//don't ask if not in pcworld.com domain (see comment below)
			var d = new Date();
			d.setDate(d.getDate()+60);//in 60 days, expire
			/*
			big tradeoff with the domain attribute=pcworld.com.  The good
			thing is that d01.pcworld.com, w01.pcworld.com, etc. will all set
			and get the same cookie.  The bad thing is that accessing just
			d01, s01, www, w01, etc. will actually fail to access any cookie
			(because they aren't in pcworld.com domain) and therefore they
			will always fail to access any cookie and therefore will always
			give you the dialog.  If the domain attribute is removed, you avoid
			this problem but each server will set/get its own cookie.
			The second half of the if test above circumvents this tradeoff :)
			*/
			document.cookie = "exitpopup=1; expires="+d.toGMTString()+"; domain=pcworld.com; path=/";
			popupwin = window.open("https://commerce.cdsfulfillment.com/P63/subscriptions.cgi?IN_Code=IHPSPCA43","","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,menubar=no,width=375,height=480");
			popupwin.focus();
		}
	}
}

window.onunload = exitPopUp;