// Validerar angivit antal till kundvagn
function validate_quantity(aForm) {
	if (isNaN(aForm.antal.value)) {
		alert("Du har angivit ett felaktigt beställningsvärde! \n\n- Ange endast siffror i antal.");
		return false;
	}
	else if (aForm.antal.value < 1 || aForm.antal.value > 999) {
   		alert("Du har angivit ett felaktigt beställningsvärde! \n\n- Din beställning måste vara mellan 1 - 999 st.");
   		return false;
   	}
   	else {
   		return true;
   }
 }
 
 
// Script för att visa/dölja lager/tabell **************

function switchMenu(name) { 
  var obj = document.getElementById(name); 
  if(obj.style.display != "block") { 
    obj.style.display = "block"; 
  } 
  else { 
    obj.style.display = "none"; 
  } 
} 

function HideMenu(name) { 
  var obj = document.getElementById(name); 
    obj.style.display = "none"; 
} 

// Visa/dölj lager slut *******************************************

// Script för att öppna fönster **************
 function openWindow(URLtoOpen, windowName, windowFeatures) 
 {
  newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
 }
// öppna fönster slut *******************************************

	function delInput(obj) {
	var msg = "Sök artiklar..."
	if(obj.value == "") {
		obj.value = msg; 
	} else if(obj.value == msg) {
		obj.value = ""
	}
}


// Maximera fönster *******************************************
	function maximize()
	{
		top.window.moveTo(0,0); 
		if (document.all) 
		   { top.window.resizeTo(screen.availWidth,screen.availHeight); } 
		else if 
		   (document.layers || document.getElementById) 
		   { 
		   if 
			(top.window.outerHeight < screen.availHeight || top.window.outerWidth < 
		screen.availWidth)
			 { top.window.outerHeight = top.screen.availHeight; 
			   top.window.outerWidth = top.screen.availWidth; } 
		   } 
	}
	
	var win= null;
	function NewWindow(mypage,myname,w,h,scroll){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='resizable=yes';
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
	} 
	function MM_openBrWindow(theURL,winName,features) { 
	window.open(theURL,winName,features);
	}
	
// Maximera fönster slut *******************************************

// Sätt höjden på scroll ytan *******************************************
	function setScroller()
	{
		var Scrollid = document.getElementById('scroller');
		var x,y;
		if (self.innerHeight) // all except Explorer
		{
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)// Explorer 6 Strict Mode
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		
		// Justa höjden här:
		y = y - 240
		//alert(y)
		Scrollid.style.height = y + 'px'; 
	}