function save_container_reference(containerIndex,container,boxshipmentno) {
	var shipment_reference = $('shipment_reference_'+containerIndex).get('value');
	var warehouse_reference = $('warehouse_reference_'+containerIndex).get('value');
	
			var req = new Request({
				method: 'post',
				url: "update_shipment_manifest_reference.cfm",
				data: { shipmentref:shipment_reference,warehouseref:warehouse_reference,containerno:container,shipmentno:boxshipmentno },
				onRequest: function() {
					$('saving_text_' + containerIndex).set('html','Saving...');
					
					$('saving_text_' + containerIndex).setStyle('opacity',100);
				},
				onComplete: function(response) { 
					if (response == 1) {
						$('saving_text_' + containerIndex).set('html','Saved.');
							$('saving_text_' + containerIndex).set('tween', {duration: 2000});
							$('saving_text_' + containerIndex).tween('opacity', '0');
						
					} else {
						$('saving_text_' + containerIndex).set('html','Error occurred. Please contact admin.');
					}
				}
			}).send();
	
		
}

function showUrlPopup(theurl) {
	var strFeatures="toolbar=no,status=no,menubar=no,location=no"
		strFeatures=strFeatures+",scrollbars=yes,resizable=yes,height=600,width=800"

		newWin = window.open(theurl,"TellObj",strFeatures);

	       newWin.opener = top;
	
	
}

function getHttpRequest(){
   	  http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
	  return http_request;
   }

	function makeGETRequest(url, parameters) {
	
	   	  http_request = getHttpRequest();
	      if (!http_request) {
	         alert('Cannot create XMLHTTP instance');
	         return false;
	      }
  
	      http_request.onreadystatechange = alertContents;
	      http_request.open('GET', url, false);//synchronous
	      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	      http_request.setRequestHeader("Content-length", parameters.length);
	      http_request.setRequestHeader("Connection", "close");
	      http_request.send(parameters);
  
  
    
	   }


	function submitme() {
			LoginNameTextBox = $('LoginNameTextBox').value;
			PasswordTextBox = $('PasswordTextBox').value;
			SigninBtn = $('SigninBtn').value;
			var url = 'login.cfm';
				var anAjax = new Request({
					  url: url,					 
					  method: 'post',
					  async: false,
					  data:{'LoginNameTextBox': LoginNameTextBox,
							'PasswordTextBox': PasswordTextBox,
							'SigninBtn': SigninBtn}, 	
					  onComplete: function(responseTxt,responseXML) {
							
							if (responseTxt.match("PASSED")){
								logOK= true;//SHOULD BE TRUE
							} else {
								alert("Invalid login details.");
							}
					  }
				  }).send();
		
				  return logOK;
	   }



var openID = null;
function popup(callerID,objid){
	if (openID != null) {
		closepopup(openID);
	}
	
	openID = objid;
	
	var callerCoords = $(callerID).getCoordinates();
	
	
	var objCoords = $(objid).getCoordinates();
	
	$(objid).setStyle('top',callerCoords.top + 15);
	$(objid).setStyle('left',callerCoords.left );
	//
	$(objid).setStyle('display','block');new Drag.Move($(objid));
}

function closepopup(objid){
	$(objid).setStyle('display','none');
}
