var mayMove = true;

function relocate(url){
	if(mayMove){
		document.location.href= url;	
	}else{
		mayMove = true;
	}
}
function confirmDel(itemName,itemId,formName)
{		

		mayMove = false;
		thisForm = document.forms[formName];
		if(! window.confirm('Weet u zeker dat u item '+itemName+" wilt verwijderen?")){	
			return;
		}else{		
			thisForm.submit();
		} 
}
function postForm(formName,action){
	var oneChecked = false;
	thisForm = document.forms[formName];
	 for(z=0; z<thisForm.length;z++){
      if(thisForm[z].type == 'checkbox'){
	  		if(thisForm[z].checked == true){
				oneChecked = true;
			}
	  }
     }
	if(oneChecked || action == 'numExt' || action == 'addDef' || action == 'addPre'){
		thisForm.action.value = action;
		thisForm.submit();
	}else{
		alert('Er is niets geselecteerd');
	}
}
function simplePost(formName){
	var allNums = new Array(); 
	var doSubmit = true;
	thisForm = document.forms[formName];
	if(formName == 'picOrder'){
		for(z=0; z<thisForm.length;z++){
			if(thisForm[z].type == 'select-one'){
				if(allNums[thisForm[z].value] != 1){
					allNums[thisForm[z].value] = 1 ;
				}else{
					doSubmit = false;
					alert('Deze volgorde klopt niet');
				}
				
	  		}	
    	}
	
			
		
	}
	if(doSubmit){
		thisForm.submit();
	}
}
function makePopup(url,w,h){
		newwindow = window.open(url,"fotopop","height="+h+",width="+w+",scrollbars=1"+",resizable=1");
		
		if (!newwindow.opener) newwindow.opener = self;

	if (window.focus) {newwindow.focus()}
	return false
}
function Popup(url,w,h,name){
		newwindow = window.open(url,name,"height="+h+",width="+w+",scrollbars=1"+",resizable=1");
		
		if (!newwindow.opener) newwindow.opener = self;

	if (window.focus) {newwindow.focus()}
	return false
}

function showStatusForm(divId){
	mayMove = false;
	div = document.getElementById(divId);
	div.style.cssText = "display: table-cell";
	
}
function showDiv(divId){
	div = document.getElementById(divId);
	if(div.style.display == "none"){
		div.style.display = "block";
	}else{
			div.style.display = "none";
	}
	
}
function changeStatus(formName,statusVal){
	mayMove = false;
	thisForm = document.forms[formName];
	thisForm.iJobStatus.value = statusVal;
	thisForm.submit();
	
}

function checkAll(formName) {

	 var theForm = document.forms[formName];
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox'){
	  	theForm[z].checked = true;
	  }
     }
    }
function unCheckAll(formName) {

	 var theForm = document.forms[formName];
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox'){
	  	theForm[z].checked = false;
	  }
     }
   }
