// deletes the cookie by resetting the experation date
function delete_All_cookies() {
	    if (document.cookie != "") {
	    	if (confirm("Do you want to delete all the cookies?")) {
	    		thisCookie = document.cookie.split("; ")
	    	    expireDate = new Date
	    	    expireDate.setDate(expireDate.getDate()-1)
	                               
	    	    for (i=0; i<thisCookie.length; i++) {
	    	        cookieName = thisCookie[i].split("=")[0]
	    	        document.cookie = cookieName + "=;expires=" + expireDate.toGMTString()
	    	    }
	    	    document.write("<H1>Number of cookies deleted: " + thisCookie.length + "<\/H1>")
	        }
	    }
}


//***********************************************************************************
// displays the cookie with the name and the value
function display_cookies(){
		if (document.cookie == "") {
			document.write("There are no cookies here")
		}
		else {
			thisCookie = document.cookie.split("; ")
	
	  	    for (i=0; i<thisCookie.length; i++) {
				document.write("Cookie name is '"+thisCookie[i].split("=")[0])
				document.write("', and the value is '"+thisCookie[i].split("=")[1]+"'<BR>")
			}
   	    }

}


//***********************************************************************************
// returns the cookies value so that you can use the value
function cookie_value(cookieName) {
	if (document.cookie != "") {
		thisCookie = document.cookie.split("; ");
		for (i=0; i<thisCookie.length; i++) {
			if(cookieName == thisCookie[i].split("=")[0]){
				return thisCookie[i].split("=")[1];
			}
		}
	}
	return 0;
}


//***********************************************************************************
// this function allows you to pass in the name, value and when you want the cookie
// to expire
function saveCookie (pstrName, pstrValue, pDaysToExpire) {
	expireDate = new Date
	
	expireDate.setDate(expireDate.getDate()+pDaysToExpire)
	
	document.cookie = pstrName + "=" + pstrValue + ";expires=" + expireDate.toGMTString();		
}
//following function is for opening thumbnails in new windows; saving image so 
//can recall it later
function NewWin(imgName, winName, intWidth, intHeight) {

     var strSize
     strSize = "width=" + intWidth + ",height=" + intHeight;

     window.open(imgName, winName, strSize)

}

function saveImage(pstrImageName) {
	saveCookie("cPhoto", pstrImageName, 1)
	
}
//following is to recall picture from other page!! slightly different from above but same thing?
function cookie_value(pCookieName) {
	if (document.cookie != "") {
		thisCookie = document.cookie.split("; ");
		for (i=0; i<thisCookie.length; i++) {
			if(pCookieName == thisCookie[i].split("=")[0]){
				return thisCookie[i].split("=")[1];
			}
		}
	}
	return "";
}

function isFilled(txtbox){
	if(txtbox.value!=""){
		return true;
	}
	return false;
}

//onfocus event to highlight contents of text boxes


//*******************************************************************************************************
// highlights the contents of the object
function fHighlight(obj) {
	obj.select()
}

