﻿var s5_nd_title = document.getElementById("s5_nd_content").getElementsByTagName("A");
	var s5_nd_title_aa = 1;
	for (var s5_nd_title_y=0; s5_nd_title_y<s5_nd_title.length; s5_nd_title_y++) {
		if (s5_nd_title[s5_nd_title_y].className == "s5_nd_title") {
			s5_nd_title[s5_nd_title_y].id="s5_nd_title_" + s5_nd_title_aa;
			s5_nd_title_aa = s5_nd_title_aa + 1;
		}
	}
	
var s5_nd_text = document.getElementById("s5_nd_content").getElementsByTagName("SPAN");
	var s5_nd_text_aa = 1;
	for (var s5_nd_text_y=0; s5_nd_text_y<s5_nd_text.length; s5_nd_text_y++) {
		if (s5_nd_text[s5_nd_text_y].className == "s5_nd_introtext") {
			s5_nd_text[s5_nd_text_y].id="s5_nd_text_" + s5_nd_text_aa;
			s5_nd_text_aa = s5_nd_text_aa + 1;
		}
	}
	
	
var s5_nd_image = document.getElementById("s5_nd_content").getElementsByTagName("SPAN");
	var s5_nd_image_aa = 1;
	for (var s5_nd_image_y=0; s5_nd_image_y<s5_nd_image.length; s5_nd_image_y++) {
		if (s5_nd_image[s5_nd_image_y].className == "s5_nd_image") {
			s5_nd_image[s5_nd_image_y].id="s5_nd_image_" + s5_nd_image_aa;
			s5_nd_image_aa = s5_nd_image_aa + 1;
		}
	}
	
	
var is_ie_s5_nd/*@cc_on = {
  // quirksmode : (document.compatMode=="BackCompat"),
  version : parseFloat(navigator.appVersion.match(/MSIE (.+?);/)[1])
}@*/;

function opacity_s5_nd(id_s5_nd, opacStart_s5_nd, opacEnd_s5_nd, millisec_s5_nd) {
	//speed for each frame
	var speed_s5_nd = Math.round(millisec_s5_nd / 100);
	var timer_s5_nd = 0;
	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart_s5_nd > opacEnd_s5_nd) {
		for(i = opacStart_s5_nd; i >= opacEnd_s5_nd; i--) {
			setTimeout("changeOpac_s5_nd(" + i + ",'" + id_s5_nd + "')",(timer_s5_nd * speed_s5_nd));
			timer_s5_nd++;
		}
	} else if(opacStart_s5_nd < opacEnd_s5_nd) {
		for(i = opacStart_s5_nd; i <= opacEnd_s5_nd; i++)
			{
			setTimeout("changeOpac_s5_nd(" + i + ",'" + id_s5_nd + "')",(timer_s5_nd * speed_s5_nd));
			timer_s5_nd++;
		}
	}
}

//change the opacity for different browsers
function changeOpac_s5_nd(opacity_s5_nd, id_s5_nd) {
	var object_s5_nd = document.getElementById(id_s5_nd).style; 
	object_s5_nd.opacity = (opacity_s5_nd / 100);
	object_s5_nd.MozOpacity = (opacity_s5_nd / 100);
	object_s5_nd.KhtmlOpacity = (opacity_s5_nd / 100);
    object_s5_nd.filter = "alpha(opacity=" + opacity_s5_nd + ")";
}

function blendimage_s5_nd(divid_s5_nd, imageid_s5_nd, imagefile_s5_nd, millisec_s5_nd) {
	var speed_s5_nd = Math.round(millisec_s5_nd / 100);
	var timer_s5_nd = 0;
	
	//set the current image as background
	document.getElementById(divid_s5_nd).style.backgroundImage = "url(" + document.getElementById(imageid_s5_nd).src + ")";
	
	//make image transparent
	changeOpac_s5_nd(0, imageid_s5_nd);
	
	//make new image
	document.getElementById(imageid_s5_nd).src = imagefile_s5_nd;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac_s5_nd(" + i + ",'" + imageid_s5_nd + "')",(timer_s5_nd * speed_s5_nd));
		timer_s5_nd++;
	}
}

function currentOpac_s5_nd(id_s5_nd, opacEnd_s5_nd, millisec_s5_nd) {
	//standard opacity is 100
	var currentOpac_s5_nd = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id_s5_nd).style.opacity < 100) {
		currentOpac_s5_nd = document.getElementById(id_s5_nd).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity_s5_nd(id_s5_nd, currentOpac_s5_nd, opacEnd_s5_nd, millisec_s5_nd)
}


function s5_nd_fadefirst() {
document.getElementById("s5_nd_title").innerHTML = document.getElementById("s5_nd_title_1").innerHTML;
document.getElementById("s5_nd_text").innerHTML = document.getElementById("s5_nd_text_1").innerHTML;
document.getElementById("s5_nd_title").onclick = s5_nd_click1;
document.getElementById("blendimage_s5_nd").onclick = s5_nd_click1;
if (document.getElementById("s5_nd_hyperlink")) { document.getElementById("s5_nd_hyperlink").onclick = s5_nd_click1; }
opacity_s5_nd('s5_nd_inner', 0, 100, 500);
opacity_s5_nd('s5_nd_content_window_bg', 0, 60, 500);
}

function s5_nd_click1() {
	if (document.getElementById("s5_nd_title_1")) {
		location.href = document.getElementById("s5_nd_title_1").href;
	}
}

function s5_nd_click2() {
	if (document.getElementById("s5_nd_title_2")) {
		location.href = document.getElementById("s5_nd_title_2").href;
	}
}

function s5_nd_click3() {
	if (document.getElementById("s5_nd_title_3")) {
		location.href = document.getElementById("s5_nd_title_3").href;
	}
}

function s5_nd_click4() {
	if (document.getElementById("s5_nd_title_4")) {
		location.href = document.getElementById("s5_nd_title_4").href;
	}
}

function s5_nd_click5() {
	if (document.getElementById("s5_nd_title_5")) {
		location.href = document.getElementById("s5_nd_title_5").href;
	}
}

function s5_nd_click6() {
	if (document.getElementById("s5_nd_title_6")) {
		location.href = document.getElementById("s5_nd_title_6").href;
	}
}

function s5_nd_click7() {
	if (document.getElementById("s5_nd_title_7")) {
		location.href = document.getElementById("s5_nd_title_7").href;
	}
}

function s5_nd_click8() {
	if (document.getElementById("s5_nd_title_8")) {
		location.href = document.getElementById("s5_nd_title_8").href;
	}
}

function s5_nd_click9() {
	if (document.getElementById("s5_nd_title_9")) {
		location.href = document.getElementById("s5_nd_title_9").href;
	}
}

function s5_nd_click10() {
	if (document.getElementById("s5_nd_title_10")) {
		location.href = document.getElementById("s5_nd_title_10").href;
	}
}

var s5_nd_current = 1;
var s5_nd_playing = 0;
var s5_nd_timer1 = 0;
var s5_nd_timer2 = 0;
var s5_nd_timer3 = 0;
var s5_nd_timer4 = 0;
var s5_nd_timer5 = 0;
var s5_nd_timer6 = 0;
var s5_nd_timer7 = 0;
var s5_nd_timer8 = 0;
var s5_nd_timer9 = 0;
var s5_nd_timer10 = 0;
var s5_nd_timer11 = 0;

function s5_nd_stop() {
	s5_nd_playing = 1;
}

function s5_nd_start() {
	s5_nd_playing = 0;
}

function s5_nd_play() {
	
	s5_nd_playing = 0;
	if (s5_nd_current == "1") {
		s5_nd_play1();
		return false;
	}
	if (s5_nd_current == "2") {
		s5_nd_play2();
		return false;
	}
	if (s5_nd_current == "3") {
		s5_nd_play3();
		return false;
	}
	if (s5_nd_current == "4") {
		s5_nd_play4();
		return false;
	}
	if (s5_nd_current == "5") {
		s5_nd_play5();
		return false;
	}
	if (s5_nd_current == "6") {
		s5_nd_play6();
		return false;
	}
	if (s5_nd_current == "7") {
		s5_nd_play7();
		return false;
	}
	if (s5_nd_current == "8") {
		s5_nd_play8();
		return false;
	}
	if (s5_nd_current == "9") {
		s5_nd_play9();
		return false;
	}
	if (s5_nd_current == "10") {
		s5_nd_play10();
		return false;
	}
}



var myInterval_s5_nd = window.setInterval("s5_nd_check_pause()",50);

function s5_nd_check_pause() {
	if (s5_nd_playing == "1") {
	clearTimeout(s5_nd_timer1);
	clearTimeout(s5_nd_timer2);
	clearTimeout(s5_nd_timer3);
	clearTimeout(s5_nd_timer4);
	clearTimeout(s5_nd_timer5);
	clearTimeout(s5_nd_timer6);
	clearTimeout(s5_nd_timer7);
	clearTimeout(s5_nd_timer8);
	clearTimeout(s5_nd_timer9);
	clearTimeout(s5_nd_timer10);
	clearTimeout(s5_nd_timer11);
	}
}


function s5_nd_ie_fix() {
	document.getElementById("s5_nd_content_window").style.filter = "none";
}
