function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function getElementsByClass(node,searchClass,tag) {
    var classElements = new Array();
    var els = node.getElementsByTagName(tag); // use "*" for all elements
    var elsLen = els.length;
    var pattern = new RegExp("\\b"+searchClass+"\\b");
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}


function navShow() {
   var arrayLayers = document.getElementsByTagName("table");
   var arraySelects = document.getElementsByTagName("select");
	for (i = 0; i < arrayLayers.length; i++) {
		if (arrayLayers[i].id.substr(0,8) == "rolldown") {
			arrayLayers[i].style.display = "none";
		}
	}
	if (navigator.appName.indexOf("Explorer") != -1) {
		for (j = 0; j < arraySelects.length; j++) {
			arraySelects[j].style.visibility = "visible";
		}
	}
	for (k = 0; k < arguments.length; k++) {
		if (document.getElementById(arguments[k])) {
			$(arguments[k]).style.display = "block";

			if (navigator.appName.indexOf("Explorer") != -1) {
				for (l = 0; l < arraySelects.length; l++) {
					arraySelects[l].style.visibility = "hidden";
				}
			}
		}
	}
}


function flash(strFile, strClass, intWidth, intHeight) {
	document.write("<object class=\"" + strClass + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + intWidth + "\" height=\"" + intHeight + "\">");
    document.write("<param name=\"movie\" value=\"/_swf/" + strFile + "\" />");
    document.write("<param name=\"quality\" value=\"high\" />");
	document.write("<param name=\"wmode\" value=\"transparent\">");
	document.write("<param name=\"SCALE\" value=\"noborder\">");
	document.write("<param name=\"menu\" value=\"false\">");
	document.write("<embed class=\"" + strClass + "\" src=\"/_swf/" + strFile + "\" width=\"" + intWidth + "\" height=\"" + intHeight + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" scale=\"noborder\" menu=\"false\"></embed></object>");
}

function flashReturn(strFile, strClass, intWidth, intHeight) {
	flash = "<object class=\"" + strClass + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + intWidth + "\" height=\"" + intHeight + "\">";
    flash += "<param name=\"movie\" value=\"/_swf/" + strFile + "\" />";
    flash += "<param name=\"quality\" value=\"high\" />";
	flash += "<param name=\"wmode\" value=\"transparent\">";
	flash += "<param name=\"SCALE\" value=\"noborder\">";
	flash += "<param name=\"menu\" value=\"false\">";
	flash += "<embed class=\"" + strClass + "\" src=\"/_swf/" + strFile + "\" width=\"" + intWidth + "\" height=\"" + intHeight + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" scale=\"noborder\" menu=\"false\"></embed></object>";

	return flash;
}

function h2(str) {
	flash("h2.swf?header=" + fixChars(str) , "h2", 450, 21);	
}

function h3(str) {
	flash("h3.swf?header=" + fixChars(str) , "h3", 200, 19);	
}

function h3News(str) {
	flash("h3.swf?header=" + fixChars(str) , "h3", 450, 19);	
}

function audio(file, header) {
	flash("audio.swf?file=/upload/mp3/" + file + "&amp;title=" + fixChars(header), "audio", 200, 25);	
}

function video(file, header) {
	flash("video.swf?file=" + file + "&amp;title=" + fixChars(header), "video", 200, 25);	
}

function videoOpen(file, header) {
	target = $("videoPopup");
	target.style.top = document.documentElement.scrollTop + "px";
	target.innerHTML = flashReturn("videoPopup.swf?file=/upload/flv/" + file, "videoPopup", 520, 310);
	target.style.display = "block";
	}

function videoClose(file, header) {
	target = $("videoPopup");
	target.innerHTML = "";
	target.style.display = "none";
}

function slideshow(str) {
	flash("slideshow.swf?sImage=" + str , "slideshow", 798, 264);	
}

function fixChars(chars) {
   chars = chars.replace(/&aring;/g, "%C3%A5");
   chars = chars.replace(/&auml;/g, "%C3%A4");
   chars = chars.replace(/&ouml;/g, "%C3%B6");
   chars = chars.replace(/&Aring;/g, "%C3%85");
   chars = chars.replace(/&Auml;/g, "%C3%84");
   chars = chars.replace(/&Ouml;/g, "%C3%96");
   chars = chars.replace(/&eacute;/g, "%C3%A9");
   chars = chars.replace(/&Eacute;/g, "%C3%89");
   chars = chars.replace(/&amp;/g, "%26");
   
   chars = chars.replace(/å/g, "%C3%A5");
   chars = chars.replace(/ä/g, "%C3%A4");
   chars = chars.replace(/ö/g, "%C3%B6");
   chars = chars.replace(/Å/g, "%C3%85");
   chars = chars.replace(/Ä/g, "%C3%84");
   chars = chars.replace(/Ö/g, "%C3%96");
   chars = chars.replace(/é/g, "%C3%A9");
   chars = chars.replace(/É/g, "%C3%89");
   chars = chars.replace(/&/g, "%26");

   return chars;
}


function rollover(obj) {
	obj.style.background = "#930";
}

function rollout(obj) {
	obj.style.background = "#555";
}

function rolldownClick() {
	document.location = this.firstChild;
}

function init() {


	var arrRolldownStyling = getElementsByClass(document,'rolldown','td');
	for (var i=0; i < arrRolldownStyling.length; i++) {
		//arrRolldownStyling[i].onmouseover = rolldownStylingOver;
		//arrRolldownStyling[i].onmouseout = rolldownStylingOut;
		arrRolldownStyling[i].onclick = rolldownClick;
	}
}

function decode(e){var a="";var b="102";var c=e.indexOf(String.fromCharCode(b));var f=1;var g=e.substring(f,c);var h=unescape(e.substring(c+1));for(i=0;i<h.length;i++){a+=String.fromCharCode(h.charCodeAt(i)-g);}window.location=a;return false;}

if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
    var ieversion=new Number(RegExp.$1);
    if (ieversion == 6) {
        var IE6 = "<link href=\"/_assets/css/ie6.css\" rel=\"stylesheet\" type=\"text/css\" />";
    } else {
        var IE6 = "";
    }
} else {
    var IE6 = "";
}

window.onload = init;
document.onclick = navShow;