/* jCarouselLite http://www.gmarwaha.com/jquery/jcarousellite/#what */
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);




// Controleren of de huidige status van de mouseover hover is :
// If so , dan de mouseover event afvuren , zodat indien de header
// niet bij het geselecteerde element past deze alsnog wordt gerefreshed
function checkMouseOverStatusses() {
	if ($('#one').hasClass("hover")) { 
		$("#one").trigger("mouseover");
	}
	
	else {
	
		if  ($('#three').hasClass("hover")) { 
			$("#three").trigger("mouseover");
		}	
		
		else {
			if  ($('#two').hasClass("hover")) { 
				$("#two").trigger("mouseover");
			}	
		}		
	
	}	
	

	
	//idName = this.id;
	//if (idName == "one") { trueID = 1; } else
	//if (idName == "two") { trueID = 2; } else { trueID = 3; }
	
}



function rollReferences(){
	$('#nextreferences').trigger("click"); 
}	


$(document).ready(function(){   
	
	
	
	$("#jCarouselLite").jCarouselLite({
	    btnNext: "#nextreferences",
	    btnPrev: "#prevreferences",
	    vertical: true,
		visible: 3
	});
	
	referencesInterval = window.setInterval("rollReferences();", 2400);

	$('#nextreferences').mousedown(function(){
		clearInterval(referencesInterval);
	});
	
	$('#prevreferences').mousedown(function(){
		clearInterval(referencesInterval);
	});

	
	// Continu de statussen van de headers en de geselecteerde blokken controleren (om de 3 seconden)
	// zodat het nooit kan voorkomen dat de getoonde header niet overeenkomt met het geselecteerde blok.
	setInterval ( "checkMouseOverStatusses()", 3000 );

	

//	$("div.slider-link").mouseout(function(event){
//		$("div.slider-link").trigger("mouseover"); 
//	});


	// Set up the Slider
	var sliderid = 1;
	var animation_active = false;
	var totalSlides = 3;
	
	// This initially hides all of the slides except the first one
	for (tempSlideNum=2;tempSlideNum<=totalSlides;tempSlideNum=tempSlideNum+1) 
	{
		$("#slider-"+tempSlideNum).hide();
		$("#slider-"+tempSlideNum).find('.title').hide();
		$("#slider-"+tempSlideNum).find('.text').hide();
		$("#slider-"+tempSlideNum).find('.img').hide();
	}

		
	// Set up the slider functionality
	$("div.slider-link").mouseover(function(event){
		
		idName = this.id;
		if (idName == "one") { trueID = 1; } else
		if (idName == "two") { trueID = 2; } else { trueID = 3; }
		
		//if (trueID != sliderid ) {				
		if (trueID != sliderid && animation_active == false) {
			
			animation_active = true;
			
			if (sliderid == 1) { oldidName = "one"; } else
			if (sliderid == 2) { oldidName = "two"; } else { oldidName = "three"; }
			
			$("ul.slider-links").find('li#'+oldidName).removeClass("active");
			newsliderid = trueID;
			$("ul.slider-links").find('li#'+idName).addClass("active");
																	
			$("#slider-"+sliderid).find('.img').animate({left:'-1300px'},{duration:1800, easing:'easeInQuint'});
			$("#slider-"+sliderid).find('.text').animate({left:'-1300px'},{duration:1225, easing:'easeInQuint'});
			$("#slider-"+sliderid).find('.title').animate({left:'4000px'},1500, 'easeInQuint', function(){
			animation_active = false;						
	
	
			
				$("#slider-"+sliderid).hide();
				$("#slider-"+sliderid).find('.title').hide();
				$("#slider-"+sliderid).find('.text').hide();
				$("#slider-"+sliderid).find('.img').hide();
				
				// Wait until the above has finished, then do the rest	
				sliderid = newsliderid;
				
				$("#slider-"+sliderid).find('.title').css("left","1200px");
				$("#slider-"+sliderid).find('.text').css("left","1200px");
				$("#slider-"+sliderid).find('.img').css("left","1200px");
				
				$("#slider-"+sliderid).show();
				$("#slider-"+sliderid).find('.title').show(function(){
					/*sIFR.replace(helveticaroman, {
					  selector: 'div.title h2'
					  ,css: [
				        '.sIFR-root { color:#000000; }'
				        ,'a { color:#0497e3; text-decoration:none; }'
				      ]
					  ,transparent: true
					});*/
				});
				$("#slider-"+sliderid).find('.text').show();
				$("#slider-"+sliderid).find('.img').show();
				
				$("#slider-"+sliderid).find('.title').animate({left:'0'},{duration:800, easing:'easeOutExpo'});
				$("#slider-"+sliderid).find('.text').animate({left:'0'},{duration:1225, easing:'easeOutExpo'});
				$("#slider-"+sliderid).find('.img').animate({left:'0'},{duration:900, easing:'easeOutExpo'});
				
				
				
			});
		
		}
		
		else {
			
			//alert('animation running');
		}
		
		$("div.slider-link").each(function(){
			$(this).removeClass('hover');
		});
		$(this).addClass('hover');
		
	});
	
	
	$("div.slider-link").each(function(){
		$(this).click(function(){
			window.location = $(this).attr("title");
		});
	});
	
	/*
	$("div.slide").each(function(){
		$(this).click(function(){
			window.location = $(this).attr("title");
		});
	});*/
	

	/* ****************************************************************************
	It is adviced to place the sIFR JavaScript calls in this file, keeping it
	separate from the `sifr.js` file. That way, you can easily swap the `sifr.js`
	file for a new version, while keeping the configuration.	
	You must load this file *after* loading `sifr.js`.	
	That said, you're of course free to merge the JavaScript files. Just make sure
	the copyright statement in `sifr.js` is kept intact.
	****************************************************************************

	var helvetica = { src: '/telecats/images/helvetica.swf' };
	var helveticaroman = { src: '/telecats/images/helveticaroman.swf' };

	sIFR.activate(helvetica, helveticaroman);

	sIFR.replace(helvetica, {
	  selector: 'div.products h2, div.pagereferences h4'
	  ,css: [
        '.sIFR-root { color:#666666; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ]
	  ,transparent: true
	  ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 17, 1.24, 18, 1.25, 28, 1.23, 34, 1.22, 41, 1.21, 53, 1.2, 57, 1.19, 58, 1.2, 90, 1.19, 92, 1.18, 96, 1.19, 98, 1.18, 100, 1.19, 104, 1.18, 105, 1.19, 1.18]
	});
	
	sIFR.replace(helvetica, {
	  selector: 'div.columns h3'
	  ,css: [
        '.sIFR-root { color:#000000; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ]
	  ,transparent: true
	  ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 17, 1.24, 18, 1.25, 28, 1.23, 34, 1.22, 41, 1.21, 53, 1.2, 57, 1.19, 58, 1.2, 90, 1.19, 92, 1.18, 96, 1.19, 98, 1.18, 100, 1.19, 104, 1.18, 105, 1.19, 1.18]
	});
	
	
	
	sIFR.replace(helveticaroman, {
	  selector: 'BODY.home DIV.slide DIV.title H2'
	  ,css: ['.sIFR-root { color:#000000; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ] ,transparent: true
	  ,ratios: [10, 1.32, 16, 1.27, 23, 1.23, 24, 1.21, 25, 1.22, 31, 1.21, 38, 1.2, 42, 1.19, 43, 1.2, 62, 1.19, 66, 1.18, 67, 1.19, 113, 1.18, 114, 1.17, 119, 1.18, 120, 1.17, 1.18]
	});
	
	sIFR.replace(helveticaroman, {
	  selector: 'BODY.green DIV.slide DIV.title H2'
	  ,css: ['.sIFR-root { color:#ffffff; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ] ,transparent: true
	  ,ratios: [10, 1.32, 16, 1.27, 23, 1.23, 24, 1.21, 25, 1.22, 31, 1.21, 38, 1.2, 42, 1.19, 43, 1.2, 62, 1.19, 66, 1.18, 67, 1.19, 113, 1.18, 114, 1.17, 119, 1.18, 120, 1.17, 1.18]
	});
	
	sIFR.replace(helveticaroman, {
	  selector: 'BODY.turqoise DIV.slide DIV.title H2'
	  ,css: ['.sIFR-root { color:#ffffff; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ] ,transparent: true
	  ,ratios: [10, 1.32, 16, 1.27, 23, 1.23, 24, 1.21, 25, 1.22, 31, 1.21, 38, 1.2, 42, 1.19, 43, 1.2, 62, 1.19, 66, 1.18, 67, 1.19, 113, 1.18, 114, 1.17, 119, 1.18, 120, 1.17, 1.18]
	});
	
	sIFR.replace(helveticaroman, {
	  selector: 'BODY.blue DIV.slide DIV.title H2'
	  ,css: ['.sIFR-root { color:#ffffff; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ] ,transparent: true
	  ,ratios: [10, 1.32, 16, 1.27, 23, 1.23, 24, 1.21, 25, 1.22, 31, 1.21, 38, 1.2, 42, 1.19, 43, 1.2, 62, 1.19, 66, 1.18, 67, 1.19, 113, 1.18, 114, 1.17, 119, 1.18, 120, 1.17, 1.18]
	});
	
	sIFR.replace(helveticaroman, {
	  selector: 'BODY.purple DIV.slide DIV.title H2'
	  ,css: ['.sIFR-root { color:#ffffff; }'
        ,'a { color:#0497e3; text-decoration:none; }'
      ] ,transparent: true
	  ,ratios: [10, 1.32, 16, 1.27, 23, 1.23, 24, 1.21, 25, 1.22, 31, 1.21, 38, 1.2, 42, 1.19, 43, 1.2, 62, 1.19, 66, 1.18, 67, 1.19, 113, 1.18, 114, 1.17, 119, 1.18, 120, 1.17, 1.18]
	});
	
	
	
	

	sIFR.replace(helvetica, {
	  selector: 'div.menu li:not(.current, .section) span'
	  ,css: [
        '.sIFR-root { color:#000000; }'
        ,'a { color:#000000; text-decoration:none; }'
        ,'a:hover { color:#000000; text-decoration:none; }'
      ]
	  ,transparent: true
	  ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 17, 1.24, 18, 1.25, 28, 1.23, 34, 1.22, 41, 1.21, 53, 1.2, 57, 1.19, 58, 1.2, 90, 1.19, 92, 1.18, 96, 1.19, 98, 1.18, 100, 1.19, 104, 1.18, 105, 1.19, 1.18]
	});
	
	sIFR.replace(helvetica, {
	  selector: 'div.menu li.current span, div.menu li.section span'
	  ,css: [
        '.sIFR-root { color:#ffffff; }'
        ,'a { color:#ffffff; text-decoration:none; }'
        ,'a:hover { color:#ffffff; text-decoration:none; }'
      ]
	  ,transparent: true
	  ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 17, 1.24, 18, 1.25, 28, 1.23, 34, 1.22, 41, 1.21, 53, 1.2, 57, 1.19, 58, 1.2, 90, 1.19, 92, 1.18, 96, 1.19, 98, 1.18, 100, 1.19, 104, 1.18, 105, 1.19, 1.18]
	});
	

	
	
	sIFR.replace(helvetica, {
	  selector: 'div.content h1, div.content h4'
	  ,css: [
        '.sIFR-root { color:#000000; }'
        ,'a { color:#000000; text-decoration:none; }'
        ,'a:hover { color:#000000; text-decoration:none; }'
      ]
	  ,transparent: true
	  ,ratios: [6, 1.41, 9, 1.35, 15, 1.29, 17, 1.24, 18, 1.25, 28, 1.23, 34, 1.22, 41, 1.21, 53, 1.2, 57, 1.19, 58, 1.2, 90, 1.19, 92, 1.18, 96, 1.19, 98, 1.18, 100, 1.19, 104, 1.18, 105, 1.19, 1.18]
	});
	 */
	
});



		