/**
 *  AjaxSendForm
 *  @author michal.senk@siteone.cz
 *  @require yui/yahoo-dom-event.js
 *  @require yui/connection.js
 *  @require yui/cookie.js
 *	@param htmlForm HTML Objekt formular ktery odesilame
 *	@param url string url pehapka
 *	@param isFile bool budeme uploadit file ?
 */
 function AjaxSendForm(htmlForm,url,isFile){
	 
	this.url = url;
	this.form = htmlForm;
	this.method = 'POST';
	this.isFile = isFile;
	 
 	var that = this;
	 
	this.handleSuccess = null;
	this.handleFailure = null;
	this.timeout = 10000;
	 
	this.execObj = {
		
		handleSuccess:function(o) {
			if (typeof(that.handleSuccess)=='function'){
				that.handleSuccess(o);
			}
		},
	 	
		handleFailure:function(o) {
			if (typeof(that.handleFailure)=='function'){
				that.handleFailure(o);
			}
		},
		
		processResult:function(o) {

		},
		
		timeout:that.timeout,
	 
		startRequest:function() {
			YAHOO.util.Connect.setForm(that.form, that.isFile);
			YAHOO.util.Connect.initHeader('X-Signature', YAHOO.util.Cookie.get("PHPSESSID"));
			
			YAHOO.util.Connect.asyncRequest(that.method, that.url, callback);
		}
	};
	
	var callback = {
		success:this.execObj.handleSuccess,
		failure:this.execObj.handleFailure,
		timeout:this.execObj.timeout,
		scope: this.execObj
	};

 
	 
	
 }
