// *** COOKIE FUNCTIONS ***
// cookies.js

// -- setCookie()
// The cookieName and cookieValue arguments are mandatory but all other arguments are optional.
// expires - (optional) is a Date object.
// path - the part of the document tree on the server that the cookie is valid for.
// domain - allows multiple server hosts to be used.
// secure - boolean and only applicable for use with HTTPS: connections.
// Example...
// var today = new Date();
// var expires = new Date(today.getMilliseconds() + (10 * 86400000)); // +10 days
// setCookie('foo', 'bar', expires, '/');
function setCookie(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie = escape(cookieName) + "=" + escape(cookieValue)
	+ ((expires)? "; expires=" + expires.toGMTString() : "")
	+ ((path)? "; path=" + path : "")
	+ ((domain)? "; domain=" + domain : "")
	+ ((secure)? "; secure" : "");
	}

// -- getCookie()
// eg. myVar = getCookie("foo");
// Returns null if no cookie
function getCookie(cookieName) {
	var cookie = " " + document.cookie;
	var search = " " + escape(cookieName) + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset!= -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
				}
			setStr = unescape(cookie.substring(offset, end));
			}
		}
	return(setStr);
	}
	
	
	
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: mrhoo | http://www.webdeveloper.com/forum/showpost.php?p=761000&postcount=40 */
window.Blink = function(args){
  // Set the color and seconds below, e.g., [args,'COLOR',SECONDS]
 	args = (/,/.test(args))?  args.split(/,/):  [args,'#000000',10];
 	var who = document.getElementById(args[0]);
 	var count = parseInt(args[2]);
 	if (--count <=0) {
  		who.style.backgroundColor = '';
  		if(who.focus) who.focus();
 	} else {
  		args[2]=count+'';
  		who.style.backgroundColor=(count%2==0)? '': args[1];
 	 	args='\"'+args.join(',')+'\"';
  		setTimeout("Blink("+args+")",500);
 	}
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


