/************************************/
/*     jQuery dimensions code       */
/************************************/
(function($){
var height = $.fn.height,
    width  = $.fn.width;

$.fn.extend({
	height: function() {
		if (!this[0]) error();
		if ( this[0] == window )
			if ( ($.browser.mozilla || $.browser.opera) && $(document).width() > self.innerWidth)
				return self.innerHeight - getScrollbarWidth();
			else
				return self.innerHeight ||
					$.boxModel && document.documentElement.clientHeight || 
					document.body.clientHeight;
		
		if ( this[0] == document )
			return Math.max( document.body.scrollHeight, document.body.offsetHeight );
		
		return height.apply(this, arguments);
	},

	width: function() {
		if (!this[0]) error();
		if ( this[0] == window )
			if (($.browser.mozilla || $.browser.opera) && $(document).height() > self.innerHeight)
				return self.innerWidth - getScrollbarWidth();
			else
				return self.innerWidth ||
					$.boxModel && document.documentElement.clientWidth ||
					document.body.clientWidth;

		if ( this[0] == document )
			if ($.browser.mozilla) {
				var scrollLeft = self.pageXOffset;
				self.scrollTo(99999999, self.pageYOffset);
				var scrollWidth = self.pageXOffset;
				self.scrollTo(scrollLeft, self.pageYOffset);
				return document.body.offsetWidth + scrollWidth;
			}
			else 
				return Math.max( document.body.scrollWidth, document.body.offsetWidth );

		return width.apply(this, arguments);
	},

	innerHeight: function() {
		if (!this[0]) error();
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
				this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	innerWidth: function() {
		if (!this[0]) error();
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
				this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},

	outerHeight: function(options) {
		if (!this[0]) error();
		options = $.extend({ margin: false }, options || {});
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight + (options.margin ? (num(this, 'marginTop') + num(this, 'marginBottom')) : 0) :
				this.height() 
					+ num(this,'borderTopWidth') + num(this, 'borderBottomWidth') 
					+ num(this, 'paddingTop') + num(this, 'paddingBottom')
					+ (options.margin ? (num(this, 'marginTop') + num(this, 'marginBottom')) : 0);
	},

	outerWidth: function(options) {
		if (!this[0]) error();
		options = $.extend({ margin: false }, options || {});
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth + (options.margin ? (num(this, 'marginLeft') + num(this, 'marginRight')) : 0) :
				this.width() 
					+ num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') 
					+ num(this, 'paddingLeft') + num(this, 'paddingRight')
					+ (options.margin ? (num(this, 'marginLeft') + num(this, 'marginRight')) : 0);
	},
	scrollLeft: function(val) {
		if (!this[0]) error();
		if ( val != undefined )
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( val, $(window).scrollTop() );
				else
					this.scrollLeft = val;
			});
		if ( this[0] == window || this[0] == document )
			return self.pageXOffset ||
				$.boxModel && document.documentElement.scrollLeft ||
				document.body.scrollLeft;
				
		return this[0].scrollLeft;
	},

	scrollTop: function(val) {
		if (!this[0]) error();
		if ( val != undefined )
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( $(window).scrollLeft(), val );
				else
					this.scrollTop = val;
			});
		if ( this[0] == window || this[0] == document )
			return self.pageYOffset ||
				$.boxModel && document.documentElement.scrollTop ||
				document.body.scrollTop;

		return this[0].scrollTop;
	},
	position: function(returnObject) {
		return this.offset({ margin: false, scroll: false, relativeTo: this.offsetParent() }, returnObject);
	}
});

var error = function() { throw "Dimensions: jQuery collection is empty"; };
var num = function(el, prop) { return parseInt($.css(el.jquery?el[0]:el,prop))||0; };
var handleOffsetReturn = function(elem, options, x, y, sl, st) {
	if ( !options.margin ) {
		x -= num(elem, 'marginLeft');
		y -= num(elem, 'marginTop');
	}

	if ( options.border && (($.browser.safari && parseInt($.browser.version) < 520) || $.browser.opera) ) {
		x += num(elem, 'borderLeftWidth');
		y += num(elem, 'borderTopWidth');
	} else if ( !options.border && !(($.browser.safari && parseInt($.browser.version) < 520) || $.browser.opera) ) {
		x -= num(elem, 'borderLeftWidth');
		y -= num(elem, 'borderTopWidth');
	}

	if ( options.padding ) {
		x += num(elem, 'paddingLeft');
		y += num(elem, 'paddingTop');
	}
	
	if ( options.scroll && (!$.browser.opera || elem.offsetLeft != elem.scrollLeft && elem.offsetTop != elem.scrollLeft) ) {
		sl -= elem.scrollLeft;
		st -= elem.scrollTop;
	}

	return options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
	                      : { top: y, left: x };
};
var scrollbarWidth = 0;
var getScrollbarWidth = function() {
	if (!scrollbarWidth) {
		var testEl = $('<div>')
				.css({
					width: 100,
					height: 100,
					overflow: 'auto',
					position: 'absolute',
					top: -1000,
					left: -1000
				})
				.appendTo('body');
		scrollbarWidth = 100 - testEl
			.append('<div>')
			.find('div')
				.css({
					width: '100%',
					height: 200
				})
				.width();
		testEl.remove();
	}
	return scrollbarWidth;
};

})(jQuery);



/********************************/
/*    fly code                  */
/********************************/

var FLBanner = new Object();

FLBanner.init = function( ) { };

FLBanner.init.prototype = {
	getViewPortHeight: function() {
		/*
		return 
			((document.compatMode || navigator.isIE) && !navigator.isOpera) 
				? (document.compatMode == 'CSS1Compat') 
					? document.documentElement.clientHeight 
					: document.body.clientHeight 
				: (document.parentWindow || document.defaultView).innerHeight;
		*/	
		var viewPortHeight = 0;
		
		if ( (document.compatMode || $.browser.msie) && !$.browser.opera )
			if (document.compatMode == 'CSS1Compat')
				viewPortHeight = document.documentElement.clientHeight;
			else
				viewPortHeight = document.body.clientHeight;
		else
			viewPortHeight = (document.parentWindow || document.defaultView).innerHeight;
			
		return viewPortHeight;
	},
	
	getScrollTop : function() {
		var scrollTop = -1;
		
		if ( $.browser.msie && document.compatMode && ( document.compatMode == "CSS1Compat" ) ) {
			void(1);
			scrollTop = document.documentElement.scrollTop;				
		} else {
			void(2);
			scrollTop = ( $.browser.mozilla ) ? window.scrollY : document.body.scrollTop;
		}
			
		return scrollTop;
	},

	
	intRand: function( startInt ) {
		if ( !arguments[1] )	var stopInt = startInt;
		else					var stopInt = arguments[1];
		while ( true ) {
			var rand = Math.round( Math.random() * ( stopInt + 1 ) );
			if ( ( rand >= startInt ) && ( rand <= stopInt ) ) return rand;
		}
	},
	
	AddEvent : function ( element, event, codeToAdd ) {
		var EventCode;
		var NewEvent;
		
		try {
			EventCode = eval ( 'element.'+event+'.toString();' );
			EventCode = EventCode.substring( EventCode.indexOf( "{" ) + 1, EventCode.lastIndexOf("}") );
			NewEvent = new Function( EventCode + " " + codeToAdd );
			eval( 'element.'+event+' = NewEvent;' );
		} catch ( err ) {
			eval( 'element.'+event+' = function(){' + codeToAdd + '}' );
		}
	},
	
	createBottomSLider : function ( id, GROUP ) {
		var HTMLcode = 
			'<div class="FlyingLiners" id="'+id+'" style="position: absolute; left: 10px; top: 0px;">' +
				'<div class="title"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>'+GROUP.text.title+'</td></tr></table></div>' +
				'<div class="text">'+GROUP.text.downText+'<a href="'+GROUP.link+'">'+GROUP.text.linkText+'</a><img src="'+GROUP.pixel+'" width="1" height="1" border="0"></div>' + 
				'<div class="eventer" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;">' + 
					'<a href="'+GROUP.link+'" target="_blank" style="display: block; width: 100%; height: 100%;">&nbsp;</a>' + 
				'</div>' + 
			'</div>';
			
		$(document.body).append( HTMLcode );
	},



	createBottomSlider4_Default : function( GROUP ) {

		var BACKGROUNDS = { 0: 'ds_03.gif', 1: 'ds_03.gif', 2: 'ds_03.gif', 3: 'ds_03.gif' };
		var bannerWidth = 200;
		var intWidth = Math.round( document.body.scrollWidth / 4 );
		var leftBorder = Math.round((intWidth - bannerWidth)/ 2) - 1;
		
		for ( var i = 0; i < 4; i++ ) {
			var id = 'FlyBanner'+this.intRand( 1000, 9999 );
			this.createBottomSLider( id, GROUP[i+1] );
			
			var banner = $('#'+id);
			
			banner
				.css({
					border		: '0px solid #777777',
					background	: 'url("http://flyingliners.com/img_fleecyclouds/lines_colored/'+BACKGROUNDS[i]+'") no-repeat top left',
					width		: bannerWidth + 'px',
					left		: i*intWidth + leftBorder + 'px'
				})
				.find( '.title' )
					.css({
						height: '37px', border: 'none', background: 'none', lineHeight: '13px', color: 'white', fontFamily: 'tahoma',
						fontWeight: 'bolder', fontSize: '11px', padding: '0px 5px', textAlign: 'center'
					})
					.find('td')
					    .css({
					        height: '37px', verticalAlign : 'middle', padding: '0px 30px', color: 'white', fontFamily: 'tahoma', lineHeight: '13px', fontSize: '11px'
					    })
					.end().end()
				.find( '.text' )
					.css({
						height: '79px', border: 'none', background: 'none', display: 'none', color: 'black', fontFamily: 'tahoma', fontSize: '11px', padding: '7px'
					}).end()
				.find('.eventer a')
					.css({
						border: '0px solid #555599', background: '#eeeeff', opacity: '0.0', filter: 'alpha(opacity=1)', padding: '0px',margin: '0px', border: 'none', textDecoration: 'none'
					});
		}
		
		var _THIS_ = this;
		
		$('div.FlyingLiners').each( function() {
			var flyItem = this;
			
			var _top = 
				_THIS_.getViewPortHeight() - 
				parseInt( $(flyItem).outerHeight() ) + 
				parseInt( _THIS_.getScrollTop() );
			
			$(flyItem)
				.css( 'top', _top )
				.find( '.eventer' )
					.css( 'height', $(flyItem).outerHeight() )
					.hover(
						function() {
							$(flyItem).find('.text').show();

							var _top = _THIS_.getViewPortHeight() - 
									   parseInt( $(flyItem).outerHeight() ) + 
									   parseInt( _THIS_.getScrollTop() );
							$(flyItem)
								.css( 'top', _top )
								.find('.eventer')
									.css( 'height', $(flyItem).outerHeight() );
						},
						function() {
							$(flyItem).find('.text').hide();

							var _top = _THIS_.getViewPortHeight() - 
									   parseInt( $(flyItem).outerHeight() ) + 
									   parseInt( _THIS_.getScrollTop() );
									   
							$(flyItem)
								.css( 'top', _top )
								.find('.eventer')
									.css( 'height', $(flyItem).outerHeight() );
						}
					);
		});
		
		var ScrollResizeCode = 
		"	$('div.FlyingLiners').each( function() { "+
		"       var viewPortHeight = "+
		"			( (document.compatMode || $.browser.msie) && !$.browser.opera ) "+
		"				? (document.compatMode == 'CSS1Compat') "+
		"					? document.documentElement.clientHeight "+
		"					: document.body.clientHeight "+
		"				: (document.parentWindow || document.defaultView).innerHeight;"+
		"		var scrollTop = -1; "+
		"		if ( $.browser.msie && document.compatMode && ( document.compatMode == 'CSS1Compat' ) ) { "+
		"			scrollTop = document.documentElement.scrollTop; "+
		"		} else { "+
		"			scrollTop = ( $.browser.mozilla ) ? window.scrollY : document.body.scrollTop; "+
		"		}"+
		"		var _top = viewPortHeight - "+
		"				   parseInt( $(this).outerHeight() ) + "+
		"				   parseInt( scrollTop ) + 'px'; "+
		"		$(this).css( 'top', _top );  "+
		"	}); ";
		
		eval( ScrollResizeCode );
		this.AddEvent( document.body, 'onscroll', ScrollResizeCode );
		this.AddEvent( window, 'onscroll', ScrollResizeCode );
		this.AddEvent( document.body, 'onresize', ScrollResizeCode );
		this.AddEvent( window, 'onresize', ScrollResizeCode );
	}
}

$(document).ready( function() {

	var FlyLinersObject = new FLBanner.init( );

	var variant = { 
	1: FlyLinersObject.intRand ( 1, 100 ), 
	2: FlyLinersObject.intRand ( 1, 100 ), 
	3: FlyLinersObject.intRand ( 1, 100 ), 
	4: FlyLinersObject.intRand ( 1, 100 ) 
};

FlyLinersObject.createBottomSlider4_Default({
	 1: { 
		text  : ( ( variant[1] <= 100 ) ? 
			{
				title: '<b>Easy Google Profit<sup style="font-size: 8px;">TM</sup></b>',
				linkText: 'See it..',
				downText: 'Learn to Earn on Google!<br/><br/><b>$200 to $943</b> per day or more<br/><br/>', 
				linkInText: ''
			} : 
			{
				title: 'Title',
				linkText: 'Link Text',
				downText: 'Down Text', 
				linkInText: ''
			} ),
		pixel : ( ( variant[1] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=1430&o=81&c=36&l=0' : 'Pixel' ),
		link  : ( ( variant[1] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=1430&o=81&c=36&l=5&subcd=_Fly_test_POI' : 'http://gmbatrack.com/track.asp?a=[prt:1233:1430]&o=81&[prt:c=1&l=0:c=36&l=0]&subcd=_POI_Fly_Google_[prt]_[from]' ) 
	},
	 2: { 
		text  : ( ( variant[2] <= 100 ) ? 
			{
				title: '<b>100% FREE Service</b>',
				linkText: 'Learn more',
				downText: 'Zero risk. No obligation. Instant access. <br/> Here\'s an easy way to <b>MAKE MONEY</b> from anywhere!<br/><br/>', 
				linkInText: ''
			} : 
			{
				title: '',
				linkText: '',
				downText: '', 
				linkInText: ''
			} ),
		pixel : ( ( variant[2] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=1430&o=87&c=12&l=0' : '' ),
		link  : ( ( variant[2] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=1430&o=87&c=12&l=0&subcd=_POI_Fly_WFA-temp_' : '' ) 
	},
	 3: { 
		text  : ( ( variant[3] <= 100 ) ? 
			{
				title: '<b>Can U Type?</b>',
				linkText: 'See it...',
				downText: 'Simple Data Entry Work Up to <b>$127/day</b>, 147 people needed  <br/><br/>', 
				linkInText: ''
			} : 
			{
				title: '',
				linkText: '',
				downText: '', 
				linkInText: ''
			} ),
		pixel : ( ( variant[3] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=1430&o=24&c=12&l=0' : '' ),
		link  : ( ( variant[3] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=1430&o=24&c=12&l=0&subcd=_POI_Fly_Megatyping-temp' : '' ) 
	},
	 4: { 
		text  : ( ( variant[4] <= 100 ) ? 
			{
				title: '<b style="font-size: 11px;">Christian Home Based Business</b>',
				linkText: 'See it...',
				downText: 'Christian Home Based Business Use your God-given talents and experience to do something extraordinary for yourself, your family, and your financial future<br><br>', 
				linkInText: ''
			} : 
			{
				title: '',
				linkText: '',
				downText: '', 
				linkInText: ''
			} ),
		pixel : ( ( variant[4] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=1430&o=56&c=4&l=0' : '' ),
		link  : ( ( variant[4] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=1430&o=56&c=4&l=0&subcd=_POI_Fly_Christian-temp' : '' ) 
	}
});
	
});