function validate(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.getElementById(email).value;
   if(reg.test(address) == false) {
      alert('The email address you have entered is invalid. Please try again.');
      return false;
   }
}

function UnpublishEquipment(EqpID,divBox)
	{
		var answer = confirm("Are you sure you want to unpublish your equipment?")
		if (answer){
			 easyAjax('/include/ajax/unpublishEquipment.cfm?EqpID='+EqpID,divBox);
		}
		else{
			return;
		}
		
	}
	
	function DeleteEquipment(EqpID)
	{
		var answer = confirm("Are you sure you want to delete your equipment?")
		if (answer){
			  easyAjax('/include/ajax/deleteEquipment.cfm?EqpID='+EqpID,'ajaxDiv');
		}
		else{
			return;
		}
	}
	
	
	function DeleteImage(EqpID,imageID)
	{
		var answer = confirm("Are you sure you want to delete your the Image?")
		if (answer){
			easyAjax('/include/ajax/deleteImage.cfm?EqpID='+EqpID+'&imageID='+imageID,'ajaxDiv');
		}
		else{
			return;
		}
	}
	
	function showWindow(EqpID){
		myWindow = ColdFusion.Window.getWindowObject('myfirstwindow');
		setText('EqpID',EqpID)
		ColdFusion.Window.show('myfirstwindow')
	}
	
	function setText(el,val)
	{
		var txt = document.getElementById(el);
		txt.value = val;
		//on IE
		if(txt.fireEvent){
			txt.fireEvent('onchange');
		}
		//on Gecko based browsers
		if(document.createEvent){
			var evt = document.createEvent('HTMLEvents');
			if(evt.initEvent){
				evt.initEvent('change', true, true);
			}
			if(txt.dispatchEvent){
				txt.dispatchEvent(evt);
			} 
		} 
	} 	

