function showProrainerProductInfo(artnr)
{
	var artikel;
	artikel = artnr;
	top.main.location.href = "./showProrainerProductInfo.php?Artnr=" + artikel;

}

function showSlamProductInfo(artnr)
{
	var artikel;
	artikel = artnr;
	top.main.location.href = "./showSlamProductInfo.php?Artnr=" + artikel;

}

//Menyfunktioner

function ShowSubMenu(meny)
{
		var i;
		for(i=1;i<3;i++)
		{
			eval('top.main.meny' + [i] + 'sub.style.visibility="hidden"');
		}
		top.main.scrollTo(0,0);
		eval('top.main.' + meny + 'sub.style.visibility="visible"');
}

function HideSubMenu(meny)
{
	var topMenu = top.logga.document.menuControl.topMenu.value;
	var subMenu = top.logga.document.menuControl.subMenu.value;
	
	if(topMenu == 'closed' && (subMenu == 'closed' || subMenu == ""))
	{
		eval('top.main.' + meny + 'sub.style.visibility="hidden"');
	}
}

function hide(meny)
{
	eval('top.main.' + meny + 'sub.style.visibility="hidden"');
}

function setFlag(val)
{
	top.logga.document.menuControl.topMenu.value = val;
}

timer = 0;

function changeImgs(img)
{
	//var ImgSrcName = "document.bildspel.src";
	//var currImg = document.bildspel.src;
	//var imgName;
	
	if(img == 1)
	{
		document.slam_img.src = "./images/slam_ocean_waves_byxa.jpg";
		document.prorainer_img.src = "./images/prorainer_4470_g.jpg";
		document.panasonic_img.src = "./images/panasonic_CF_18.gif";
		document.seatrack_img.src = "./images/seatrack_2.gif";
		document.tng_img.src = "./images/tng_watch_2.gif";
		
		timer = setTimeout('changeImgs(\'2\')',2000);
	}
	if(img == 2)
	{
		document.slam_img.src = "./images/slam_ocean_waves_jacka.jpg";
		document.prorainer_img.src = "./images/prorainer_2470_g.jpg";
		document.panasonic_img.src = "./images/panasonic_wireless_screen.jpg";
		document.seatrack_img.src = "./images/seatrack_instrument_mini.jpg";
		document.tng_img.src = "./images/tng_watch.jpg";
		
		timer = setTimeout('changeImgs(\'1\')',2000);
	}
	
}

//Scrollfunktion för första sidan

 var srcArray = [
 
 "./images/slideshow/GDS_0506.jpg",
 "./images/slideshow/GDS_0512.jpg",
 "./images/slideshow/GDS_0546.jpg",
 "./images/slideshow/GDS_1059.jpg",
 "./images/slideshow/GDS_3173.jpg",
 "./images/slideshow/GDS_3179.jpg",
 "./images/slideshow/GDS_3633.jpg",
 "./images/slideshow/GDS_4009.jpg",
 "./images/slideshow/GDS_4864.jpg" 
 ];
 
 var maxNo = srcArray.length;
 var curNo = 0;
 
 var longDelay = 0;
 var shortDelay = 15;
 
 var scrollPos = 0;
 var scrollent;
 
 function initScroller() {
 	
 	scrollent = document.getElementById( "slideshow" );
 
 	//alert("initScroller");
 	if ( document.all ) { // Adjust timing for IE
 		longDelay = longDelay * 1.1;
 		shortDelay = shortDelay * 1.1;
 	}
 
 	for ( var i = 0; i < 9; i++ ) {
 		addPic();
 	}
 	
 	setTimeout( "doit();", 1500 );
 }
 
 function addPic() {
 	
 	var img = document.createElement( "IMG" );
 		
 	img.src = srcArray[ curNo ];
 		
 	img.className = "img";
 		
 	scrollent.appendChild( img );
 		
 	curNo++;
 }
 
 function doit() {
 
 	//alert("doit");
 	
 	if ( curNo >= maxNo-1 ) {
 		curNo = 0;
 	}
 	
 	addPic();
 	scrollPos = 0;
 	
 	setTimeout( "scroll()", shortDelay );
 }
 
 function scroll() {
 	
 	
 	scrollent.style.left = "-" + scrollPos + "px";
 	scrollPos++;
 	
 	if ( scrollPos < 525 ) {
 		setTimeout( "scroll()", shortDelay );
 	} 
 	else {
 		var el = scrollent.childNodes[ 0 ];
 		
 		scrollent.removeChild( el );
 		scrollent.style.left = "0px";
 		
 		if ( (curNo < 10 && curNo % 2 != 0) || (curNo > 6 && curNo % 2 == 0) ) {
 			
 			setTimeout( "doit()", longDelay );
 		} else {
 			
 			doit();
 		}
 	}
}


var timer2;

function showSubMenu(id,stopid)
{
	window.clearTimeout(timer2);
	
	var menuEl = document.getElementById("subMenuAlt" + id);
	
	menuEl.style.visibility = "visible";
	
	id++;
	
	if(id <= stopid)
	{
		timer2 = setTimeout("showSubMenu(" + id + "," + stopid + ")",50);
	}
}

function hideSubMenu(id)
{
	window.clearTimeout(timer2);
	
	var formEl = document.getElementById("menu_form");
		
	var menu_status = formEl.status.value;
	
	var menuEl = document.getElementById("subMenuAlt" + id);
	
	if(menu_status == "closed")
	{
		menuEl.style.visibility = "hidden";
	
		id = id - 1;
	
		if(id > 0)
		{
			timer2 = setTimeout("hideSubMenu(" + id + ")",50);
		}
		
	}
}

function doHideSubMenuAll()
{
	
	var j;
	
	for(j = 1;j < 9;j++)
	{
		var menuEl = document.getElementById("subMenuAlt" + j);
		
		menuEl.style.visibility = "hidden";
		
	}
}

function setMenuFlag(val)
{

	var formEl = document.getElementById("menu_form");

	formEl.status.value = val;
	
}

//Första sidan

function index_showSubMenu(id,stopid)
{
	window.clearTimeout(timer2);
	
	var menuEl = document.getElementById("index_subMenuAlt" + id);
	
	menuEl.style.visibility = "visible";
	
	id++;
	
	if(id <= stopid)
	{
		timer2 = setTimeout("index_showSubMenu(" + id + "," + stopid + ")",50);
	}
}

function index_hideSubMenu(id)
{
	window.clearTimeout(timer2);
	
	var formEl = document.getElementById("menu_form");
		
	var menu_status = formEl.status.value;
	
	var menuEl = document.getElementById("index_subMenuAlt" + id);
	
	if(menu_status == "closed")
	{
		menuEl.style.visibility = "hidden";
	
		id = id - 1;
	
		if(id > 0)
		{
			timer2 = setTimeout("index_hideSubMenu(" + id + ")",50);
		}
		
	}
}

function index_doHideSubMenuAll()
{
	
	var j;
	
	for(j = 1;j < 9;j++)
	{
		var menuEl = document.getElementById("index_subMenuAlt" + j);
		
		menuEl.style.visibility = "hidden";
		
	}
}

function index_setMenuFlag(val)
{

	var formEl = document.getElementById("menu_form");

	formEl.status.value = val;
	
}

//scriptfile

var timer3;

function rotatePic()
{
	window.clearTimeout(timer3);
	var img = document.getElementById("memotime_header");
	
	var img_width = eval("img" + img_count + ".width");
	var currOp = 100;
	
	//var img_height = img.width;
	timer3 = setTimeout('doWidth(' + currOp + ')',200);
	
	//alert(img_width);
}

var timer;

function doWidth(io)
{
	window.clearTimeout(timer);
	
	var img = document.getElementById("memotime_header");
	var img_op= io;
	
	while(io > 5)
	{
		
		img.style.filter = "alpha(style=0,opacity=" + io + ")";
		
		io = img_op - 10;
		
		break;
		
	}
	if(io <= 5)
	{
		window.clearTimeout(timer);
		timer = setTimeout("getNewImg()",500);
	}
	if(io > 5)
	{
		timer = setTimeout('doWidth(' + io + ')',300);
	}
	
}

var img_count;
img_count = 0;

function getNewImg()
{
	window.clearTimeout(timer);
	
	var img = document.getElementById("memotime_header");
	
	var imgArr = new Array("./images/memotime_2.jpg","./images/memotime_1.jpg");
	
	//img.height = 358;
	
	img.width = eval("img" + img_count + ".width");
	
	if(img_count < 1)
	{
		img_count++;
	}
	else
	{
		img_count = 0;
		
	}
	
	img.src = imgArr[img_count]; 
	
	timer = setTimeout("rotatePic()",1500);
		
}