var RecaptchaOptions = {
   theme : 'clean'
};

// Measure the dimensions of all images in the current jQuery array of elements:
// Optional: Specify deep=true to also measure dimensions of all images within the array of elements.
// Required: Provide a callback to receive the measurements. (This is necessary because images are loaded asynchronously)
// The callback will be triggered for every IMG in the jQuery array that has a "src" attribute.
// The callback is passed 2 params:
// - The first param is an object of {width,height,fileSize}.
// - The second param is the temporary IMG element that was used for measuring. (It gets destroyed after callback)
// Inside the callback you can use "this" to refer to the IMG element that was in the original jQuery array. 
// Note that fileSize can only be measured in IE. This value will be 0 in browsers that doe not support IMG.fileSize.
jQuery.fn.imgSize = function(deep,callback){

 callback = callback || deep;
 var $images = this.filter("IMG[src]");
 if(deep) $images.add( this.find("IMG[src]") );

 $images.each(function(){

  var origImg = this;
  var url = $(origImg).attr("src");

  $("<img>").load(function(){
   var $dummy = $(this), size = { width:$dummy.width(), height:$dummy.height(), fileSize:0 };
   try{ size.fileSize = parseInt($dummy.attr("fileSize")) || 0 }catch(e){};
   jQuery.isFunction(callback) && callback.apply( origImg, [size,this] );
   $dummy.remove();
  })
  // To be on the safe side, apply inline styles to prevent any css styles affecting our measurements:
  // (We use a try-catch workaround for IE7 because it raises errors when we try to set maxWidth/maxHeight)
  .css({ display:"none", width:"auto", height:"auto", minWidth:"auto", minHeight:"auto" })
  .each(function(){ try{ $(this).css({ maxWidth:"auto", maxHeight:"auto" }) }catch(e){}; })
  .addClass("imgSize-temp-img")
  .appendTo(document.body)    // The width/height would be zero if img is not added to DOM.
  .attr({ src:url });

 });

 return this;
}


function tipShow() {

	 var hoverText = $(this).attr("tiptitle");
         var offset = $(this).offset();
         vertSpot = offset.top + $(this).height() + 6;
	 var widthoffset = $(this).width() / 2
                horizSpot = offset.left + (widthoffset / 2);

          if (hoverText){
                $("div.tip").css("top", vertSpot);
                $("div.tip").css("left", horizSpot);
                var hoverText = hoverText + "<div style=\"clear:left\"></div>";

          $("div#tipcontent").html(hoverText);
          $("div.tip").css({ opacity: 0.95 });
          $("div.tip").slideDown("fast");
	  	  viewportheight = $(window).height();
	  distancetobot = offset.top - $(window).scrollTop();
        currentdtb = viewportheight - distancetobot
	  if (currentdtb < 250){

	  $.scrollTo("+=250px", 800);
	  }

          }
	}

        function tipHide() {

	  $("div.tip").hide();
	}

	 var config3 = {
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
     interval: 200, // number = milliseconds for onMouseOver polling interval
     over: tipShow,
     timeout: 0, // number = milliseconds delay before onMouseOut
     out: tipHide
};




$(document).ready(function(){

$('#multiimage li img').click(function(){
$("#multiimage li").removeClass("active");
$(this).parent("li").addClass("active");
			$("#prodimages img").attr("src", $(this).attr("src").replace("frame-", ""));
$("#prodimages img").imgSize(function(size){
$("#prodimages img").css("height", size.height + "px ");
});
		});		


   $("a#cartlink").hover(function () {
      var coffset = $(this).offset();
         cvertSpot = coffset.top + $(this).height();
	 var cwidthoffset = $(this).width();
                chorizSpot = (coffset.left + cwidthoffset) - 300;
      $("#cartfloat").slideDown("fast");
       $("div#cartfloat").css("top", cvertSpot);
                $("div#cartfloat").css("left", chorizSpot);

   });
   $("#cardtype").change(function(){
   var cardtypevalue = $("#cardtype").val();
   if (cardtypevalue == "American Express"){
      $("#cardmessage").html("Kaivac happily accepts American Express cards for payment. However, due to processing charges, an extra 2% will be added on to your total.");
      $("#cardmessage").slideDown();
   }else{$("#cardmessage").slideUp();$("#cardmessage").html("");}

   });

    $("#cartfloat").hover('', function () {

       $("#cartfloat").slideUp("fast");

    });

          $("a#cvvhelp").fancybox({
              'frameWidth':  800,
              'frameHeight': 600


   });

	$("a.nlsignuplink").fancybox({
		'frameWidth':   700,
		'frameHeight':  500,
		'overlayShow': false,
		'hideOnContentClick' : false
		});


	$("a.iframe").fancybox({
		'frameWidth':   800,
		'frameHeight':  500,
		'overlayShow': false,
		'hideOnContentClick' : false
		});

	$("ul.relvidlist a").fancybox({
		'frameWidth':   420,
		'frameHeight':  250,
		'overlayShow': false
		});

$(".searchbox").ready(function(){
var orgSearchDesc = $(".searchbox").val();
	$(".searchbox").focus(function(){
            $(".searchbox").val("");
        });
        $(".searchbox").blur(function(){
            var currentSearchValue = $(".searchbox").val();
            if (currentSearchValue == ""){
            $(".searchbox").val(orgSearchDesc);
            }
        });
});



        $(".newslink").click(function () {
        $(this).parent().next('.newscont').toggle("fast");
	if ($(this).html().match("Hide")){$(this).html("View Full Story &raquo;");}else{
	    $(this).html("Hide Full Story &uarr;");
	}
	return false;
	});
	        $(".nextbuttona").click(function () {
        $(this).parent().prev().toggle("fast");
	if ($(this).html().match("Hide")){$(this).html("View Full Details &raquo;");}else{
	    $(this).html("Hide Details &uarr;");
	}
	return false;
	});

	 $(".catlist img").reflect({height:0.33,opacity:0.2});


	 $(function () {
    var tabContainers = $('#tabcontent div');

    $('div#tabs a').click(function () {
        tabContainers.hide().filter(this.hash).show();

        $('div#tabs li').removeClass('selected');
        $(this).parent().addClass('selected');

        return false;
    }).filter(':first').click();

});

	// $("ul.relvidlist li a").hover(function (){
	//	$("#viddesc").html(this.title);

	// });

 $('ul.navmenu').superfish({
	 speed:       'fast',
	 autoArrows:  false,
	 dropShadows: false

 });


 $(".helper").hoverIntent(config3);

 var atag, sTitle;
	var anchors = document.getElementsByTagName ("a");

	for (var i = 0; i < anchors.length; i ++) {
		atag = anchors[i];
		sTitle = atag.getAttribute("title");
		if(sTitle) {
			atag.setAttribute("tiptitle", sTitle);
			atag.removeAttribute("title");
                }
        }

});


function dupaddress(){
var addcheck=document.checkout.billsame.checked;
if (addcheck){
document.checkout.billname.value = document.checkout.shipname.value;
document.checkout.billaddress.value = document.checkout.shipaddress.value;
document.checkout.billaddress2.value = document.checkout.shipaddress2.value;
document.checkout.billcity.value = document.checkout.shipcity.value;
document.checkout.billstate.value = document.checkout.shipstate.value;
document.checkout.billzip.value = document.checkout.shipzip.value;
document.checkout.billcountry.value = document.checkout.shipcountry.value;
}else{
document.checkout.billname.value = '';
document.checkout.billaddress.value = '';
document.checkout.billaddress2.value = '';
document.checkout.billcity.value = '';
document.checkout.billstate.value = '';
document.checkout.billzip.value = '';
document.checkout.billcountry.value = '';
}
}

function checkform() {
if (document.checkout.shipcity.value != "" && document.checkout.shipzip.value != "" && document.checkout.shipname.value != "" && document.checkout.shipaddress.value != "" && document.checkout.phone.value != ""){allgood = 1;}else{allgood = 0;}

						if (allgood == 1){
document.checkout.submit();
}else{
alert ("Address Information is required.  Please make sure all the requested information is provided, then try again.");

}
}

function checkform2() {
if (document.checkout.email.value != "" && document.checkout.shipname.value != "" && document.checkout.shipaddress.value != "" && document.checkout.phone.value != ""){allgood = 1;}else{allgood = 0;}

						if (allgood == 1){
document.checkout.submit();
}else{
alert ("Email Address, Name, Address, Phone, and Payment Information are required.  Please make sure all the requested information is provided, then try again.");

}
}

//<![CDATA[
/* Replacement calls. Please see documentation for more information. */

if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax
	sIFR.replaceElement(named({sSelector:"h1", sFlashSrc:"franklingothicheavy.swf", sColor:"#222222", sLinkColor:"#3693D0", sBgColor:"#E3E3E3", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"franklingothicheavy.swf", sColor:"#3693D0", sLinkColor:"#3693D0", sBgColor:"#E3E3E3", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"h1.prodtitle", sFlashSrc:"franklingothicheavy.swf", sColor:"#222222", sLinkColor:"#3693D0", sBgColor:"#E3E3E3", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"h4#prodinfo", sFlashSrc:"franklingothicheavy.swf", sColor:"#ffffff", sLinkColor:"#3693D0", sBgColor:"#E3E3E3", sWmode:"transparent"}));

}

//]]>
