 
var $d123=jQuery.noConflict();
(function( $d123 ){	
	var as = $d123.ajaxSettings;	
	$d123.xhr = {registry: {xhr: as.xhr},register:function( name, fn ){this.registry[name] = fn;}
	};	
	// The built-in method is used by default
	// To set another one as default, use $d123.ajaxSetup({ transport:'my_xhr' })
	as.transport = 'xhr';	
	// This handler is used instead, don't override it
	as.xhr = function(){return $d123.xhr.registry[ this.transport ]( this );};	
})( jQuery );

(function( $d123 ){
	$d123.flXHRproxy = flensed.flXHR;	// make jQuery.flXHRproxy a reference alias to flensed.flXHR, for convenience
	var _opts = [], old_ajax = $d123.ajax;
	
	$d123.extend({	// extend the "success handler" so that XHRObj is passed along as third parameter, like all other frameworks
		ajax:function(s) {
			var old_success = s.success, my_xhr = null;
			s.success = function() { 
				var args = $d123.makeArray(arguments);
				args.splice(2,0,my_xhr);
				if (typeof old_success === "function") old_success.apply(null,args); 
			};
			my_xhr = old_ajax(s);
			return my_xhr;
		}
	});
	
	$d123.flXHRproxy.registerOptions = function(url,fopts) {	// call to define a set of flXHR options to be applied to a 
															// matching request URL
		// set up flXHR defaults, if not already defined
		if (typeof fopts==="undefined"||fopts===null) fopts = {};
		if (typeof fopts.instancePooling==="undefined"||fopts.instancePooling===null) fopts.instancePooling = true;
		if (typeof fopts.autoUpdatePlayer === "undefined"||fopts.autoUpdatePlayer===null) fopts.autoUpdatePlayer = true;
		_opts.push(function(callUrl) {	// save this set of options with a matching function for the target URL
			if (callUrl.substring(0,url.length)===url) return fopts;
			else return null;
		});
	}
	$d123.xhr.register('flXHRproxy',function(as) {
		var tmp = null, useopts = null;
		if (as.async&&(as.type==="POST"||as.type==="GET")) {	// flXHR only supports async and GET/POST
			for (var i=0; i<_opts.length; i++) {	// loop through all registered options for flXHR
				if ((tmp=_opts[i](as.url))!==null) useopts = tmp;	// if URL match is found, use those options
			}
		}
		if (useopts !== null) {	// if any matching options were found, use them
			var old_onerror = useopts.onerror;
			useopts.onerror = function() {
				var errObj = arguments[0];
				var newErrObj = new Error(errObj);
				for (var i in errObj) 
					if (errObj[i]!==Object.prototype[i]) newErrObj[i] = errObj[i];
				if (typeof old_onerror === "function") old_onerror.call(as,newErrObj.srcElement,"error",newErrObj);
				$d123.handleError.call(as,as,newErrObj.srcElement,"error",newErrObj);	// trigger error in jQuery
			};
			return new $d123.flXHRproxy(useopts);
		}
		else {	// else, fall back on standard XHR
			return $d123.xhr.registry['xhr'](as);
		}
	});
})(jQuery);

 

(function($d123){
/*
 * d123include noproxy
 *
  * Date: Nov 11 2009
 */ 
  jQuery.flXHRproxy.registerOptions("http://web.dealer123.com",{xmlResponseText:true});
 $d123.include = function(urls,finaly){	
	var luid = $d123.include.luid++;
	//alert("luid:"+luid);
	var onload = function(callback,data){
						if($d123.isFunction(callback)){callback(data);}						
						if(--$d123.include.counter[luid]==0&&$d123.isFunction(finaly)){finaly();}
					}
	if(typeof urls=='object' && typeof urls.length=='undefined'){
		$d123.include.counter[luid] = 0;
		for(var item in urls)
			$d123.include.counter[luid]++;
		return $d123.each(urls,function(url,callback){$d123.include.load(url,onload,callback);	});
	}
	urls = $d123.makeArray(urls);
	$d123.include.counter[luid] = urls.length;
	$d123.each(urls,function(){alert("ef");return false;$d123.include.load(this,onload,null);});
}

$d123.extend(
	$d123.include,
	{
		luid: 0,
		counter: [],
		load: function(url,onload,callback){
			if($d123.include.exist(url))
				{ return onload(callback);}
			if(/.css$d123/.test(url))
				{$d123.include.loadCSS(url,onload,callback);}
			else if(/.js$d123/.test(url))
				{ $d123.include.loadJS(url,onload,callback);}
			else 
				{  
					//alert("getting url="+url);
				//doit(url,callback);
		jQuery.ajaxSetup({transport:'flXHRproxy',error:handleError});		

		jQuery.post(url,function(data){onload(callback,data)},"text/plain"); 	 
				//alert("got it");
					//$d123.get(url,function(data){onload(callback,data)});
					//alert("callback="+callback);
					//alert("got it");
					}
		},		
		exist: function(url){
			var fresh = false;
			$d123('head script').each(
								function(){
									if(/.css$d123/.test(url)&&this.href==url)
											return fresh=true;
									else if(/.js$d123/.test(url)&&this.src==url)
											return fresh=true;
								}
							);
			return fresh;
		}
	}
);
 
})(jQuery);

function handleError(XHRobj,errtype,errObj) {
	alert("Error: "+errObj.number+"\nType: "+errObj.name+"\nDescription: "+errObj.description+"\nSource Object Id: "+errObj.srcElement.instanceId);
}
var proxylocation="http://web.dealer123.com/include/";

