function openhelp(id,w,h)
{
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;

        winprops = 'height=450,width=700,top='+wint+',left='+winl+',resizable=0,scrollbars=no,toolbar=no,status=no'
        window.open("help.php?id="+id+"", "", winprops)
        
}

function displayImage(picName,  windowName, windowWidth, windowHeight){
  var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + windowWidth + ",height=" + windowHeight)
  if(winHandle != null){
    var htmlString = "<html><head><title>Picture</title></head>"  
    htmlString += "<body background=" + picName + ">"
    htmlString += "</body></html>"
    winHandle.document.open()
    winHandle.document.write(htmlString)
    winHandle.document.close()
    }	
  if(winHandle != null) winHandle.focus() //brings window to top
  return winHandle
  }

function HideOrShowStuff(controlToHide)
{
    if (document.getElementById)
    {
        // Hide all regions
        document.getElementById('txtShow3').style.display = 'none';
        document.getElementById('txtShow4').style.display = 'none';
        document.getElementById('txtShow3').disabled = 'disabled';
        document.getElementById('txtShow4').disabled = 'disabled';

        // Display the requested region
        document.getElementById
            ('txtShow' + controlToHide).style.display = 'block';
        document.getElementById
            ('txtShow' + controlToHide).disabled = '';
    }
    else
    {
        alert('Ongelma selaimen yhteensopivuuden kanssa');
    }
}

function HideOrShowStuff2(controlToHide)
{
    if (document.getElementById)
    {
        // Hide all regions
        document.getElementById('txtShow1').style.display = 'none';
        document.getElementById('txtShow2').style.display = 'none';
        document.getElementById('txtShow1').disabled = 'disabled';
        document.getElementById('txtShow2').disabled = 'disabled';

        // Display the requested region
        document.getElementById
            ('txtShow' + controlToHide).style.display = 'block';
        document.getElementById
            ('txtShow' + controlToHide).disabled = '';
    }
    else
    {
        alert('Ongelma selaimen yhteensopivuuden kanssa');
    }
}

function showHide(element) {
        if (document.getElementById) {
                // W3C standard
                var style2 = document.getElementById(element).style;
                style2.display = style2.display ? "" : "block";
        }
        else if (document.all) {
                // old MSIE versions
                var style2 = document.all[element].style;
                style2.display = style2.display ? "" : "block";
        }
        else if (document.layers) {
                // Netscape 4
                var style2 = document.layers[element].style;
                style2.display = style2.display ? "" : "block";
        }
}

function showHideAll() {
  var cCommonDivName = "tuotteet";
  var arrDivs = document.getElementsByTagName('div');
  for(i = 0 ; i < arrDivs.length ; i++) {
    if (arrDivs[ i ].id.match(cCommonDivName)) {
      showHide(arrDivs[ i ].id);
    }
  }
}
