  var selectedTab=0;
	
	function selectTab(id)
	{
	  $('#tab-cnt-'+selectedTab).css('display', 'none');
	  $('#tab-'+selectedTab).addClass('tab-u');
	  $('#tab-'+selectedTab).removeClass('tab-s');
    selectedTab=id;
	  $('#tab-cnt-'+selectedTab).css('display', 'block');
	  $('#tab-'+selectedTab).addClass('tab-s');
	  $('#tab-'+selectedTab).removeClass('tab-u');
	}
  
  function showDetails(id)
  {
    ajaxProcessRequest('./product.php?id='+id);
  }
  
	function showDetailsDiv(data)
	{
		var ww=getWinWidth();
		var wh=getWinHeight();
		$('#cover').css('width', $(window).width());
		$('#cover').css('height', $(document).height());
		$('#cover').css('opacity', '0.5');
		$('#cover').fadeIn();
		$('#product-div').html(data);

		var dispHeight=parseInt($('#product-div').css('height'), 10);
		var dispWidth=650;
		var top=Math.round((wh-dispHeight)/2);
		var left=Math.round((ww-dispWidth)/2);
		if (top<0) top=10;
		if (left<0) left=10;
		$('#product-div').css('top', top+getScrollTop());
		$('#product-div').css('left', left+getScrollLeft());
		$('#product-div').fadeIn();
	}
	
  function closeDetails()
  {
		$('#product-div').fadeOut();
		$('#cover').fadeOut();
  }
  
  function showGalleryPic(id)
  {
    ajaxProcessRequest('./gallery.php?id='+id);
  }
  
	function showGalleryDiv(data)
	{
		var ww=getWinWidth();
		var wh=getWinHeight();
		$('#cover').css('width', $(window).width());
		$('#cover').css('height', $(document).height());
		$('#cover').css('opacity', '0.5');
		$('#cover').fadeIn();
		$('#product-div').html(data);

		var dispHeight=parseInt($('#product-div').css('height'), 10);
		var dispWidth=650;
		var top=Math.round((wh-dispHeight)/2);
		var left=Math.round((ww-dispWidth)/2);
		if (top<0) top=10;
		if (left<0) left=10;
		$('#product-div').css('top', top+getScrollTop());
		$('#product-div').css('left', left+getScrollLeft());
		$('#product-div').show();
	}
	
	function getWinHeight()
	{
		var h=0;
		if (window.document.innerHeight>h) h=window.document.innerHeight;
		if (window.document.documentElement.clientHeight>h) h=window.document.documentElement.clientHeight;
		if (window.document.body.clientHeight>h) h=window.document.body.clientHeight;
		return h;
	}
	
	function getWinWidth()
	{
		var w=0;
		if (window.document.innerWidth>w) w=window.document.innerWidth;
		if (window.document.documentElement.clientWidth>w) w=window.document.documentElement.clientWidth;
		if (window.document.body.clientWidth>w) w=window.document.body.clientWidth;
		return w;
	}
		
	function getScrollTop()
	{
		if(typeof pageYOffset!= 'undefined')
		{
			//most browsers
			return pageYOffset;
		}
		else
		{
			var B= document.body; //IE 'quirks'
			var D= document.documentElement; //IE with doctype
			D= (D.clientHeight)? D: B;
			return D.scrollTop;
		}
	}

	function getScrollLeft()
	{
		if(typeof pageXOffset!= 'undefined')
		{
			//most browsers
			return pageXOffset;
		}
		else
		{
			var B= document.body; //IE 'quirks'
			var D= document.documentElement; //IE with doctype
			D= (D.clientWidth)? D: B;
			return D.scrollLeft;
		}
	}

	function getDocHeight()
	{
		var D = document;
		return Math.max(
			Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
			Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
			Math.max(D.body.clientHeight, D.documentElement.clientHeight)
		);
	}

	function getDocWidth()
	{
		var D = document;
		return Math.max(
			Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
			Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
			Math.max(D.body.clientWidth, D.documentElement.clientWidth)
		);
	}

  function getScrollHeight()
  {
    if (isIE) return Math.max(document.body.offsetHeight, document.body.scrollHeight);
    if (isKHTML) return Math.max(document.body.scrollHeight, document.body.scrollHeight);
    return Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
  }

  function jsStartup()
  {
  }
  
      var overTrigger=false;
      var linkQueue=new Array();
      var menuQueue=new Array();
      var menuDepth=-1;
      var isLin=0;

      function pPos(obj)
      {
        if(obj==null)return [0, 0];
        var curleft =0;
        var curTop=0;
        if (obj.offsetParent)
        {
          curleft = obj.offsetLeft;
          curtop = obj.offsetTop;
          while (obj = obj.offsetParent)
          {
            curtop += obj.offsetTop;
            curleft += obj.offsetLeft;
          }
        }
        return [curtop, curleft];
      }

      function inArray(val, arr)
      {
        var found=-1;
        var limiter=(arguments.length>2)?arguments[2]:arr.length;
        for(var i=0; i<limiter; i++)
          if (arr[i]==val)
          {
            found=i;
            break;
          }
        return found;
      }

      function showSub(obj, id)
      {
        var depth=0;
        if (isLin==0)
				{
					overTrig(true);
					var mc=document.getElementById('main_menu_'+id);
					var ml=document.getElementById('menu_link_'+id);
					if (mc)
					{
						var addonX=0;
						var addonY=0;
						var res=pPos(obj);
						mc.style.top=res[0]+19+addonY+16+15;
						mc.style.left=res[1]+addonX;
					}
					if (menuDepth>=depth)
					{
						for (i=menuQueue.length-1; i>=depth; i--)
						{
							if (menuQueue[i]&&menuQueue[i]!=id)
							{
								document.getElementById('main_menu_'+menuQueue[i]).style.display='none';
								menuQueue[i]=null;
								menuDepth--;
							}
						}
					}
					var found=inArray(id, menuQueue);
					if (mc&&found)
					{
						menuDepth=depth;
						menuQueue[menuDepth]=id;
						mc.style.display='block';
						linkQueue[menuDepth]=id;
					}
				}
      }

      function realHideSub()
      {
        if (!overTrigger)
        {
          for(var i=0; i<allMenuDivs.length; i++)
					{
						var div=document.getElementById(allMenuDivs[i]);
						if (div&&div.style.display=='block')
						{
							div.style.display='none';
						}
					}
          menuQueue=new Array();
          linkQueue=new Array();
          menuDepth=-1;
        }
      }

      function hideSub()
      {
			  overTrig(false);
 				setTimeout('realHideSub()', 100);
      }

      function overTrig(state)
      {
        overTrigger=state;
      }

 
