
    if (top.location!= self.location) {
      top.location = self.location.href
    }

var current_ul;
var menuEffect = 'fade';

function mainmenu(){

  $('.top-nav li.hasChildren').hover(function() {
    $(this).find('ul:first').stop().show();
}, function() {
  $(this).find('ul:first').stop().css({ display: "none" });
  });
}

function initsearch(){
  $('.search-submit').hover(function() {
    $(this).addClass('hover'); }, function() {
    $(this).removeClass('hover'); });
 
  $('.search-submit').click(function() {
    doSearch();
    e.preventDefault();
    });
  $(".search-text").keyup(function(e){
    if(e.keyCode == 13){
      doSearch();
      e.preventDefault();}
    });
  $('.search-text').val(urlParams['search']);
}

function doSearch(){
  var url = '/search.aspx?search=' + $('.search-text').val();
  window.location=url;
}


function initializeRequest(sender, args) {
  if (prm.get_isInAsyncPostBack())
   args.set_cancel(true);
  $('.ajax-form').block({ overlayCSS: { backgroundColor: '#fff'} });
}

function endRequest(sender, args) {
  $('.ajax-form').unblock();
}   

function fancyStart(){
  Cufon.replace('.fancybox-title-inside');
  Cufon.now();
}
$(document).ready(function(){

  mainmenu();
  initsearch();
  $(".home-scrollable").scrollable({circular: true});
  
  $(".fancybox").fancybox({
    //'titlePosition' : 'inside',
    'onStart': fancyStart
  });
  
  
    $("input.money").keypress(function (e) {
      if(e.which !=8 && e.which !=0 && (e.which < 48 || e.which > 57) ){
      return false;
      }
    });
 
  prm = Sys.WebForms.PageRequestManager.getInstance();
  prm.add_initializeRequest(initializeRequest);
  prm.add_endRequest(endRequest);
  Sys.Application.add_init(function() {
     $.blockUI.defaults.css = {};
  });
  
});


var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q))
       urlParams[d(e[1])] = d(e[2]);
})();



/*
 * call this function on a scrollable node to add some more clones on the right side of the carousel
 * as the jQuery Tools Scrollable plugin is build to just show one item on screen at once (not
 * multiple small elements). This function fills up the empty space right to the carousel with dummy
 * nodes
 * @param int addItems [OPTIONAL] define the number of clone items to aditionally add to the wrapper
 * @return void
 */

/*
function mainmenu(){
$("#header-nav li ul").css({ display: "none" }); // Opera Fix
$("#header-nav li").hover(function() {

    $(this).addClass('activeItem');
    $(this).find('a:first').addClass('activeItem');
    $(this).find('ul:first').css({ height: '', paddingBottom: '10px' }).slideDown('normal');
}, function() {
    $(this).removeClass('activeItem');
    $(this).find('a:first').removeClass('activeItem');
    $(this).find('ul:first').stop().css({ display: "none" });
});
}*/
function contactpop(){
$("#ctact").css({display: "none"}); // Opera Fix
   $("#contact-btn").click(function() {
               $("#ctact").load("contact.html", function(){
        $(this).slideToggle("slow") });
               $(this).slice(0,1).toggleClass("active");
               return false;
       }); 
}
function bloglink(){
$(".blogbox ul li").hover(function(){
    $(this).animate({backgroundColor: "#fff", paddingLeft: "30px"},300);
    },function(){
    $(this).animate({backgroundColor: "#f6f6f6", paddingLeft: "15px"},300);
    });
}
function footerlink(){
$("#footer ul.follow li a").hover(function(){
    $(this).animate({textIndent: "40px",backgroundPosition: ("20px 12px")},300);
    },function(){
    $(this).animate({textIndent: "30px", backgroundPosition: ("10px 12px")},300);
    });
}
function rightcolumn(){
$("#rightcolumn ul.norm li a").hover(function(){
    $(this).animate({backgroundColor: "#fff", textIndent: "10px",backgroundPosition: ("20px 12px")},300);
    },function(){
    $(this).animate({backgroundColor: "#f1f1f1", textIndent: "0px", backgroundPosition: ("10px 12px")},300);
    });
$("#rightcolumn ul li a").hover(function(){
    $(this).animate({textIndent: "10px",backgroundPosition: ("20px 12px")},300);
    },function(){
    $(this).animate({textIndent: "0px", backgroundPosition: ("10px 12px")},300);
    });
}

function footerlink2(){
$("#footer ul.reg li a").hover(function(){
    $(this).stop().animate({textIndent: "13px",backgroundPosition: ("3px 16px")},300);
    },function(){
    $(this).stop().animate({textIndent: "10px", backgroundPosition: ("0px 16px")},300);
    });
}
function footermap(){
$("#map").hover(function(){
    $('.locate').animate({opacity: 0.6},300);
    },function(){
    $('.locate').animate({opacity: 0},300);
    });
}
function portfolio(){
$("#portfolio li span").hover(function(){
    $(this).animate({opacity: 0.6},300);
    },function(){
    $(this).animate({opacity: 0},300);
    });
}
function services(){
$(".services li").hover(function(){
    $(this).find('span').animate({opacity: 1},300);
    },function(){
    $(this).find('span').animate({opacity: 0},300);
    });
}
function videolink(){
$("#videolink").hover(function(){
    $(this).find("span").animate({opacity: 0.6},300);
    },function(){
    $(this).find("span").animate({opacity: 0},300);
    });
}

$(document).ready(function(){
  if($(".block-recently-viewed-products").length){
    $("div.recent").show();
  };
  $('input#ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ctrlNewsLetterSubscriptionBox_txtEmail_txtValue').css({'width': '120px', 'float': 'left'}).attr('value', 'Email');
  $("#ctl00_ctl00_ctl00_ctl00_ContentPlaceHolderDefault_content_content_ctl00_txtQuantity_txtValue").addClass("qty-input");
  
});         

$(document).ready(function(){
  var category = $('a.category-crumb').text();
  $('#page-title h1').append(category);
});


$(document).ready(function($) {
  var text = $('#page-title h1').html();
  $('#page-title h1').html(text.replace(/\b([A-Za-z0-9])/g,'<span class="caps">$1</span>'));
  $('.caps').css('font-size',88);
  $('div.product-item').each(function(){
    if ( $(this).find(".oldproductPrice").length != 0) 
    {
      $(this).append('<img src="/images/sale.png" alt="Sale item" class="sale-image" />');
      $(this).find('.productPrice').css('color', 'red');
    }
  });
   /*$(function() {
                 
      $("#wrap").anythingZoomer({
      
         expansionSize: 30,
         speedMultiplier: 1.4
      
      });
            
    });
  $("#ctl00_ctl00_ctl00_ctl00_ContentPlaceHolderDefault_content_content_ctl00_defaultImage").addClass("main-product-image");
  var productimage = $('.main-product-image').text();
  $(".main-product-image").before('<div id="wrap"><div id="small">');
  $(".main-product-image").after('</div><div id="mover"><div id="overlay-thing"></div><div id="large"><img src="$productimage" alt="big rushmore" /></div></div></div>');
  $("#wrap").anythingZoomer({
      
      expansionSize: 30,      // How far outside the wrap edges the mouse can go
      speedMultiplier: 1.4,   // How much faster in the inside area moves than the mouse
      
      smallArea: "#small",    // Overrides small area ID
      largeArea: "#large",    // Overrides large area ID
      zoomPort: "#overlay",   // Overrides zoom overlay area ID
      mover: "#mover"         // Overrides mover ID
      
});*/
});


