function esc(_f){
	return _f?escape(_f):_f;
}

if (typeof old_onload == 'undefined') {
	var old_onload = window.onload;
}

// BANNER CLASS DEFINING
function BannerClass()
{
	// BANNER PARAMETERS
	this.terms = window.esc(window.fiq_terms);
	this.affiliate = window.esc(window.fiq_affiliate);
	this.sub = window.esc(window.fiq_sub);
	this.IP = window.fiq_IP;
	this.width = window.fiq_width;
	this.height = window.fiq_height;
	this.hpp = window.fiq_hpp;
	this.radius = window.fiq_radius;
	this.background = window.fiq_background;
	this.link_face = window.fiq_link_face;
	this.link_color = window.fiq_link_color;
	this.link_size = window.fiq_link_size;
	this.link_underline = window.fiq_link_underline;
	this.description_face = window.fiq_description_face;
	this.description_color = window.fiq_description_color;
	this.description_size = window.fiq_description_size;
	this.body = window.fiq_body;
	this.even = window.fiq_even;
	this.odd = window.fiq_odd;
	this.caption = window.fiq_caption;
	// BANNER PARAMETERS
	
	this.AdsScriptUrl = 'http://adserver.finditquick.com/widget.php';
	this.RandomNumber = Math.round(Math.random() * 1000000);
	this.SpanElement = '';
	this.AdsScriptElement = '';

	this.load = function() {
		try {
			var BannerParametersObject = {
				terms:this.terms,
				affiliate:this.affiliate,
				sub:this.sub,
				IP:this.IP,
				width:this.width,
				height:this.height,
				hpp:this.hpp,
				radius:this.radius,
				background:this.background,
				link_face:this.link_face,
				link_color:this.link_color,
				link_size:this.link_size,
				link_underline:this.link_underline,
				description_face:this.description_face,
				description_color:this.description_color,
				description_size:this.description_size,
				body:this.body,
				even:this.even,
				odd:this.odd,
				caption:this.caption,
				url:encodeURIComponent(document.location)
			};
			
		} catch (exeption) {
			var BannerParametersObject = {
				terms:this.terms,
				affiliate:this.affiliate,
				sub:this.sub,
				IP:this.IP,
				width:this.width,
				height:this.height,
				hpp:this.hpp,
				radius:this.radius,
				background:this.background,
				link_face:this.link_face,
				link_color:this.link_color,
				link_size:this.link_size,
				link_underline:this.link_underline,
				description_face:this.description_face,
				description_color:this.description_color,
				description_size:this.description_size,
				body:this.body,
				even:this.even,
				odd:this.odd,
				caption:this.caption,
				url:encodeURIComponent(document.location)
			};
		}
		
		var ParametersStringsArray = new Array();
		for (var Key in BannerParametersObject) {
			if (BannerParametersObject[Key]) {
				ParametersStringsArray.push(Key + "=" + BannerParametersObject[Key]);
			}
		}
		
		var DateObject = new Date();
		
		this.AdsScriptElement = document.createElement('SCRIPT'); 
		this.AdsScriptElement.src = this.AdsScriptUrl + "?SpanElementId=" + this.SpanElement.id + "&tstamp=" + DateObject.getTime() + "&" + ParametersStringsArray.join('&');
		this.AdsScriptElement.type = 'text/javascript'; 
		this.SpanElement.appendChild(this.AdsScriptElement);
	}
}
// BANNER CLASS DEFINING

var BannerObject = new BannerClass();
BannerObject.SpanElement = document.createElement('SPAN');
BannerObject.SpanElement.id = 'ID_SPAN_' + BannerObject.RandomNumber;
var ScriptsArray = document.getElementsByTagName("SCRIPT");
ScriptsArray[ScriptsArray.length - 1].parentNode.appendChild(BannerObject.SpanElement);

if (typeof fiq_run_method == 'undefined') {
	var fiq_run_method = '';
}
switch (fiq_run_method) {
	case 'preload':
		BannerObject.load();
		break;
		
	case 'onload':
	default:
		// BANNERSARRAY APPENDING
		if (typeof BannersArray == 'undefined') {
			var BannersArray = new Array();
		}
		BannersArray.push(BannerObject);
		// BANNERSARRAY APPENDING
		
		window.onload = function() {
			try {
				(old_onload)();
			} catch(event) { }
			
			while (BannersArray.length > 0) {
				var BannerObject = BannersArray.shift();
				BannerObject.load()
			}
		}
		break;
}

