function openCIRCmap(id,name){
	//Check for browser requirements
	if(!requirement_Ver5()) document.location = "requirement_ver5.htm";
	if(!requirement_Cookie()) document.location = "requirement_vookie.htm";
	if(!requirement_PopUp()) document.location = "requirement_popup.htm";
	
	var w = Math.min((screen.width-10), 1280);
	var h = Math.min(screen.height, 1024) - 80;

	var maploc = "http://maps.rupri.org/RACapp/map_v2.htm?id=" + id + "&name=" + escape(name)
	var circMap = window.open(maploc,"circMap","menubar=0,width="+w+",height="+h+",resizable=1,status=1,top=0,left=0");
	circMap.focus();
    
	window.status = "Opening map in a new window.";
}

function setCookie(name, value) {
	document.cookie = name + "=" + escape(value) + "; path=/";
}

function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return unescape (document.cookie.substring(offset, endstr));
}

function getCookie(name) {
   var arg = name+"=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }
   return null;
}

function deleteCookie (name) {
   var ThreeDays = 3 * 24 * 60 * 60 * 1000;  
   var exp = new Date();  
   exp.setTime (exp.getTime() - ThreeDays);  
   var cval = getCookie (name);  
   document.cookie = name + "=null; path=/; expires=" + exp.toGMTString();
}

//Functions to check for browser requirements
//==============================================
function requirement_Ver5(){
	theBrowser = navigator.appName
	theVersion = navigator.appVersion
	if (theVersion.indexOf("MSIE") != -1) {
		theVersion = theVersion.substring(theVersion.indexOf("MSIE")+5,theVersion.length)
		theVersion = theVersion.substring(0, theVersion.indexOf(";"))
	}else
		theVersion = theVersion.substring(0,theVersion.indexOf(" ("))

	if (parseFloat(theVersion) >= 5.0){
		return true;
	}
	return false;
}

function requirement_Cookie(){
	setCookie("testCookie","myCookie")
	var testCookie = getCookie("testCookie")
	if (testCookie != null){
		deleteCookie("testCookie")
		return true;
	}
	return false;
}

function requirement_PopUp(){
	var testWin = window.open("","","width=1,height=1,left=-200,top=-200");
	if (testWin != null){
		testWin.close();
		testWin = null;
		return true;
	}
	return false;
}

