
function keyCheck(e){
	var key;
	var browser;
	if(window.event){
		key=event.keyCode;
	}else{
		key=e.keyCode;
	}
	if(key==123){
		openAdmin(getValues());
	}
} 

function openAdmin(id){
	var query=window.location.href.split('/');
	var page=query[query.length-1];
	if(page==''){
		page=query[query.length-2];
	}
	var height=500;
	if(window.event){
		height-=4;
	}
	newAdmin=window.open('http://www.opusnorden.com/'+getRoot()+'admin/?tool='+id,'OpusAdmin','scrollbars=no,menubar=no,height='+height+',width=700,resizable=no,toolbar=no,location=no,status=no,screenX=50,screenY=50,top=50,left=50');
	newAdmin.focus();
}

	
document.onkeyup=keyCheck;

function openFlash(item){
	var width=373;
	var height=280;
	if(window.event){
		width-=4;
		height-=5;
	}
	newFlash=window.open('','OpusFlashes');
	newFlash.close();	
	newFlash=window.open(item,'OpusFlashes','width='+width+',height='+height+',scrollbars=no,resizable=no,screenX=50,screenY=50,top=50,left=50');
	newFlash.focus();
}
function openMovie(path,item){
	var width=400;
	var height=400;
	if(window.event){
		width-=4;
		height-=5;
	}		
	newMovie=window.open('','OpusMovies');
	newMovie.close();	
	newMovie=window.open(path+'media/movieviewer.php?item='+item+'&width='+width+'&height='+height,'OpusMovies','width='+width+',height='+height+',scrollbars=no,resizable=no,screenX=20,screenY=20,top=20,left=20');
	newMovie.focus();
}
function openSound(path,item,width,height){
	if(!width||!height){
		width=380;
		height=150;
	}
	if(window.event){
		width-=4;
		height-=5;
	}		
	newSound=window.open('','OpusSounds');
	newSound.close();
	newSound=window.open(path+'media/soundplayer.php?item='+item,'OpusSounds','width='+width+',height='+height+',scrollbars=no,resizable=no,screenX=20,screenY=20,top=20,left=20');
	newSound.focus();
}
function openImage(path,item,width,height){
	if(window.event){
		width-=4;
		height-=5;
	}			
	newImage=window.open('','OpusImages');
	newImage.close();
	newImage=window.open(path+'media/imageviewer.php?item='+item,'OpusImages','width='+width+',height='+height+',scrollbars=no,resizable=no,screenX=20,screenY=20,top=20,left=20');
	newImage.focus();
}
function openLink(item){
	window.open(item);
}
function relExt(){
	if(document.getElementsByTagName){	
		var anchors=document.getElementsByTagName('a');		
		for(var i=0;i<anchors.length;i++){			
			var anchor=anchors[i];
			if(anchor.getAttribute('href')&&anchor.getAttribute('rel')=='ext'){
				anchor.target='_blank';
			}
		}
	}
}
function relImg(){
	if(document.getElementsByTagName){	
		var anchors=document.getElementsByTagName('img');		
		for(var i=0;i<anchors.length;i++){			
			var anchor=anchors[i];
			if(anchor.getAttribute('src')&&anchor.getAttribute('rel')=='img'){
				anchor.onclick=function(){openLink(anchor.src);};
				anchor.style.cursor='pointer';
			}
		}
	}
}
