  var map = null;
  var marker = null;
  var mapCount = 0;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-24652712-1']);
  _gaq.push(['_setDomainName', '.hotel-central.nl']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11678595-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


(function($){  
	$.fn.tinyTips = function (supCont) {
		
		/* User settings
		**********************************/
		
		// Enter the markup for your tooltips here. The wrapping div must have a class of tinyTip and 
		// it must have a div with the class "content" somewhere inside of it.
		var tipFrame = '<div class="tinyTip"><div class="content"></div><div class="bottom">&nbsp;</div></div>';
		
		// Speed of the animations in milliseconds - 1000 = 1 second.
		var animSpeed = 300;
		
		/***************************************************************************************************/
		/* End of user settings - Do not edit below this line unless you are trying to edit functionality. */
		/***************************************************************************************************/
		
		// Global tinyTip variable;
		var tinyTip;
		var tText;
		
		// When we hover over the element that we want the tooltip applied to
		$(this).hover(function() {
		
			// Inject the markup for the tooltip into the page and
			// set the tooltip global to the current markup and then hide it.
			$('body').append(tipFrame);
			tinyTip = $('div.tinyTip');
			tinyTip.hide();
			
			// Grab the content for the tooltip from the title attribute (or the supplied content) and
			// inject it into the markup for the current tooltip. NOTE: title attribute is used unless
			// other content is supplied instead.
			if (supCont === 'title') {
				var tipCont = $(this).attr('title');
			} else if (supCont !== 'title') {
				var tipCont = supCont;
			}
			$('.tinyTip .content').html(tipCont);
			tText = $(this).attr('title');
			$(this).attr('title', '');
			
			// Offsets so that the tooltip is centered over the element it is being applied to but
			// raise it up above the element so it isn't covering it.
			var yOffset = tinyTip.height() + 17;
			var xOffset = (((tinyTip.width() - 10) / 2)) - ($(this).width() / 2);
			
			// Grab the coordinates for the element with the tooltip and make a new copy
			// so that we can keep the original un-touched.
			var pos = $(this).offset();
			var nPos = pos;
			
			// Add the offsets to the tooltip position
			nPos.top = pos.top - yOffset;
			nPos.left = pos.left - xOffset;
			
			// Make sure that the tooltip has absolute positioning and a high z-index, 
			// then place it at the correct spot and fade it in.
			tinyTip.css('position', 'absolute').css('z-index', '1000');
			tinyTip.css(nPos).fadeIn(animSpeed);
			
		}, function() {
			
			$(this).attr('title', tText);
		
			// Fade the tooltip out once the mouse moves away and then remove it from the DOM.
			$('div.tinyTip').fadeOut(animSpeed, function() {
				$(this).remove();
			});
			
		});
		
	}

})(jQuery);

if(!Array.indexOf){
    Array.prototype.indexOf = function(obj){
        for(var i=0; i<this.length; i++){
            if(this[i]==obj){
                return i;
            }
        }
        return -1;
    }
}

$(document).ready(function() {
	$('.button a').attr('target','_self');
	$('#flags a:last-child').hide();
	$('#showcase > div:first div.admin_overlay').css('height','150px');
	if( $('#ietje').length )
		$('#menu').addClass('editing');
	$('#nav ul:first').superfish();
	$('#menu .image a').each( function() {
		$( this ).children().insertAfter( $( this ) );
		$( this ).insertBefore( $( this ).closest( '.image' ) );
		$( this ).nextAll( '.text' ).appendTo( this );
	} );


	$( '#googlemap' ).bind('click', function() {
            
            var loc = '<iframe style="display:block" width="400" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" '+
                       'src="http://maps.google.com/maps?f=q&source=s_q&hl=nl&geocode=&q=Golden Tulip Hotel Central, Burgemeester Loefplein 98, \'s-Hertogenbosch, Nederland&iwloc=near&output=embed&ie=UTF8"></iframe>';
            TINY.box.show({
                    width:400,
                    height:300,
                    opacity:80,
                    topsplit:3,
                    html: loc,
                    });
                     
            
    
    });
/*
	$( '#wrapper.home .right .right a:last' ).each( function() { $( this ).prettyPhoto( {
		default_width: 400,
		default_height: 300,
		changepicturecallback: function() {
			var map = new google.maps.Map( $('<div/>').appendTo('.pp_content').css({width:400,height:300,margin:'0 20px'})[0], {
				zoom: 14,
				center: new google.maps.LatLng(51.689851,5.304208),
				mapTypeId: google.maps.MapTypeId.ROADMAP
			} );
			new google.maps.Marker( {
				map: map,
				position: map.center,
				icon: 'files/96/template/marker.png',
				title: 'Hotel Central'
			} );
			$( '.pp_pic_holder' ).css( 'top', parseInt( $( '.pp_pic_holder' ).css( 'top' ) ) - 130 );
			$( '.pp_content' ).css( 'height', 300 );
		}
	} ); } );
*/
	$( 'input#aankomst, input#vertrek' ).datepicker( {
		dateFormat: 'dd/mm/yy'
	} );
	
	Cufon.replace('h1 span, h1 em, h1 .segmenttext_body, #menu a div.segmenttext_body', { fontFamily: "Gill Sans Light" });
	//Cufon.replace('#nav a, #menu a, h2', { fontFamily: "Calluna", hover: true });
	
	$( 'ul.faqs li' ).css( 'margin', '20px 0 25px 60px' ).each( function() {
		var div = $( '<div></div>' );
		$( this ).find( 'h6' ).nextAll().each( function() {
			div.append( $( this ).remove() );
		} );
		if( div.find( '*' ).length )
			$( this ).tinyTips( div );
	} );
	$( 'table#arrangementen .more' ).each( function() {
		$( this ).hide();
		$( '<span style="cursor: pointer; font-style: italic; display: block; margin-bottom: 15px;">meer...</span>' ).click( function() {
			$( this ).hide().next().slideDown();
		} ).insertBefore( this );
		$( '<span style="float: right; cursor: pointer; display: block; margin: 0 0 10px 10px;">[-]</span>' ).click( function() {
			$( this ).parent().slideUp( function() { $( this ).prev().show(); } );
		} ).prependTo( this );
	} );
	$( 'table#arrangementen .more_en' ).each( function() {
		$( this ).hide();
		$( '<span style="cursor: pointer; font-style: italic; display: block; margin-bottom: 15px;">read more...</span>' ).click( function() {
			$( this ).hide().next().slideDown();
		} ).insertBefore( this );
		$( '<span style="float: right; cursor: pointer; display: block; margin: 0 0 10px 10px;">[-]</span>' ).click( function() {
			$( this ).parent().slideUp( function() { $( this ).prev().show(); } );
		} ).prependTo( this );
	} );
	
	
	
	$( 'input[name=info_ontvangen]' ).change( function() {
		$( '.required' ).removeClass( 'required' );
		$( '.error' ).removeClass( 'error' );
		$( 'span.requirement' ).remove();
		
		var required = 'input[name=uw_naam], input[name=voornaam_letters], input[name=aanhef], input[name=telefoon], input[name=emeel], input[name=stad]';
		
		if( $( this ).val() == 'per post' )
			required += ', input[name=adres], input[name=postcode]';
		else if( $( this ).val() == 'per fax' )
			required += ', input[name=fax]';
		else
			required += '';
		
		$( $.unique( $( required ).addClass( 'required' ).closest( 'td' ) ) ).append( '<span class="requirement">*</span>' );
	} ).change();
	
	$( '#c_vn_48_vn_2_homeText form, #PAGE_infor8836f_vn_2_homeText form' ).submit( function() {
		$( '.error' ).removeClass( 'error' );
		$( 'input.text.required' ).each( function() {
			if( !$( this ).val() )
				$( this ).closest( 'tr' ).addClass( 'error' );
		} );
		
		if( !$( 'input.radio.required:checked' ).length )
			$( 'input.radio.required' ).closest( 'tr' ).addClass( 'error' );
		
		if( $( 'tr.error' ).length )
			return false;
	} );
	
	$( 'input[name=aankomst]' ).change( function() {
		var aankomst = new Date( $( this ).datepicker( 'getDate' ) );
		var vertrek = $( 'input[name=vertrek]' ).datepicker( 'getDate' );
		if( aankomst > vertrek )
			$( 'input[name=vertrek]' ).datepicker( 'setDate', new Date( aankomst.valueOf() + 24*60*60*1000 ) );
	} );
	
	$( '#hoofdmenu_element > ul > li:has(ul) > a' ).each( function() { $( this ).replaceWith( $( this ).html() ); } )
	
	
	
});

function change_language(dest_language, ajax_call, func_callback)
{
	jQuery.get(BASE_DIR + 'pages/set_language/' + dest_language + '/0/', { }, function() {
		if (dest_language == 'nl')
		{
			window.location = '/';
		}
		else
		{
			window.location = '/' + dest_language;
		}
	});
}


