// JavaScript Document
$(document).ready(function() {

Cufon.replace('#canvas #header #mainnav ul li a, #canvas #header #tools, #footer,a.download,#subnavigation ul li a', {hover: true, fontFamily: 'Helvetica'});
Cufon.replace('h1, h2, h5', {hover: true, fontFamily: 'Caslon', hover: true,   textShadow: '2px 0px #FFFFFF, 0px 2px #FFFFFF, -2px 0px #FFFFFF, 0px -2px #FFFFFF, 2px 2px #DDDDDD'});
Cufon.replace('h3, h4', {hover: true, fontFamily: 'VAG', hover: true});
Cufon.replace('.homepage #homebanners .banner .bannertitle h1', {hover: true, fontFamily: 'VAG', hover: true, textShadow: '3px 0px #FFFFFF, 0px 3px #FFFFFF, -3px 0px #FFFFFF, 0px -3px #FFFFFF, 5px 3px #DDDDDD'});

$("#footer ul li:last-child").addClass("last");
$("#mainnav ul li:last-child").addClass("last");
$("#tools ul li:last-child").addClass("last");
$(".downloadtable td a").prepend("<div class=\"downloadoverlayer\"></div>");
$("a.download").append("<span></span>");

$("a.link").append("<span></span>");
$("#subnavigation ul li a").append("<span></span>");
$(".faq_list").accordion({ header: '.faq_question', autoHeight: false, active: false, collapsible: true });


	var timeout    = 500;
	var closetimer = 0;
	var ddmenuitem = 0;

$("#calltoaction div.item:last").each(function(){      $(this).addClass("last");});

var i = 1;

$("#calltoaction div.item").each(function(){      
	$(this).addClass("item"+i);
	i++;
});

function languagesel_open()
{  languagesel_canceltimer();
   languagesel_close();
   ddmenuitem = $(this).find('ul').css('display', 'block');

   }

function languagesel_close()
{  if(ddmenuitem) ddmenuitem.css('display', 'none');

}

function languagesel_timer()
{  closetimer = window.setTimeout(languagesel_close, timeout);}

function languagesel_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#languagesel > li').bind('mouseover', languagesel_open)
   $('#languagesel > li').bind('mouseout',  languagesel_timer)});

document.onclick = languagesel_close;

$("#subnavigation ul li a").each(function(){   
if ($(this).height() > 30){  
$(this).addClass("big");
}

 });
 
$(".ngg-gallery-thumbnail a").hover(
function() {
$(this).children(".post_image_overlayer").stop().animate({"opacity": "0.9"}, "10");

},
function() {
$(this).children(".post_image_overlayer").stop().animate({"opacity": "0"}, "10");

});

$(".downloadtable a").hover(
function() {
$(this).children(".downloadoverlayer").stop().animate({"opacity": "0.9"}, "10");

},
function() {
$(this).children(".downloadoverlayer").stop().animate({"opacity": "0"}, "10");

});


$(".post_image_overlayer").stop().animate({"opacity": "0"}, "10");
$(".downloadoverlayer").stop().animate({"opacity": "0"}, "10");


  // set up the options to be used for jqDock...
  var dockOptions =
    { align: 'middle' // horizontal menu, with expansion UP/DOWN from the middle
    , size: 120  // set the maximum minor axis (horizontal) image dimension to 36px
    };
  // ...and apply...
  $('#product_slider_content').jqDock(dockOptions);

  // NOTE : the z-indexing used in this example's css and script will not have the
  // desired effect in IE below version 8; you'd have to use a jquery $().hover()
  var itemCount = $('#product_slider_content_home').children().length
      // set up the options to be used for jqDock...
    , dockOptions =
      { align: 'top' // horizontal menu, with expansion DOWN from a fixed TOP edge
      , size: 60 //increase 'at rest' size to 60px
      , labels: 'mc' //set labels to middle-center
        //I'm using setLabel to append my jigsaw pieces. I could use onReady but
        //the setLabel is slightly more convenient because of the parameters
        //passed to it...
      , setLabel: function(t, i, el){  //NB : el is div.jqDockLabel
          //split t on bar...
          var s = t.split('|');
          //the jigsaw image is appended directly onto the anchor...
          $('<img class="jigsaw" src="' + s[1] + '" alt="" />')
            .css({zIndex:itemCount - i})
            .appendTo($(el).parent().css({zIndex:2 * (itemCount - i)}));
          //label is first part of t (before the bar)...
          return s[0];
        }
      };
  // ...and apply...
  $('#product_slider_content_home').jqDock(dockOptions);
 
 $('.postthumb').corner({
			  tl: { radius: 5 },
			  tr: { radius: 5 },
			  bl: { radius: 5 },
			  br: { radius: 5 }}); 

 $('.ngg-gallery-thumbnail .puppyimg').corner({
			  tl: { radius: 5 },
			  tr: { radius: 5 },
			  bl: { radius: 5 },
			  br: { radius: 5 }});  
  
});





