/**
	Slide Effekt for Siteman as
	Author: Alireza Balouch
	Last update: 04.09.2009 by Alireza Balouch @ siteman as

**/
var g_intAutoSlideshowTimer = 4000;
var g_blnDoAutoSlideshow = true;
var macImgwidth = 328 ;
var bildeLitenWidth = 182;
var bildeStorHeight = 146 ;
var prCount = 1;
var prMax = 4;
var blnReady = true;
var intI = 0;
var intLs = 0;
var intLd = 0;
var animTid1 = 1200; // bare for iMac bilder


$(document).ready(function(){

	// preset
	$('#sllogo ul').css({top:0});
	$('#sldetail ul').css({left:0});
	$('#mac ul').css({left:0});
	$('#sltxt div:not(#p1)').hide();
	$('#sltxt div:last').show();
	$('#sltxt #p1').show();

	//-- click action
	$('#nextpj a').click(function (){
		Slide(false);
	});

	setTimeout("AutoSlide();",g_intAutoSlideshowTimer);

});

function AutoSlide(){
	if(g_blnDoAutoSlideshow) {
		Slide(true);
		setTimeout("AutoSlide();",g_intAutoSlideshowTimer);
	}
}

/** Slidefunksjon **/

function Slide(blnDoAutoSlideshow){
		if(blnReady){
			g_blnDoAutoSlideshow = blnDoAutoSlideshow;

			blnReady = false;

			if (prCount > prMax){prCount = 0;}
			intI = prCount * macImgwidth * - 1 ;
			intLs = prCount * bildeStorHeight * - 1;
			intLd = prCount * bildeLitenWidth * - 1;
			prCount++;

			// slider bildet i iMac
			$('#mac ul').animate({left: intI },animTid1 ,function(){
				blnReady = true;
			});


		    $('#sllogo ul').animate(
				    			{top: (intLs )},
				    			 { 	duration: animTid1,
				    			 	easing: 'easeOutBack'
				    			}
			    			);


		    $('#sldetail ul').animate({left: (intLd )},
			    						{ 	duration: animTid1,
					    			 	easing: 'easeOutBack'
					    				}
			    					);


			$('#sltxt div:not(#nextpj)' ).fadeOut(300, function(){

			});

			$('#sltxt #p' + (prCount) ).fadeIn(800);


		}
		return false;

}