jQuery(document).ready(function() {
	
	jQuery('div.nameHover').qtip({
		position: {
			my: 'bottom left',  // Position my top left...
			at: 'top center'
		},
		style: {
			classes: 'ui-tooltip-light ui-tooltip-shadow'
		},
		content: {
			//title: jQuery(this),
			text: function(api) {
				return jQuery(this).attr('tipContent');
			}
		},
		show: {
			effect: function(offset) {
				jQuery(this).fadeIn(200); // "this" refers to the tooltip
			},
			delay: 150
		}
	}).mouseenter(function () {
		jQuery(this).stop().animate({ marginTop: -5}, 150);
	}).mouseout(function () {
		jQuery(this).stop().animate({ marginTop: 0}, 150);
	});
	
	// Reset Font Size
	jQuery(".resetFont").click(function(){
		jQuery('#content').css('font-size', '12px');
		jQuery('#content').css('line-height', '16px');
		
	});
	// Increase Font Size
	jQuery(".big").click(function(){
		jQuery('#content').css('font-size', '14px');
		jQuery('#content').css('line-height', '20px');
		return false;
	});
	// Decrease Font Size
	jQuery(".bigger").click(function(){
		jQuery('#content').css('font-size', '16px');
		jQuery('#content').css('line-height', '24px');
		return false;
	});
});

jQuery(window).load(function() {
	jQuery('#slideShow').nivoSlider({
		effect:'random',
		startSlide:0,
		pauseTime: 4000,
		animSpeed: 450,
        directionNav: false,
		keyboardNav: false
	});
	
	jQuery('#praxisSlidesWrapper').cycle({ 
	    fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0, 
	    next:   '#praxisForward', 
	    prev:   '#praxisBack' 
	});
	
	//load googlemap
	initializeMap();
});

// Google Maps Stuff
function initializeMap() {
	//maps.google.de/maps?q=Erftstra%C3%9Fe+7-9,+D%C3%BCsseldorf&hl=de&ie=UTF8&sll=51.151786,10.415039&sspn=22.253302,34.277344&view=map&z=16
	var secheltLoc = new google.maps.LatLng(51.21395, 6.75667);

	var myMapOptions = {
		zoom: 15
		,center: secheltLoc
		,mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var theMap = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);


	var marker = new google.maps.Marker({
		map: theMap,
		draggable: true,
		position: new google.maps.LatLng(51.21395, 6.75667),
		visible: true
	});

	var boxText = document.createElement("div");
	boxText.style.cssText = "border: 1px solid grey; margin-top: 8px; background: white; padding: 5px;";
	boxText.innerHTML = "<b>Hafendoc Praxis Adresse</b>:<br/><a target='_blank' href='http://maps.google.de/maps?q=Erftstra%C3%9Fe+7,+D%C3%BCsseldorf&hl=de&ie=UTF8&sll=51.151786,10.415039&sspn=24.256668,35.991211&z=16'>Erftstraße 7<br/>40219 Düsseldorf</a>";

	var myOptions = {
		content: boxText
		,disableAutoPan: false
		,maxWidth: 0
		,pixelOffset: new google.maps.Size(20, -40)
		,zIndex: null
		,boxStyle: { 
			background: "url('tipbox.gif') no-repeat"
			,opacity: 0.9
			,width: "200px"
		}
		,closeBoxMargin: "10px 2px 2px 2px"
		,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
		,infoBoxClearance: new google.maps.Size(1, 1)
		,isHidden: false
		,pane: "floatPane"
		,enableEventPropagation: false
	};

	google.maps.event.addListener(marker, "click", function (e) {
		ib.open(theMap, this);
	});

	var ib = new InfoBox(myOptions);
	ib.open(theMap, marker);
}
