function init(e) {
    $('#nav li').hover(nav_over, nav_out);
    $('.sub_group li').hover(subnav_over, subnav_out);
    // $('#subnav').mouseleave(subnav_out);
    // $('#nav li').click(goto_id);
    $('#nav li').click(goto_link);
    $('#meet_curry_supply').hover(meet_curry_over, meet_curry_out);
    $('#meet_curry_supply').click(function() {
        location.href='http://www.currysupply.com';
    });
    $('#search_btn').click(function() {
        location.href='../search.php';
    });
    
}

function meet_curry_over(e) {
    $(this).animate({width:'58px', height:'328px', top:'150px'}, {queue:false, duration:600, easing:'easeOutBack'});
}

function meet_curry_out(e) {
    $(this).animate({width:'53px', height:'300px', top:'162px'}, {queue:false, duration:600, easing:'easeOutBounce'});
}

function goto_id(e) {
	location.href=$(this).attr('id') + '.php';
}

function nav_over(e) {
    $(this).addClass('selected');
    if ($(this).hasClass('main')) {
        $(this).children('img').attr('src', '../images/nav_arrow_over.png');
    }
    $("#" + $(this).attr('id') + "_sub").css('display', 'block');
}

function nav_out(e) {
    $(this).removeClass('selected');
    if ($(this).hasClass('main')) {
        $(this).children('img').attr('src', '../images/nav_arrow.png');
    }
    $("#" + $(this).attr('id') + "_sub").css('display', 'none');
}

function subnav_over(e) {
    $(this).addClass('selected');
    $("#" + $(this).attr('id') + "_sub").css('display', 'block');
}

function subnav_out(e) {
    $(this).removeClass('selected');
    $("#" + $(this).attr('id') + "_sub").css('display', 'none');
}

function goto_link(e) {
	links = $(this).children('a');
	if (links.length > 0) {
		url = $(links[0]).attr('href');
		location.href=url;
	}
}

/*function subnav_out(e) {
    $("#nav li").removeClass('selected');
    $(".sub_group").css('display', 'none');
}*/

$(document).ready(init);
