/*All scripts Copyright Carl Russell 2006*/
function domIt() {
	if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors .length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
		anchor.target = "_blank";
		anchor.title = (anchor.title != "") ? anchor.title+" (opens in a new window)" : "opens in a new window";
		anchor.className = (anchor.className != '') ? anchor.className+' external' : 'external';
		}
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup") {
			anchor.onclick = function() {
				url = this.getAttribute("href");
				window.open(url,'popup','width=600,height=480,resizable=yes,scrollbars=yes');
				return false;
			  }
			anchor.title = (anchor.title != "") ? anchor.title+" (opens in a popup window)" : "opens in a popup window";
		}
	}
	/*  INIT NEWS SCROLL Based on DOM NEWS: http://www.onlinetools.org/tools/domnews/  */
	var n=document.getElementById(dn_newsID);
	if(!n){return;}
	
	dn_startpos = n.clientHeight;
	dn_endpos = - n.scrollHeight;
	dn_scrollpos=dn_startpos;
	
	n.className=dn_classAdd;
	ctime = setTimeout("scrollDOMnews()",30);
	var newa=document.createElement('a');
	var newp=document.createElement('p');
	newp.setAttribute('id',dn_paraID);
	newa.href='#';
	newa.appendChild(document.createTextNode(dn_stopMessage));
	newa.onclick=stopDOMnews;
	newp.appendChild(newa);
	n.parentNode.insertBefore(newp,n.nextSibling);
	n.onmouseover=function() {		
		copyspeed=pausespeed;
	}
	n.onmouseout=function()	{
		copyspeed=dn_speed;
	}
	
}
function stopDOMnews() {
	clearTimeout(ctime);
	var n=document.getElementById(dn_newsID);
	n.className='';
	n.parentNode.removeChild(n.nextSibling);
	return false;
}
function scrollDOMnews() {
	var n=document.getElementById(dn_newsID).getElementsByTagName('ul')[0];
	n.style.top=dn_scrollpos+'px';	
	dn_scrollpos = parseInt(dn_scrollpos)-copyspeed;
	if(dn_scrollpos<dn_endpos){dn_scrollpos=dn_startpos;}
	ctime = setTimeout("scrollDOMnews()",30);
}

function confirmSubmit() {
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}


/* Variables for NEWS SCROLL */
	// initial position set dynamically
	var dn_startpos=0; 			
	// end position set dynamically
	var dn_endpos=0; 			
	// Speed of scroller higher number = faster scroller 
	var dn_speed=1;
	
	var copyspeed = dn_speed;
	var pausespeed= 0;	
	
	// ID of the news box
	var dn_newsID='hilite';			
	// class to add when JS is available
	var dn_classAdd='hasJS';		
	// Message to stop scroller
	var dn_stopMessage='Stop scroller';	
	// ID of the generated paragraph
	var dn_paraID='scrollStopper';
	// Prevent errors
	var ctime = null;

	var dn_scrollpos=dn_startpos;
	
window.onload=function(){
	domIt();
}
window.onunload=function()	{
	clearTimeout(ctime);
}



