




// some configuraitons

cookieName="chops_radar_new_features3";
delCookieName="chops_radar_new_features1";
turnOffCookie = 1;



<!--

//set up the browsers
var dom = (document.getElementById) ? true : false;
var mac = (navigator.userAgent.indexOf("Mac")>-1) ? true : false;
var ns5up = ((navigator.userAgent.indexOf("Gecko")>-1) && dom && (navigator.userAgent.indexOf("Netscape")>-1)) ? true: false;
var fb5up = ((navigator.userAgent.indexOf("Gecko")>-1) && dom && (navigator.userAgent.indexOf("Firebird")>-1 || navigator.userAgent.indexOf("Firefox")>-1)) ? true: false;
var ie = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie50 = ((navigator.userAgent.indexOf("MSIE 5.0")>-1) && dom) ? true : false;
var ie55 = ((navigator.userAgent.indexOf("MSIE 5.5")>-1) && dom) ? true : false;
var ie6 = (navigator.userAgent.indexOf("MSIE 6")!=-1) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;



// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
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;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function isCookieEnabled() {
   if (document.all) return navigator.cookieEnabled;
   Set_Cookie('testcookie',today.getTime());
   var tc = Get_Cookie('testcookie');
   Delete_Cookie('testcookie');
   return (tc == today.getTime());
}

function cookieAlert () {
   if (!isCookieEnabled()) {
      alert('You will require cookies to logon. Please enable cookies in your Web Browser and try again.');
      return false;
   }
   else {
      return true;
   }
}
//var today = new Date();
//cookieAlert();


// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function get_update (state,radar,type,count,start,finish,colour,viewType,update) {
    var cookie_value = getCookie("chops_radar_config"+viewType);
    var cookie_value2 = getCookie("chops_radar_config_date");
    var value=state+"|"+radar+"|"+type+"|"+count+"|"+start+"|"+finish+"|"+colour+"|"+viewType;
    total_qty=0;
    total_price=0;
    expire_cookie= new Date("December 31, 2030");
    if (update) { // we are updating the current cookie
        setCookie("chops_radar_config"+viewType, value, expire_cookie, "/", "", 0);
        setCookie("chops_radar_config_date", value, "", "/", "", 0);
        return 1;
    }

    if(cookie_value) { // do we have a cookie to work with. If not then write a new one
        <!--- update cookie --->
        var valueArray= cookie_value.split("|");
        if (!update) { //we are getting the cookie data
            var valueArray= cookie_value.split("|");
            obj=document.selectradar;
            obj.the_state.value = (obj.the_state.options.length >= valueArray[0])?valueArray[0]:1;
            obj.type.value = valueArray[2];
            obj.numberofImages.value = valueArray[3];

            obj.radarid.value =  valueArray[1];
            //obj.colourSatName.value = valueArray[6];

        }
    }
    if(cookie_value2) { // do we have a cookie to work with. If not then write a new one
        <!--- update cookie --->
        var valueArray= cookie_value2.split("|");
        if (!update) { //we are getting the cookie data
            obj.dateStart.value = valueArray[4];
            obj.dateFinish.value = valueArray[5];

        }
    }

}

function AWSWD (aswName,tD_c,tR_c,wth_c,hgt_c,min_c,WS_c,show_c,update) {
    var awsdata = getCookie(aswName);

    var value=tD_c+"|"+tR_c+"|"+wth_c+"|"+hgt_c+"|"+min_c+"|"+WS_c+"|"+show_c;

    //alert(aswName + " " +awsdata);
    expire_cookie= new Date("December 31, 2030");
    if (update) { // we are setting the current cookie
        setCookie(aswName, value, expire_cookie, "/", "", 0);
    }
    if(awsdata) { // do we have a cookie to work with. If not then write a new one
        <!--- update cookie --->
        if (!update) { //we are getting the cookie data
            var valueArray= awsdata.split("|");
            return valueArray;
        }
    }

}



function checkSeenNewFeature() {
    if(!turnOffCookie) {
        if(getCookie(cookieName)==0||getCookie(cookieName)==null) { // assume haven't seen features window yet. so show them
            openWindow("?fuseaction=loops.newFeatures&stoplayout=1","newFeatures",220,400,1);

        }
    }

}


function setSeenNewFeature() {



    expire_cookie= new Date("December 31, 2030"); 
    if(delCookieName.length) {
        deleteCookie(delCookieName,"/","");
    } 
    setCookie(cookieName, 1, expire_cookie, "/", "", 0);

}




function openWindow(u,n,h,w,sb){ //u = url, n = name, h = height, w = width, sb = scrollbars

    if (!window.window2) { ///want to close the window as it is about to be reloaded. make it a clean exit
        // has not yet been defined
    }
    else {
        // has been defined
        if (!window2.closed) {
            // still open
             window2.close();
        }
    }
    //center the window opening 
    if (h==0) { h=450; } else { h=h +20; }
    if (w==0) { w=750; } else { w=w +20; }
    hp=(screen.height-h)/2;
    hw=(screen.width-w)/2;
    window2 = window.open(u, n,'toolbar=no,status=yes,menubar=no,location=no,scrollbars='+sb+',resizable=no,height='+h+',width='+w+',top='+hp+',left='+hw+',screenY='+hp+',screenX='+hw+'');
}

function check() {
    if (!window.window2) {
        // has not yet been defined
    }
    else {
        // has been defined
        if (!window2.closed) {
            // still open
            window2.focus();
        }
    }
}

function addOne(addto,counter) {
    if(document.selectradar.numberofImages.disabled==false){
        counter++;
        if(addto) {
            document.selectradar.numberofImages.value++;
        }
        else {
            document.selectradar.numberofImages.value--;
        }
        
        if (document.selectradar.numberofImages.value >1) {
            if(counter<=5) {
                thistimer = setTimeout("addOne("+addto+","+counter+")",250);
            }
            else {
                thistimer = setTimeout("addOne("+addto+","+counter+")",70);
            }
        }
    }
}


function runFunctions(id) {
    if(id=="Distance") {
        toggleDistance()
    }
    else {
        hidebox(id);
    }
}
// -->
