/************************************/
/*     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( config ) {
    this.DisableByCookies = false;

    for ( var i in config.PrtCookies )
    {
        var cookie_value = this.readCookie(config.PrtCookies[i]);
       
        if ( cookie_value != false )
        {
            for ( var k in config.NotAllowedPrt )
            {
                if ( config.NotAllowedPrt[k] == cookie_value ) 
                {
                    this.DisableByCookies = true;
                    return;
                }
            }
        }
    }

};


FLBanner.init.prototype = {
	getViewPortHeight: function() {
		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;
	},

    
    readCookie: function(name)
    {
        cookie_name = name + "=";
        cookie_length = document.cookie.length;
        cookie_begin = 0;
        
        while (cookie_begin < cookie_length)
        {
            value_begin = cookie_begin + cookie_name.length;
            if (document.cookie.substring(cookie_begin, value_begin) == cookie_name)
            {
                var value_end = document.cookie.indexOf (";", value_begin);
                if (value_end == -1)
                {
                    value_end = cookie_length;
                }
                return unescape(document.cookie.substring(value_begin, value_end));
            }
            cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
            if (cookie_begin == 0)
            {
                break;
            }
        }
        return false;
    },

	
	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; z-index: 10000;">' +
				'<div class="title">'+GROUP.text.title+'</div>' +
				'<div class="text">'+GROUP.text.downText+'<a href="'+GROUP.link+'" rel="nofollow">'+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" rel="nofollow" style="display: block; width: 100%; height: 100%;">&nbsp;</a>' + 
				'</div>' + 
			'</div>';
			
		$(document.body).append( HTMLcode );
	},



	createBottomSlider4_Default : function( GROUP ) {
		var BACKGROUNDS = { 0: 'green.gif', 1: 'orange.gif', 2: 'blue.gif', 3: 'violet.gif' };
		var intWidth = Math.round( document.body.scrollWidth / 4 );
		
		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		: '200px',
					left		: i*intWidth + 'px'
				})
				.find( '.title' )
					.css({
						height: '24px', border: 'none', background: 'none', lineHeight: '24px', color: 'white', fontFamily: 'tahoma',
						fontWeight: 'bolder', fontSize: '11px', padding: '0px 5px', textAlign: 'center'
					}).end()
				.find( '.text' )
					.css({
						height: '93px', 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({
	    PrtCookies      : [ "prt", "track_prt"  ],
	    NotAllowedPrt   : [ "500", "1472"  ]
	});

	if ( FlyLinersObject.DisableByCookies ) 
	    return;
	
	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>100% FREE Service</b>',
				linkText: 'See it..',
				downText: 'Zero risk. No obligation. Instant access. <br/> Here\'s an easy way to <b>MAKE MONEY</b> from HOME!<br/><br/>', 
				linkInText: ''
			} : 
			{
				title: '<b>Free Wealth Book</b>',
				linkText: 'Get Your Free Book',
				downText: 'Learn the secrets to generating wealth!<br>We\'re giving away <b>FREE bestselling books</b> by financial advisor, Robert Allen!<br><br>', 
				linkInText: ''
			} ),
		pixel : ( ( variant[1] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=390&o=224&c=12&l=0' : 'http://www.gmbtrack.com/tracki.asp?a=390&o=153&c=10&l=0' ),
		link  : ( ( variant[1] <= 100 ) ? 'http://gmbdtrack.com/track.asp?a=390&o=224&c=12&l=0&subcd=' : 'http://gmbatrack.com/track.asp?a=390&o=153&c=10&l=0' ) 
	},
	 2: { 
		text  : ( ( variant[2] <= 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: '<b>Can you send email?</b>',
				linkText: 'Sign up now!',
				downText: 'Make <b>$453 a day</b> sending pre-written emails!<br/><br/>10,000 paying companies. Work from home. Start within minutes!<br/><br/>', 
				linkInText: ''
			} ),
		pixel : ( ( variant[2] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=390&o=81&c=5&l=4' : 'http://www.gmbtrack.com/tracki.asp?a=390&o=182&c=10&l=3' ),
		link  : ( ( variant[2] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=390&o=81&c=5&l=4' : 'http://gmbatrack.com/track.asp?a=390&o=182&c=10&l=3&subcd=' ) 
	},
	 3: { 
		text  : ( ( variant[3] <= 100 ) ? 
			{
				title: '<b>Get a $500 Grant!</b>',
				linkText: 'Learn more',
				downText: 'Fast, easy process. Apply online!<br><br><b>Have money</b> in your pocket<br> in just days!</b><br><br><br>', 
				linkInText: ''
			} : 
			{
				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: ''
			} ),
		pixel : ( ( variant[3] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=390&o=191&c=4&l=0' : 'http://www.gmbtrack.com/tracki.asp?a=390&o=24&c=11&l=8' ),
		link  : ( ( variant[3] <= 100 ) ? 'http://gmbbtrack.com/track.asp?a=390&o=191&c=4&l=0&subcd=' : 'http://gmbatrack.com/track.asp?a=390&o=24&c=11&l=8' ) 
	},
	 4: { 
		text  : ( ( variant[4] <= 100 ) ? 
			{
				title: 'Beware&nbsp;of&nbsp;At&nbsp;Home&nbsp;Jobs',
				linkText: 'See it...',
				downText: '98.3%&nbsp;Make&nbsp;Money&nbsp;Sites&nbsp;<br>Are&nbsp;Scams.&nbsp;<br/><br/>Learn&nbsp;3&nbsp;Tested&nbsp;Ways <br/>to <b>Make&nbsp;Money</b>.<br/><br/>', 
				linkInText: ''
			} : 
			{
				title: '<b>Get a $500 Grant!</b>',
				linkText: 'Learn more',
				downText: 'Fast, easy process. Apply online!<br><br><b>Have money</b> in your pocket<br> in just days!</b><br><br><br>', 
				linkInText: ''
			} ),
		pixel : ( ( variant[4] <= 100 ) ? 'http://www.gmbtrack.com/tracki.asp?a=390&o=131&c=8&l=4' : 'http://www.gmbtrack.com/tracki.asp?a=390&o=191&c=2&l=0' ),
		link  : ( ( variant[4] <= 100 ) ? 'http://gmbatrack.com/track.asp?a=390&o=131&c=8&l=4&x_company=fly_Coo' : 'http://gmbatrack.com/track.asp?a=390&o=191&c=2&l=0&subcd=' ) 
	}
});
	
});