// developerResourcePage.js

function deleteDeveloperKeyConfirm() {

	var answer = confirm("Are you sure you want to delete the selected keys?");
	
	if (answer){
		document.forms[0].action = '../../../deleteURL.url?'; document.forms[0].submit();return false;
	}
}

function resendDeveloperKeyConfirm(did, durl) {
    
	var answer2 = confirm("Do you wish to receive details on this developer key by email?");
	
	if (answer2){
		document.forms[0].action = "../../../resendDeveloperKey.url?developerId="+did+"&url="+durl; 

	}
}

function validateDelete(control){

	var countChecked = 0;
	for(var i = 0; i < control.form.elements.length; i++){
		var eleControl = control.form.elements[i];
		if(eleControl.type == "checkbox"){
			if(eleControl.checked){
				++countChecked;
			}
		}
	}
	
 	if(countChecked == 0){  
 		alert("No keys were selected.\r\nSelect one or more keys from the from the list below and click delete." );
 		return false;			
	} else {
	
		var answer2 = confirm("Are you sure you want to delete the selected keys.");	
		if (answer2){
			document.forms[0].action = '../../../deleteURL.url?'; document.forms[0].submit();return false;
		}		
	} 
}			
			
function checkUncheckAll(control) {

	var theForm = control.form, z = 0;
	for(z=0; z<theForm.length;z++){
		if(theForm[z].type == 'checkbox' 
      	   && theForm[z].name != 'deleteAllCheckbox'){
	  		theForm[z].checked = control.checked;
	  	}
	}
}


function toggleDeleteAllCheckbox(control) {
	
	if(control.checked == false){
		control.form.deleteAllCheckbox.checked = false;
	} else{
		var allChecked = true;
		for(var i = 0; i < control.form.elements.length; i++){
			var eleControl = control.form.elements[i];
			if(eleControl.type == "checkbox" && eleControl.name != "deleteAllCheckbox" ){
		
				if(eleControl.checked == false){
					allChecked = false; break;
				}
			}
		}
		control.form.deleteAllCheckbox.checked = allChecked;		
	}
	
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


