// JavaScript Document

var $jq = jQuery.noConflict();
$jq(document).ready(function(){	
	var loc="Home";
	var leftmenuTop=0;
	var grpID = "1";
	var artID = "1";
	
	$jq("#logo").fadeIn(500, function() {
		$jq("#top_menu").animate({"left": "-=674px"}, 500, function(){});
		$jq("#left_menu").animate({"top": "+=300px"}, 500, function(){					
				leftmenuTop=$jq("#left_menu").css('top');
			});
	});
	$jq(".menu_item").css('cursor', 'pointer');
	$jq(".submenu_item").css('cursor', 'pointer');
	
	$jq(".submenu_item").mouseover(function(event){
		var lft=140-parseInt($jq(this).css('width'));
		$jq(this).animate({"left": "-="+lft+"px"}, 100, function(){});
		event.preventDefault();
	});	
	$jq(".submenu_item").mouseout(function(event){
		var lft=140-parseInt($jq(this).css('width'));
		$jq(this).animate({"left": "+="+lft+"px"}, 500, function(){});
		//alert("testing out");
		event.preventDefault();
	});	
	$jq(".submenu_item").click(function(event){
		artID = $jq(this).attr("title");
		
		event.preventDefault();
	});
	$jq("#pull_login").click(function(event){
		if($jq("#login").css("top")!="0px"){
			$jq("#login").animate({"top": "+=80px"}, 500, function(){});
		}else{
			$jq("#login").animate({"top": "-=80px"}, 500, function(){});
		}
		event.preventDefault();
	});	
	
	$jq(".menu_item").click(function(event){	
		loc = $jq(this).attr("id");
		switch(loc){
			case ("products"):
				if ($jq("#left_menu").css('top')<=leftmenuTop){
					$jq("#left_menu").animate({"top": "+=280px"}, 500, function(){
						$jq("#menu_items").css('margin-top', '30px');
						$jq("#submenu_items").fadeIn(500, function() {});
					});
				}
				break;
			case ("group_58"):
				if ($jq("#left_menu").css('top')>leftmenuTop){
					$jq("#submenu_items").fadeOut(500, function() {
						$jq("#menu_items").css('margin-top', '315px');
						$jq("#left_menu").animate({"top": "-=280px"}, 500, function(){});
					});
				}
				break;
			case ("group_59"):
				if ($jq("#left_menu").css('top')>leftmenuTop){
					$jq("#submenu_items").fadeOut(500, function() {
						$jq("#menu_items").css('margin-top', '315px');
						$jq("#left_menu").animate({"top": "-=280px"}, 500, function(){});
					});
				}
				break;					
		}
		event.preventDefault();
	});
});
