function init(){
	event_addListener(document, 'mousedown', dostuff);
	addBookmarkLink();
	
}

function dostuff() {
	if(document.forms[0]){
		event_addListener(document.forms[0], 'click', blankit);
	}
}

function blankit() {
	var target = event.target || event.srcElement;
	if(target.tagName == 'INPUT' && target.type == 'text'){
		if(target.value.substring(0,5).toLowerCase() == 'enter' || target.value.substring(0,12).toLowerCase() == 'please enter'){
			target.value = '';
		}
	}
	
}

function addBookmarkLink() {

	if(!document.getElementById || !document.getElementById("login") || !document.createElement || !document.createTextNode) return false;

	var text = document.createTextNode(" this page");
	var linkText = document.createTextNode("Bookmark");
	var para = document.createElement("p");
	var myLink = document.createElement("a");
	myLink.setAttribute("href", document.location.href);
	myLink.onclick = function() {
		createFavourite("ToTo Ristorante", this.href);
		return false;
	}
	
	myLink.appendChild(linkText);
	para.appendChild(myLink);
	para.appendChild(text);
	
	var pageLoc = document.getElementById("login");
	pageLoc.appendChild(para);
	
	return true;
	
}

function createFavourite(title,url) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); 
	} else if(window.opera && window.print) { // Opera Hotlist
		return true;
	}
}

function print_r(obj){ //for debugging
	var str = '';
	for(var prop in obj){
		str += prop + " value :" + obj[prop] + "\n";
	}
	alert(str);
}
