/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/

this.vtip = function() {
    this.xOffset = -10; // x distance from mouse
    this.yOffset = 10; // y distance from mouse

    $(".vtip").unbind().hover(
        function(e) {
            this.t = this.title;
            this.title = '';
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);

            $('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );

            $('p#vtip #vtipArrow').attr("src", 'fileadmin/templates/scripts/contact_map/vtip_arrow.png');
            $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");

        },
        function() {
            this.title = this.t;
            $("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");
        }
    );

    $('.vtip').mouseover(function() {

    	// IM SORRY
    	if($.browser.webkit == true) {
    		$.ajax({
			  type: 'GET',
			  contentType: 'text/html; charset=utf-8',
			  url: 'fileadmin/templates/scripts/contact_map/readcvs.php',
			  data: {ort: $(this).attr('id')},
  			success: function(data) {
  				$('#info2').html(data);
  			}
			});
		} else {
    		$('#' + $(this).attr('id') + 'info').css('visibility', 'visible');
    	}
    });

    $('.vtip').mouseout(function() {
    	$('#' + $(this).attr('id') + 'info').css('visibility', 'hidden');
    });


    $('.vtip').click(function() {
    	$.ajax({
			  type: 'GET',
			  contentType: 'text/html; charset=utf-8',
			  url: 'fileadmin/templates/scripts/contact_map/readcvs.php',
			  data: {ort: $(this).attr('id')},
  			success: function(data) {
  				$('#info2').html(data);
  			}
			});
    });

};

jQuery(document).ready(function($){vtip();})
