//function loadDefault(){
$(function(){
	$('#displayContent').html('<br><br><br><br><center><img src="../images/ajax-loader.gif" /></center>');
    $('#displayContent').load("../tpl/content-get-fit-with-carmen.html", "",
        function(responseText, textStatus, XMLHttpRequest) {
            if(textStatus == 'error') {
                $('#displayContent').html('<p>There was an error making the AJAX request</p>');
            }
        }
    );
	$("a#menu6").addClass("active");
});
//}
//window.onload = loadDefault;

function displayPageRequest(url) {
	//alert("url: " + url);
	$('#displayContent').html('<br><br><br><br><center><img src="../images/ajax-loader.gif" /></center>');
    $('#displayContent').load("../tpl/content-"+url+".html", "",
        function(responseText, textStatus, XMLHttpRequest) {
            if(textStatus == 'error') {
                $('#displayContent').html('<p>There was an error making the AJAX request</p>');
            }
        }
    );
	
	$("a#menu6").removeClass("active");
	$('#headerMenu2 .btmLinks').find('a').click(selectNav);
	function selectNav() {
	  $(this)
		.parents('ul:first')
		  .find('a')
			.removeClass('active')
		  .end()
		.end()
		.addClass('active');
	}
}

$(function(){
	$('#passDialog').show();
	$('#userPass').hide();
	
	$('input[type="text"]').each(function() {
		this.value = $(this).attr('title');

		$(this).focus(function(){	
			if($(this).attr('title') == 'PASSWORD'){
				$('#passDialog').hide();
				$('#userPass').show();
				$('#userPass').focus();
			}else{
				if(this.value == $(this).attr('title')){
					this.value = '';
				}
			}
		});
		
		$('#userPass').blur(function() {
			if($('#userPass').val() == '') {
				$('#passDialog').show();
				$('#userPass').hide();
			}
		});
		
		$('#userName').blur(function() {		
			if(this.value == ''){
				this.value = $(this).attr('title');	
			}
		});
		
		$(this).blur(function() {		
			if(this.value == ''){
				this.value = $(this).attr('title');	
			}
		});
	});
});

$(document).ready(function(){
	var $panels = $('#slider .scrollContainer > div');
	var $container = $('#slider .scrollContainer');
	var horizontal = true;
	
	if (horizontal) {
	  $panels.css({
		'float' : 'left',
		'position' : 'relative' // IE fix to ensure overflow is hidden
	  });
	  
	  $container.css('width', $panels[0].offsetWidth * $panels.length);
	}
	
	var $scroll = $('#slider .scroll').css('overflow', 'hidden');
	
	//$scroll
	 // .before('<img class="scrollButtons left" src="images/scroll_left.png" />')
	  //.after('<img class="scrollButtons right" src="images/scroll_right.png" />');
	
	function selectNav() {
	  $(this)
		.parents('ul:first')
		  .find('a')
			.removeClass('active')
		  .end()
		.end()
		.addClass('active');
	}
	
	$('#slider .navigation').find('a').click(selectNav);
	
	function trigger(data) {
	  var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
	  selectNav.call(el);
	}
	
	if (window.location.hash) {
	  trigger({ id : window.location.hash.substr(1) });
	} else {
	  $('ul.navigation a:first').click();
	}
	
	var offset = parseInt((horizontal ? 
	  $container.css('paddingTop') : 
	  $container.css('paddingLeft')) 
	  || 0) * -1;
	
	
	var scrollOptions = {
	  target: $scroll, 
	  items: $panels,	  
	  navigation: '.navigation a',
	  prev: 'img.left', 
	  next: 'img.right',	  
	  axis: 'xy',	  
	  onAfter: trigger,	  
	  offset: offset,	  
	  duration: 400,	  
	  easing: 'swing'
	};
	
	$('#slider').serialScroll(scrollOptions);
	$.localScroll(scrollOptions);
	scrollOptions.duration = 1;
	$.localScroll.hash(scrollOptions);
});


function mycarousel_initCallback(carousel){
    // Disable autoscrolling if the user clicks the prev or next button.
		carousel.buttonNext.bind('click', function() {
			carousel.startAuto(0);
		});

		carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});

    // Pause autoscrolling if the user moves with the cursor over the clip.
		//carousel.clip.hover(function() {
		//	carousel.stopAuto();
		//}, function() {
		//	carousel.startAuto();
		//});
		carousel.stopAuto();
};
	
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 0,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});
