$(document).ready(function() {
    // homepage stuff

    $("ul#slideshow").cycle({
        timeout: 10000,
        speed: 400,
        //after: onAfter,
        pager: "#slideshow_nav",
        pagerAnchorBuilder: function(idx, slide) {
            return '<a href="#">' + $(slide).children("div.link_text").html() + '</a>';
        }
    });

    // pause the slideshow when a thumbnail is clicked
    $("#slideshow_nav a").click(function() {
        $("ul#slideshow").cycle('pause');
        //$('#textshow').cycle('pause');
    });

    // zebra-stripe tables that dont already have those class names on their <tr> tags
    $("#specChart tr:even").each(function() {
        $(this).addClass("even");
    });
    $("#specChart tr:odd").each(function() {
        $(this).addClass("odd");
    });
});

/*************************************
 ** Auto clear search box 
 *************************************/
function clearText(thefield){ if (thefield.defaultValue==thefield.value) thefield.value = "" }

/*************************************
/* home page  manage Wells Advantage 
 *************************************/
$(document).ready(function() {
    $("div#spotlight div a").click(function() {
        var id = $(this).attr("id");
        id = id.replace("BOX", "");

        $(".filmstrip_detail").each(function() {
            $(this).css("display", "none");
        });

        if(!jQuery.browser.msie) {
            $("#DETAIL"+id).fadeIn(500, function() {    // the following CSS rule is a hack to fix a rendering problem on iPads
                $("#DETAIL"+id).css("position", "relative").css("left", 0).css("top", 0);
            });
        }
        else { $("#DETAIL"+id).css("display", "block"); }

    });
});
/*************************************
/* All pages to add curves to the upper right and lower right corners of the content 
 *************************************/
$('.curve').cornerz({ radius:20, background: "black",   corners: "tr", borderWidth: "4", borderColor: "#CACACA" })   
$('.curve').cornerz({ radius:20, background: "#092B46", corners: "br", borderWidth: "4", borderColor: "#CACACA" })

// curve tabs' top right corners. cornerz didn't work because cornerz runs before jQuery finishes generating the tabs
if(!jQuery.browser.msie) {
    $("#overall #content #tophalf .L2col0 .ui-tabs .ui-tabs-nav li").corner("tr 6px");
    $("#overall #content #tophalf .L2col0 .ui-tabs .ui-tabs-nav li a").corner("tr 4px");
}

/*************************************
 ** home page swap news and most popular newsbits 
 *************************************/

  $(document).ready(function() {
    $("#NEWSBOX1").click(function() {
      $("#itemlist").css("display","block");
      $("#popitemlist").css("display","none");
      $("#AA").attr("src", "/images/tab1-selected.jpg");
      $("#AB").attr("src", "/images/tab2-normal.jpg");
    });
  });
  $(document).ready(function() {
    $("#NEWSBOX2").click(function() {
      $("#itemlist").css("display","none");
      $("#popitemlist").css("display","block");
      $("#AA").attr("src", "/images/tab1-normal.jpg");
      $("#AB").attr("src", "/images/tab2-selected.jpg");
    });
  });

