function doBlink() {
  var blink = document.all.tags("BLINK")
  for (var i=0; i<blink.length; i++)
  blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
  if (document.all)
    setInterval("doBlink()",1000)
}

function toggleDiv(element){
  var el;
  el = document.getElementById(element);
  if(el.style.display != 'block') {
    el.style.display = 'block';
  }
  else {
    el.style.display = 'none';
  }
}

//Generating Pop-up Preview for images
function createPage(titleName, imageName, x, y)
{
  //Creating new pagevar
  pp = window.open("", "imagePreview", "toolbar=no, scrollbars=yes, resizable=yes, height=" + y + ",width=" + x, false);
  pp.document.open()
  //Adding HTML opening tag with <HEAD> … </HEAD> portion
  pp.document.writeln('<html><head><title>'+titleName+'</title></head>')
  //Adding Body Tag
  pp.document.writeln('<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0" onClick="javascript:window.close()">');
  pp.document.writeln('<center><h1>'+titleName+'</h1><img src="'+imageName+'"></center>');
  pp.document.writeln('</body></html>');
  pp.document.close()
  if (window.focus) {pp.focus()}
}

// neon flashing effect
var message=""
var neonbasecolor=""
var neontextcolor=""
var neontextcolor2=""
var flashspeed=100            // speed of flashing in milliseconds
var flashingletters=10        // number of letters flashing in neontextcolor
var flashingletters2=0        // number of letters flashing in neontextcolor2 (0 to disable)
var flashpause=0              // the pause between flash-cycles in milliseconds
var code=""
var n=0

function neonLink() {
  message=document.all ? 
    (document.all.neonLink != null ? document.all.neonLink.innerHTML : '') :
    (document.getElementById("neonLink") != null ? document.getElementById("neonLink").innerHTML : '')
  if (message != '') {
    flashingletters = message.length
    neonbasecolor=document.all ? document.all.neonLink.style.color : document.getElementById("neonLink").style.color
    neontextcolor=document.all ? document.all.neonLink.rel : document.getElementById("neonLink").getAttribute("rel")

    if (document.all||document.getElementById){
      for (m=0;m<message.length;m++)
        code += '<span id="neonlight'+m+'">'+message.charAt(m)+'</span>'
      if (document.all) document.all.neonLink.innerHTML = code
      else document.getElementById("neonLink").innerHTML = code
      beginNeon()
    }
  }
}

function crossRef(number){
var crossObj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number)
return crossObj
}

function Neon(){
//Change all letters to base color
if (n==0){
  for (m=0;m<message.length;m++)
    crossRef(m).style.color=neonbasecolor
}

//cycle through and change individual letters to neon color
if (n<message.length) crossRef(n).style.color=neontextcolor

if (n>flashingletters-1) crossRef(n-flashingletters).style.color=neontextcolor2 
if (n>(flashingletters+flashingletters2)-1) crossRef(n-flashingletters-flashingletters2).style.color=neonbasecolor

if (n-flashingletters<message.length-1)
  n++
else{
  n=0
  clearInterval(flashing)
  setTimeout("beginNeon()",flashpause)
  return
  }
}

function beginNeon(){
  if (document.all||document.getElementById)
  flashing=setInterval("Neon()",flashspeed)
}

// banner slide functions
var pee = 0;
var drec = 10;
var speed = 20;
var l = pee;

// function that closes the menu
function glideBack(inText,outText) {
  l += drec;
  if (document.layers) {
    document.banners.top = l;
  } else if (document.all) {
    document.all.banners.style.pixelTop = l;
  } else if (document.getElementById) {
    document.getElementById('banners').style.top = l + 'px';
  }
  if (l < 0)
    setTimeout('glideBack(\''+inText+'\',\''+outText+'\')', speed);
  else {
	  if (document.layers) {
      var html = '';
      html += '<A HREF="javascript:;"';
      html += 'onClick="glideOut(\''+inText+'\',\''+outText+'\'); return false;">';
      html += outText;
      html += '<\/A>';
      var a = window.document.banners.document.glider;
      a.document.open();
      a.document.write(html);
      a.document.close();
    }
    else if (document.all) {
      document.all.gliderLink.innerHTML = outText;
      document.all.gliderLink.onclick = function() {glideOut(inText,outText); return false;};
    }
    else if (document.getElementById) {
      document.getElementById('gliderLink').firstChild.nodeValue = outText;
      document.getElementById('gliderLink').onclick = function() {glideOut(inText,outText); return false;};
    }
  }
}

// function that opens the menu
function glideOut(inText,outText) {
  l -= drec;
  if (document.layers) {
    document.banners.top = l;
  } else if (document.all) {
    document.all.banners.style.pixelTop = l;
  } else if (document.getElementById) {
    document.getElementById('banners').style.top = l + 'px';
  }
  if (l > pee)
    setTimeout('glideOut(\''+inText+'\',\''+outText+'\')', speed);
  else {
    if (document.layers) {
      var html = '';
      html += '<A HREF="javascript:;"';
      html += 'onClick="glideBack(\''+inText+'\',\''+outText+'\'); return false;">';
      html += inText;
      html += '<\/A>';
      var a = window.document.banners.document.glider;
      a.document.open();
      a.document.write(html);
      a.document.close();
    }
    else if (document.all) {
      document.all.gliderLink.innerHTML = inText;
      document.all.gliderLink.onclick = function() {glideBack(inText,outText); return false;};
    }
    else if (document.getElementById) {
      document.getElementById('gliderLink').firstChild.nodeValue = inText;
      document.getElementById('gliderLink').onclick = function() {glideBack(inText,outText); return false;};
    }
  }
}

function getHeight() {
  if (document.layers) {
    l = pee = document.banners.top = -document.banners.offsetHeight + document.glider.offsetHeight;
    document.banners.style.visibility='visible';
  } else if (document.all) {
    l = pee = document.all.banners.style.pixelTop = -document.all.banners.offsetHeight + document.all.glider.offsetHeight + 2;
    document.all.banners.style.visibility='visible';
  } else if (document.getElementById) {
    l = pee = -document.getElementById('banners').offsetHeight + document.getElementById('glider').offsetHeight + 4;
    document.getElementById('banners').style.top = l + 'px';
    document.getElementById('banners').style.visibility='visible';
  }
}

<!--NNresizeFix Reloads the page to workaround a Netscape Bug-->
if (document.layers) {
  origWidth = innerWidth;
  origHeight = innerHeight;
}

function reDo() {
  if (innerWidth != origWidth || innerHeight != origHeight) location.reload();
}
if (document.layers) onresize = reDo;
//-->

// scroller functions
/**********************************************************************************   
NewsSlideFade 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera=this.agent.indexOf("Opera")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera)
	return this
}
var bw=new lib_bwcheck()

/****
Variables to set 
****/

//How do you want the script to work? 
//0 = normal
//1 = Slide in - Fade out
//2 = Fade in - Fade out
//3 = Random 
nWorks = 0

//If you use the slide set these variables:
nSlidespeed = 1 //in px
nNewsheight = 20 //This is how long down it should start the slide.

nBetweendelay = 2000 //The delay before fading out.
nFont = 'Arial,Sans-Serif,Tahoma' //The font for the news.
nFontsize = 12 //Font size in pixel.
nFadespeed = 100 //The speed to fade in, in milliseconds.

//Set the colors, first color is same as background, last color is the color it stops at:
//You can have as many colors you want
nColor=new Array('#FFFCF4','#E9ECE1','#CDDAC9','#ADC4AE','#8BAD91','#6C9776','#51855E','#3D784E')

//This is the news you wanna have, set the link and the text. If you don't wan't it to link anywhere
//use a # as the link
nNews=new Array()

/********************************************************************************
Object code...Object constructors and functions...
********************************************************************************/
function makeNewsObj(obj,nest,font,size,color,news,fadespeed,betweendelay,slidespeed,works,newsheight){
    nest=(!nest) ? "":'document.'+nest+'.'
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;	
   	this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
	if(font){this.color=new Array(); this.color=eval(color); this.news=new Array(); this.news=eval(news)
		this.font=font; this.size=size; this.speed=fadespeed; this.delay=betweendelay; this.newsheight=newsheight;
		this.fadeIn=b_fadeIn;this.fadeOut=b_fadeOut; this.newsWrite=b_newsWrite; this.y=1
		this.slideIn=b_slideIn; this.moveIt=b_moveIt; this.slideSpeed=slidespeed; this.works=works
		if(bw.dom || bw.ie4){this.css.fontFamily=this.font; this.css.fontSize=this.size; this.css.color=this.color[0]}
	}
	this.obj = obj + "Object"; 	eval(this.obj + "=this"); return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}

function b_newsWrite(num,i){
if (bw.ns4){
		this.writeref.write("<a href=\""+this.news[num]['link']+"\""+(this.news[num]['target']!=''?" target=\""+this.news[num]['target']+"\"":"")
		  +" style=\"text-decoration:none; font-size:"+this.size+"px\">"
			+"<font face=\""+this.font+"\" color=\""+this.color[i]+"\">"+this.news[num]['text']+"</font></a>")
		this.writeref.close()
	}else this.writeref.innerHTML = '<a id="'+this.obj+'link' +'" style="text-decoration:none; font-size:'+this.size+'px; color:'+
	  this.color[i]+'" href="'+this.news[num]['link']+'"'+(this.news[num]['target']!=''?' target="'+this.news[num]['target']+'"':'')
	  +'>'+this.news[num]['text']+'</a>'
}
//Slide in
function b_slideIn(num,i){
	if (this.y>0){
		if (i==0){this.moveIt(0,this.newsheight); this.newsWrite(num,this.color.length-1)}
		this.moveIt(this.x,this.y-this.slideSpeed)
		i ++
		setTimeout(this.obj+".slideIn("+num+","+i+");",50)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}
//The fade functions
function b_fadeIn(num,i){
	if (i<this.color.length){
		if (i==0 || bw.ns4) this.newsWrite(num,i)
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i ++
		setTimeout(this.obj+".fadeIn("+num+","+i+")",this.speed)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}

function b_fadeOut(num,i){
	if (i>=0){
		if (i==0 || bw.ns4) this.newsWrite(num,i)	
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i --
		setTimeout(this.obj+".fadeOut("+num+","+i+")",this.speed)
	}else{
		num ++
		if(num==this.news.length) num=0
		works = !this.works?0:this.works==1?1:Math.round(Math.random())
		if(works==0) setTimeout(this.obj+".fadeIn("+num+",0)",500)
		else if (works==1){this.y=1; setTimeout(this.obj+".slideIn("+num+",0)",500)
		}
	}
}
/********************************************************************************************
The init function. Calls the object constructor and set some properties and starts the fade
*********************************************************************************************/
function fadeInit(){
	oNews = new makeNewsObj('scroller','scrollbar',nFont,nFontsize,"nColor","nNews",nFadespeed,nBetweendelay,nSlidespeed,nWorks,nNewsheight)
	oNewsCont = new makeNewsObj('scrollbar')
	works = !oNews.works?0:oNews.works==1?1:Math.round(Math.random())
	if (works==0) oNews.fadeIn(0,0)
	else if (works==1) oNews.slideIn(0,0)
	oNewsCont.css.visibility = "visible"
}

function showNode(currentNode,ulNode)
{
	var ulID = document.getElementById ? document.getElementById("ul" + ulNode) : document.all["ul" + ulNode]
	if (ulID)
	{
		if (ulID.style.left != '')
		{
			currentNode.style.backgroundImage = 'url(img/minus.gif)'
			ulID.style.position = ''
			ulID.style.left = ''
			ulID.style.display = 'block'
		}
		else
    {
    	currentNode.style.backgroundImage = 'url(img/plus.gif)'
		  ulID.style.position = 'absolute'
			ulID.style.left = '-1000px'
			ulID.style.display = 'none'
    }
  	return false
  }
  else
  	return true
}

var ulPath = new Array()
var ulCount = 0
var divFound = false

function traverseNodes(node)
{
  var childs = node.childNodes
  for (var i = 0; i < childs.length; i++)
		if (childs[i].nodeType == 1)
		{
     	if (childs[i].nodeName.indexOf('UL') != -1)
     	{
        if (!divFound)
        	ulCount++
        ulPath.push(childs[i].id)
      }
      if (childs[i].nodeName.indexOf('DIV') != -1)
      	divFound = true
     	traverseNodes(childs[i])
  	}
  if (!divFound && childs.length>1 && childs[childs.length - (bw.ie || bw.opera ? 1 : 2)].nodeName.indexOf('UL') != -1 && ulPath.length > 0)
  {
    ulPath.pop()
    ulCount--
  }
}

function MenuStartUp(expandAll)
{
	var mainMenu = document.getElementById("ul0")
	var mainMenuNodes = mainMenu.childNodes
  for (var i = 0; i < mainMenuNodes.length; i++)
  	if (mainMenuNodes[i].nodeType == 1)
  	{
  		if (!divFound)
  		{
  			ulPath = new Array()
  			ulCount = 0
  		}
  		traverseNodes(mainMenuNodes[i])
  	}
  	
	var ulPathNew = new Array()
	for(var i = 0; i < ulCount; i++)
		ulPathNew[i] = ulPath[i]
	
	var ulPathList = ulPathNew.join(";") + ";"
	
	var ulTags = mainMenu.getElementsByTagName("UL");
	for(var i = 0; i < ulTags.length; i++)
	{
		var ulTagItems = ulTags[i].getElementsByTagName("LI");
    for (var j = 0; j < ulTagItems.length; j++)
    {
      var ulExists = false
			var childs = ulTagItems[j].childNodes
			
			for (var k = 0; k < childs.length; k++)
			if (childs[k].nodeType == 1)
  			if (!ulExists)
    			if (childs[k].nodeName.indexOf('UL') != -1)
      			ulExists = true

			for (var k = 0; k < childs.length; k++)
				if (childs[k].nodeType == 1)
				{
   				if (childs[k].nodeName.indexOf('A') != -1)
      			if (ulExists)
      				childs[k].style.backgroundImage = 'url(img/plus.gif)'
      			else
      				childs[k].style.backgroundImage = 'url(img/minus.gif)'
      		else if (childs[k].nodeName.indexOf('DIV') != -1)
      			if (ulExists)
      				childs[k].childNodes[0].style.backgroundImage = 'url(img/plus.gif)'
      			else
      				childs[k].childNodes[0].style.backgroundImage = 'url(img/minus.gif)'
      	}
    }
		
		if (expandAll || ulPathList.indexOf(ulTags[i].id + ";") != -1)
		{
			ulTags[i].style.position = '';
			ulTags[i].style.left = '';
			ulTags[i].style.display = 'block';
			ulTags[i].parentNode.childNodes[0].style.backgroundImage = 'url(img/minus.gif)'
		}
		else
		{
			ulTags[i].style.position = 'absolute';
			ulTags[i].style.left = '-1000px';
			ulTags[i].style.display = 'none';
		}
	}
}

document.documentElement.className += " js";

// create xhtml strict friendly iframe
$(document).ready( function() {
$('a.iframe').each(
function (i) {
$(this).replaceWith("<iframe src='" + this.getAttribute("href") + "' width='425' height='350' frameborder='0' scrolling='no'></iframe>");
}
);
});