function getElementsByClass(searchClass,node,tag) {
   
   var classElements = new Array();
   var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
   node = (node == null) ? document : node;
  
   if ((document.getElementsByTagName("*").length > 0) || (tag != null)){
      tag = (tag == null) ? "*" : tag;
      var els = node.getElementsByTagName(tag);
      var elsLen = els.length;
      for (i = 0, j = 0; i < elsLen; i++){
         if (pattern.test(els[i].className)){
            classElements[j] = els[i];
            j++;
         }
      }
   }else{
      var els = node.all;
      var elsLen = els.length;
      for (i = 0, j = 0; i < elsLen; i++){
         if (pattern.test(els[i].className)){
            classElements[j] = els[i];
            j++;
         }
      }
   }
   return classElements;
} 


function hideClass(cls){
  var toHide = getElementsByClass(cls);
  for(i=0; i<toHide.length; i++){
    toHide[i].style.display = "none";
  }
}

function showClass(cls){
  var toShow = getElementsByClass(cls);
  for(i=0; i<toShow.length; i++){
    toShow[i].style.display = "block";
  }
}


function checkClass(cls, val){
  var toShow = getElementsByClass(cls);
  for(i=0; i<toShow.length; i++){
    toShow[i].checked = val;
  }
}

function show(id)
{
  document.getElementById(id).style.display="block"; 
}
   
function isVisibleClass( cls ) {
	var toShow = getElementsByClass(cls);
	if( !( toShow[0] == undefined ) )
		return ( toShow[0].style.display == 'none')? false : true ;
	else
	 	return false;
}
          
function hide(id)
{
  document.getElementById(id).style.display="none";           
}



function getMouseXY(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	} 
  return new Array(posx, posy);
}

function showPic(e, link)
{	
	var xy = getMouseXY(e);
	var bl = document.getElementById('pictPopup');
	bl.src = link;
	bl.style.visibility = 'visible';  
	bl.style.width='auto';
	bl.style.top = xy[1]+10+'px';
	bl.style.left = xy[0]+10 +'px';	
}

function hidePic()
{
	var bl = document.getElementById('pictPopup');
	bl.src = '';
	bl.style.visibility = 'hidden';
	bl.style.width='0px';
}
// -->

 function showMore( beg, name, end ){
    var rew = name2Rewrite(name.toLowerCase()) ;
  	window.location.href = beg + rew.replace( ',', '.' ) + end ;
  }
