$(document).ready(function() {

$("#slider_div").animate({"top": "-=5000px"}, "slow");

function switch_news(param1,param2) 
{
	$("#news_text_div"+param1).fadeOut("slow",function()
	{
		$(".news_text_div").hide();
		$("#news_text_div"+param2).fadeIn("slow");
	});
}


var second = false;
var current = 1;
var total = 5;
var nextdiv = 0;

$.timer(3000, function (timer) 
{
	nextdiv = current + 1;
	if(nextdiv > total)
	{
		nextdiv = 1;
	}

	
	switch_news(current,nextdiv);
	current = nextdiv;


	if (!second) 
	{
		second = true;
		timer.reset(4000);
	}
	else 
	{
		second = false;
	}

});



$("#news_btn_right").click(function()
{
		$(".news_text_div").hide();
	nextdiv = current + 1;
	if(nextdiv > total)
	{
		nextdiv = 1;
	}
	$("#news_text_div"+nextdiv).fadeIn("slow");
	current = nextdiv;
});

$("#news_btn_left").click(function()
{
		$(".news_text_div").hide();
	nextdiv = current - 1;
	if(nextdiv < 1)
	{
		nextdiv = total;
	}
	$("#news_text_div"+nextdiv).fadeIn("slow");
	current = nextdiv;
});




	$("#trust_tab").attr("src","img/trust_tab_m.gif");


   $("#service_tab").hover(function() {

   	   $("#service_tab").attr("src","img/service_tab_m.gif");
   	   $("#price_tab").attr("src","img/price_tab.jpg");
   	   $("#quality_tab").attr("src","img/quality_tab.jpg");
   	   $("#trust_tab").attr("src","img/trust_tab.jpg");

	   $("#hp_content_service").show();
	   $("#hp_content_price").hide();
	   $("#hp_content_quality").hide();
	   $("#hp_content_trust").hide();
   },function () {});

   $("#price_tab").hover(function() {

   	   $("#service_tab").attr("src","img/service_tab.jpg");
   	   $("#price_tab").attr("src","img/price_tab_m.gif");
   	   $("#quality_tab").attr("src","img/quality_tab.jpg");
   	   $("#trust_tab").attr("src","img/trust_tab.jpg");

	   $("#hp_content_service").hide();
	   $("#hp_content_price").show();
	   $("#hp_content_quality").hide();
	   $("#hp_content_trust").hide();
   },function () {});

   $("#quality_tab").hover(function() {

   	   $("#service_tab").attr("src","img/service_tab.jpg");
   	   $("#price_tab").attr("src","img/price_tab.jpg");
   	   $("#quality_tab").attr("src","img/quality_tab_m.gif");
   	   $("#trust_tab").attr("src","img/trust_tab.jpg");
   	   
	   $("#hp_content_service").hide();
	   $("#hp_content_price").hide();
	   $("#hp_content_quality").show();
	   $("#hp_content_trust").hide();
   },function () {});

   $("#trust_tab").hover(function() {

   	   $("#service_tab").attr("src","img/service_tab.jpg");
   	   $("#price_tab").attr("src","img/price_tab.jpg");
   	   $("#quality_tab").attr("src","img/quality_tab.jpg");
   	   $("#trust_tab").attr("src","img/trust_tab_m.gif");
	   
	   $("#hp_content_service").hide();
	   $("#hp_content_price").hide();
	   $("#hp_content_quality").hide();
	   $("#hp_content_trust").show();
   },function () {});

 });
