function $$$(id) {
  return document.getElementById(id);
}

function catalog_foto_change(color_id, image_url, image_url_big)
{
  $$$('catalog_foto').innerHTML = '<a class="gallery_1" target="_blank" href="'+image_url_big+'"><img src="'+image_url+'" alt="" /></a><img src="/frontend/i/spacer.gif" width="100" height="100" />';
//  alert(image_url_big);
  for (var i in colors)
    $$$('catalog_color_'+i).className = 'color';
  $$$('catalog_color_'+color_id).className = 'color active';
  
  $(function() {
    $('a.gallery_1').lightBox();
  });
}

function defPosition(event) {
    var x = y = 0;
    if (document.attachEvent != null) { // Internet Explorer & Opera
        x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    } else if (!document.attachEvent && document.addEventListener) { // Gecko
        x = event.clientX + window.scrollX;
        y = event.clientY + window.scrollY;
    } else {
        // Do nothing
    }
    return {x:x, y:y};
}

function catalog_show_id(event, color_id)
{
  $$$('catalog_color_id').innerHTML = color_id;
  $$$('catalog_color_id').style.display = 'block';
  $$$('catalog_color_id').style.top = defPosition(event).y+20+'px';
  $$$('catalog_color_id').style.left = defPosition(event).x+20+'px';
}

function catalog_hide_id()
{
  $$$('catalog_color_id').style.display = 'none';
}

function submenu(id)
{
  if ($$$('submenu_'+id).style.display == 'block') $$$('submenu_'+id).style.display = 'none';
  else $$$('submenu_'+id).style.display = 'block';
}

function subsubmenu(id)
{
  if ($$$('subsubmenu_'+id).style.display == 'block') $$$('subsubmenu_'+id).style.display = 'none';
  else $$$('subsubmenu_'+id).style.display = 'block';
}
