 function openWin(URL,name,width,height,scroll) {
   self.name = "main";
   newWin = window.open(URL,name,
'width='+width+',height='+height+',status=no,toolbar=no,menubar=no,scrollbars='+scroll);
newWin.focus();
} 

//Open Window function
 function openPhotoWin(URL,width,height) {
 	var photowin;
 if (photowin){photowin.close()};
   photowin = window.open(URL,'photo',
'width='+width+',height='+height+',status=no,toolbar=no,menubar=no,scrollbars=no');
photowin.focus();
}   


function returnError(ErrorMessage, Field) {
		alert(ErrorMessage);
		Field.select();
		Field.focus();}

/*Some constants used by other functions */
	buttonPressed = true;
	reNoDigits = /\D+/;
	reAlfaNumber = /[^a-zA-Z0123456789_\-]+/;
	reAlfaNumberSwe = /[^a-zA-ZåäöÅÄÖ0123456789_\-]+/;
	reFileName = /[^a-zA-Z0123456789_\-\.]+/;

/*Validate if a field is empty */
function isEmpty(Field){
	if (Field == '') {return true;}
}

/*Validate if field is numeric */	
function notNumber(Field, Optional) {
	if (reNoDigits.test(Field) || Field == '' && Optional =='') {return true;}
} 	

/*Validate if filename contains characters other than a-z, 0-9, _ - . */
function notGoodFileName(Field, Optional)	{
	pos = Field.lastIndexOf( '\\' ) ;
	tot = Field.length;
	filename = Field.substr( pos+1, tot );
	if (reFileName.test(filename)|| filename == '' && Optional =='') {return true;}
	} 

