
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(Custom.init);
addLoadEvent(function slide() {
            var container = $('div.sliderGallery');
            var ul = $('ul', container);
            
            var itemsWidth = ul.innerWidth() - container.outerWidth();
            
            $('.slider', container).slider({
                min: 0,
                max: itemsWidth,
                handle: '.handle',
                stop: function (event, ui) {
                    ul.animate({'left' : ui.value * -1}, 500);
                },
                slide: function (event, ui) {
                    ul.css('left', ui.value * -1);
                }
            });
        }); 

function set_present(div_id, class_name)
{
	if(document.getElementById(div_id) != undefined)
	    document.getElementById(div_id).className = class_name;
}

function get_present(div_id)
{
	if(document.getElementById(div_id) != undefined)
		return document.getElementById(div_id).className;
}

function hide_present(div_id)
{
	if(document.getElementById(div_id) != undefined)
	    document.getElementById(div_id).style.display = 'none';
}

   function set_off(option_id)
{
	set_present(option_id, '');
}

function show_option(div_id) {
    hide_present('item_description');
	hide_present('specifications');
	hide_present('enquire');


	set_off('item-description-option');
	set_off('specifications-option');
	set_off('enquire-option');


    document.getElementById(div_id).style.display = 'block';
	document.getElementById(div_id + '-option').className = 'on';
}


