function clearText(thefield) { thefield.value = ""; }

function createCookie(name,keys,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	var strkeys
	strkeys = "buy="+value+keys   // "&key1=blah1&key2=blah2&key2=blah2;"
	// document.cookie = name+"="+keys+expires+"; path=/"; = org
	document.cookie = name+"="+strkeys+expires+"; path=/";
}

function RewriteCookieFromFormBlur(theFormField, CookieInstance, newKeys) {
 	 			  
 var TheValue
 var TheNewCookieKeyString
 	 			  
 TheValue = theFormField.value
 TheNewCookieKeyString = newKeys+TheValue
 	
 // alert("The New Quantity = "+TheValue)
 // alert("The overwritten Cookie-Instance = "+CookieInstance) 
 // alert("TheNewCookieKeyString = "+TheNewCookieKeyString)
		  
 createCookie(CookieInstance,TheNewCookieKeyString,1,7);
}

//function Cookanew(theFormField, CookieInstance) {
// var TheValue
// var TheNewCookieKeyString
// TheValue = theFormField.value
// TheNewCookieKeyString = "<%=CookieKeyString%>"+TheValue
// createCookie(CookieInstance,TheNewCookieKeyString,1,7);
//}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function showOrHideDiv(id) { 
//	 
	if (document.getElementById) { 
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = '';
		} else {
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = '';
			} else {
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = '';
			} else {
				document.all.id.style.display = 'none';
			}
		}
	} 
//	
}
