function goto(url) {
	window.open(url);
};

function updateDemo(id) {
	if (id != "") {
		$('#fvmap').fanvenues({
			mapSet:'fv',
			mapId:id, 
			defaultZoom: 3,                                                                                          
			interactWithTicketList: false,
			priceFilter: false,
			fullscreenMapButton: false,
			resetMapButton: false,
			printMapButton: false,
			ssize: '340x183',
			ticketList:{                                                                                                    
				'items':[                                                                                           
					{id:'1231',section:'201',row:'10',price:'110.00',notes:'n/a'},  
					{id:'1232',section:'201',row:'12',price:'24.00',notes:'n/a'},   
					{id:'1233',section:'202',row:'4',price:'150.00',notes:'n/a'},
					{id:'1234',section:'117',row:'4',price:'210.00',notes:'n/a'},   
					{id:'1235',section:'223',row:'4',price:'110.00',notes:'n/a'},   
					{id:'1236',section:'316',row:'4',price:'115.00',notes:'n/a'},   
					{id:'1237',section:'107',row:'4',price:'300.00',notes:'n/a'},   
					{id:'1238',section:'101',row:'4',price:'320.00',notes:'n/a'},   
					{id:'1239',section:'213',row:'4',price:'80.00',notes:'n/a'},    
					{id:'1240',section:'307',row:'4',price:'100.00',notes:'n/a'},   
					{id:'1241',section:'318',row:'4',price:'130.00',notes:'n/a'},   
					{id:'1242',section:'112',row:'4',price:'510.00',notes:'n/a'},   
					{id:'1243',section:'203',row:'4',price:'110.00',notes:'n/a'}	
				]                                                                                                           
			}                                                                                                               
		})                                                                                                                  
		.bind('fvmapNotAvailable', function() {                                                                   
			$(this).replaceWith('Sorry! Map could not be found.');                                                  
		})                                                                                                                  
		.bind('fvmapEnlargeImage', function(obj, url, section) {
			// display large image section view                                                   
		})
		.bind('fvmapSectionFocus', function(obj, smallImageUrl, section) {
			// display thumbnail section view
			$('#thumbnail')
				.html('<img src="'+smallImageUrl+'" />');
		})
		.bind('fvmapSectionBlur', function(obj, smallImageUrl, section) {
			// perform action when section loses focus (mouse out)
			// thumbnail image url and section name are passed in
		})
		.bind('fvmapSectionClick', function(obj, smallImageUrl, section) {
			// perform action on section select
			// thumbnail image url and section name are passed in
		})
		.bind('fvmapSectionDeselect', function(obj, smallImageUrl, section) {
			// perform action on section deselect
			// thumbnail image url and section name are passed in
		});
	}
}


$(document).ready(function() {
       //Page scrolling
        $('a[href*=#]').click(function() {
            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
              var $target = $(this.hash);
              $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
                if ($target.length) {
                  if($('#powerpack-menu').length != 0) {
                    var targetOffset = $target.offset().top - 70;
                  } else {
                    var targetOffset = $target.offset().top - 30;
                  }
                  $('html,body')
                  	.animate({scrollTop: targetOffset}, 1000);
                       	return false;
                  }
            }
      });

	$('#products .leftcol .menu').click( function() {
		var oldEl = $('#products .leftcol .active');
		var newEl = $(this);

		oldEl.removeClass('active');
		if (oldEl.hasClass('img1')) {
			$('#products-content #pdt-one').hide();
			$('#pdt-text-one').hide();
		}
		else if (oldEl.hasClass('img2')) {
			$('#products-content #pdt-two').hide();
			$('#pdt-text-two').hide();
		}
		else if (oldEl.hasClass('img3')) {
			$('#products-content #pdt-three').hide();
			$('#pdt-text-three').hide();
		}
		newEl.addClass('active');
		if (newEl.hasClass('img1')) {
			$('#products-content #pdt-one').fadeIn();
			$('#pdt-text-one').fadeIn();
		}
		else if (newEl.hasClass('img2')) {
			$('#products-content #pdt-two').fadeIn();
			$('#pdt-text-two').fadeIn();
		}
		else if (newEl.hasClass('img3')) {
			$('#products-content #pdt-three').fadeIn();
			$('#pdt-text-three').fadeIn();
		}
	});
	
	var demoEl = $("#demo");
	var thumbEl = $("#thumbnail");
	$(window).scroll(function () {
		//console.log($(window).scrollTop());
		
		if (($(window).scrollTop() >= demoEl.offset().top - 100) && ($(window).scrollTop() <= demoEl.offset().top + 668)) {
			thumbEl.slideDown();
		}
		else {
			thumbEl.slideUp();
		}
	});

	// updateDemo('8085');

});

