<!--AP ISR -->
<!--
var expDays = 365*24*60*60*1000;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays));

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 argVal = name + "=";  
        var argLen = argVal.length;
        var cooLen = document.cookie.length;  
        var i = 0;  
        while (i < cooLen) {    
        var j = i + argLen;    
        if (document.cookie.substring(i, j) == argVal)      
                return getCookieVal (j);    
                i = document.cookie.indexOf(" ", i) + 1;    
                if (i == 0) break;
        }  
        return null;
}

function isMember(name, member, nonMember){
        if ((getCookie(name) != null) && (getCookie(name) != "")){
                window.location.href = member;
                //alert('Found cookie');
                //if (member.indexOf(".htm")>-1){
                //      window.location.href = member;
                //} else {
                //      window.location.href = member + ".htm";
                //}
        } else {
                window.location.href = nonMember;
                //alert('Did not Find cookie ' + name);
                //if (nonMember.indexOf(".htm")>-1){
                //      window.location.href = nonMember;
                //} else {
                //      window.location.href = nonMember + ".htm";
                //}
        }
}

function setCookie(name, value, expiry) {
        var expires = "; expires=";
        var path = "/";
        var domain = "";
        var secure = "";
        var argVal = setCookie.arguments;
        var argLen = setCookie.arguments.length;
        if (expiry){
                expires += expiry.toGMTString();
        } else if(argLen > 2) {
                expires += argVal[2];
        } else {
                expires += exp.toGMTString();
        }
        if (argLen > 3){
 //               path = "; path=" + argVal[3];
        }
        if (argLen > 4){
                domain = "; domain=" + argVal[4];
        }
        if (argLen > 5){
                secure = "; secure";
        }
        document.cookie = name + "=" + escape(value) + expires + path + domain + secure;
}

function getForm(which, name){
        var frmVal = "";
        for (var w=0;w<which.length;w++){
                frmVal += which.elements[w].name + "=" + which.elements[w].value + "&";
        }
        frmVal += "2+2=5"
        var expMins = 30000;
        var expNow = new Date(); 
        expNow.setTime(expNow.getTime() + (expMins));
        setCookie(name, frmVal, expNow);
}

function setTempCookie(temp_cookie_name,temp_cookie_value){
        var frmVal = "";
        var expMins = 30000;
        var expNow = new Date(); 
        expNow.setTime(expNow.getTime() + (expMins));
        frmVal = expNow;
        setCookie(temp_cookie_name, temp_cookie_value, expNow);
        //alert("Set temp cookie");
}

function checkCookies(perm_cookie_name, temp_cookie_name, loginpage) {
//-------------------------------------------------------------------------
//Parameters: 
//      perm_cookie_name - name of the permanently stored cookie
//      temp_cookie_name - name of the temporary stored cookie
//      loginpage - where to redirect user if user has not registered
//-------------------------------------------------------------------------

var expDays = 365*24*60*60*1000;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays));
var temp_cookie_value= getCookie(temp_cookie_name);

//alert('Expiry time is ' + exp.toGMTString());
//Check if user did not register before.

        if ( (getCookie(perm_cookie_name) == null || getCookie(perm_cookie_name) == "") && (getCookie(temp_cookie_name) == null || getCookie(temp_cookie_name) =="")) {
                window.location.href = loginpage; 
        }
        else
        {
                //check if user registered just now - create new permanent cookie
                if ((getCookie(perm_cookie_name) == null) || getCookie(perm_cookie_name) == "") {
                        //alert('Setting cookie ' + perm_cookie_name);
                        setCookie(perm_cookie_name, temp_cookie_value, exp);
                }
                else
                {
                        //alert('do not Set cookie ' + perm_cookie_name);
                }
        }

}

//-->
