function slideshow()
{
    var $active = $('#slideshow IMG.active');
    if($active.length==0)
    {
        $active = $('#slideshow IMG:last');
    }
    var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0},700,function() {$active.removeClass('active last-active');});
}
function side_slideshow()
{
    var $active = $('#side_slideshow div a.active');
    if($active.length==0)
    {
        $active = $('#side_slideshow div a:last');
    }
    var $next = $active.next().length ? $active.next() : $('#side_slideshow div a:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0},700,function() {$active.removeClass('active last-active');});
}
function getElementsByClassName(classname)
{
    var anchs =  document.getElementsByTagName("div");
    var total_anchs = anchs.length;
    var regexp = new RegExp('\\b' + classname + '\\b');
    var class_items = new Array()
    for(var i=0;i<total_anchs;i++)
    {
        var this_item = anchs[i];
        if(regexp.test(this_item.className))
        {
            class_items.push(this_item);
        }
    }
    return class_items;
}
function changeImg(value,block,colour)
{
    var image = document.getElementById("maintshirtimg");
    image.src = value;
    var divs = getElementsByClassName('tshirtcoloursdiv');
    for(var i=0;i<divs.length;i++)
    {
        divs[i].style.border = '1px solid #888';
    }
    block.parentNode.style.border = '1px solid #F37422';
    document.getElementById("basketColour").value = colour;
}
function changeImg2(value)
{
    var image = document.getElementById("maintshirtimg");
    image.src = value;
}
function validateAdd()
{
    var colour = document.getElementById("basketColour");
    if(colour.value=="")
    {
        alert("You must select a colour")
        return false;
    }
    else
    {
        return true;
    }
}
