var isDOM = (document.getElementById);
var isIE4 = (document.all && !isDOM);
var isNS4 = (document.layers);
var isDyn = (isDOM || isIE4 || isNS4);

function getRef(id) {
  if (isDOM) return document.getElementById(id);
  if (isIE4) return document.all[id];
  if (isNS4) return document.layers[id];
}

var over_bgColor ='#c03';
var prev_bgColor = '';

function setOutBG(theObj) {
  theObj.style.backgroundColor=prev_bgColor;
}

function setOverBG(theObj) {
  prev_bgColor = theObj.style.backgroundColor;
  theObj.style.backgroundColor=over_bgColor;
}

function setOutBG2(theObj) {
  name=theObj.id.substr(0,2);
  getRef(name).style.backgroundColor=prev_bgColor;
}

function setOverBG2(theObj) {
  prev_bgColor = theObj.style.backgroundColor;
  name=theObj.id.substr(0,2);
  getRef(name).style.backgroundColor=over_bgColor;
}


function openWin(adresa,jmeno) {
  var _width = 640;
  var _height = 340;
	var leftpos = (screen.availWidth - _width) / 2;
	var toppos = (screen.availHeight - _height - 30) / 2;

	resiz = (navigator.appName == "Netscape") ? 0 : 1;
	windowHandle = window.open(adresa, jmeno, "width=" + _width + ", height=" + _height + ", top=" + toppos + ", left=" + leftpos + ", directories=0, location=0, menubar=1, scrollbars=1, status=0, titlebar=0, toolbar=0, resizable=" + resiz);
	windowHandle.focus();
}


$(document).ready(function() {	 
    $('.s1-image').hover(function() {
        $('.s1-image').hide();
        $('.s1-hover').show();        
    });
    $('.s1-hover').mouseleave(function() {
        $('.s1-image').show();
        $('.s1-hover').hide();        
    });
    $('.s2-image').hover(function() {
        $('.s2-image').hide();
        $('.s2-hover').show();        
    });
    $('.s2-hover').mouseleave(function() {
        $('.s2-image').show();
        $('.s2-hover').hide();        
    });
    $('.s3-image').hover(function() {
        $('.s3-image').hide();
        $('.s3-hover').show();        
    });
    $('.s3-hover').mouseleave(function() {
        $('.s3-image').show();
        $('.s3-hover').hide();        
    });
    $('.s4-image').hover(function() {
        $('.s4-image').hide();
        $('.s4-hover').show();        
    });
    $('.s4-hover').mouseleave(function() {
        $('.s4-image').show();
        $('.s4-hover').hide();        
    });
    $('.s1-image').show();
    $('.s1-hover').hide();
    $('.s2-image').show();
    $('.s2-hover').hide();
    $('.s3-image').show();
    $('.s3-hover').hide();
    $('.s4-image').show();
    $('.s4-hover').hide();
    
    
    $('.produkt').hover(function() {        
        $(this).addClass('p-variant');
        $('.p-variant .popis').show();
        $('.p-variant .p-image').hide();
        
    });
    $('.produkt').mouseleave(function() {
        $('.popis').hide();
        $('.p-image').show();        
        $(this).removeClass('p-variant');        
    });
    $('.popis').hide();
});

$(document).ready(function() {
  if (typeof _gaq != 'undefined') {
    $('a[href^="/?download="]', $('#telo')).live('click', function() {
      _gaq.push(['_trackEvent', 'Views', 'Downloads', $(this).attr('href')]);
    });
  }
});

