/*
Cufon.replace('h1', {
color: '#2e2e2e'
});
*/
//NEWS SLIDER

//NUMBER OF NEWS!!!
var newsNO = 0;
var the_height = 0;
var shownNewsNo = 1;
var the_height = 0;
var toppos = 0;

  $(document).ready(function() {

  	// set news height to whole class news_block	
    newsNO = $(".news_block").length;
		
	goo();
	
	// cleaning up html
	
	$('#link3').click(function(){
		$('#img2').hide	();
		$('#img3').show();
		intValue=window.clearTimeout(intValue);
		intValue = window.setTimeout(function(){ 
			slide1();
		}, 12500);
		return false;
	});
	
	$('#link2').click(function(){
		$('#img2').show();
		$('#img3').hide();
		intValue=window.clearTimeout(intValue);
		intValue = window.setTimeout(function(){
			slide3(); 
		}, 12500);
		return false;
	});
	
	$('#link1').click(function(){
		$('#img2').hide();
		$('#img3').hide();
		intValue=window.clearTimeout(intValue);
		intValue = window.setTimeout(function(){
			slide2();
		}, 12500);
		return false;
	});
	
	/*
	$('#x2').click(function(){
		$('#overlay').hide();
		$('#img2').hide(); 
		$('#img3').hide();
		intValue=window.clearTimeout(intValue); 
		intValue = window.setTimeout(function() { slide2(); }, 1500);
		$('#iframe').attr('src', '/blank.html');
	});
	$('.view_portfolio_btn').click(function(){
		$('#overlay').show(); 
        intValue=window.clearTimeout(intValue);
        $('#iframe').attr('src', '/flashM4forIframe.html');
	})
	*/
	
	
  }); // end of document.ready

function get_height(a) {
the_height = document.getElementById('news1') != null ? document.getElementById('news1').offsetHeight : 100;
//alert(the_height);
news_move();
}

var slid = 0;

function news_move() {
	shownNewsNo += 1;
	
	toppos -= the_height;
	if (shownNewsNo > newsNO) { toppos=0; shownNewsNo=1; }
		 
	$("#slider").animate({ top:toppos+"px" }, 1000, function() { goo(); });
		 
}  

function goo() {
	window.setTimeout(function() {	get_height(shownNewsNo); }, 2500);
}

// slideshow

window.onload = function() { slide2(); }

var slide = 1;
var intValue = 0;

function slide2() {
	intValue = window.setTimeout(function() {
	slide = 2;
     $('#img2').fadeIn("slow");
		slide3();
	}, 2500);
}

function slide3() {
	intValue = window.setTimeout(function() {
	slide = 3;
     $('#img3').fadeIn("slow");
		slide1();
	}, 2500);
}
function slide1() {
	intValue = window.setTimeout(function() {
	slide = 1;
	$('#img2').hide();
	$('#img3').fadeOut("slow");
		slide2();
	}, 2500);
}

