$(function() {

	//Rotating Push Marketing
	/*$('.home-push-wrapper ul').each(function() {
		$(this).jcarousel({scroll:1,wrap:'both'});
	});*/
	
	// Flash Email Signup
	
	$("div#flash-email-signup").each(function(){
		var cookieval = $.cookie("flashcheck");
		var flashopen = true;
		if ( cookieval == "flashopened" ) {
			flashopen = false;
		}
		$(this).flash(
			{src:"/flash/flash-dropdown.swf",
			 width:196,
			 height:202,
			 name:"homeMasthead",
			 id:"homeMasthead",
			 wmode:"transparent",
			 quality:"high"},
			 {version:"9"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.openOnLoad = flashopen;
					$(this).html($.fn.flash.transform(htmlOptions));
			});
		$.cookie("flashcheck", "flashopened", { expires: 7 });
	});
	
		// JQModal 
	var openFn=function(hash){
		hash.w.show();
		$('#dialog').css({left:($(window).width()-$('#dialog').width())/2,top:$(window).scrollTop()+10});
	};

	var hideFn=function(hash){
		hash.w.hide()
		hash.o.remove();
	};

	$('#dialog').jqm({onShow: openFn, onHide: hideFn});

	$("div#wedding-video").flash( {src:"flash/wedding-flash.swf", width:375, height:328, wmode:"transparent", allowScriptAccess:"always", quality:"high"}, {version:"7"});	
	

	// Nav Stuff
	$('#meetings').css({ position: 'absolute', cssFloat: 'none' });
	$('#leisure').css({ position: 'absolute', cssFloat: 'none' });
	
	$('#booking-form').submit(function() {
		var val1 = $('#arrive', this).val().split('/');
		var val2 = $('#depart', this).val().split('/');
		
		var start = new Date($('#arrive', this).val());
		var end = new Date($('#depart', this).val());
		var one_day=1000*60*60*24;
		var days = Math.ceil((end.getTime()-start.getTime())/(one_day))	

		$('#numberOfNights').val(days);
		
		$('#arriveMonth').val(val1[0]);
		$('#arriveDay').val(val1[1]);
		$('#arriveYear').val(val1[2]);

		$('#departMonth').val(val2[0]);
		$('#departDay').val(val2[1]);
		$('#departYear').val(val2[2]);
		
		if($('#departMonth').val()=='mm') {
			alert("Please choose valid dates");
			return false;
		}
	});
	
	if($('li#leisure-li').is('.current')) {
		$('#leisure-sidebar').show();
	}
	
	if($('li#meetings-li').is('.current')) {
		$('#meetings-sidebar').show();
	}


	if($('#villa-nav').is('ul')) {
		$('#meetings-sidebar').show();
	}

	$('#news-ticker-flash').flash({
	    src:'flash/news-ticker.swf',
	    width:335,
	    height:250,
	    wmode:'transparent',
	    quality:'high'
	});

	$('.meetings-logo').flash({
	    src:'flash/logo-meet.swf',
	    width:246,
	    height:121,
	    wmode:'transparent',
	    quality:'high'
	});


	if($('body').is('.home')) {
		var currenttab = $('ul#nav-tab li.current').attr("id");
		$('div#nav ul#main-nav li#leisure-li').css('display','none');
		$('#popupwrapper').hide();
		var qsParms = new Array();
		var querystring = window.location.search.substring(1);
		var parms = querystring.split('&');
		for (var i=0; i<parms.length; i++) {
			var pos = parms[i].indexOf('=');
			if (pos > 0) {
				var key = parms[i].substring(0,pos);
				var val = parms[i].substring(pos+1);
				qsParms[key] = val;
			}
		}

		if (qsParms['sec'] == 'meetings') {
			findFlash('homeMasthead');
			//meetingPhotos();
	try {
 thisFlash.meetingPhotos();
 } catch ( e ) {}
				//Show Home Push marketing for the current section
				AddHomepageMeetingPush()
			$('ul#main-nav li#meetings-li').addClass('current');
			$('ul#nav-tab li#leisure-tab').removeClass('current');
			$('ul#nav-tab li#meetings-tab').addClass('current');
			$('ul#utility-nav li#meetings-util').addClass('current');
			$('div#flash-masthead').addClass('flash-meetings-alt');
		} else {
				//Show Home Push marketing for the current section
				AddHomepageLeisurePush()
			$('ul#main-nav li#leisure-li').css('display','block');
			$('ul#main-nav li#leisure-li').addClass('current');
			$('ul#utility-nav li#leisure-util').addClass('current');
		}


		$('ul#nav-tab li').children('a').click( function() { 
			var currentlyClicked= $(this).parent().attr('id');
			var notClicked = $(this).parent().siblings('li').attr('id');
			if (currentlyClicked == 'meetings-tab' && $('ul#nav-tab li#meetings-tab').attr('class') != 'current' ) {
				
				//Show Home Push marketing for the current section
				AddHomepageMeetingPush()
				meetingPhotos();
				$('ul#nav-tab li#leisure-tab').removeClass('current');
				$('ul#nav-tab li#meetings-tab').addClass('current');
				$('div#flash-masthead img').remove();
				$('div#flash-masthead').addClass('flash-meetings-alt');
				$('ul#main-nav li#leisure-li').animate({
  					top: -10, opacity: 'hide'
					}, 500, function() { 
						$('ul#main-nav li#leisure-li').removeClass('current');
						$('ul#main-nav li#meetings-li').addClass('current-li');
						 $('ul#main-nav li#meetings-li').animate({
							top: 3, opacity: 'show'
						}, 500); 
					}
				);
				
                $('a#push-own-piece').hide();
                $('div#leisure-content').hide();
                $('div#meeting-content').show();
                
				if (BrowserDetect.browser == "Safari") {
					$('ul#utility-nav li#leisure-util').hide( function() { $('ul#utility-nav li#meetings-util').show(); });
				} else {
					$('ul#utility-nav li#leisure-util').fadeOut( function (){
						$('ul#utility-nav li#leisure-util').removeClass('current');
						$('ul#utility-nav li#meetings-util').fadeIn( function() { $('ul#utility-nav li#meetings-util').addClass('current-li'); });		
					});
				}
				
			} else if ( currentlyClicked == 'leisure-tab'  && $('ul#nav-tab li#leisure-tab').attr('class') != 'current') {
				//Show Home Push marketing for the current section
				AddHomepageLeisurePush()
				leisurePhotos();
				$('div#flash-masthead').removeClass('flash-meetings-alt');
				$('ul#nav-tab li#meetings-tab').removeClass('current');
				$('ul#nav-tab li#leisure-tab').addClass('current');
				$('ul#main-nav li#meetings-li').animate({
  					top: -10, opacity: 'hide'
					}, 500, function() { 
						$('ul#main-nav li#meetings-li').removeClass('current');					
						$('ul#main-nav li#leisure-li').addClass('current-li');
						 $('ul#main-nav li#leisure-li').animate({
							top: 3, opacity: 'show'
						}, 500); 	
					}
				);
                $('a#push-own-piece').show();
                $('div#leisure-content').show();
                $('div#meeting-content').hide();
				
				if (BrowserDetect.browser == "Safari") {
					$('ul#utility-nav li#meetings-util').hide( function() { $('ul#utility-nav li#leisure-util').show(); });
				} else {
				
					$('ul#utility-nav li#meetings-util').fadeOut( function (){
						$('ul#utility-nav li#meetings-util').removeClass('current');
						$('ul#utility-nav li#leisure-util').fadeIn( function() { $('ul#utility-nav li#leisure-util').addClass('current-li'); });		
					});
				}
			}
	
			return false;
		});	

	} else {
	
		if($('li#meetings-li').is('.current'))	{
			$('ul#nav-tab li#leisure-tab').removeClass('current');
			$('ul#nav-tab li#meetings-tab').addClass('current');
			$('ul#utility-nav li#meetings-util').addClass('current');
		} else {
			$('ul#utility-nav li#leisure-util').addClass('current');
			$('ul#main-nav li#leisure-li').addClass('current');
		}
	
	}
	
	// Sifr
	$('div#content h1#landing').sifr({ strSWF: '/flash/palatino-linotype-bold.swf', strColor: '#45413a', strWmode: 'transparent', strCase: 'upper' },{ expressInstall: true });
	$('div#content h1').sifr({ strSWF: '/flash/palatino-linotype-bold.swf', strColor: '#45413a', strWmode: 'transparent', strCase: 'upper' },{ expressInstall: true });
	$('div#content h2').sifr({ strSWF: '/flash/palatino-linotype.swf', strColor: '#858079', strWmode: 'transparent' },{ expressInstall: true });
	$('div#content h3').sifr({ strSWF: '/flash/palatino-linotype.swf', strColor: '#7c7360', strWmode: 'transparent' },{ expressInstall: true });
	$('div#content #guests-say-box h4, div#content #online-praise-box h4, div#content #testimonials-box h4, div#content #online-praise h4, div#content #testimonials h4').sifr({ strSWF: 'flash/humanst521-bt-roman.swf', strColor: '#45413a', strWmode: 'transparent' },{ expressInstall: true });

	// Flash
	$("body.home div.branding").flash({src:"flash/logo.swf", width:246, height:121, wmode:"transparent", quality:"high"}, {version:"8", update:false});

	if ( !$('body.home div#branding embed').length ) {
	    $('body.home div#branding').css({ background:'white', top:'-8px' });
	}
	$("div#photos").flash({src:"flash/photos.swf", width:445, height:300, wmode:"transparent", quality:"high"});
	$("div#photos-lifestyle").flash({src:"flash/lifestyle.swf", width:389, height:340, wmode:"transparent", quality:"high"});
	$("div#photos-villas").flash({src:"flash/virtualTour.swf ", width:400, height:246, wmode:"transparent", quality:"high"});
	$("div#video-oasis").flash({src:"flash/oasis.swf ", width:315, height:275, wmode:"transparent", quality:"high"});
	$("div#package-flash").flash({src:"flash/AGRmasthead.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#video-oasis-popup").flash({src:"flash/oasis.swf ", width:315, height:275, wmode:"transparent", quality:"high"});
	$("div#video-tvspot-popup").flash({src:"/flash/tv-spot.swf ", width:444, height:379, wmode:"transparent", quality:"high"});
	$("div#video-dare-popup").flash({src:"flash/doubleDogDare/doubleDogDare.swf ", width:320, height:250, wmode:"transparent", quality:"high"});
	$("div#video-kid-popup").flash({src:"flash/areYouKidEnough/areYouKidEnough01.swf", width:320, height:300, wmode:"transparent", quality:"high"});
	$("div#gift-card-flash").flash({src:"/flash/gift-card.swf", width:243, height:154, wmode:"transparent", quality:"high"});
	
	
	
	// Flash Mastheads
	/*$("div#flash-masthead").flash(
		{src:"flash/grand-opening-masthead-2.swf",
		 width:694,
		 height:500,
		 name:"homeMasthead",
		 id:"homeMasthead",
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
				htmlOptions.flashvars.imagesXML = "/flash/xml/grand-opening-masthead-3.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		});*/
	$("div#packages-masthead").flash({src:"/flash/packages.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#accommodations-masthead").flash({src:"flash/accommodations.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#resort-tour-masthead").flash({src:"flash/resort_tour.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#golf-spa-masthead").flash({src:"flash/golf_spa.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#oasis-park-masthead").flash({src:"flash/oasis_park.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#fitness-masthead").flash({src:"flash/fitness.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#dining-masthead").flash({src:"flash/dining.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#the-resort-masthead").flash({src:"flash/the_resort.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#meetings-masthead").flash({src:"flash/meetings.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#events-masthead").flash({src:"flash/events.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#weddings-masthead").flash({src:"flash/weddings.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#facilities-map-masthead").flash({src:"flash/facilities_map.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#golf-spa-recreation-masthead").flash({src:"flash/golf_spa_recreation.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#villas-masthead").flash({src:"flash/villas.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#springfling").flash({src:"/flash/spring_fling.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#spring-fling").flash({src:"/flash/spring-fling.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#grandchoices").flash({src:"/flash/something-grand.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#kidenough").flash({src:"/flash/kid-enough-masthead.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#grand-green").flash({src:"/flash/green_grand.swf", width:684, height:250, wmode:"transparent", quality:"high"});
	$("div#passport-masthead").flash({src:"/flash/AGRmasthead_passport.swf", width:684, height:250, wmode:"transparent", quality:"high"});



	// Photo Galleries
	$("div#photos-oasis").flash(
		{src:"flash/photo-gallery-oasis.swf", width:560, height:420, wmode:"transparent", quality:"high"}, {version:"8"},
			function(htmlOptions) { 
				htmlOptions.flashvars.configFile = "flash/xml/gallery-config-oasis.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/images-oasis.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);	

	$("div#photos-weddings").flash(
		{src:"flash/photo-gallery-weddings.swf", width:560, height:420, wmode:"transparent", quality:"high"}, {version:"8"},
			function(htmlOptions) { 
				htmlOptions.flashvars.configFile = "flash/xml/gallery-config-weddings.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/images-weddings.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);	

	$("div#epostcard-gallery").flash(
		{src:"flash/photo_gallery.swf", width:466, height:416, wmode:"transparent", quality:"high"}, {version:"8"},
			function(htmlOptions) {
				htmlOptions.flashvars.configFile = "flash/xml/gallery_config.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/images.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);
	
	$("div#media-center").flash(
		{src:"in-the-news-01.swf", width:603, height:400, wmode:"transparent", quality:"high"}, {version:"8"},
			function(htmlOptions) { 
				//htmlOptions.flashvars.configFile = "flash/xml/gallery-config-oasis.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/inTheNews.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);
	
	$('#photo_select').change(function() {
		$('#press-photo-wrapper').load('includes/press-photo-gallery.php', {photo_select: $(this).val()}, function() {
			$('.zoom-in').fancybox();
		});					   
	}).next().hide();
	
	$('#press-photo-wrapper').each(function() {
		$('.zoom-in').fancybox();
	});

	// General Toggelr
	$('.toggle-details').hide();
	$(".toggle-wrapper a.toggler").toggle(function() {
		$(this).parents(".toggle-wrapper").find(".toggle-details").animate({
			height: 'show'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("hide details");
	}, function() {
		$(this).parents(".toggle-wrapper").find(".toggle-details").animate({
			height: 'hide'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("view details");
	});

	// Table Striping
	$('table#press-release-table tr:odd').addClass('altrow');


	$('a#oasis-video').click(function() {
		window.open( "http://www.clicklinktracker.com/c/?id=1889", "popup", "status=1,height=379,width=444,resizable=0");
		return false;								  							  
	});
	
	$('a#tv-spot').click(function() {
		window.open( "/popup-tvspot.php", "popup", "status=1,height=379,width=444,resizable=0");
		return false;								  							  
	});

	$('a#double-dare-video').click(function() {
		window.open( "http://www.clicklinktracker.com/c/?id=1891", "popup", "status=1,height=300,width=410,resizable=0");
		return false;								  							  
	});

	$('a#kid-video').click(function() {
		window.open( "http://www.clicklinktracker.com/c/?id=1890", "popup", "status=1,height=300,width=410,resizable=0");
		return false;								  							  
	});

	// JCarousel
	try {
		$('#mycarousel').jcarousel({ size: 11, scroll: 3 });
	} catch (e){ }


//styles for send-to-friend.php form -- Add a Friend
	var i = 0;
			$('p#add-friend').click(function() {
				i++;
				$('p#add-friend').before('<br /><div class="field">\n\
				<label for="to_name[]">Name</label>\n\
				<input type="text" name="to_name[]" id="to_name[]" maxlength="100" class="textfield" />\n\
				</div>\n\
				<div class="field">\n\
				<label for="to_email[]">Email</label>\n\
				<input type="text" name="to_email[]" id="to_email[]" maxlength="100" class="textfield email" />\n\</div>');
				if (i>=4) {
				$('p#add-friend').remove();
				}
			});


	//-----News Ticker--------
	
	var tickerWrapper = $(".news-ticker-content-wrapper");
	var ticker;
	var totalItems = $("div.total-items").html();
	$("span.total-count").html(totalItems);
	var theitem = 0;
	var currentItem = theitem + 1;
	$("span.current-item").html(currentItem);
	
	$("li#nt-leisure a").click( function() {
		$("li#nt-meetings").removeClass("nt-current").removeClass("meetings-current");
		$("li#nt-villas").removeClass("nt-current").removeClass("villas-current");
		$("li#nt-leisure").addClass("nt-current").addClass("leisure-current");
		$("div.news-ticker-wrapper").addClass("green-ticker-bg").removeClass("blue-ticker-bg").removeClass("red-ticker-bg");
		currentItem = 1;
		theitem = 0;
		$.get("/includes/news-ticker.php",{ticker:"294"}, function(data) {
			$(".news-ticker-content-wrapper").html(data);
			TickerReadMore();
			totalItems = $("div.total-items").html();
			if (totalItems == '0') {
				$("span.current-item").html(totalItems);
			} else if (totalItems != '0') {
				$("span.current-item").html(theitem+1);
			}
			$("span.total-count").html(totalItems);
			});
		tickerWrapper.get(0).scrollTop=0;
		return false;
	});

	$("li#nt-meetings a").click( function() {
		$("li#nt-leisure").removeClass("nt-current").removeClass("leisure-current");
		$("li#nt-villas").removeClass("nt-current").removeClass("villas-current");
		$("li#nt-meetings").addClass("nt-current").addClass("meetings-current");
		$("div.news-ticker-wrapper").addClass("red-ticker-bg").removeClass("blue-ticker-bg").removeClass("green-ticker-bg");
		currentItem = 1;
		theitem = 0;
		$.get("/includes/news-ticker.php",{ticker:"295"}, function(data) {
			$(".news-ticker-content-wrapper").html(data);
			TickerReadMore();
			totalItems = $("div.total-items").html();
			if (totalItems == '0') {
				$("span.current-item").html(totalItems);
			} else if (totalItems != '0') {
				$("span.current-item").html(theitem+1);
			}
			$("span.total-count").html(totalItems);
			});
		tickerWrapper.get(0).scrollTop=0;
		return false;
	});

	$("li#nt-villas a").click( function() {
		$("li#nt-meetings").removeClass("nt-current").removeClass("meetings-current");
		$("li#nt-leisure").removeClass("nt-current").removeClass("leisure-current");
		$("li#nt-villas").addClass("nt-current").addClass("villas-current");
		$("div.news-ticker-wrapper").addClass("blue-ticker-bg").removeClass("green-ticker-bg").removeClass("red-ticker-bg");
		currentItem = 1;
		theitem = 0;
		$.get("/includes/news-ticker.php",{ticker:"296"}, function(data) {
			$(".news-ticker-content-wrapper").html(data);
			TickerReadMore();
			totalItems = $("div.total-items").html();
			if (totalItems == '0') {
				$("span.current-item").html(totalItems);
			} else if (totalItems != '0') {
				$("span.current-item").html(theitem+1);
			}
			$("span.total-count").html(totalItems);
			});
		tickerWrapper.get(0).scrollTop=0;
		return false;
	});
	
	
	$("li#prev-item a").click( function() {
		tickerWrapper.get(0).scrollTop=0;
		if (theitem == 0) {
			return false;
		}
		else {
			theitem = theitem - 1;
			currentItem = currentItem - 1;
			$.get("news-ticker.php",{theitem:theitem}, function(data) {
				$("span.current-item").html(currentItem);
				$(".news-ticker-content-wrapper").html(data);
				TickerReadMore();
			});
			return false;
		}
		return false;
	});

	$("li#next-item a").click( function() {
		tickerWrapper.get(0).scrollTop=0;
		if ((totalItems == '0') || (currentItem == totalItems)) {
			return false;
		}
		else {
			theitem = theitem + 1;
			currentItem = currentItem + 1;
			$.get("news-ticker.php",{theitem:theitem}, function(data) {
				$("span.current-item").html(currentItem);
				$(".news-ticker-content-wrapper").html(data);
				TickerReadMore();
			});
			return false;
		}
		return false;
	});
	
	function TickerReadMore() {
		$(".news-ticker-content-wrapper").each( function() {
			var father = $(this);
			$(".news-ticker-read-more a", father).toggle( function() {
				$(".news-ticker-content-long", father).animate({height:'show'}, 'slow');
				$(this).html("Hide Details");
				}, function() {
				$(".news-ticker-content-long", father).animate({height:'hide'}, 'slow');
				$(this).html("Read More");
			});
		});
	}
	
	TickerReadMore();
	
	
	//Online Praise toggler
	$('.praise-long-content').hide();
	$(".praise-details-link a").toggle(function() {
		$(this).parents(".praise-wrapper").find(".praise-long-content").animate({
			height: 'show'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("hide details").removeClass("plus").addClass("minus");
	}, function() {
		$(this).parents(".praise-wrapper").find(".praise-long-content").animate({
			height: 'hide'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("view details").removeClass("minus").addClass("plus");
	});

	//Testimonials toggler
	$('ul.testimonial-quote-list').hide();
	$("#testimonials-list li").each( function() {
		var fatherli = $(this);
		$(".testimonials-show a", fatherli).toggle(function() {
			$("ul.testimonial-quote-list", fatherli).animate({
				height: 'show'
			}, 'slow');
			// Changes the Text of the Control
			$(this).html("hide testimonials");
			fatherli.addClass("current");
		}, function() {
			$("ul.testimonial-quote-list", fatherli).animate({
				height: 'hide'
			}, 'slow');
			// Changes the Text of the Control
			$(this).html("view testimonials");
			fatherli.removeClass("current");
		});
	});
	



	// Adds rel=nofollow to external links in Hotel Review page
	$('div.praise-wrapper').children('div.praise-long-content').each(function() { 
		// Gets Hostname/Domain
		var hostname = window.location.hostname;
		hostname = hostname.replace("www.","").toLowerCase();
		
		// Gets all Anchors inside Long Content
		var a = this.getElementsByTagName("a");
		
		// Checks if External
		$.fn.check = function(obj) {
				var href = obj.href.toLowerCase();
				return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;		
		};
		
		// Sets rel if external
		$.fn.set = function(obj) {
			return this.each(function() {
				obj.rel = "nofollow";	
			});
		};		
	
		for (var i=0;i<a.length;i++){
			if( $(this).check(a[i]) ) {
				$(this).set(a[i]);
			}
		};				
	});
	
	
	/*
	 ankwin = function(){
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	var a = document.getElementsByTagName("a");	
	this.check = function(obj){
		var href = obj.href.toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	};
	this.set = function(obj){
		obj.target = "_blank";
		obj.className = "external";
	};	
	for (var i=0;i<a.length;i++){
		if(check(a[i])) set(a[i]);
	};		
	*/
	
	/*--------------- Special Packages ------------------*/
	$('.package').packagePreview();
	
	/*---------------Calendar of Events ------------------*/
	$(".vcalendar").eventPreview();
	

	//Remove Homepage leisure push
	function AddHomepageLeisurePush() {
		$(".home-push-wrapper").html('').hide();
		$.get("includes/home-push.php", function(data){
			$("#home-push-leisure").show().html(data).fadeIn();
			$('#home-push-leisure ul').each(function() {
				$(this).jcarousel({scroll:1,wrap:'both'});
			});
		});
	}
	function AddHomepageMeetingPush() {
		$(".home-push-wrapper").html('').hide();
		$.get("includes/home-push-meeting.php", function(data){
			$("#home-push-meeting").show().html(data).fadeIn();
			$('#home-push-meeting ul').each(function() {
				$(this).jcarousel({scroll:1,wrap:'both'});
			});
		});
	}
		
});

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	popup = 1
	win = window.open(mypage, myname, winprops);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

if (typeof updatePhone == 'function') { updatePhone(); }