<!--

function imgPopup(url,winTitle){
	MyWin = window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100");
	with(MyWin.document){
	open();
	write("<html>\n<head><scr"+"ipt>awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;</scr"+"ipt>\n<title>"+url+"</title>\n</head>\n<body onLoad=\"window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight+32)\"  onBlur=\"window.close()\" marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:text;\">\n");
	write("<img src=\""+url+"\">\n");
	write("</body>\n</html>\n");
	close();
	}
}

function trim(str){
	newstr = str.replace(/^\s*|\s*$/g,"");
	return newstr;
}

function formvalidation(thisform, formnr)
{
	with (thisform)
	{
	if (digitvalidation(document.getElementById('txtantal'+formnr),1,10,"Ange ett antal")==false) {document.getElementById('txtantal'+formnr).focus(); return false;};
	if (document.getElementById('txtstorlek'+formnr)) {
		if (emptyvalidation(document.getElementById('txtstorlek'+formnr),"Ange storlek")==false) {document.getElementById('txtstorlek'+formnr).focus(); return false;};
	}
	if (document.getElementById('txtfarg'+formnr)) {
		if (emptyvalidation(document.getElementById('txtfarg'+formnr),"Ange färg")==false) {document.getElementById('txtfarg'+formnr).focus(); return false;};
	}
	}
	document.getElementById('form'+formnr).submit();
}

function formvalidation2(thisform)
{
	with (thisform)
	{
	if (emptyvalidation(document.getElementById('txtcompany'),"Ange ett företag")==false) {document.getElementById('txtcompany').focus(); return false;};
	if (emptyvalidation(document.getElementById('txtaddress'),"Ange en adress")==false) {document.getElementById('txtaddress').focus(); return false;};
	if (digitvalidation(document.getElementById('txtzipcode'),5,5,"Ange ett postnummer")==false) {document.getElementById('txtzipcode').focus(); return false;};
	if (emptyvalidation(document.getElementById('txtcity'),"Ange en postort")==false) {document.getElementById('txtcity').focus(); return false;};
	if (emptyvalidation(document.getElementById('txtphone'),"Ange ett telefonnummer")==false) {document.getElementById('txtphone').focus(); return false;};
	if (emailvalidation(document.getElementById('txtemail'),"Ange en giltig e-postadress")==false) {document.getElementById('txtemail').focus(); return false;};
	}
	document.uploadform.submit();
	showLoadingPage();
}

function digitvalidation(entered, min, max, alertbox, datatype)
{
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") 
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}
function emptyvalidation(entered, alertbox, max)
{
	with (entered)
	{
		value = trim(value)
		
		if (value==null || value=="")
		{
				if (alertbox!="") {alert(alertbox);} return false;
		}
		
		else 
		{
			if (value.length<max)
			{
				if (alertbox!="") {alert("Du måste ange minst "+max+" tecken");} return false;
			}
			else
			{
				return true;
			}
		}
	}
}

function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}



function hideLoadingPage() {
	if (document.getElementById) {  // DOM3 = IE5, NS6
		document.getElementById('hidepage').style.visibility = 'hidden';
	}
	else if (document.layers) {  // Netscape 4
			document.hidepage.visibility = 'hidden';
	}
	else {  // IE 4
		document.all.hidepage.style.visibility = 'hidden';
	}
}

function showLoadingPage() {
	if (document.getElementById) {  // DOM3 = IE5, NS6
		document.getElementById("hidepage").style.visibility="visible";
	}
	else if (document.layers) {  // Netscape 4
		document.hidepage.visibility = "show";
	}
	else {  // IE 4
		document.all.hidepage.style.visibility="visible";
	}
}

function confirmation(msg, url) {
	var answer = confirm(msg)
	if (answer){
		window.location.href = url;
	}
}


function popup(sUrl,sName) {
		window.open(sUrl,sName,"width=370,height=350,scrollbars=yes,status=no,toolbar=no,resizable=no,location=no,menubar=no,directories=no")
	}

-->
