var dopopupwh;
function dopopup(url,winhandle,width,height)
{
	if (typeof(dopopupwh) != "undefined" && dopopupwh != self) {
			dopopupwh.location = url;
			dopopupwh.focus;
			}
		else {
			dopopupwh = open(url,winhandle,'height=' + height + ',width=' + width + ',resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no')
		}
}

function fitWindowSize() {
	window.resizeTo(500, 500);
	
	width = 500 - (document.body.clientWidth -  document.images[0].width);
	height = 500 - (document.body.clientHeight -  document.images[0].height);
	window.resizeTo(width+30, height+125);
}

function suicide() {
self.opener.dopopupwh = opener;
}




function customerslogin(theform)
{ 		
		
if (theform.fUserId.value == "")
	{ 
		alert("Du måste fylla i ditt användarnamn.");
		theform.fUserId.focus();
		return false;
	}	

if (theform.fUserPw.value == "")
	{ 
		alert("Du måste fylla i ditt lösenord.");
		theform.fUserPw.focus();
		return false;
	}
	
return true;

}





function newsletter(theform)
{ 		
		
if (theform.company.value == "")
	{ 
		alert("Du måste fylla i företagsnamn.");
		theform.company.focus();
		return false;
	}

if (theform.firstname.value == "")
	{ 
		alert("Du måste fylla i ditt förnamn.");
		theform.firstname.focus();
		return false;
	}

if (theform.lastname.value == "")
	{ 
		alert("Du måste fylla i ditt efternamn.");
		theform.lastname.focus();
		return false;
	}

if (theform.phone.value == "")
	{ 
		alert("Vänligen fyll i ditt telefonnummer.");
		theform.phone.focus();
		return false;
	}

if (theform.email.value == "")
	{ 
		alert("Du måste fylla i din e-postadress.");
		theform.email.focus();
		return false;
	}	
if (theform.email.value.length > 0)
	{
	if (theform.email.value.search(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i))
		{
			alert("Din epostadress är felaktig. Vänligen kontrollera den igen.");
			theform.email.focus();
			return false;
		}	
	}
	
return true;

}



