document.write('<link rel="stylesheet" type="text/css" href="http://www.travekos.com/ads/flip/jsflip.css" />');
var $j161query = $.noConflict();
$j161query(document).ready(function(){
	
	$j161query.ajax({
		url: 'http://www.travekos.com/ads/flip/getcontent.php',
		dataType: 'jsonp',
		crossDomain: true,
		jsonp: false,
		jsonpCallback: 'jsonP',
		data: 'ref=' + window.location.href,
		success: function(data) {
			if(data.error == 0) {
				img = data.image; 
				url = data.url;
				msg = data.msg;
				ico = data.icon;
				
				$j161query('body').prepend('<div id="pageflip"><a href="'+ url +'"><img src="'+ img +'" alt="" /><span class="msg_block">'+ msg +'</span></a></div>');
				$j161query("#pageflip").hover(function() { //On hover...
					$j161query("#pageflip img , .msg_block").stop()
						.animate({ width: '307px', height: '319px' }, 500);
					} , function() {
					$j161query("#pageflip img").stop().animate({ width: '50px', height: '52px' }, 220);
					$j161query(".msg_block").stop().animate({ width: '50px', height: '50px' }, 200);
				});
				
				$j161query(window).scroll(function(){
					$j161query("#pageflip").stop().animate({"top": ($j161query(window).scrollTop()) + "px"}, "slow" );
				});
				
				$j161query("#pageflip").addClass('p161flip');
				$j161query("#pageflip .msg_block").css('background-image', 'url(' + ico + ')');
			}
		}
	});
});
