
/**********************************/
// 		Activate Tabs
/**********************************/
function productTabs() {
	// :first selector is optional if you have only one tabs on the page
	$("ul.css-tabs").tabs("div.css-panes > div");
}


/**********************************/
// 		Activate Accordion
/**********************************/
$(function() { 

$("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
});

/**********************************/
//		Equal Heights Calls
/**********************************/
$(document).ready(function() {
	equalHeight($(".adjust"));
	equalHeight($(".equal"));
	equalHeight($(".simpleBox"));
	equalHeight($(".equal2"));	
	
});

/********************************************/
//		jQuery Equal Heights
/********************************************/

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

function setupBookmark() {
    $("a.bookmark").click(function(e) {
                    if ($.browser.opera == false) {
                            e.preventDefault();
                            var url = this.href;  
                            var title = document.title;

                            if ($.browser.mozilla == true) {
                                    window.sidebar.addPanel(title, url, '');
                                    return false;
                            } else if($.browser.msie == true) {  
                                    window.external.AddFavorite( url, title);
                                    return false;
                            } else {
                                    alert('Please use CTRL + D to bookmark this website.');
                            }


        }
    });
}

function emailForm()
{
    var daReferrer = document.referrer;
    //var email = "yours@email.com";
    //var errorMsg = "here here here is the error error error error";
    var subject = "Check out this page on Netgear.com";
    var body_message = "Check out " + daReferrer + " on Netgear.com";

    var mailto_link = 'mailto:?subject='+subject+'&body='+body_message;

    win = window.open(mailto_link,'emailWindow');
    if (win && win.open &&!win.closed) win.close();
    return false;
    
}

// For a custom pop-up, use this function
function openPopUp(url, name, options)
{
	newWindow = window.open(url, name, options);
	if (newWindow) 
	{
		newWindow.focus();
	}
}

$(document).ready(function() {

    $('#menu').superfish({ 
            delay:       2000,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows 
        }); 

    productTabs();

    setupBookmark();
    
    /********************************************/
	//		Home Page Rotating Banners
	/********************************************/
	
	$('#bannerInnerWrap').before('<div id="pagernav">').cycle({ 
		fx:     'fade',             
		speed:   1000, 
		timeout: 8000, 
		pager:  '#pagernav' 
	});
	/********************************************/
	//         Overlays
	/********************************************/
	
	$("a[rel*=overlay]").overlay({
	        closeOnClick: false,
	        finish: {
	            top: 10
	        },
	        expose: {
	            color: '#2c3138',
	            opacity: 0.8,
	            closeOnClick: false
	        },
	        onBeforeLoad: function() {
	            /* Preload the iframe for faster response */
	            var myIframe = this.getOverlay().find("iframe");
	            myIframe.attr("src",this.getTrigger().attr("href")); 
	            /*myIframe.load(this.getTrigger().attr("href"));*/
	            
	        },
	        onLoad: function() {
	            
	        },
	        onClose: function() {
	            /*$("div.wrap").empty();*/
	        }
	    });
	

});

