function go_to(url)
{
	document.location.href = url;
	return false;
}

function quickselect_changed(obj)
{
	var url = obj.value;
	if (url == "hpi-fleetassist.123.html")
	{
		openFleetAssist();
	}
	else
	{
		window.open(url);
	}
}

function hide_subnavi()
{
	$("SN1").style.display="none";
	$("SN2").style.display="none";
	$("SN3").style.display="none";
	$("SN4").style.display="none";
	$("SN5").style.display="none";
}
function show_subnavi(num)
{
	hide_subnavi();
	$("SN"+num).style.display="block";
}

function init()
{
	document.addEvent('click', function(e){
		//e.stop();
		hide_subnavi();
	});

	if ($("left")){
		$("left").addEvent('mouseover', function(e){
			e.stop();
			hide_subnavi();
		});		
	}
	if ($("main")){
		$("main").addEvent('mouseover', function(e){
			e.stop();
			hide_subnavi();
		});		
	}
	if ($("right")){
		$("right").addEvent('mouseover', function(e){
			e.stop();
			hide_subnavi();
		});		
	}
	if ($("footer")){
		$("footer").addEvent('mouseover', function(e){
			e.stop();
			hide_subnavi();
		});		
	}
}

// --------------------------------------------------------------
// Scroller
// --------------------------------------------------------------

var m_scrollerLength = 0;
var m_scrollerSize = 554;
var m_scrollSpeed = 15;
var m_scrollerSeparator = " +++ ";

function initScroller() {
	
	buildScrollerElement();

	l_scroller = document.getElementById("scroller");
	// l_scroller.style.backgroundColor = "#00ff00";
	l_scroller.style.overflow = "hidden";
	l_scroller.style.width = m_scrollerSize+"px";
	l_scroller.style.position = "absolute";
	l_scroller.style.height = "20px";

	l_scrollerContent = document.getElementById("scrollerContent");
	// l_scrollerContent.style.backgroundColor="#ff0000";
	l_scrollerContent.style.left = m_scrollerSize+"px";
	l_scrollerContent.style.width = (m_scrollerLength * 6.5)+"px";//"100%";
	l_scrollerContent.style.position = "absolute";

	resumeScroller();
}	

function holdScroller() {
	window.clearInterval(m_timer);
}

function resumeScroller() {
	m_timer = window.setInterval("scrollText()", m_scrollSpeed);
}

function scrollText() {
	l_content = document.getElementById("scrollerContent");

	if(l_content.style.left)
	{
		l_currentPosition = parseInt(l_content.style.left.substring(0, l_content.style.left.indexOf("px")));
		if (l_currentPosition < (m_scrollerLength * 8) * -1) {
			l_currentPosition = m_scrollerSize;
		}
		l_content.style.left = (l_currentPosition - 1)+"px";
	}
	else
	{
		l_content.style.left = m_scrollerLength+"px";
	}
}

function buildScrollerElement() {
	for (var i=0; i < m_scrollerText.length; i++) {
	  l_text = m_scrollerText[i];
		l_link = m_scrollerLink[i];
		l_linkTarget = m_scrollerLinkTarget[i];
		l_span = document.createElement("span");
		l_spanAttr = document.createAttribute("class");
		l_spanAttr.nodeValue = "scrollText";
		l_span.setAttributeNode(l_spanAttr);
		l_separatorPre = document.createTextNode(m_scrollerSeparator);
		l_separatorPost = document.createTextNode(m_scrollerSeparator);
		if (i == 0) {
			m_scrollerLength = m_scrollerLength + m_scrollerSeparator.length;
			l_span.appendChild(l_separatorPre);
		}
		if (l_link.length > 0) {
			// if link is not empty create href
			l_element = document.createElement("a");
			l_textNode = document.createTextNode(l_text);
			l_textAttr = document.createAttribute("href");
			l_textAttr.nodeValue = l_link;
			l_element.setAttributeNode(l_textAttr);
			l_targetAttr = document.createAttribute("target");
			l_targetAttr.nodeValue = l_linkTarget;
			l_element.setAttributeNode(l_targetAttr);
			l_element.appendChild(l_textNode);
			l_span.appendChild(l_element);
		}
		else {
			// only append text node if link is empty
			l_textNode = document.createTextNode(l_text);
			l_span.appendChild(l_textNode);
		}
		l_span.appendChild(l_separatorPost);
		m_scrollerLength = m_scrollerLength + l_text.length + m_scrollerSeparator.length;
		document.getElementById("scrollerContent").appendChild(l_span);
	}
}

// --------------------------------------------------------------
// Fleet-Login
// --------------------------------------------------------------

function openFleetAssist() { 
        l_xPosition = (screen.availWidth) / 2; 
        l_yPosition = (screen.availHeight) / 2; 
        windowParameters = 'height=305,width=300,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,left=' + l_xPosition + ',top=' + l_yPosition; 
        window.open("http://fleetassist.hpigmbh.com/eFleetIIWEB", "schwacke", windowParameters);
		return false;
} 

