function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.RegForm.FILE1.value != "" || document.RegForm.FILE2.value != "" || document.RegForm.FILE3.value != "")
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes; status: no;";
      window.showModelessDialog('UploadMessage.htm',null,winstyle);
    }
    else
    {
     TheWin = window.open('UploadMessage.htm','UplWin','width=370,height=115,scrollbar=no', true);
    }
  }
  this.formIt = document.RegForm;
  this.formIt.submit();
}


function debug(){
	
	this.formIt = document.RegForm;
	this.myFile 		= this.formIt.FILE1.value;
	this.F_NAME 		= this.formIt.F_NAME.value;
	this.E_NAME 		= this.formIt.E_NAME.value;
	this.ADDRESS		= this.formIt.ADDRESS.value;
	this.POSTALAREA 	= this.formIt.POSTALAREA.value;
	this.ZIPCODE 		= this.formIt.ZIPCODE.value;
	this.MOBILE 		= this.formIt.MOBILE.value;
	this.EMAIL 			= this.formIt.EMAIL.value;
	this.FILETITLE 		= this.formIt.FILETITLE.value;
	this.FILEDESCRIPTION= this.formIt.FILEDESCRIPTION.value;
	this.booool 		= true;

	if(this.F_NAME  == "" || this.F_NAME == "GLÖMT ATT FYLLA I"){
		this.formIt.F_NAME.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.E_NAME  == "" || this.E_NAME == "GLÖMT ATT FYLLA I"){
		this.formIt.E_NAME.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.ADDRESS  == "" || this.ADDRESS == "GLÖMT ATT FYLLA I"){
		this.formIt.ADDRESS.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.POSTALAREA  == "" || this.POSTALAREA == "GLÖMT ATT FYLLA I"){
		this.formIt.POSTALAREA.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.ZIPCODE  == "" || this.ZIPCODE == "GLÖMT ATT FYLLA I"){
		this.formIt.ZIPCODE.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}	
	if(this.MOBILE  == "" || this.MOBILE == "GLÖMT ATT FYLLA I"){
		this.formIt.MOBILE.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.EMAIL  == "" || this.EMAIL == "GLÖMT ATT FYLLA I"){
		this.formIt.EMAIL.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}else{
		if(checkEmailAddress(document.RegForm.EMAIL)){
			this.booool 		= true;
		}else{
			this.formIt.EMAIL.value = "FEL E-POST ADRESS";
			this.booool 		= false;
		}		
	}	
	if(this.FILETITLE  == "" || this.FILETITLE == "GLÖMT ATT FYLLA I"){
		this.formIt.FILETITLE.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.FILEDESCRIPTION  == "" || this.FILEDESCRIPTION == "GLÖMT ATT FYLLA I"){
		this.formIt.FILEDESCRIPTION.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}	
			
					
	if(this.myFile != ""){
		var ext = this.myFile;
	 	 ext 	= ext.substring(ext.length-3,ext.length);
	 	 ext 	= ext.toLowerCase();
		 if(ext != 'jpg') {
	   	 	alert('DU VALDE EN .'+ext+' FIL; VÄNLIGEN VÄLJ EN .jpg ISTÄLLET!');
			//this.formIt.FILE1.value = "DET MÅSTE VARA EN (.JPG) FIL";  
	    	this.booool = false; 
		}
	}else{
   	 	alert('DU MÅSTE VÄJA EN BILD (.JPG)!');
		//this.formIt.FILE1.value = "DU MÅSTE VÄJA EN BILD (.JPG)";  
		this.booool = false; 
    	//return false; 
	}
	
	// IF TRUE THEN SEND
	if(booool){
		ShowProgress();
		//this.formIt.submit();
	}	
	
}


/*======================================================
Script:     Email Address Checker-Validator

Functions:
   Checks name field to see if empty
   Checks e-mail address, which must have:
      - "@" symbol and no spaces
      - one or more good characters before
            and after "@" 
      - .xx country code or .com, .net,
            .edu, .mil, .gov, .org at end
Browsers:   All 4.0 and later browsers
============================================================*/

var good;
function checkEmailAddress(field) {
// Note: The next expression must be all on one line...
//       allow no spaces, linefeeds, or carriage returns!
//alert(field)
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){
  // good = true
  return true;
} else {
   //alert('Please enter a valid e-mail address.')
   //field.focus()
   //field.select()
  // good = false
  return false;
   }
}

function charAlert() {
	var textField = document.RegForm.FILEDESCRIPTION
	var characters = document.RegForm.FILEDESCRIPTION.value

	if(textField.value.length > 255){ 
		/* must be > 5, not == 5 or else the substring statement on the next line will cause the function to run again if the user dismisses the alert by pressing the 'enter' key rather than clicking 'OK'. */ 
		textField.value= textField.value.substring(0,5) 
		// set field's value equal to first five characters. 
		textField.blur() 
		/* move cursor out of form element to keep it from placing itself at position zero, causing an overwrite of the first character */
		alert("No more text can be entered") 
	}else{
		document.RegForm.text_counter.value = "Tecken kvar: "+(255 - characters.length)
	}
} 

function checkContact(){
	//alert("dnaef")
	//this.formIt.submit();
	this.formIt = document.contForm;
	//alert(this.formIt.name);
	this.NAME 			= this.formIt.NAME.value;
	this.EMAIL 			= this.formIt.EMAIL.value;
	this.FILEDESCRIPTION= this.formIt.FILEDESCRIPTION.value;
	this.booool 		= true;
	
	if(this.NAME  == "" || this.NAME == "GLÖMT ATT FYLLA I"){
		this.formIt.NAME.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}
	if(this.EMAIL  == "" || this.EMAIL == "GLÖMT ATT FYLLA I"){
		this.formIt.EMAIL.value = "GLÖMT ATT FYLLA I";
		this.booool 		= false;
	}else{
		if(checkEmailAddress(document.contForm.EMAIL)){
			this.booool 		= true;
		}else{
			this.formIt.EMAIL.value = "FEL E-POST ADRESS";
			this.booool 		= false;
		}		
	}
	if(this.FILEDESCRIPTION  == "" || this.FILEDESCRIPTION == "GLÖMT ATT FYLLA I"){
		this.formIt.FILEDESCRIPTION.value = "GLÖMT ATT FYLLA I";
		field.focus()
   		field.select()
		this.booool 		= false;
	}	
			
	// IF TRUE THEN SEND
	if(booool){
		this.formIt.submit();
	}	
	
}

// the active link 
var activeLink;
function InitialiseFrames(active) {
	if(active != ""){
		color = "#99CC99";
		document.getElementById(active).style.color = color;
		activeLink = document.getElementById(active)
		
	}else{
		color = "#99CC99";
		document.getElementById("1").style.color = color;
		activeLink = document.getElementById("1");
			
	}

}

/* Sets the Active Link to normal*/
function resetActive(link){

	color = "#ffffff";
	activeLink.style.color = color;
	activeLink = link;
	link.style.color = "#99CC99"; 
	location.href = "/default_2006.asp?ID=" + link.id;
	
}
/* Sets the Active Link to normal*/
function overActive(link){
	color = "#99CC99";
	link.style.color = color;
	activeLink.style.color = "#99CC99"; 
} 
/* Sets the Active Link to normal*/
function outActive(link){
	color = "#ffffff";
	link.style.color = color;
	activeLink.style.color = "#99CC99";  
} 


function openW(mypage,myname,w,h,features) {
	if(screen.width){
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
	}else{winl = 0;wint =0;}
	
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	// Features Settings
	if (features != "" || features == "basic")
		features = "menu=no,status=no";
	if (features != "" || features == "full")
		features = "";
	if (features == "none")
		features = "menu=no,status=no,scrollbars=no,directories=no,location=no,resizable=no";
	
	var settings = 'height=' + h + ',';
		settings += 'width=' + w + ',';
		settings += 'top=' + wint + ',';
		settings += 'left=' + winl + ',';
		settings += features;
	win = window.open(mypage,myname,settings);
	win.window.focus();
}