var shtips={};var code;
function rate_convert(rate){var rr=[];rr['Eu']='&euro;';rr['$']='$';rr['GB']='&pound;';return rr[rate];}
function get_pansion(c)
 {
	 if(c=='BB'){r='Bed & Breakfast - только завтрак';}
	 else if(c=='FB'){r='Full Board - Полный пансион (завтрак, обед и ужин)';}
	 else if(c=='HB'){r='Half Board - Половинный пансион (завтрак и ужин)';}
	 else if(c=='ALL'){r='ALL inclusive - Все включено<br>(завтрак, обед и ужин + прохладительные и алкогольные напитки местного происхождения.)';}
	 return r;
 }

function get_rc(c)
 {
	 if(c=='STD'){r='Стандартный номер';}
	 else if(c=='Sup'||c=='SUP'){r='Улучшенный номер';}
	 else {r=c;}
	 return r;
 }

this.vtip = function() {    
    this.xOffset = -10; // x distance from mouse
    this.yOffset = 10; // y distance from mouse       
    
    $("#avia_info").unbind().hover(
	  function(e)
	   {
		
		this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
        $('body').append( '<p id="vtip"></p>' );  
		$("#vtip").html('<img src="http://www.holidaym.ru/images/italy_test/vtip/vtip_arrow.png" id="vtipArrow">'+$("#avia_div").html());
		$('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
		
	   },
        function() {
            $("p#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
           	this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);                         
            $("p#vtip").css("top", this.top+"px").css("left", this.left+"px").css("opacity",1);
			
        }
	);
	
	
	
	$(".shl, .tpr").unbind().hover(    
        function(e) {
          var parts;
		  if($(this).attr("title")!='') {
		 
			code=$(this).attr("title");
			
			img='<img src="http://www.holidaym.ru/images/italy_test/vtip/vtip_arrow.png" id="vtipArrow">';
			parts=$(this).attr("title").split('|');
			this.title='';
						
			this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            $('body').append( '<p id="vtip">'+img+'<img src="http://www.holidaym.ru/images/loading_aaf_circle.gif"></p>' );
			
			
			
			if(!shtips[code]) {		
			
			
			
			
			
			if(parts[0]=='h')
			 {
			  
			  $.get("http://www.holidaym.ru/lib/php/get_hotel_description.php", {hotel:parts[1]}, function(data){ $("#vtip").html(img+ data);shtips[code]=img+data;});
			  
			  
			  		   
			 }
			else if(parts[0]=='pk')
			 {
			  
			  
			  if(prices[parts[1]]){price=prices[parts[1]];}else{price=$(this).html();}
			  $.get("http://www.holidaym.ru/lib/php/get_pricekey_description.php", 
					{tour:tourkey,pk:parts[1]}, 
					function(data)
					 { 
					  $("#vtip").html(img+ data);
					  $('SPAN.price_rub').html(number_format(price*course,0,',',' '));
					  $('SPAN.orig_price').html(number_format(price,0,',',' '));
					  $('SPAN.price_rate').html(rate_convert(rate));
					  $('SPAN.today').html(date_today);
					  shtips[code]=$("#vtip").html();
			  });
			  
			 }
			 
			
			else if(parts[0]=='pan')
			 {
			  $("#vtip").html(img + get_pansion(parts[1]));
			  
			 }
			else if(parts[0]=='rc')
			 {
			  $("#vtip").html(img + get_rc(parts[1]));
			 }
			 	
			
			} // if(!shtips[code])
			else
			 {
				 $("#vtip").html(shtips[code]);
			 }
             
			 $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
			}
		
        },
        function() {
            $("p#vtip").fadeOut("slow").remove();
			this.title=code;
        }
    ).mousemove(
        function(e) {
           	this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);                         
            $("p#vtip").css("top", this.top+"px").css("left", this.left+"px").css("opacity",1);
			
        }
    );            
    
};

jQuery(document).ready(function($){vtip();}) 
