	function delete_Promp(){
		var p=confirm("You are about to delete the following permanently from the system. Press OK to continue or Cancel to cancel");
		return p;
	}
	function selectcategory(NForm){
		if(NForm.s_package.value=="p"){
			alert("Please Select Diffrent Services");
		}
	}
	function validate_package(NForm){
		if(NForm.s_package.value==""){
			alert("Please Select Services");
			return false;
		}
		return true;
	}
////////////////////////change login password////////////////////////

function Validate_Form(fname)
{
 return Validate_AddUser_OldPasswords(fname)&&
 	Validate_AddUser_Passwords(fname) &&
 	Validate_AddUser_Password(fname) &&
	 true;
 
}
function Validate_AddUser_OldPasswords(NForm) 
{ 
 NForm.opassword.focus();
 if(NForm.opassword.value.length==0){ 
  alert("You must enter Old Password"); 
  return false; 
 }else{
  return true;
 }
}
function Validate_AddUser_Passwords(NForm) 
{ 
 NForm.password.focus();
 if(NForm.password.value.length==0){ 
  alert("You must enter password"); 
  return false; 
 }else{
  return true;
 }
}
 
function Validate_AddUser_Password(NForm) 
{ 
 NForm.password.focus();
 var v = NForm.password.value; 
 var w = NForm.vpassword.value; 
          
 if(v != w ){                  
	 alert("Passwords don't match ");         
 	return false;
 }else{
 	return true; 
 }	
}  
////////////////////////change login password////////////////////////

////////////////////////Display Statement////////////////////////
	function checkDate(){
		filter.dateselect.checked=true;
	}
	function checkinvrec(){
		filter.invrecselect.checked=true;
	}
	function checkJoborder(){
		filter.joborderselect.checked=true;
	}
////////////////////////Display Statement////////////////////////
function display_ShowHide(id,type) {
	var target = document.getElementById(id);
	var all = document.getElementsByTagName(type);
	if (target.style.display == '') {
		target.style.display = 'none';          
	  	return true;
	}
	for (var i = 0; i < all.length; i++) { 
		all[i].style.display = "none";
	} 
	if (target.style.display == "none") {
		target.style.display = '';          
	}
}
// Add a new option to a select element
function addOption(selectElement,newOption) {
  // First try the DOM2 method ...
  try {
   selectElement.add(newOption,null);
  }
  // ... And if that doesn't work use the IE-only method
  catch (e) {
    selectElement.add(newOption,selectElement.length);
  }
} 
function getSelectOption(oSelect, value, sDisplay, nIndex){
	var i;
	if (value){
		for (i=0;i<oSelect.length;i++){
			if(value==oSelect.options[i].value){
				return oSelect.options[i];
			}
		}
	}
	if(sDisplay){
		for (i=0;i<oSelect.length;i++){
			if (sDisplay==oSelect.options[i].text){
				return oSelect.options[i];
			}
		}
	}
	if (nIndex>-1 && nIndex<oSelect.length){
		return oSelect.options[nIndex];
	}
	return null;
}

function copyOption2Select(oSel1, oSel2, oOption)
{
	// first check to see if oOption is really in oSel1
	if(!getSelectOption(oSel1, oOption.value, oOption.text, null)){
		// option not in the select control.
		return false;
	}
	// copy to the destination select
	var newOption = document.createElement("OPTION");
	newOption.text = oOption.text;
	newOption.value = oOption.value;
	if((String(oSel1.name).indexOf("source_"))!=-1){
		newOption.selected = true; //new addition to the double select by abed for bta
	}
	addOption(oSel2,newOption);
	return true;
}

function copySelect2Select(oSel1, oSel2)
{
	var oSel1_length = oSel1.length;
	for(var i=0; i<oSel1_length; i++){
		if(!copyOption2Select(oSel1, oSel2, getSelectOption(oSel1, null, null, i))){
			return false;
		}
	}
	return true;
}

function delSelectOption(oSelect, oOption)
{
	for(var i=0; i<oSelect.length; i++){
		if(getSelectOption(oSelect, null, null, i)==oOption){
			oSelect.remove(i);
			return true;
		}
	}
	return false;
}

function copySelectedOptions(oSel1, oSel2)
{
	var oOption;
	for(var i=0; i<oSel1.length; i++){
		oOption = getSelectOption(oSel1, null, null, i);
		if(oOption.selected){
			copyOption2Select(oSel1, oSel2, oOption);
		}
	}
	// there is no way this function can fail.
	return true;
}

function clearSelect(oSel)
{
	while(oSel.length>0){
		if(!delSelectOption(oSel, getSelectOption(oSel, null, null, 0))){
			return false;
		}
	}
	return true;
}

/*
	Name		=	getSelectedOptions
	Module		=	DoubleSelect
	Version		=	1.0
*/
function getSelectedOptions(oSel)
{
	var oArray = new Array();
	for(var i=0; i<oSel.length; i++){
		oOption = getSelectOption(oSel, null, null, i);
		if(oOption.selected){
			oArray[oArray.length] = oOption;
		}
	}
	return oArray;
}

/*
	Name		=	moveSelectedOptions
	Module		=	DoubleSelect
	Version		=	1.2
*/

function moveSelectedOptions(oSel1, oSel2)
{
	if(!copySelectedOptions(oSel1, oSel2) || !deleteSelectedOptions(oSel1, oSel2)){
		return false;
	}
	
	if(String(oSel1.name).indexOf("source_")==-1){
		for(var i=0; i<oSel1.length; i++){
			oSel1.options[i].selected=true;
		}
	}
	if((String(oSel2.name).indexOf("source_"))==-1){
		for(var i=0; i<oSel2.length; i++){
			oSel2.options[i].selected=true;
		}
	}
	return true;
}

/*
	Name		=	deleteSelectedOption
	Module		=	DoubleSelect
	Version		=	1.1
*/

function deleteSelectedOptions(oSel)
{
	var oArray = getSelectedOptions(oSel);
	for(var i=0; i<oArray.length; i++){
		if(!delSelectOption(oSel, oArray[i])){
			return false;
		}
	}
	return true;
}

function fixOnSubmit()
{
	var oSelects = document.body.getElementsByTagName("SELECT");
	var oSelects_length = oSelects.length;
	for(var i=0; i<oSelects_length; i++){
		if(oSelects[i].multiple){
			// a multiple select box
			if(oSelects[i].name.indexOf('source_')==0){
				var sDest = oSelects[i].name.substring(7, oSelects[i].name.length);
				eval("var oDest = document.getElementsByName('" + sDest + "')[0];");
				for(var j=0; j<oDest.options.length; j++){
					oDest.options.item(j).selected = true;
				}
			}
		}
	}
	return true;
}

function fillDoubleSelect()
{
	var oSelects = document.body.getElementsByTagName("SELECT");
	var oSelects_length = oSelects.length;
	for(var i=0; i<oSelects_length; i++){
		if(oSelects[i].multiple){
			// a multiple select box
			if(oSelects[i].name.indexOf('source_')==0){
				var sDest = oSelects[i].name.substring(7, oSelects[i].name.length);
				eval("var oDest = document.getElementsByName('" + sDest + "')[0];");
				moveSelectedOptions(oSelects[i], oDest);
			}
		}
	}
	return true;
}

function IsPopupBlocker() {
	var strNewURL = "index.php"
	var Strfeature = "" ;
	var WindowOpen = window.open(strNewURL,"MainWindow",Strfeature);
	try{
		var obj = WindowOpen.name;
		WindowOpen.close();
		return true;
	}catch(e){ 
		alert("System has been blocked by POP-UP BLOCKER.\nPlease disable the POP-UP BLOCKER and try again\nor\nPlease contact your system administrator. ");
		return false;
	}
}
