var PopupWin = {
	toolbar : 1,
	width : 500,
	height : 300,
	Init : function(){
	        //find all popuplinks on the current page
	       	var popLinksColl = document.getElementsByTagName("a");
		var url, anchorClassName;
		//attach popup events
		for(var i=0;i<popLinksColl.length;i++){
			anchorClassName = popLinksColl[i].className;
			if(/popup-link/i.test(anchorClassName)){
				popLinksColl[i].onclick = PopupWin.WinOpen;
			}
		}
	},
	WinOpen : function(){
		window.open(this.href, "", "toolbar=" + PopupWin.toolbar + ",height=" + PopupWin.height + ",width=" + PopupWin.width);
		return false;
	}
};

var TextAreaFocus = {
	Init : function(){
		//find all textareas on the current page
		var textareaColl = document.getElementsByTagName("textarea");
		var url, anchorClassName;
		//attach textarea events
		for(var i=0;i<textareaColl.length;i++){
			anchorClassName = textareaColl[i].className;
			if(/textarea-focus/i.test(anchorClassName)){
				textareaColl[i].onfocus = TextAreaFocus.FocusTextarea;
			}
		}
	},
	FocusTextarea : function(){
		if (this.value == this.defaultValue) { this.value = ''; };
		return false;
	}
};

SafeOnload.AddFunction(PopupWin.Init);
SafeOnload.AddFunction(TextAreaFocus.Init);
