/*	-------------------------------------------------------------------
	Comment this line to disable the popup windows. 
	-------------------------------------------------------------------	*/
	addEvent(window, 'load', findPopUps, false);	
		
/*	-------------------------------------------------------------------
	AddEvent
	-------------------------------------------------------------------	*/
	function addEvent(elm, evType, fn, useCapture)
	{
		if(elm.addEventListener)
		{
			elm.addEventListener(evType, fn, useCapture);
			return true;
		}
		else if (elm.attachEvent)
		{
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		}
		else
		{
			elm['on' + evType] = fn;
		}
	}

/*	-------------------------------------------------------------------
	Create the popup window
	-------------------------------------------------------------------	*/
	var newWindow = null;

	function popUpWin(url, type, strWidth, strHeight)
	{				
		type = type.toLowerCase();
		
		
		//	Depending of the type :		
		var tools="";		
		if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";		
		else if (type == "console" ) tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=100,top=100";
				
		//	Create the url of the popup + the parameter to open the survey.		

		
		//	Open the popup
				
		newWindow = window.open(url, 'newWin', tools);

		//	Keep focus on current windows
		//newWindow.blur();				
		//window.focus();
	}

/*	-------------------------------------------------------------------
	Methode call on onclick
	-------------------------------------------------------------------	*/
	function doPopUp(e)
	{
			
		//	set defaults - if nothing in rev attrib, these will be used
		var t = "console";
		var w = "375";
		var h = "175";
		var url = '';
		
		url = this.rev;	   
		
					
		popUpWin(url, t, w, h);
			
	}

/*	-------------------------------------------------------------------
	Add onclick event for all link with rev and popup="true"
	-------------------------------------------------------------------	*/		
	function findPopUps()
	{		
				
		var popups = document.getElementsByTagName("a");
		for (i=0; i<popups.length; i++)
		{				
			if (popups[i].rev != "")
			{
				//	Attach popup behaviour
				popups[i].onclick = doPopUp;	
							
			}
		}		
		
	}
	

