function bookmarkSite(){
	var bookmarkTitle = document.getElementById('bookmark').getAttribute('title');
	if (document.all){
		window.external.AddFavorite(document.location, bookmarkTitle); }else if(window.sidebar){window.sidebar.addPanel(bookmarkTitle, document.location, "")}; 
	return false; 
}


function popup(url) {
	var w = 969;
	var h = 670;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	
	var page = url;
	windowprops = "height="+h+",width="+w+",top="+ wint +",left="+ winl +",location=no,"
	+ "scrollbars=no,menubars=no,toolbars=no,resizable=no,status=yes";
	window.open(page, "Popup", windowprops);
}
		

function showPop(thisimg,showhide){
	
	if(showhide == 'h'){
		document.getElementById('popimg').style.backgroundImage = '';
		document.getElementById('popup').style.minHeight = '';
		document.getElementById('popup').style.visibility = 'hidden';
		}
	else {
		document.getElementById('popimg').style.backgroundImage = 'url('+thisimg+')';
		document.getElementById('popcontent').style.marginTop = (document.documentElement.clientHeight- 370) /2 +'px';
		document.getElementById('popup').style.minHeight = '670px';
		scroll(0,0);
		document.getElementById('popup').style.visibility = 'visible';
	}
}



//check for flash
var flashversion = 0;
if (navigator.plugins && navigator.mimeTypes.length) {
	var x = navigator.plugins["Shockwave Flash"];
	if(x && x.description) {
		var y = x.description;
		flashversion = parseInt(y.substr(y.indexOf(".") - 2, 2), 10);
	}
} else {
	result = false;
	for(var i = 30; i >= 3 && result != true; i--){
		execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
		flashversion = i;
	}
}

if (flashversion >= 5) {
// remove flicker of non flash
document.getElementsByTagName('html')[0].className = 'flashInstalled';
}


function getFlash(what, movie, query, width, height) {

	new_txt = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+width+'" height="'+height+'">\n';
	new_txt += '<param name="movie" value="'+movie+'">\n';
	new_txt += '<param name="quality" value="high" />\n';
	new_txt += '<param name="menu" value="false">\n';
	new_txt += '<param name="flashvars" value="'+query+'">\n';
	new_txt += '<param name="wmode" value="transparent">\n';
	new_txt += '<param name="scale" value="noscale" />\n';
	new_txt += '<param name="salign" value="lt" />\n';
	new_txt += '<embed src="'+movie+'" width="'+width+'" height="'+height+'" flashvars="'+query+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" scale="noscale" salign="lt" wmode="transparent"></embed>\n';
	new_txt += '</object>';
	what.innerHTML = new_txt;
	what.style.visibility= 'visible';
}


function flashRewrite(x, movie, query, type){

	// x: the element, movie: swf address, query: added info to send, type: 1 = TagName  0 = id	
	if (flashversion >= 5){
		
	if (type == '1'){
	
	xArea = x.split('>'); //if TagName in a id
	if (xArea[1]){
		
	var x = document.getElementById(xArea[0]).getElementsByTagName(xArea[1]);	
	} else {	
	var x = document.getElementsByTagName(x);	
	}
	
	for (var i=0;i<x.length;i++){
	
		width = x[i].offsetWidth;
		height = x[i].offsetHeight;
		title = x[i].innerHTML;
		if (title) {title = title.replace("&", "%26")}
		
			if (!query){
				q= "title="+ title;
			}else{
				q= query +"&title="+ title;
			}
			
		// check for flash in 'a' tag
		if(x[i].nodeName == 'A') {
			
			thelink = x[i].href
			q+= "&link="+ thelink.replace("&", "%26");
			if (x[i].className == "flash" || x[i].className == "flash on"){
				
				if (x[i].className == "flash on"){ q+= "&s=1" }
				getFlash(x[i], movie, q, width, height)
				}
			
		}else{
			getFlash(x[i], movie, q, width, height)
		}

		q = '';
	}
	} else {
	
	var x = document.getElementById(x);
	
		width = x.offsetWidth;
		height = x.offsetHeight;
		getFlash(x, movie, query, width, height)
	}
}	
}

	
function theflash(movie,width,height,text) {

if (flashversion > 5)
	{	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+width+'" height="'+height+'">\n');
    document.write('<param name="movie" value="'+movie+'">\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="menu" value="false">\n');
	document.write('<param name="wmode" value="transparent">\n');
	document.write('<embed src="'+movie+'" width="'+width+'" height="'+height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>\n');
    document.write('</object>\n');	
	}
	else
	{
	document.write('<b>'+text+'</b>');	
	}
}

function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}



window.onload=function onLoader()
{	
//open new window
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
	if (x[i].getAttribute('title') >'') {
		
		if (x[i].getAttribute('title').indexOf("Link opens in a new window") >= 0)
		{
		x[i].onclick = function () {window.open(this.href); return false}
		}	
	}	
}
	
	
//navi
if (document.getElementById("navi")) {
	topnaviRoot = document.getElementById("navi");
		
		for (i=0; i<topnaviRoot.childNodes.length; i++) {
			node = topnaviRoot.childNodes[i];
			
			
				if (node.nodeName=="LI") {
				node.onclick=function() {
					
					for (j=0; j<topnaviRoot.childNodes.length; j++) {
					topnaviRoot.childNodes[j].className="";
					}
					
					this.className+=" over";
				}
			}
		}
}

	
//form

var formRoot = document.getElementsByTagName("form"); 
for (var f=0;f<formRoot.length;f++){
	var r = formRoot[f].elements;
	var rlen = r.length;

	for (var h = 0; h < rlen; h++) {		
		var node = r[h];
		node.onfocus=function() {
			if(this.type !=='checkbox' && this.type !=='radio' && (this.tagName =='INPUT' || this.tagName =='TEXTAREA')) {
				this.className="textformfocus";
				if (this.value.charAt(0) == '-') { this.value='' } 
		}
	}
											
	node.onblur=function() {
		if(this.type !=='checkbox' && this.type !=='radio' && (this.tagName =='INPUT' || this.tagName =='TEXTAREA')) {
			this.className="textform";
		}
	}
		
	}
}
}	