/*Browsercheck:*/
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

if (layers) {
whichDom = '["'
styleObj = '"]'
} else if (all) {
whichDom = ".all."
styleObj = ".style"
} else {
whichDom = '.getElementById("'
styleObj = '").style'
}

if (layers) {
howDom = '.'
writeObj = '.'
} else if (all) {
howDom = ".all."
writeObj = ""
} else {
howDom = '.getElementById("'
writeObj = '")'
}


//Css style object reference
function setObject(obj) {
var theObj
if (typeof obj == "string")
theObj = eval("document" + whichDom + obj + styleObj)
else
theObj = obj
return theObj
}

//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
}

/********************************************************************************
Here are the variables you must set: (this is the only part you have to change)

Remember that, if you wan't different size for the layers, different clip or anything
change that in the stylesheet.
*/

//The number of news lines
var lines = 3;

//The current first news 
var currentNews=0;

//The delay between the fades (in milliseconds) smaller value gives less time:
betweendelay=4000

//Do you wan't it to start over on the first one when it's gone trought all the news?
//(set to 0 if not)
var loop=1

//Which font do you want to use?
FontFace='verdana,arial,helvetica'

//What font-size (in pixel)?
FontSize=10

//Do you wan't it to fade out aswell? 1 for on, 0 for off
fadeback=0

//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]='#464646'
colors[1]='#444444'
colors[2]='#424242'
colors[3]='#404040'
colors[4]='#c0c0c0'
colors[5]='#f0f0f0'
colors[6]='#FFFFFF'

/*Dont change anything below this!
*********************************************************************************/
fadeInit=new Function("oNews=new makeObj('divNews2','divCont1'); fadeNews(0)");

function makeObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=setObject('divNews2');
this.writeref=objectForWriting(obj, nest);
this.fadeIt=b_fadeIt
this.obj = obj + "Object"; eval(this.obj + "=this") 
}

function b_fadeIt(font,size,speed,fn,num,c0,c1,c2,c3,c4,c5,c6){
if(num<arguments.length && arguments[num]!=0){
writetext='<hr size="0" width="100%" color="#464646">';
//writetext='';
for (var i=0; i<lines; i++) { //write a newsline
type=news[(currentNews+i)%newsCounter]["type"];
time=news[(currentNews+i)%newsCounter]["time"];
if (news[(currentNews+i)%newsCounter]["text"].length>90)
text=news[(currentNews+i)%newsCounter]["text"].slice(0,90)+"...";
else
text=news[(currentNews+i)%newsCounter]["text"];
link=news[(currentNews+i)%newsCounter]["link"];
target=news[(currentNews+i)%newsCounter]["target"];
writetext+='<a href="'+link+'"'
+' target="'+target+'"'
+' style="text-decoration:none; font-size:'+size+'px">'
+'<font face="'+font+'" color="'+arguments[num]+'">'
//+'<img src="'+type+'.gif"> '
+'<font color="#F66500">'+time+' </font>'
+text
//+' [<b>'+type+'</b>]'
+'</font></a><br>';
//if (i+1<lines)
writetext+='<hr size="0" width="100%" color="464646">';
}
if(n){this.writeref.write(writetext); this.writeref.close()}
if (isNav6) this.writeref.innerHTML=writetext;
if(ie) this.writeref.innerHTML=writetext 
num++

setTimeout(this.obj+'.fadeIt("'+font+'",'+size+','+speed+',"'
+fn+'",'+num+',"'+c0+'","'+c1+'","'+c2+'","'+c3+'","'+c4+'","'+c5+'","'+c6+'")',speed)
}else setTimeout('eval('+fn+')',betweendelay)
}
function fadeNews(num){
if (top.news==null) {
alert("Warning: news file not loaded! Reload the page.");
return;
}
currentNews=num;
if(num<news.length){
fn=fadeback?'fadeBack('+num+')':'fadeNews('+(num+1)+')';
oNews.fadeIt(FontFace,FontSize,100,fn,7,
colors[0],colors[1],colors[2],colors[3],colors[4],colors[5],colors[6])
}else if(loop)fadeNews(0)
}

function fadeBack(num){
if(num>=0){
oNews.fadeIt(FontFace,FontSize,100,'fadeNews('+(num+1)
+')',7,colors[6],colors[5],colors[4],colors[3],colors[2],colors[1],colors[0])
}
}
/*End of fadescript
**********************************************************************************/

