<!-- Original:  Pete Thompson (thompp@globalnet.co.uk) -->
<!-- Web Site:  http://www.users.globalnet.co.uk/~thompp -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
var ShowCount = 0;
var SwapColour;
function ListToDoItems() {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ShowCount = 0; SwapColour = 0;
for (i=1; i <= NumToDoItems; i++) {
ToDoItem = GetCookie('PT_ToDoItem'+i);
if (ToDoItem != null) {
PrintItem(ToDoItem, i);
      }
   }
}
function DeleteItem(Count) {
DeleteCookie('PT_ToDoItem'+Count);
window.location = window.location;
}
function PrintItem (ToDoItem, Count) {
var color = "";
SwapColour = 1 - SwapColour;
if (SwapColour==1) {color = "bgcolor='#c0c0c0'"} ;
ShowCount++;
document.write("<tr " + color + ">");
document.write("<td width=10% align=center valign=top><small><b>"+ShowCount);
document.write("<td width=75% align=left  ><small>"+ToDoItem);
document.write("<td width=15% align=center><small>"+"<a href='javascript:DeleteItem(" + Count + ")'>Delete</a>");
}
function AddItem() {
var NumToDoItems = GetCookie('PT_NumToDoList');
var i;
var ToDoItem;
if (NumToDoItems == null) {
NumToDoItems = 0;
}
ToDoItem = prompt("Write your note here");
if ((ToDoItem != null) && (ToDoItem != "undefined" )) {
NumToDoItems++;
SetCookie('PT_ToDoItem'+NumToDoItems, ToDoItem, exp);
SetCookie('PT_NumToDoList',NumToDoItems, exp);
window.location = window.location;
   }
}
function set() {
VisitorName = prompt("Who are you?");
SetCookie ('VisitorName', VisitorName, exp);
SetCookie ('WWHCount', 0, exp);
SetCookie ('WWhenH', 0, exp);
}
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 arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//  End -->

function openWindow(){
var windowpop=window.open("weightcon.html", "windowpop", "toolbar=no, status=no, width=500, height=250, resizable=no, scrollbars=no, menubar=no");
}

function openWindow2(){
var windowpop=window.open("calc.html", "windowpop", "toolbar=no, status=no, width=350, height=290, resizable=no, scrollbars=no, menubar=no");
}

function openWindow3(){
var windowpop=window.open("pastapicker.html", "windowpop", "toolbar=no, status=no, width=500, height=600, resizable=no, scrollbars=no, menubar=no");
}

function openWindow4(){
var windowpop=window.open("oven.html", "windowpop", "toolbar=no, status=no, width=400, height=250, resizable=no, scrollbars=no, menubar=no");
}
function redirect(){
window.location="search.html";
}

function creatRequestObject(){
	var ro;

	if(window.ActiveXObject){
		ro=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		ro=new XMLHttpRequest();
	}
	return ro;
}

var http=creatRequestObject();


function ad(){
var name=document.signin.nom.value;
var message=document.signin.message.value;
var stitch=name+'xxxx'+message;
addMessage(stitch);
}

function addMessage(textfil){

var url="addmessage.php?timestamp="+new Date().getTime();
var message=textfil;
queryString="message="+message;
http.open("POST", url, true);
http.onreadystatechange=handleMessage;
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
http.send(queryString);

}

function handleMessage(){
	if(http.readyState==4){

		var stuff=http.responseText;
		alert(stuff)



	}

}

function swapImage(imageName){
var imageName=imageName;

document.getElementById('mainImage').setAttribute('src',imageName);
}

function restoreImage(oldImage){
var oldImage=oldImage;
document.getElementById('mainImage').setAttribute('src',oldImage);
}

function SetCookieEZ(name, value){
document.cookie=name + "=" + escape(value);

}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    }
  }
return ""
}

function checkCookie(){
var bookName=getCookie('book');

if(bookName=='busyvegetarian'){
window.location.href='busyvegetarian.php';
}

else if(bookName=='nirvana'){
window.location.href='vegetablenirvana.php';
}
//Just add other book name cookies here
}


function deleteCookie(name){
var ThreeDays=3*24*60*60*1000;
var expDate=new Date();
expDate.setTime(expDate.getTime()-ThreeDays);
document.cookie=name + "=NA; expires=" + expDate.toGMTString();
}

function KeepEmOut(){
var bookName=getCookie('book');

if(bookName.length<4){
window.location.href='kitchen.html';
}
}

