
function AddToLst(formname,sourcefld,targetfld){
   var A = document.form1.A_roles;
   var C = document.form1.C_roles;
   		if (C.length <=1 && C[0].value =="blank"){
			  C.options[0]= new Option (A[A.selectedIndex].text,A[A.selectedIndex].value);
			  A[A.selectedIndex]=null;
			  
		}
		else{
			C.options[C.length]= new Option (A[A.selectedIndex].text,A[A.selectedIndex].value);
			A[A.selectedIndex]=null;
		}
   	
 }
 
 function DelFromLst(formname,sourcefld,targetfld){
     var A = document.form1.A_roles;
	 var C = document.form1.C_roles;
	 
	 if (C.selectedIndex <0 || C[C.selectedIndex].value == "blank"){
	    window.alert("The Selected Item Cannot Be Deleted");
		return false;
	 }
	 else{
	   A.options[A.length] = new Option (C[C.selectedIndex].text,C[C.selectedIndex].value);
	   C[C.selectedIndex]=null;
	  
	   if(C.length <=0){
	   		C.options[0]= new Option ("Select A Role","blank");
	   }	
    }
	 
 
 }
 
 function ConfirmSubmit(obj_form){
  if (confirm("Do You Really Want To Delete The Selected Item")){
      document.delform.submit();
  }
  else{
  	 return false;	
  }	 
 }
 
function OpenNewWindow(imageurl){
var Imagepage = imageurl;var windowheight = 480;var windowwidth =600 ;
var windowleft = (screen.width - parseInt(windowwidth)) / 2;
var windowtop = (screen.height - parseInt(windowheight)) / 2;
var windowname = "PopupWindow";
windowproperties = 'resizable=no,status=no,toolbar=no,height='+windowheight+',width='+windowwidth+',top='+windowtop+',left='+windowleft+',scrollbars=yes'
setwindow = window.open(Imagepage, windowname, windowproperties)
	if (CheckNavigatorVersion()==true){
			setwindow.window.focus();}
}  

function CheckNavigatorVersion()
{
	if (parseInt(navigator.appVersion) >= 4)
		{
			return true;
		}
    	return false;

}

function MustEnter(obj, field)
{
	if (obj.value == "") 
	{
		alert("Please enter " + field);
		obj.focus();
		obj.select();
		
		return false;
	}
	return true;
}

function MustEnterInt(obj, field)
{
	if ( MustEnter(obj, field) )
	{
		if (isNaN(obj.value) ){
			alert("Please enter a valid integer for " + field);
			obj.focus();
			obj.select();
			return false;
		}
		
		return true;
	}
	return false;
}

function validateEmail(field, fieldName){
	var str
	str = field.value;
		
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(^\s)/;
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 
	  
	if (!reg1.test(str) && reg2.test(str)) { 
     return true;
	}

	return false;
}