
function readCookie(cookiename,path) {
     if (document.cookie == "") {
        writeCookie(cookiename,path);
	return false;
     } else {
        var the_cookie = document.cookie;
        the_cookie = unescape(the_cookie);
        the_cookie_split = the_cookie.split(";");
        for (loop=0;loop<the_cookie_split.length;loop++) {
                var part_of_split = the_cookie_split[loop];
                var find_name = part_of_split.indexOf(cookiename)
                if (find_name!=-1) {
                        break;
                }
        }
        if (find_name==-1) {
                writeCookie(cookiename,path);
		return false;
        } else {
		return true;
        }
      }
}

function writeCookie(cookiename,path) {
     var mydate=new Date();
     var nextdate=new Date(mydate.valueOf()+(60*60*1*1000));
     var today = new Date();
     var the_cookie_date = nextdate.toGMTString();
     var the_cookie = cookiename+"="+escape(today);
     var the_cookie = the_cookie + ";expires=" + the_cookie_date;
     var the_cookie = the_cookie + ";path="+path;
     document.cookie=the_cookie
}


