var GH = {
    show_cart: function() {
	new Ajax.Request('/ajax/cart', {
		method: 'POST',
		evalScripts: true,
		onSuccess: function(t) {
		    Effect.BlindDown('cart_div',{duration:0.2});
		    $('cart_div_inner').update(t.responseText);
		}
	});
    },

    hide_cart: function() {
	Effect.BlindUp('cart_div',{duration:0.2});
    },

    curdesc: 0,

    switch_desc: function(i) {
	$('c_'+GH.curdesc).hide();
        $('tab_'+GH.curdesc).removeClassName('active');
	GH.curdesc = i;
        $('c_'+i).show();
	$('tab_'+i).addClassName('active');
    },

    showToxipedia: function(where,term) {
      var d = $('tox');
      if (!d) {
        d = document.createElement('div');
        d.id = 'tox';
        d = $(d);
        document.body.appendChild(d);
      }
      d.innerHTML = '<h1>Toxipedia: '+term+'</h1>' + GH.tox[term];
      d.clonePosition(where,{offsetTop:14,setWidth:false,setHeight:false});
      if (where.viewportOffset().left + 200 > document.viewport.getWidth()) {
  	d.style.left = (where.viewportOffset().left - 200 + where.getDimensions().width) + 'px';
      }
      d.show();
    },

    enlarge_image: function(url,text) {
      window.open('/ajax/popwin?imgurl='+url+'&text='+text,'popwin','width=620,height=450,scrollbars=1');
    }

};

