var Dom = YAHOO.util.Dom;

function ObjectConnection(div,url,form,upload){

		this.div = div;
		this.url = url;
		this.form = form;
		this.upload = upload;
		this.callback = new Object();
		
		if (typeof(_ObjectConnection_prototype_called) == 'undefined')
		{
			_ObjectConnection_prototype_called = true;
			ObjectConnection.prototype.requestUrl = requestUrl;
			ObjectConnection.prototype.submitForm = submitForm;
			ObjectConnection.prototype.handleSuccess = handleSuccess;
			ObjectConnection.prototype.handleFailure = handleFailure;
		}
				
		function requestUrl() {
			
			var cObj = YAHOO.util.Connect.asyncRequest('GET', this.url, this.callback);
			
		}
		
		function handleSuccess(o){
				var div = document.getElementById(o.argument);
				div.innerHTML = o.responseText;
		}
		
		function handleFailure(o){
			// Failure handler
			alert(o.statusText);
		}
		
		function submitForm() {
			var formObject = document.getElementById(this.form);
			YAHOO.util.Connect.setForm(formObject,this.upload);
			YAHOO.util.Connect.asyncRequest('POST',this.url,this.callback);
		}

		this.callback =
		{
			success : this.handleSuccess,
			failure : this.handleFailure,
			upload : this.handleSuccess,
			argument: this.div,
			cache: 0
		};
}

function ConnectionDrag(div,url,form,upload){

		this.div = div;
		this.url = url;
		this.form = form;
		this.upload = upload;
		this.callback = new Object();
		
		if (typeof(_ConnectionDrag_prototype_called) == 'undefined')
		{
			_ConnectionDrag_prototype_called = true;
			ConnectionDrag.prototype.requestUrl = requestUrl;
			ConnectionDrag.prototype.handleSuccess = handleSuccess;
			ConnectionDrag.prototype.handleFailure = handleFailure;
		}
				
		function requestUrl() {
			var cObj = YAHOO.util.Connect.asyncRequest('GET', this.url, this.callback);
		}
		
		function handleSuccess(o){
				var div = document.getElementById(o.argument);
				div.innerHTML = o.responseText;
		}
		
		function handleFailure(o){
			alert(o.statusText);
		}
		
		this.callback =
		{
			success : this.handleSuccess,
			failure : this.handleFailure,
			upload : this.handleSuccess,
			argument: this.div,
			cache: 0
		};
}