﻿$(document).ready(function() {

// latest news accordion.. 
$('.small-red dd').hide()
$('.small-red dt').bind('click', function() {
    $(this).siblings().removeClass('view')
    $(this).next().addClass('view')
    $(this).siblings().css("background-color", "#e0c8d1");
    $(this).siblings().css("color", "#333");
    $(this).css("color", "#fff");
    $(this).css("background-color", "#822247");
    $('.small-red dd:not(.view)').hide('normal');
    $('.small-red dd.view').toggle('normal');
})	

// disable add to basket buttons..
$('.addbasket').attr("disabled", "disabled");

// show add comment box..
$('#addcomment').hide();
$('#comments a.right').click(function() {
    $('#addcomment').toggle('400');
    return false;
});

$("input[name='radio']").change(function(){
    if ($("input[name='radio']:checked").val() == 'site') {
        // if site is checked
        $("#cx input").val('010437246197033806203:fcjr6pzpnby');
        $("#cx input").attr('name', 'cx');
    } else { 
        if ($("input[name='radio']:checked").val() == 'directory') {
            // if coins or medals is checked
            $("#cx input").val('');
            $("#cx input").attr('name', '');
        }
    }
});



// show cvv help image..
$('#cvvhelp').hide();
$('#showcvv').click(function() {
    $('#cvvhelp').toggle('400');
    return false;
});

// show add address form..
$('#newaddressform').hide();
$('#addnewaddress').click(function() {
    $('#newaddressform').toggle('400');
    return false;
});

// archives collapsable list..
$(function(){
    $('#archive li:has(ul)').click(function(event){
        if (this == event.target) {
            if ($(this).children().is(':hidden')) { $(this).children().show();} else { $(this).children('ul').hide(); }
        }
    })
    .css('cursor', 'pointer').click();
	$('#archive li:has(ul) em').css('cursor','default')
    $('li:not(:has(ul))').css({
        cursor: 'default'
    });
});
});