$(document).ready(function()
{
    $("#slider_left").attr("style","visibility:hidden;");
	$("#slider_holder").width($("#slider_holder").children().size() * 550);
    $("#slider_right").click(function()
    {
        MoveQuestionsNext();
    });
    $("#slider_left").click(function()
    {
        MoveQuestionsBack();
    });
	$("#t_one").click(function()
    {
        t_one();
    });
	$("#t_two").click(function()
    {
        t_two();
    });
	$("#t_three").click(function()
    {
        t_three();
    });
	$("#t_four").click(function()
    {
        t_four();
    });
	$("#t_five").click(function()
    {
        t_five();
    });
	$("#tBtn4").click(function()
    {
        tBtn4();
    });
	$("#get-in-touch").click(function()
    {
        tBtn4();
    });
	$("#shout").click(function()
    {
        tBtn4();
    });
	$("#backtotop").click(function()
    {
        backtotop();
    });
});

function tBtn4()
{  
	$('html, body').animate({
    scrollTop: $("#footer-wrap").offset().top
	}, 1000);
}
function backtotop()
{  
	$('html, body').animate({
    scrollTop: $("#header-wrap").offset().top
	}, 1000);
}

// move questions div functions
function MoveQuestionsNext()
{       
        
    // get current position and substract width of a question
    var newpos = $("#slider_holder").position().left - 550;
    // to prevent questions from half moving if people click to fast remove remainder
    if ((newpos % 550) != 0)
    {
        newpos = newpos - (newpos % 550);
    }
	if ((newpos) <= ($("#slider_holder").width() - 550) * (-1))
    {
        $("#slider_right").attr("style","visibility:hidden;");
    }
    $("#slider_holder").animate({"left": newpos}, "slow");
    $("#slider_left").attr("style","visibility:visible;");
}
function MoveQuestionsBack()
{    
    
    // get current position and add width of a question
    var newpos = $("#slider_holder").position().left + 550;
    // to prevent questions from half moving if people click to fast remove remainder
    if ((newpos % 550) != 0)
    {
        newpos = newpos - (newpos % 550);
    }
    // stop questions moving if reached beginning
    if (newpos >= 0)
    {
        newpos = 0;
        $("#slider_left").attr("style","visibility:hidden;");
    }
    $("#slider_holder").animate({"left": newpos}, "slow");
    $("#slider_right").attr("style","visibility:visible;");
}

function t_one()
{  
	var newpos = 0; 
	$("#slider_left").attr("style","visibility:hidden;");
	$("#slider_holder").animate({"left": newpos}, "slow");
    $("#slider_right").attr("style","visibility:visible;");
}
function t_two()
{  
	var newpos = -550; 
	$("#slider_holder").animate({"left": newpos}, "slow");
	$("#slider_left").attr("style","visibility:visible;");
	$("#slider_right").attr("style","visibility:visible;");
}
function t_three()
{  
	var newpos = -1100; 
	$("#slider_holder").animate({"left": newpos}, "slow");
	$("#slider_left").attr("style","visibility:visible;");
	$("#slider_right").attr("style","visibility:visible;");
}
function t_four()
{  
	var newpos = -1650; 
	$("#slider_holder").animate({"left": newpos}, "slow");
	$("#slider_left").attr("style","visibility:visible;");
	$("#slider_right").attr("style","visibility:visible;");
}
function t_five()
{  
	var newpos = -2200; 
	$("#slider_holder").animate({"left": newpos}, "slow");
	$("#slider_left").attr("style","visibility:visible;");
	$("#slider_right").attr("style","visibility:visible;");
}
