﻿/*
 * Cycle Slave Global functions
 *
 * Copyright (c) 2009 Wirepoint Media, LLC (www.wirepointmedia.com)
 *
 * @Author: Chris Cox <chris.cox@wirepointmedia.com> 
 * @Date: 08-19-09
 * @version: 1.0 REV. 08-19-09
 */

 
jQuery.noConflict();

jQuery(function(){


    /*
    //Add classes to pages
    if (jQuery(".catalogueItemNotFound").length > 0) {
        //Sub-catalog page
        jQuery("#contentWrapper").addClass("subcatalog");        
    }
    */

    var cartIsOpen = false;
    var searchIsOpen = false;

    //Shopping cart button
    jQuery("#cart-box").click(function(){
        //First close an open dropboxes
        hideDropBox(jQuery("#searchWrapper"));
        searchIsOpen = false;
        
        window.location = "/OrderRetrievev2.aspx?CatalogueID=0";
        /*
        if (cartIsOpen == false) {        
            //SlideDown shopping cart
            jQuery("#cartWrapper").load("/OrderRetrievev2.aspx?CatalogueID=0 #cart", function(){
                showDropBox(jQuery("#cartWrapper"));                
                cartIsOpen = true;
            }); 
        } else {
            //Close cart
            hideDropBox(jQuery("#cartWrapper"));
            cartIsOpen = false;
        }
        */
    });
    
    /*
    //Search button
    jQuery("#search-box").click(function(){    
        //First close an open dropboxes
        hideDropBox(jQuery("#cartWrapper"));
        cartIsOpen = false;
        
        if (searchIsOpen == false) {
            //SlideDown search box
            showDropBox(jQuery("#searchWrapper"));
            searchIsOpen = true;
        } else {
            //Close cart
            hideDropBox(jQuery("#searchWrapper"));
            searchIsOpen = false;
        }
    });
    */
    
    
    function showDropBox(id) {
        //Animate show of dropbox
        jQuery(id).css("top", -jQuery(id).height()).show();
        jQuery(id).animate({top: 0 }, 300 );       
        //jQuery(id).effect("bounce",{times:1.5, direction:'up', distance:15},200);
    };
    
    function hideDropBox(id) {
        //Animate hiding of dropbox
        jQuery(id).animate({top: -jQuery(id).height() }, 200, function(){
            jQuery(id).hide();
        });
        jQuery("#pageBody .content").animate({marginTop:0}, 300 );
    };
    
    jQuery("#close-cart").click(function(){
        alert("hello");
        /*
        if (cartIsOpen == true) {
            //Close cart
            jQuery("#cartWrapper").animate({top: -jQuery("#cartWrapper").height() }, 200, function(){
                jQuery("#cartWrapper").remove();
            });            
            cartIsOpen = false;
        }
        */
    });

    jQuery("#cart-box").hover(
    /*
        function(){
            jQuery(this).css("backgroundPosition", "0 -45px");
        },
        function(){
            jQuery(this).css("backgroundPosition", "0 0");
        }
    */
    );

    //Chupa Boy
    jQuery("#chupa-boy").hover(
        function(){
            jQuery(this).css("backgroundPosition", "0 -110px");
            jQuery("#chupa-defined").show();
        },
        function(){
            jQuery(this).css("backgroundPosition", "0 0");
            jQuery("#chupa-defined").hide();
        }
    );
    
    /*
    //Highlight items in nav
    if ( jQuery("#canvas:has(#home)").length > 0) {
        jQuery("#nav-home").addClass("page-link-active");
    } else if ( jQuery("#canvas:has(#about)").length > 0) {
        jQuery("#nav-about").addClass("page-link-active");
    } else if ( jQuery("#canvas:has(#blog)").length > 0) {
        jQuery("#nav-blog").addClass("page-link-active");
    } else if ( jQuery("#canvas:has(#contact)").length > 0) {
        jQuery("#nav-contact").addClass("page-link-active");
    } else if ( jQuery("#canvas:has(#login)").length > 0) {
        jQuery("#nav-login").addClass("page-link-active");
    }
    */


});
