function validate_form()
{
valid = true;	

//Loopa igenom radionbuttons
var radio_choice = false;
for (counter = 0; counter < myform.typ.length; counter++)
{
if (myform.typ[counter].checked)
radio_choice = true; 
}
	
	 if (!radio_choice)
       {
            alert ( "Du måste välja betalningstyp");
             valid = false;
       }	   
	else if ((myform.kundnr.value=="") && (valid == true))
		{
	     alert ( "Du måste fylla i kundnummer" );
		 valid = false;
	   }
	else if ((myform.refno.value=="") || (isNaN(myform.refno.value)) || (myform.refno.value.length!=4) && (valid == true))
       {
            alert ( "Best. Nr stämmer inte" );
             valid = false;
	   }
	else if ((myform.summa.value=="") || (isNaN(myform.summa.value)) && (valid == true))
       {
            alert ( "Priset måste fyllas i och vara i kr." );
             valid = false;
       } 
	 else if ( (myform.Comment.value == "")  && (valid == true))
       {
            alert ( "Du måste fylla i ditt namn" );
             valid = false;
       }	   
        return valid;
}

function refreshImages(){
var search="?"+(new Date()).getTime();
for(var i=0;i<document.images.length;document.images[i++].src+=search);
}

var sWidth = screen.width;
sWidth=(sWidth/2)-350;
function winPopUp(filename) {
msgWindows=window.open(filename, "","top=150,left=" + sWidth + ",resizable=yes,scrollbars=no,width=350,height=420");
}
function winPopUploop(filename) {
msgWindows=window.open(filename, "","top=150,left=" + sWidth + ",resizable=yes,scrollbars=no,width=600,height=400");
}
/*använd vid utskrift fönster
function winPopUpprint(filename) {
msgWindows=window.open(filename, "","top=150,left=" + sWidth + ",resizable=yes,scrollbars=yes,width=700,height=600");
            }
*/
function doSlide(id){
	timeToSlide = 10; // in milliseconds
	obj = document.getElementById(id);
	if(obj.style.display == "none"){ // si c hidden on fait le slide
		obj.style.visibility = "hidden";
		obj.style.display = "block";
		height = obj.offsetHeight;
		obj.style.height="0px";
		obj.style.visibility = "visible";
		pxPerLoop = height/timeToSlide;
		slide(obj,0,height,pxPerLoop,'down');
	} else {
		height = obj.offsetHeight;
		pxPerLoop = height/timeToSlide;
		slide(obj,height,height,pxPerLoop,'up');
	}
}

function slide(obj,offset,full,px,direction){
	if(direction == 'down'){
		if(offset < full){
			obj.style.height = offset+"px";
			offset=offset+px;
			setTimeout((function(){slide(obj,offset,full,px,'down');}),1);
		} else {
			obj.style.height = "auto"; //Can be usefull in updated divs otherwise
			//just use full+"px"
		}
	}else if(direction == 'up'){
		if(offset > 5){
			obj.style.height = offset+"px";
			offset=offset-px;
			setTimeout((function(){slide(obj,offset,full,px,'up');}),1);
		} else {
			obj.style.display = "none";
			obj.style.height = height+"px";
		}
	}
}
