


		function getpopup(loc){
			//Determine the Available Width on the page 
			var fWidth; 
			//For old IE browsers 
			if(document.all) 
			{ 
			fWidth = document.body.clientWidth; 
			} 
			//For DOM1 browsers 
			else if(document.getElementById &&!document.all) 
			{ 
			fWidth = innerWidth-18; 
			} 
			else if(document.getElementById) 
			{ 
			fWidth = innerWidth; 
			} 
			//For Opera 
			else if (is.op) 
			{ 
			fWidth = innerWidth; 
			} 


			var elem = document.getElementById("boxB");			
			
			
			LeftPosition = (fWidth) ? (fWidth-783)/2 : 0;
			
			elem.style.visibility='visible';
			elem.style.left = LeftPosition +"px";






			if (loc != "")	{
				//alert(loc);
				parent.rese.location.href=loc;
			}
			else	{}
		}
		
		
		
		/*
		Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
		Permission granted to Dynamic Drive to feature script in archive
		For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
		*/
		
		var win = null;
		function NewWindow(mypage,myname,w,h,scroll,rez,direct,loc,menu,stat,tool){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings =
		'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+rez+',directories='+direct+',location='+loc+',menubar='+menu+',status='+stat+',toolbar='+tool
		win = window.open(mypage,myname,settings)
		}


var bSubmitted
// Client script eventhandler form_onSubmit
function form_onSubmit(){
	var objFrm = document.forms['frmMain']
	
	if (objFrm == null) return false
	
	if (bSubmitted) {
		alert(msg.pleasewait)
		return false //prevents multi button press
		}

	objFrm.SupportsScript.value = 'True'
	
	var objCtr
	
	objCtr = objFrm.inpPointFr
	if ("text" == objCtr.type) {
		if(objCtr.value.length < 2){alert('Du måste ange minst 2 tecken');objCtr.focus();return false}
		}
	objCtr = objFrm.inpPointTo
	if ("text" == objCtr.type) {	
		if(objCtr.value.length < 2){alert('Du måste ange minst 2 tecken');objCtr.focus();return false}
		}
	bSubmitted = true
	getpopup();
	return true
}

function checkDate(oInpDate){
	var bValid = false;
	if (oInpDate.value.length == 6)	{
			
		var day = oInpDate.value.substr(4,2);
		var month = oInpDate.value.substr(2,2);
		var year = '20' + oInpDate.value.substr(0,2);
			
    		var today = new Date();
   		 year = ((!year) ? y2k(today.getYear()):year);
  		  month = ((!month) ? today.getMonth():month-1);
  		  if (day) {
   		 	var test = new Date(year,month,day);
   		 	if ( (y2k(test.getYear()) == year) &&
   		  	    (month == test.getMonth()) &&
   		  	    (day == test.getDate()) )
   		   	  bValid = true;
		   			 
			}
	}
			
	if(!bValid) {
		alert('Du har angivit fel datum-format (ååmmdd): ' + oInpDate.value)		
		if(document.layers) objFrm.selDirection.focus() //prevents recursion i NE4
		}

}

function y2k(number) { 
	return (number < 1000) ? number + 1900 : number;
}

function checkTime(oInpTime){	

	if(oInpTime.value.length==3) oInpTime.value = "0" + oInpTime.value
	
	var retVal = false
	var strVal = oInpTime.value
	
	if(strVal.length == 4){
		if(!isNaN(strVal)){
			while(strVal.charAt(0) == '0') strVal = strVal.substring(1, strVal.length)
			if(strVal == '') strVal = '0'
			var intTime = parseInt(strVal)
			if(intTime<2400 && intTime >= 0){
				if(intTime%100<60){
					retVal = true
				}
			}
		}
	}

	if (retVal == false) {
			alert('Du har angivit ett icke giltigt klockslag: ' + oInpTime.value)		
			if(document.layers) objFrm.selDirection.focus() //prevents recursion i NE4
			}
				
}

