function validate()
{
if(document.forms[0].tvl_mem.checked)
	document.forms[0].tvl_mem.value="YES";
else
   document.forms[0].tvl_mem.value="NO";

}

function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=337,height=415,left = 227,top = 10');");
}

function popUp3(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=250,height=300,left = 227,top = 150');");
}

var win800 = null
function w8()
{

	var POP_WIDTH = 794
	var POP_HEIGHT = 610
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var aa = "toolbar=no,directories=no, menubar=no, scrollbars=yes, resizable=yes";
	aa = aa +",width="  + POP_WIDTH;
	aa = aa +",height=" + POP_HEIGHT;
	aa = aa + ",left=" +leftpos;
	aa = aa + ",top=" +toppos;

	win800=open("" ,"vwin", aa);
	winfocus (win800)
}

function winfocus(str)
{
	str.focus();
}

var MidWindow = null
function openDestWindow(winURL)
{
	var POP_WIDTH = 420
	var POP_HEIGHT = 510
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var features = "scrollbars=yes, resizable=yes";
	features = features +",width="  + POP_WIDTH;
	features = features +",height=" + POP_HEIGHT;
	features = features + ",left=" +leftpos;
	features = features + ",top=" +toppos;

	MidWindow=open(winURL,"MidWindow",features);
}

var MidWindow = null
function openWindow(winURL)
{
	var POP_WIDTH = 290
	var POP_HEIGHT = 300
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var features = "scrollbars=no, resizable=yes";
	features = features +",width="  + POP_WIDTH;
	features = features +",height=" + POP_HEIGHT;
	features = features + ",left=" +leftpos;
	features = features + ",top=" +toppos;

	MidWindow=open(winURL,"MidWindow",features);
}

var MidWindow = null
function openHelpWindow(winURL)
{
	var POP_WIDTH = 760
	var POP_HEIGHT = 600
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var features = "scrollbars=no, resizable=yes";
	features = features +",width="  + POP_WIDTH;
	features = features +",height=" + POP_HEIGHT;
	features = features + ",left=" +leftpos;
	features = features + ",top=" +toppos;

	MidWindow=open(winURL,"MidWindow",features);
}

var MidWindow = null
function VWindow(winURL)
{
	var POP_WIDTH = 760
	var POP_HEIGHT = 600
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var features = "scrollbars=yes, resizable=yes";
	features = features +",width="  + POP_WIDTH;
	features = features +",height=" + POP_HEIGHT;
	features = features + ",left=" +leftpos;
	features = features + ",top=" +toppos;

	MidWindow=open(winURL,"MidWindow",features);
}

var MidWindow = null
function openReqWindow(winURL)
{
	var POP_WIDTH = 794
	var POP_HEIGHT = 511
	var leftpos = (screen.width - POP_WIDTH) / 2; 
	var toppos = (screen.height - POP_HEIGHT) / 2;
	var features = "scrollbars=no, resizable=yes";
	features = features +",width="  + POP_WIDTH;
	features = features +",height=" + POP_HEIGHT;
	features = features + ",left=" +leftpos;
	features = features + ",top=" +toppos;

	MidWindow=open(winURL,"MidWindow",features);
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.ccoptin.ea
		
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Vennligst legg inn din e-postadresse igjen")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

function validateData()
{
	if (document.vouch.groupname.value == "")
	{
		alert("Vennligst velg Firma/Gruppenavn")
		document.vouch.groupname.focus()
		return (false)
	}
	if (document.vouch.kperson.value == "")
	{
		alert("Vennligst velg Kontakt person")
		document.vouch.kperson.focus()
		return (false)
	}
		if (document.vouch.tel.value == "")
	{
		alert("Vennligst velg Telefon")
		document.vouch.tel.focus()
		return (false)
	}
		if ((document.vouch.email.value == "")||(document.vouch.email.value == null))
	{
		alert("Vennligst legg inn din e-postadresse igjen")
		document.vouch.email.focus()
		return (false)
	}
		if (echeck(document.vouch.email.value)==false){
		document.vouch.email.value=""
		document.vouch.email.focus()
		return false
	}

		if (document.vouch.til.value == "")
	{
		alert("Vennligst velg Til")
		document.vouch.til.focus()
		return (false)
	}
	if (document.vouch.goingdt.value == "")
	{
		alert("Vennligst velg Utreise dato")
		document.vouch.goingdt.focus()
		return (false)
	}
		if (document.vouch.comingdt.value == "")
	{
		alert("Vennligst velg Hjemreisedato")
		document.vouch.comingdt.focus()
		return (false)
	}
}


