/*Browser check:*/
ie=document.all?1:0 // Internet Explorer
n=document.layers?1:0 // Netscape 4.x

//declare globals to build object reference
var whichDom = "", styleObj = "", howDom ="", writeObj =""
var isNav4, isNav6, isIE
var isBrand = navigator.appName
var agt = navigator.userAgent.toLowerCase()
var navVer = parseInt(navigator.appVersion)

isNav4 = (isBrand == "Netscape" && navVer < 5) ? true : false
isNav6 = (isBrand == "Netscape" && navVer >= 5) ? true : false

isNav46 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.6)) &&
(parseFloat(navigator.appVersion) < parseFloat(4.7))) ? true : false
isNav47 = ((isBrand == "Netscape") && (parseFloat(navigator.appVersion) >= parseFloat(4.7))) ? true : false

isIE = ((agt.indexOf("msie") != -1) && (parseInt(navVer) >= 4)) ? true : false

//construct object reference
var doc = document
var layers = doc.layers
var all = doc.all

//********************************************************************************

//The number of news lines
var lines = 1;

//The current first news 
var currentNews=0;

//Which font do you want to use?
FontFace='arial,verdana,helvetiva'

//What font-size (in pixel)?
FontSize=10

// Velocita' e intervallo tra i cicli
speed=07
between = 4000;

// Numero di caratteri dopo il quale troncare il titolo
truncChar = 50;
//Set the colors, first color is same as background, last color is the color it stops at:
//You can have upto 7 colors, set the ones you wan't use to 0
colors=new Array()
colors[0]='#FFFFFF'
colors[1]='#EEEEEE'
colors[2]='#CCCCCC'
colors[3]='#999999'
colors[4]='#666666'
colors[5]='#333333'
colors[6]='#000000'

/*Dont change anything below this!
*********************************************************************************/
if (news!=null && news.length>0) {
  fadeInit=new Function("oNews=new News('divNews1','divCont',colors); fadeNews(news.length-1)");
}else{
  fadeInit='';
}

if (layers)  {
  howDom = '.'
  writeObj = '.'
} else if (all)  {
  howDom = ".all."
  writeObj = ""
} else {
  howDom = '.getElementById("'
  writeObj = '")'
}
//Content object reference
function objectForWriting(obj,nest) {
  var theObj
	if (typeof obj == "string")
		if (n)//Navigator 4.x
			theObj = eval(nest + "document" + howDom + obj + writeObj + "document");
		else 
			theObj = eval("document" + howDom + obj + writeObj);
	else {
		theObj = obj
		}
		return theObj
}

function News(obj,nest,colors){
  nest=(!nest) ? '':'document.'+nest+'.'
	this.writeref = objectForWriting(obj, nest);
	this.fadeIt = b_fadeIt;
  this.colors = colors;
  this.size = FontSize;
  this.font = FontFace;
  this.speed = speed;
  this.lines = lines;
  this.between = between;
  this.obj = obj + "Object";      eval(this.obj + "=this");
}


function b_fadeIt(numColor,currNews){
  if (numColor<this.colors.length) {
    writetext='';
    for (var i=0 ; i<this.lines ; i++) { //write a newsline
      var type=news[(currNews-i)%newsCounter]["type"];
      var text=news[(currNews-i)%newsCounter]["text"];
      var body=news[(currNews-i)%newsCounter]["body"]; 
      var link=news[(currNews-i)%newsCounter]["link"];
      var target=news[(currNews-i)%newsCounter]["target"];
      
      if ( link == null || link == '' ) {
      	writetext+= '&nbsp;'+text + body +'&nbsp;';
 	    }
 	  	else  {
      	writetext+='<a href="'+link+'" target="' + target + '"  class="nero">'+'&nbsp;'+ text + body+'</a>&nbsp;';
      }
    }
    numColor++;
    if (n) {this.writeref.write(writetext); this.writeref.close();};
    if (isNav6 || ie) {this.writeref.innerHTML=writetext};
    setTimeout(this.obj+'.fadeIt('+numColor+','+currNews+')',this.speed);
  }else{
    currNews--;
    setTimeout('fadeNews('+currNews+')',this.between);
  }
}

function fadeNews(numNews){
	if (top.news==null) {
		//alert("Warning: news file not loaded! Reload the page.");
		return;
	}
	if (numNews > 0) {
		oNews.fadeIt(0,numNews);
	}else {
    oNews.fadeIt(0,news.length-1);
  }
}

/*End of fadescript
**********************************************************************************/

