
function modalwin(url)
{
if (window.showModelessDialog)
	window.showModelessDialog(url,"","center:1;help:0;status:0;scroll:1;resizable:0;dialogWidth:450px;dialogHeight:500px");
else
	window.open(url,"","top=50,left=75,width=450,height=500,directories=0,location=0,menubar=0,resizable=0,status=0,toolbar=0,scrollbars=1");
}

function popmeup(e){ 
	if( !e && window.event ){
		e = window.event;
	}
	
	var target = (e.target) ? e.target : (e.srcElement) ? e.srcElement : null;
	
	if(target.tagName.toLowerCase()=='img') target = target.parentNode;
	
	if(target && target.href){
		modalwin(target.href);
		return false; // do not follow link
	}else{
		return true; // we could not create a popup. Go to link.
	}
	
	
}

function showhide( e, id, lang ){
	var elm,parent,tmp,active;
	var hili = [];
	if( !e && window.event ){
		e = window.event;
	}
	
	var target = (e.target) ? e.target : (e.srcElement) ? e.srcElement : null;
	if(!target) return true;
	
	
	if(document.getElementById && ( elm=document.getElementById(id+'_'+lang)) ){
		active = ! (  elm.className == 'active'  );
		elm.className = (active) ? 'active' : '';
		parent = elm.parentNode; // .opusdetails TD
	}else{
		return true;
	}
	for(var i=0; tmp=parent.childNodes[ i ]; i++){ 
		if( tmp.className == 'active' && tmp!=elm ) tmp.className ='';
	}
	hili.push(  util_findParent(target, 'tr')  );
	
	hili.push( util_findNext(  hili[hili.length-1], 'tr'  )  );
	highlight(  hili, active  );
	return false;
}

function highlight(elms, active){
	for( var i=0; i<elms.length; i++ ){
		elms[ i ].className = (active) ? 'active' : '';
	}
	
}

function clickableTRs(){
	if(!document.getElementsByTagName) return;
	
	var trs = document.getElementById('opustable').getElementsByTagName('tr')
	for(var i=0,tr;tr=trs[i];i++){
		if(  tr.getElementsByTagName('a')[0]  ){
			tr.onclick = clickChildA;
			tr.className+=' clickable';
		}
	}
}
function clickChildA(e){
	var tmp;
	if( !e && window.event ){
		e = window.event;
	}
	var target = (e.target) ? e.target : (e.srcElement) ? e.srcElement : null;
	if(!target) return;
	target = util_findParent(target, 'tr'); 
	tmp = target.getElementsByTagName('a')[0]
	if(  tmp && tmp.onclick) tmp.click();
}

function util_findNext(  node, tagname  ){
	while(  node.nextSibling && node.nextSibling.tagName && node.nextSibling.tagName.toLowerCase()!=tagname  ){
		node = node.nextSibling;
	}
	return node;
}
function util_findParent(  node, tagname  ){
	while(  node.parentNode && node.tagName.toLowerCase()!=tagname  ){
		node = node.parentNode;
	}
	return node;
}

