﻿function show(e, id) 
{
  //alert(id);
    if (navigator.appName == "Microsoft Internet Explorer")
    {
      if(!e)
      e = window.event;
      e.cancelBubble = true;
    }
    else
    {
      e.stopPropagation();
    }
    
}

function showId(id)
{
    var sub = document.getElementById(id);
//    alert(id);
//    var dt = document.getElementById(id);
//    
//    sel.innerHTML += id +',';
//    var idOdkazy = id + '_odkazy';
//    var idOdkazyOtevren = 0;
//    var zkl = "";
//      
//      {
//          switch(id.indexOf('0'))
//          {
//            case 1:
//            {
//              zkl = id.substring(0,1);
//              
//              break;
//            }
//            case 2:
//            {
//              zkl = id.substring(0,2);
//              
//              break;
//            }
//            case 3:
//            {
//              zkl = id.substring(0,3);
//              
//              break;
//            }
//            case 4:
//            {
//              zkl = id.substring(0,4);
//              
//              break;
//            }
//            case -1:
//            {
//              zkl = "";
//              
//              break;
//            }
//          }
//                
//  
//        for(var n=1; n < 10; n++)
//        {
//            switch(zkl.length)
//          {
//            case 2:
//            {
//              id = zkl + n + '0';
//              break;
//            }
//            case 3:
//            {
//              id = zkl + n ;
//              break;
//            }
//            case 0:
//            {
//              id = id + '_odkazy';
//              n = 10;
//              break;
//            }
//          }
//          
//            sub = document.getElementById(id);
//            if(sub != null)
//            {
//              if(sub.id != null)
//              {
//                if(id.indexOf('_') > 0)
//                  idOdkazyOtevren = 1;
//                if(sub.style.display=='none')
//                {
//                  sub.style.display='';
//                 }
//                else
//                {
//                    sub.style.display='none';  
//                }
//              }
//            }
//         }
//      }
//      
//      var  sub = document.getElementById(idOdkazy);
      if(sub != null )
      {
        if(sub.id != null)
        {
          if(sub.style.display=='none')
          {
            sub.style.display='';
            }
          else
          {
              sub.style.display='none';  
          }
        }
      } 
      
}

function hideAll()
{
  for(var n = 1; n < 20; n++)
  {
      var id = 'a' + n + '00';
      var src = document.getElementById(id);
      
      if(src != null)
      {
        if(src.id != null)
        {
          id = 'a' + n + '00_odkazy';
          src = document.getElementById(id);
           if(src != null)
            {
              if(src.id != null)
              {
                  src.style.display='none';   
              }
            }
        
          for(var k = 1; k < 10; k++)
          {
              id = 'a' + n.toString() + k.toString() + '0';
              src = document.getElementById(id);
             // alert('h2 ' + id);
              if(src != null)
              {
                if(src.id != null)
                {
                  src.style.display='none'; 
                  
                  id = 'a' + n.toString() + k.toString() + '0_odkazy';
                  src = document.getElementById(id);
                   if(src != null)
                    {
                      if(src.id != null)
                      {
                          src.style.display='none';   
                      }
                    }
                
                   
                  for(var l = 1; l < 10; l++)
                  {
                      id = 'a' + n.toString() + k.toString() + l.toString();
                      src = document.getElementById(id);
                      
                      if(src != null)
                      {
                        if(src.id != null)
                        {
                            src.style.display='none';   
                            id = id + '_odkazy';
                            src = document.getElementById(id);
                            if(src != null)
                            {
                              if(src.id != null)
                              {
                                  src.style.display='none';   
                              }
                            }
                        }
                      }
                   }      
                }
              }
              
           } 
        }
      }
      
   } 
}
function showAll(id_call)
{
  if(id_call != 0)
  {
      var id = "";
      if(id_call.length == 4)
        id = id_call.substring(0,2) + '00';
      else if(id_call.length == 5)
        id = id_call.substring(0,3) + '00';
      else
        alert('Chybně zadané identifikační číslo odkazu v administrační části obchodu!!!');  
       showId(id);
      {
        if(id_call.length == 4)
            id = id_call.substring(0,3) + '0';
          else if(id_call.length == 5)
            id = id_call.substring(0,4) + '0';
            showId(id);
            {
              id = id_call;
              showId(id);
            }
      }
   } 
}

function showHelp(e, id) {
  var doc = document.getElementById(id);
  if(!e)
      e = window.event;
    if(e.x)//explorer
    {
      var x = e.x;
      var y = e.y;
      doc.style.left = x + 235;
      doc.style.top = y + 20;  
      doc.style.display = '';
    }
    else //Firefox
    {
      var x = e.layerX;
      var y = e.layerY;
      doc.style.left = x + 235 +'px';
      doc.style.top = y + 20 + 'px';
      
      doc.style.display = '';
       
    }
  
}

function hideHelp(id) {
  var doc = document.getElementById(id);
  doc.style.display = 'none';   
}


function ShowImage(obrazek) {
	var pic = 'Grafika/struct/mas-box-det' + obrazek + '.jpg';
	window.open('./ShowImage.aspx?pic=' + pic, "Picture","scrollbars=0,status=0,toolbar=0,location=0,directories=0,height=100,width=100,resizable=1");

}function changeImg(arg1, arg2){
var imgZkl = document.getElementById('produktDetailImg1');
imgZkl.setAttribute("src", arg1);
var imgZoom = document.getElementById('produktDetailImg1').parentNode;
if(imgZoom){
	imgZoom.setAttribute("href", arg1);
	imgZoom.setAttribute("class", arg2);
	var options = {
				    zoomWidth: 325,
				    zoomHeight: 300,
			        xOffset: 30,
			        yOffset: 0,
			        title:false,
			        position: "right" 
			};
		$(arg2).jqzoom(options);
	
}
}
