/*

----Javascript------
Created by Randy Bennet http://home.thezone.net/~rbennett/utility/javahead.htm
Featured on JavaScript Kit (http://javascriptkit.com)
For this and over 400+ free scripts, visit http://javascriptkit.com
*/
/* script för kundvagn select box alltid synlig*/

function setVariables() {
if (document.layers) {
v=".top=";
dS="document.";
sD="";
y="window.pageYOffset";
}
else if (document.all){
v=".pixelTop=";
dS="";
sD=".style";
y="document.body.scrollTop";
}
else if (document.getElementById){
y="window.pageYOffset";
}
}
function checkLocation() {
object="object1";
yy=eval(y);
if (document.getElementById)
document.getElementById("object1").style.top=yy
else
eval(dS+object+sD+v+yy)
setTimeout("checkLocation()",10);
}
/* script för meny (visa dölj)*/

function toggle(e){
	if (e.style.display == ""){
		e.style.display = "none";}
	else{
		e.style.display = "";}	
}

function bild(b){
var r, re; 
s = b.src;
 re = /-.gif/i; 
 r = s.match(re);
	if (r == "-.gif"){
		b.src= "images/+.gif";
		}
	else{
		b.src = "images/-.gif";
		
				
		}
	
		
}

function MatchDemo(){

           //Declare variables.

   var s = "The rain in Spain falls mainly in the plain";

   re = /ain/i;    //Create regular expression pattern.

   r = s.match(re);   //Attempt match on search string.

   return(r);         //Return first occurrence of "ain".

}


/* Check required form elements script- By JavaScript Kit (http://javascriptkit.com) Over 200+ free scripts here!*/
function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Du måste fylla i alla fält markerat med en stjärna ")
return false
}
else
return true
}
/* script för felmedelanden*/

function medelande(text)

{alert(text);}

function popupAuto(id) {

var tmarg = 100;
var vmarg = 350;
var bredd = 500;
var hoejd = 500;


// Hela den följande koden - till och med ); - skall ligga på en rad
adress = 'testbild2.asp?id='+ id ;
newWindow = window.open(adress,'newWindow','toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no,location=no,top='+tmarg+',left='+vmarg+',width='+bredd+',height='+hoejd);
}

function scrollWindow()
{
parent.scrollTo(0,0)
}





