function ClearFormField(field,text) {
	// Usage: onFocus="ClearFormField(this.form.username,'Username');"
		if (field.value == text) {
			field.value = "";
			field.SetFocus;
		}
	}

function Navigate(FormObj) {
		if (FormObj.options[FormObj.selectedIndex].value != "") {
			self.location.href=FormObj.options[FormObj.selectedIndex].value;
		}
	}


function dowinpopup(url,winhandle,width,height) {

	window.open(url,winhandle,'height=' + height + ',width=' + width + ',resizable=yes,scrollbars=yes,menubar=no,toolbar=no,directories=no,location=no,status=yes,left=0,top=0,screenX=0,screenY=0')
}

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=yes,scrollbars=yes,menubar=no,toolbar=no,directories=no,location=no,status=yes,left=0,top=0,screenX=0,screenY=0')
		}
}

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 ClearFormField(field,text) {
	// Usage: onFocus="ClearFormField(this.form.username,'Username');"
		if (field.value == text) {
			field.value = "";
			field.SetFocus;
		}
	}

	function Navigate(FormObj) {
		if (FormObj.options[FormObj.selectedIndex].value != "") {
			self.location.href=FormObj.options[FormObj.selectedIndex].value;
		}
	}


function control(theForm)
{ 

	if (theForm.email.value == "")
	{ 
		alert("Du måste skriva in 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 e-postadress är felaktig. Vänligen kontrollera den igen.");
				theForm.email.focus();
				return false;
			}	
	}
return true;
	
}
