function popUp(pageurl,width,height,resize,scroll,loc){
	day = new Date();
	id = day.getTime();if(typeof loc=="undefined")loc=1;
	if (window.screen) {  
		lpos = (screen.width/2)-(width/2);  
		hpos = (screen.height/3)-(height/3);
	}else	{
		lpos = 1;
		hpos = 1;		
	}		 		
	eval("popWin"+id+" = window.open('"+pageurl+"','"+id+"','toolbar=0,scrollbars="+scroll+",location="+loc+",status=0,menubar=0,resizable="+resize+",width="+width+",height="+height+",left="+lpos+",top="+hpos+"')");
}

function showhideDuruus(visibleID){
	nodes = getElementsByClassName(document, 'zebra');
    for(var i=0,j=nodes.length; i<j; i++){
		if(nodes[i].id!=visibleID)
 		  nodes[i].style.display='none';
	}
	showhide(visibleID);
	showhide(visibleID+"_button");
}

function hideDuruus(visibleID){
	$(visibleID).style.display='none';
	$(visibleID+"_button").style.display='none';
}

function showhide(id) {
//alert($(id).style.display)
  $(id).style.display =  $(id).style.display == 'inline' ? 'none' : 'inline';
 }
function getElementsByClassName(node, classname)
{
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function $(){
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++)
  {
    var element = arguments[i];
      if (typeof element == 'string')
        element = document.getElementById(element);
      if (arguments.length == 1)
        return element;
      elements.push(element);
  }
  return elements;
}
function trim(s) {
  return s.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  //return(this.replace(/^\s*|\s*$/g, ""));
};
function stripHTML(s) {
  return trim(s.replace(/<.*?>/g, '')).replace(/\r|\n|\r\n/g, "").replace("&nbsp;","");
};
function attachOnclicks() {

}
function attachEvent(links) {
  for(i=0, size=links.length; i < size; i++){
    a = links[i];
    l = a.href.toLowerCase();
    if(l.indexOf(".ram")!==-1  ||l.indexOf(".rm")!==-1  ||l.indexOf(".ra")!==-1|| l.indexOf(".mp3")!==-1 || l.indexOf(".wmx")!==-1){
//      a.href="javascript:popUp('/player.php?url='+a.href+'&title='+escape(stripHTML(a.innerHTML)), 520, 355, 1, 0, 0);";
      a.onclick=function(evt){
        popUp('/player.php?url='+this.href+'&title='+escape(stripHTML(this.innerHTML)), 520, 355, 1, 0, 0);
		 this.href="#";
		 evt.cancel=true;
		 evt.returnValue=false;
		 evt.cancelBubble=true;
		 if (evt.stopPropagation) evt.stopPropagation();
		 if (evt.preventDefault) evt.preventDefault();
		return false;
      }
    }
  }
}

window.onload=function(){
  left   = document.getElementsByTagName("a");
  rite   = $('jambigaMidig').getElementsByTagName("a");
  attachEvent(left);
  attachEvent(rite);

  if($("QoraalContainer"))
	attachEvent($("QoraalContainer").getElementsByTagName("a"));

}
