// JavaScript Document
function validate()
{
var antall=document.getElementById("ant1").value;
var int=new RegExp("[1-9]");
 
submitOK="true";

if (antall == null || antall == "")
	 {
		 alert("Antall mangler");
		 submitOK="false";
	 }
else if (!int.test(antall) == true)
	{
 		alert("Verdien av antall er ikke gyldig");
		submitOK="false";
	}
if (submitOK=="false")
	{
 		return false;
	}
}
function open_win()
{
cart=window.open("cart.php","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=790, height=700");
cart.focus();
}
/*function open_pic(pic)
{
bilde=window.open("bilde.php?bilde=pic","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=750, height=700");
bilde.focus();
}*/
function open_wininfo(frm)
{
valgf= window.open("about:blank","form_win0","toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=900, height=700");
valgf.focus();
}
function submit_form(frm)
{
  valg=window.open('about:blank', 'form_win', 'height=200,width=300,menubar=no,resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no');
  frm.submit();
  valg.focus();
}
/*function submit_form_v(frm)
{
  window.open('about:blank', 'form_win0', 'height=130,width=300,menubar=no,resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no');
  frm.submit();
}
function submit_form_f(frm)
{
  window.open('about:blank', 'form_win', 'height=400,width=400,menubar=no,resizable=no,toolbar=no,location=yes,directories=no,status=no,scrollbars=yes');
  frm.submit();
}*/
function fullfort()
{
	ref= document.getElementById('ref').value;
	ok = "y";
	if(ref == "" || ref == null)
	{
		alert("Du har ikke fylt inn referanse");
		ok = "n";
	}
	if(ok == "y")
	{
		alert("Bestillingen er sendt, du vil straks motta en epost med bekreftelse ");
	}
	if(ok == "n")
	{
		return false;
	}

}
function load()
{
	document.getElementById('adrid').click();
	document.getElementById('transport').click();
}

function rabatt(str)
	{
		if (window.ActiveXObject) req = new ActiveXObject("Microsoft.XMLHTTP");
		else if (window.XMLHttpRequest) req = new XMLHttpRequest();
		if(req != null)
		{
			req.open("GET", "../classes/hentrab.php?q=" + str + "&id=" + Math.random(), true);
			req.send(null);
			req.onreadystatechange  = stateChanged;
		}
	}
	function stateChanged()
	{
		if(req.readyState == 4)
		document.getElementById("rab").innerHTML = req.responseText;
	}
 
 function change(bilde)
{
	 document.getElementById("pic").src=bilde
}
function tekst(text)
{
	document.getElementById("info").innerHTML="<td>" + text + "</td>"
}
function tekstut()
{
	document.getElementById("info").innerHTML="&nbsp;"
}
function nyadr()
{
	document.getElementById('adrid_ny').click();	
}

