function PopUp(url, title)
{
	var newwindow;

	newwindow=window.open(url,title,"height=300,width=298,resizable=yes,scrollbars=no,toolbar=no,menubar=no");
	if (window.focus) {newwindow.focus();}
}

function sendMail(subject, body)
{
	var url = document.location.href;
	var shortUrl = url.split("?")[0];
	window.location = "mailto:?subject=" + subject + "&body=" + body + shortUrl;
}

function vote(result)
{
  	var form = document.forms.vote;
	if(form != null) {
		form.elements['pageurl'].value = document.location.href.split("?")[0];
		form.elements['url'].value = document.location.href.split("?")[0];
		form.elements['answer'].value = result;
		form.submit();
	}
}

function tellUsMore(link)
{
	var url = document.location.href;
	var newUrl = link + "?fromUrl=" + url.split("?")[0];
	window.location = newUrl;
}

function enableOverlays() {
	var arrTooltipSpans = YAHOO.util.Dom.getElementsByClassName('yuimenu', 'div', document);
	AGFA.Utils.MoreInfo.createMoreInfoFor(arrTooltipSpans);
}

var AGFA = window.AGFA || {};

AGFA.Utils = function(){};

AGFA.Utils.MoreInfo = function() {

var timer;

return {

 /**
 * Creates more info blocks for a given array of objects
 * This function uses the default Yahoo tooltip widget and inserts some custom behaviour
 * @param arrObjects the objects to attach a tooltip
 */
createMoreInfoFor: function(arrObjects){
	if(arrObjects.lenght === 0) return;
	
	for(var i=0; i<arrObjects.length; i++){
		var currentContextElement = arrObjects[i];
		var oMenu = new YAHOO.widget.Overlay(currentContextElement, {context:[currentContextElement.id + "_link", "tl", "bl"], effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.25}});
		oMenu.hide();
		oMenu.render();
		
		YAHOO.util.Event.addListener(currentContextElement.id + "_link", "mouseover", this.onMouseOver, oMenu);
		YAHOO.util.Event.addListener(currentContextElement.id + "_link", "mouseout", this.onMouseOut, oMenu);
		YAHOO.util.Event.addListener(currentContextElement, "mouseover", this.clearTimer, oMenu);
		YAHOO.util.Event.addListener(currentContextElement, "mouseout", this.onMouseOut, oMenu);
		YAHOO.util.Event.addListener(document, "click", this.onMouseOut, oMenu);
	}
},

onMouseOver: function(event, obj){
	clearTimeout(timer);
	obj.show();
},

onMouseOut: function(event, obj){
	timer = setTimeout(function() {obj.hide();}, 50);
},

clearTimer: function(event, obj){
	clearTimeout(timer);
}
};}()