function setCookie(name, value, expires, path, domain, secure) {
		var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
			document.cookie = curCookie;
	}
			
	function getCookie(cookieName) {
		var theCookie=""+document.cookie;
		var ind=theCookie.indexOf(cookieName);
		if (ind==-1 || cookieName=="") return null;
		var ind1=theCookie.indexOf(';',ind);
		if (ind1==-1) ind1=theCookie.length;
		return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
	}
			
	function popupCheck(swfName, magCode, redir) {

		
		if (redir=='') {
			var so = new FlashObject(swfName + ".swf", "webmag", "100%", "100%", "8", "#cccccc");		
			so.addParam("allowScriptAccess", "sameDomain");
			so.addParam("quality", "high");
			so.addParam("scale", "noscale");
			so.addParam("loop", "false");
			so.addParam("menu", "false");
			so.addVariable("magCode", magCode);	
			so.write("divFlashContainer");		
		}else {
			showHideLayers('divPopup','','show')
		}
				
		//if (window.opener) {		
		//	var so = new FlashObject("mag02.swf", "webmag", "100%", "100%", "8", "#cccccc");		
		//	so.addParam("allowScriptAccess", "sameDomain");
		//	so.addParam("quality", "high");
		//	so.addParam("scale", "noscale");
		//	so.addParam("loop", "false");
		//	so.addParam("menu", "false");
		//	so.addVariable("magCode", magCode);	
		//	so.write("divFlashContainer");		
		//
		//} else {
		//	// window has been opened by direct navigation and not popup
		//	// display the open window image else just display							
		//	showHideLayers('divPopup','','show')
		//}
	}

	function popup(bookURL) 
	{
		
		var w, h;

		w = screen.width-10;
		h = screen.height-50;

		var isMac = (navigator.appVersion.indexOf("Mac") != -1);
		var isNetscape = (!(navigator.appName.indexOf("Microsoft") != -1));
		var isVersion7 = (navigator.userAgent.indexOf("Netscape/7") != -1);

		if (isMac)
		{
		bookURL += "&IsMac=1";
		}
		if (isNetscape)
		{
		bookURL += "&IsNetscape=1";
		}
		if (isVersion7)
		{
		bookURL += "&BrowserVersion=7";
		}
		if ((!isMac) && (isNetscape) && (isVersion7))
		{
		h -= 50;
		}
		if ((isMac) && (isNetscape))
		{
		h -= 55;
		}

		iwindowHand = window.open(bookURL, "webmag", "fullscreen=no,resizable=yes,status=yes,toolbar=no,menubar=no,location=no,width="+w+",height="+h+",top=0,left=0");
		iwindowHand.focus();	
				
		return false;
		
	}
	
function showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}	