// JavaScript Document

/********** getElementById - IE fix ***********/
if (/msie/i.test (navigator.userAgent)) //only override IE
{
	document.nativeGetElementById = document.getElementById;
	document.getElementById = function(id)
	{
		var elem = document.nativeGetElementById(id);
		if(elem)
		{
			//make sure that it is a valid match on id
			if(elem.id == id)
			{
				return elem;
			}
			else
			{
				//otherwise find the correct element
				for(var i=1;i<document.all[id].length;i++)
				{
					if(document.all[id][i].id == id)
					{
						return document.all[id][i];
					}
				}
			}
		}
		return null;
	};
}
/********************************************/

function changeButtonBg(id,image){        
    if(image=="transparent"){
        document.getElementById(id).style.background='transparent';
    }else{
        document.getElementById(id).style.background='transparent url(/env/images/'+image+') no-repeat 0 0';
        document.getElementById(id).style.cursor='pointer';
        }
}


function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
 }
} 

/*
*
*drop down menu
***/
function showMenu(that){
  var children =that.childNodes;
  for(var i=0;i<children.length;i++){
    if(children[i].className=="submenu"){
      children[i].style.display='block';
    }
    if(children[i].tagName=="A"){      
      children[i].style.color='#FF8300';
    }
  }
  
}
function hideMenu(that){
  var children =that.childNodes;
  for(var i=0;i<children.length;i++){
    if(children[i].className=="submenu"){
      children[i].style.display='none';
    }
    if(children[i].tagName=="A"){
      children[i].style.color='#FEAC55';
    }
  }
  
}
/*
* left dropDown
*/
function showHideMenu(that){
  var children =that.parentNode.childNodes;
  for(var i=0;i<children.length;i++){
    if(children[i].className=="submenu"){
      if(children[i].style.display=='block'){
        children[i].style.display='none'
      }else{
        children[i].style.display='block'
      }
    }    
  }
}

/*
*copy&paste disable
*/
function checkCtrlIns(event){
  if (event.ctrlKey==1 || event.keyCode==45){
    return false
  }
  else{
    return true
  }
}   

/*
*numbers only
*/     
function isNumberKey(evt){
   var charCode = (evt.which) ? evt.which : event.keyCode
   if (charCode > 31 && (charCode < 48 || charCode > 57))
      return false;

   return true;
}

/*
*popup for cd samples
*/
var WindowObjectReference = null; // global variable
function popUp(URL)
{
  if(WindowObjectReference == null || WindowObjectReference.closed)
  {
    WindowObjectReference = window.open("http://eshop.naturnet.sk/extra/player.php" + URL,
   "popUp", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=200");
  }
  else
  {
    WindowObjectReference.focus();
  };
}
