function docdate (doc) {
da = new Date(doc.lastModified); 
db = da.toGMTString(); 
dc = db.split(" ");  
if ( eval( dc[3] ) < 1970 ) dc[3] = eval( dc[3] ) +100;  
db = dc[1] + " " + dc[2] + " " + dc[3];  
document.write ( db );
} 

// Actions.html
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) + 
        ( (expires) ? ";expires=" + expires.toGMTString() : "") + 
        ( (path) ? ";path=" + path : "") +  
        ( (domain) ? ";domain=" + domain : "") + 
        ( (secure) ? ";secure" : "");
}

function setupForm() {
    if (userProfile) getValues(userProfile);
}
//The setupForm() function is invoked by the onLoad="" event within the  tag. 
//This checks to see if userProfile has been created (i.e. the store variable, and if it has 
//repopulates the form by invoking the getValues() function by passing the contents of the userProfile. 

function getValues(string) {
    for (var i=0;i<76+1;i++)///////////////MAKE CHANGES ONLY ON THIS LINE!!
        getValue(string,"i"+i, eval("document.profileForm.i"+i), "checkbox");
}
//The getValues() function is the one place where you may need to adapt the contents to populate your form. 
//The current contents sets the form profileForm elements user, email, country, age, sex and i0 through to i7. 
//The getValues() function is passed the parameter string which holds the contents of the userProfile. 
//This is then used by each call to getValue along with the name of the form element, a reference to the element 
//(which includes the name of the form and the name of the form element) and the type of the element, i.e. text, select, radio, or checkbox. 
//The last two lines of the getValues() function show a simple means of looping through a list of like named form elements, 
//by just changing the i suffix each time. It requires the use of the eval() method to convert a string into the actual reference of the element. 
//To adapt this function for your own form, requires you to add a call to the getValue() function for each of your forms elements, 
//changing the name of the element, the name of the form, and the element type. 

function replace(string,text,by) {
// Replaces text with by in string
    var i = string.indexOf(text);
    var newstr = '';
    if ((!i) || (i == -1)) return string;
    newstr  = +string.substring(0,i) + by;
    if (i+text.length < string.length)
        newstr += replace(string.substring(i+text.length,string.length),text,by);
    return newstr;
}
//The replace() function simply replaces any occurences of the text string within the string string with the by string. 

function onCheck(string) { 
if (string == "on") return true; return false; 
}
//The onCheck() function is used by the following getValue() function to return true if passed "on". 

function getValue(string,elementName,object,elementType) {
// gets value of elementName from string and populates object of elementType
    var startPos = string.indexOf(elementName + "=")
    if (startPos > -1) {
        startPos = startPos + elementName.length + 1;
        var endPos = string.indexOf("&",startPos);
        if (endPos == -1) endPos = string.length;
       var elementValue = unescape(string.substring(startPos,endPos));
        if (elementType == "text")     object.value = elementValue;
        if (elementType == "password") object.value = elementValue;
        if (elementType == "select")   object.selectedIndex = elementValue;
        if (elementType == "checkbox") object.checked = onCheck(elementValue);
        if (elementType == "radio")    object[elementValue].checked = true;
    }
}
//The getValue() function is the guts of the whole code. It attempts to find the elementName, within the passed string 
//(i.e. the store variable as described in the psuedo code). It does so by searching for the name of the element plus the "=" character 
//using the indexOf() method. 
//If it is not found it simply returns to the invoking getValues() function. 
//If it is found then it searchs for the "&" character, which is used to append the form name-value pairs together, again using the indexOf() method. 
//If the "&" character is not found then it is assumed to be the last form name-value pair within the string. 
//The elementValue of the element is then extracted using the substring() and unescape() methods. 
//Then based on the elementType passed to getValue it sets the value of the object (i.e. reference to element) as required. 
//Where the elementType is a "checkbox" it uses the onCheck() function to set the value of the checked property to true, if the elementValue is "on". 
//Where the elementType is a "radio" the assumption is that the name of the radio element is the same as its index number. 
//-->
