// JavaScript Document

// Slide Panel Jquery

var $j = jQuery.noConflict();

$j(document).ready(function(){

	$j(".btn_slide").click(function(){
		$j("#panel").slideToggle("slow");
		$j(this).toggleClass("active_panel"); return false;
	});
	
	 
});
/* //Slide Panel Jquery */


/* Slider Apple Style */

$j(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */
	
	var totWidth=0;
	var positions = new Array();
	
	$j('#slides .slide').each(function(i){
		
		/* Traverse through all the slides and store their accumulative widths in totWidth */
		
		positions[i]= totWidth;
		totWidth += $j(this).width();
		
		/* The positions array contains each slide's commulutative offset from the left part of the container */
		
		if(!$j(this).width())
		{
			alert("Please, fill in width & height for all your images!");
			return false;
		}
		
	});
	
	$j('#slides').width(totWidth);

	/* Change the cotnainer div's width to the exact width of all the slides combined */

	$j('#menu ul li a').click(function(e,keepScroll){

			/* On a thumbnail click */

			$j('li.menuItem').removeClass('act').addClass('inact');
			$j(this).parent().addClass('act');
			
			var pos = $j(this).parent().prevAll('.menuItem').length;
			
			$j('#slides').stop().animate({marginLeft:-positions[pos]+'px'},450);
			/* Start the sliding animation */
			
			e.preventDefault();
			/* Prevent the default action of the link */
			
			
			// Stopping the auto-advance if an icon has been clicked:
			if(!keepScroll) clearInterval(itvl);
	});
	
	$j('#menu ul li.menuItem:first').addClass('act').siblings().addClass('inact');
	/* On page load, mark the first thumbnail as active */
	
	
	
	/*****
	 *
	 *	Enabling auto-advance.
	 *
	 ****/
	 
	var current=1;
	function autoAdvance()
	{
		if(current==-1) return false;
		
		$j('#menu ul li a').eq(current%$j('#menu ul li a').length).trigger('click',[true]);	// [true] will be passed as the keepScroll parameter of the click function on line 28
		current++;
	}

	// The number of seconds that the slider will auto-advance in:
	
	var changeEvery = 10;

	var itvl = setInterval(function(){autoAdvance()},changeEvery*1000);

	/* End of customizations */
});


/* //Slider apple style */

/* Cloud Carousel */
/*
$j(document).ready(function(){
						   
	// This initialises carousels on the container elements specified, in this case, carousel1.
	$j("#carousel1").CloudCarousel(		
		{			
			xPos: 270,
			yPos: 16,
			minScale: 0.5,
			buttonLeft: $("#left-but"),
			buttonRight: $("#right-but"),
			altBox: $("#alt-text"),
			titleBox: $("#title-text")
		}
	);
});

*/

/* //Cloud Carousel */

/* Newsticker */

$j(document).ready(
	function()
	{
		$j("#news").newsTicker();
	}
);

/* //Newsticker */

/*  SWF CLOCK */

var flashvars = {};
var params = {wmode:"transparent"};
var attributes = {};

swfobject.embedSWF("swf/clock.swf", "swf_clock", "220", "130", "9.0.0", "expressInstall.swf", flashvars, params, attributes);


/*  //SWF CLOCK */


/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/


/* Download Now Tooltips */

$j(document).ready(function()
{
	$j(".download_now").tooltip({ effect: 'slide'});
});


/* //Download Now Tooltips */

/* SCROLL */
$j(function() {		
		
	// initialize scrollable with mousewheel support
	$j(".scrollable").scrollable({ vertical: true, mousewheel: true });	
	
});
/* //SCROLL */




$j(document).ready(function() {	

	//Show Banner
	$j(".main_image .desc").show(); //Show Banner
	$j(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$j(".image_thumb ul li:first").addClass('active'); 
	$j(".image_thumb ul li").click(function(){ 
		//Set Variables
		var imgAlt = $j(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $j(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $j(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $j(".main_image").find('.block').height();	//Calculate height of block	
		
		if ($j(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			$j(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$j(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$j(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			});
		}
		
		$j(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$j(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$j(this).addClass('hover');
		}, function() {
		$j(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$j("a.collapse").click(function(){
		$j(".main_image .block").slideToggle();
		$j("a.collapse").toggleClass("show");
	});
	
});//Close Function
