
function wc()
{
	if(window.console)
	{
		for(var i = 0; i < arguments.length; i++)
		{
			window.console.log(arguments[i]);
		}
	}
}

$(function() {
	
	ImgMapBg();
	
	function ImgMapBg(){
		
		var img = $('#about-visual');
		var mapName = $(img).attr('usemap');
		var height = 310;
		
		$('area',$('map[name='+mapName+']'))
		.mouseover(function() { 
			
			var count = $(this).prevAll('area').length;
			//var url = $(this).attr('href'); 
			//var coords = $(this).attr('coords').split(','); 
		
			// Your code here 
			//wc(count);
			if(count > 1){
				$(img).css({'background-position': 'left -'+((count-1)*height)+'px'});
			} else {
				$(img).css({'background-position': 'left 0px'});
			}
			// To prevent default action 
		  	return false; 
		})
		.mouseout(function() { 
			
			$(img).css({'background-position': 'left 0px'});
			
		  	return false; 
		})
	}
	
});

$(document).ready(function()
{
	/* 
		open a link in a new
		window
	*/
	$('a._blank').click(function()
	{
		window.open(this.href);
		
		return false;
	});
		
	/* 	
		image cycler
	*/
	$("#pictures").cycle({random: 1, speed: 300});

	/* 	
		image cycler
	*/
	$(".clients").cycle({random: 1, before: onBefore, timeout: 10000 });
	
	function onBefore()
	{
		var height = $(this).height() + 20;
		
		$(this).parent().animate({'height' : height }, 'fast');
	}

	/* 	
		prepare and act slider
	
	var active_modules = null;
	
	var animation_in_progress = false;
	
	var callback_animation_complete = function() {
		
		animation_in_progress = false;						
	}
	
	var offset_left_px = '-250px';
	
	$("#prepare-slider, #act-slider").hover(
	
	  	function()
	  	{
			active_modules = $(this).children('.modules');
			
			active_modules.addClass("selected");
			
			active_modules.animate(
				
				{ left: offset_left_px, width: '500px' },
				
				{ duration: 'normal', complete: callback_animation_complete }
				
			);
			
			active_modules.children('.information').show('slow');
							
			active_modules.is_open = true;
		
	  		return false;
	  			  	
	  	},
	  	
	  	function()
	  	{
			active_modules.stop(true, true);
			
			active_modules.removeClass("selected");
			
			animation_in_progress = true;
			
			active_modules.children('.information').hide('slow');
			
			active_modules.animate(
				
				{ left: '240px', width: '30px' },
				
				{ duration: 'slow', complete: callback_animation_complete }
				
			);

			active_modules.is_open = false;
			
			active_modules = null;
		
	  		return false;
	  	}
	);
	*/
	
	/* 
		SALVAGE RESERVATION FORMS
	
	$('p.register').show();
	
	$('form.hide-form').hide();
	
	$('p.register a').click(
		
		function()
		{
			$(this).parent().hide();
			
			$('form.register-for-course', $(this).parent().parent()).show();
			
			return false;
		}
		
	);
	*/
	
	
	/*
	| -------------------------------------------------------------------
	| begin slider
	| -------------------------------------------------------------------
	*/
	
	var photocontainer_height = 0;
	
	$("#photoslider div.photocontainer img").each(
	
		function()
		{
			photocontainer_height += $(this).height() ; // + 1 px border
		}
	);
	
	 
	
	$("#photoslider div.photocontainer").height(photocontainer_height);
	
	function slide_images() { 
		
				
		$("#photoslider div.photocontainer").animate(
			
			{
				top: -1 * (photocontainer_height / 2)
								
			},
			
			//24000,
			//68000,
			48000,
			
			'linear',
			
			function()
			{				
				$(this).css('top', '0px');
				
				slide_images();
			}
		);	
	}
	
	slide_images();
		
	
});

