// superfish menu nav
$(document).ready(function() {
    		// Main navigation dropdowns
            $('ul.sf-menu').superfish({
                delay:       300,                            // one second delay on mouseout
                animation:   { height:'show' },              // fade-in and slide-down animation
                speed:       'fast',                         // faster animation speed
                autoArrows:  true,                           // disable generation of arrow mark-up
                disableHI:   true,
                dropShadows: false                           // disable drop shadows
            });
         });
        jQuery(document).ready(function() {
          /* portfolio image effect */
          $("img.a").hover(
          function() {  $(this).stop().animate({"opacity": "0.7"}, "slow");  },
          function() {  $(this).stop().animate({"opacity": "1"}, "slow");  });
          $("img.pthumb").hover(
          function() {  $(this).stop().animate({"opacity": "0.7"}, "slow");  },
          function() {  $(this).stop().animate({"opacity": "1"}, "slow");  });
          $("ul.tabs").tabs("div.panes > div");
          $("ul.css-tabs").tabs("div.css-panes > div");
          $(".scrollable").scrollable();
          $(".accordion").tabs(".pane", {tabs: 'h2', effect: 'slide'});
          $(".accordion-faq").tabs(".pane", {tabs: 'span', effect: 'slide'});
          /* $(function() {
          $("ul.pricing-col-small").mouseover(function(){
          $(this).removeClass().addClass("highlight-small");
          }).mouseout(function(){
          $(this).removeClass().addClass("pricing-col-small");
          })}); */
 });


$(function() {
    /* External links open in new windows */
    $("a[rel='external']").bind("click.external", function(){
        window.open(this.href);
        return false;
    });
});

// simple hide no animation
function hide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "none";
    }     }

// simple show no animation
function show(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "";
    }    }

// jquery hide, show and toggle
function ajaxshow(id){	$(id).fadeIn("slow");	}
function ajaxhide(id){	$(id).fadeOut("slow");	}
function toggle(id){	$(id).slideToggle("fast"); }



//quicskand gallery categories filtering
jQuery(document).ready(function($){
 	// clone applications to get a second collection
	var $data = $(".gallery-content .container").clone();
 	//note: only filter on the main portfolio page, not on the subcategory pages
	$('.gallery-main li').click(function(e) {
		$(".filter li").removeClass("current-cat");
		//use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
		var filterClass=$(this).attr('class').split(' ').slice(-1)[0];

		if (filterClass == 'all-items') {
			var $filteredData = $data.find('.gallery-item');
		} else {
			var $filteredData = $data.find('.gallery-item[data-type=' + filterClass + ']');
		}
		$(".gallery-content .container").quicksand($filteredData, {
			duration: 700,
			easing: 'easeInOutQuad'
		}, function(){
				//callback function to re-apply hover effects on cloned elements
                $("img.pthumb").hover(
                function() {  $(this).stop().animate({"opacity": "0.7"}, "slow");  },
                function() {  $(this).stop().animate({"opacity": "1"}, "slow");  });
                $("a[rel^='prettyPhoto']").prettyPhoto();
		});

		$(this).addClass("current-cat");
		return false;
	});
});

function getdate() {

var orderid = parseInt(document.getElementById('orderid').value);
var status = "None";
						   
if ((orderid > 4000000) && (orderid < 4015755)) {
        status = "Shipped";
} else if ((orderid > 4015755) && (orderid < 4016398)) {
        thedate = "June 06 - June 10";
        status = "Shipped";
} else if ((orderid > 4016397) && (orderid < 4016829)) {
        thedate = "June 20 - June 24";
        status = "Shipped";
} else if ((orderid > 4016828) && (orderid < 4017068)) {
        thedate = "June 27 - July 01";
        status = "Shipped";
} else if ((orderid > 4017067) && (orderid < 4018012)) {
        thedate = "July 04 - July 08";
        status = "Shipped";
} else if ((orderid > 4018013) && (orderid < 4018762)) {
        thedate = "Aug 08";
        status = "Shipped";
} else if ((orderid > 4018761) && (orderid < 4019253)) {
        thedate = "Aug 22 - Aug 26";
        status = "Shipped";
} else if ((orderid > 4019252) && (orderid < 4019898)) {
        thedate = "Aug 29 - Sep 02";
        status = "Shipped";
} else if ((orderid > 4019897) && (orderid < 4020702)) {
        thedate = "Sep 05 - Sep 09";
        status = "Shipped";
} else if ((orderid > 4020701) && (orderid < 4021919)) {
        thedate = "Sep 12 - Sep 16";
        status = "Shipped";
} else if ((orderid > 4021918) && (orderid < 4022867)) {
        thedate = "Sep 19 - Sep 23";
        status = "Shipped";
} else if ((orderid > 4022866) && (orderid < 4024217)) {
        thedate = "Sep 26 - Sep 30";
        status = "Shipped";
} else if ((orderid > 4024216) && (orderid < 4026417)) {
        thedate = "Sep 26 - Sep 30";
        status = "Shipped";
} else if ((orderid > 4026416) && (orderid < 4028099)) {
        thedate = "Oct 03 - Oct 07";
        status = "Shipped";
} else if ((orderid > 4028098) && (orderid < 4029787)) {
        thedate = "Oct 03 - Oct 07";
        status = "Shipped";
} else if ((orderid > 4029786) && (orderid < 4031593)) {
        thedate = "Nov 7 - Nov 11";
        status = "Shipped";
} else if ((orderid > 4031592) && (orderid < 4032828)) {
        thedate = "Nov 14 - Nov 18";
        status = "Shipped";
} else if ((orderid > 4032827) && (orderid < 4033665)) {
        thedate = "Nov 14 - Nov 18";
        status = "Shipped";
} else if ((orderid > 4033664) && (orderid < 4051429)) {
        thedate = "Nov 14 - Nov 18";
        status = "Shipped";
} else if ((orderid > 4051430) && (orderid < 4051629)) {
        thedate = "Nov 21 - Nov 25";
        status = "Shipped";
} else if ((orderid > 4051629) && (orderid < 4051774)) {
        thedate = "Nov 28 - Dec 02";
        status = "Shipped";
} else if ((orderid > 4051773) && (orderid < 4051919)) {
        thedate = "Dec 05 - Dec 09";
        status = "Shipped";
} else if ((orderid > 4051918) && (orderid < 4052038)) {
        thedate = "Dec 19 - Dec 23";
        status = "Shipped";
} else if ((orderid > 4052037) && (orderid < 4052222)) {
       thedate = "Dec 26 - Dec 30";
        status = "Shipped";
} else if ((orderid > 4052223) && (orderid < 4055400)) {
       thedate = "Jan 16 - Jan 20";
       status = "Not Shipped";
} else {
        status = "None";

}

if (status == "Shipped") {
       var orderstatus = "Your order has already shipped, please refer to your paid e-invoice for your Fed Ex tracking number. If you have an order for a Rechargeable your order will be fulfilled Jan 23 - Jan 27.";
       document.getElementById('orderstatus').innerHTML = orderstatus;
} else if (status == "Not Shipped") {
       var orderstatus = "Your order has not shipped, your estimated ship date range is the week of " + thedate + " 2011. If you have an order for a Rechargeable your order will be fulfilled Jan 23 - Jan 27.";
       document.getElementById('orderstatus').innerHTML = orderstatus;
} else if (status == "Shipping") {
       var orderstatus = "We have your device(s) on hand. Your order is being processed and will ship out this week. You will receive an email with your e-invoice and your Fed Ex tracking number.";
       document.getElementById('orderstatus').innerHTML = orderstatus;
} else if (status == "None") {
       var orderstatus = "I'm sorry we could not find your order ID.";
       document.getElementById('orderstatus').innerHTML = orderstatus;
}

}

// Cufon Replacements
Cufon.replace(' h1, h2, h3, h4, h5, .featured-top, .pack .button, .pack-last .button, .textbutton, .applyfont, ul.css-tabs a', { hover: true, fontFamily: 'Museo' });
Cufon.replace('.header h1, .header-alt h1, .header-alt-sec h1, .header-alt h4, .header-alt-sec h4, .header-inner h1, .subtitle h3', { hover: true, textShadow: '1px 1px 0 #444444', fontFamily: 'Museo' });
Cufon.replace('.btn-small, .btn-medium, .btn-big, .btn-big-light, .form-button, .accordion h2, .text-replace, .big-home-button', { hover: true, textShadow: '1px 1px 0 #ffffff', fontFamily: 'Museo' });
Cufon.replace('.btn-orange-small, .btn-orange-medium, .btn-orange-big', { hover: true, textShadow: '1px 1px 0 #cb6a20', fontFamily: 'Museo' });
Cufon.replace('.btn-green-small, .btn-green-medium, .btn-green-big', { hover: true, textShadow: '1px 1px 0 #588b11', fontFamily: 'Museo' });
Cufon.replace('.big-footer h4', { textShadow: '1px 1px 0 #555555', fontFamily: 'Museo' });

