function processHTMLElements() {


	if(!document.getElementsByTagName) return;
	l=document.getElementsByTagName("a");
	for(i=0;i<l.length;i++){


		// ----------------------------------
		// ------------- title on a elements
		// ----------------------------------
		
		// ---------------------- notification on title attribute for target window
		if(l[i].className.indexOf("notifyWinTitle")!=-1){ 
			var infoText = ' (si apre in una nuova finestra)';
			//l[i].title = l[i].title + infoText;
			if(l[i].title){
				l[i].title = l[i].title + infoText;
				}
			else {
				l[i].title = l[i].text + infoText;
				}		
		}

		// ---------------------- notification in content for target window
		if(l[i].className.indexOf("notifyWinContent")!=-1){ 
			var infoText = document.createTextNode(' (si apre in una nuova finestra)');
		
			var parent = l[i].parentNode;
			if (l[i].nextSibling) {
				parent.insertBefore(infoText,l[i].nextSibling);
			} else {
				parent.appendChild(infoText);
			}
		}

		// ----------------------------------
		// ------------- target on a elements
		// ----------------------------------

		// ---------------------- blank window
		if(l[i].className.indexOf("blankWin")!=-1){ 
		  
			l[i].onclick = function() {
				window.open(this.href,'_blank'); return(false)
			}
			
			l[i].onkeypress = function(e) {
				var key;
				if(window.event)
					key = window.event.keyCode;     //IE
				else
					key = e.which;     //Firefox
				
				if(key && key == 13)	{
					window.open(this.href,'_blank'); return false;
				}
			}
		}


		// ---------------------- popup window
		if(l[i].className.indexOf("popupWin")!=-1){ 
		  
			l[i].onclick = function() {
				window.open(this.href,'popup','top=10,left=10,width=600,height=550,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,status=yes'); return false
			}	
			
			l[i].onkeypress = function(e) {
				var key;
				if(window.event)
					key = window.event.keyCode;     //IE
				else
					key = e.which;     //Firefox
				
				if(key && key == 13)	{
					window.open(this.href,'popup','top=10,left=10,width=600,height=550,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,status=yes'); return false
				}	
			}
		}

		// ---------------------- popup window
		if(l[i].className.indexOf("popupDemo")!=-1){ 
		  
			l[i].onclick = function() {
				window.open(this.href,'popup','top=20,left=20,width=800,height=600,scrollbars=auto,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,status=no'); return false
			}
			
			l[i].onkeypress = function(e) {
				var key;
				if(window.event)
					key = window.event.keyCode;     //IE
				else
					key = e.which;     //Firefox
				
				if(key && key == 13)	{
					window.open(this.href,'top=20,left=20,popup','width=800,height=600,scrollbars=auto,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,status=no'); return false
				}
			}
		}

 	} // end of for loop

 	
 	
	// ----------------------------------
	// ------------- title on img elements
	// ----------------------------------  
	l=document.getElementsByTagName("img");
	for(i=0;i<l.length;i++){
	  if(l[i].className.indexOf("notifyWinTitle")!=-1){ 
		var infoText = ' (si apre in una nuova finestra)';
		//l[i].title = l[i].title + infoText;
		if(l[i].title){
			l[i].title = l[i].title + infoText;
			}
		else if(!l[i].title) {
			l[i].title = l[i].parentNode.title;
			}
		else if(!l[i].parentNode.title) {
			l[i].title = 'Attenzione il link si apre in una nuova finestra';
			}
	  }
 	} // end of for loop

	// -------------------------------------------------
	// ------------- title and new win on area elements
	// -------------------------------------------------

	if(!document.getElementsByTagName) return;
	m=document.getElementsByTagName("area");
	for(i=0;i<m.length;i++){
				if(m[i].className.indexOf("notifyWinTitle")!=-1){ 
			var infoText = ' (si apre in una nuova finestra)';
			if(m[i].title){
				m[i].title = m[i].title + infoText;
				}
			else {
				m[i].title = m[i].text + infoText;
				}		
		}
		if(m[i].className.indexOf("blankWin")!=-1){ 
		  
			m[i].onclick = function() {
				window.open(this.href,'_blank'); return(false)
			}
			
			m[i].onkeypress = function(e) {
				var key;
				if(window.event)
					key = window.event.keyCode;     //IE
				else
					key = e.which;     //Firefox
				
				if(key && key == 13)	{
					window.open(this.href,'_blank'); return false;
				}
			}
		}
	}

} //end of function declaration


 


// http://simonwillison.net/2004/May/26/addLoadEvent/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(processHTMLElements);

addLoadEvent(function() {
  if(!NiftyCheck())
  return;
  Rounded("div.roundedbox","top","#FFF","FAFAFA","border #D1D1D1");
  Rounded("div.roundedbox","bottom","#FFF","#E8E8E8","border #D1D1D1"); 
});
