function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}


// function to open new window

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") == "comment") {
       anchor.href ="javascript:comWin('"+anchor.href+"');";
   } else if 
       (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "blank") {
       anchor.target = "_blank";  
   }
 }
} 
window.onload = externalLinks;

function comWin(url) {
	window.open(url, 'comments', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=320, height=400, left=460, top=160');
}

/*(function audioWin() {
	if (!audioPlayer) || eval(audioPlayer.closed)){
		if (audioPlayer && audioPlayer.open && !audioPlayer.closed) {
			audioPlayer.focus();
		} else {
			audioPlayer = window.open('/audio.html','audioPlayer','width=230, height=330, left=430, top=140, scroll=auto, resizable=no, toolbar=no, directories=no, status=no, menubar=no, titlebar=no');
		}
	}
	audioPlayer.focus();
}
function videoWin() {
	if (audioPlayer!=null)
		audioPlayer.close();
	if (videoPlayer==null || videoPlayer.closed){
		videoPlayer = window.open('/video.html','videoPlayer','width=240, height=330, left=30, top=140, scroll=auto, resizable=no, toolbar=no, directories=no, location=no, status=no, menubar=no, titlebar=no');
	} else
	videoPlayer.focus();
}*/
function audioWin(){
	tmt_winOpen('/audio.html','audioPlayer','width=230,height=330,left=650,top=280,scroll=auto,resizable=0',1);
	tmt_winControl('videoPlayer','close()');
}
function videoWin(){
	tmt_winOpen('/video.html','videoPlayer','width=330,height=250,left=600,top=280,scroll=auto,resizable=0',1);
	tmt_winControl('audioPlayer','close()');
}

function tmt_winOpen(u,id,f,df){
	if(eval(id)==null||eval(id+".closed")){
	eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
	else if(df){eval(id+".focus()");}
	else{eval(id+"=window.open('"+u+"','"+id+"','"+f+"')");eval(id+".focus()");}
}

function tmt_winControl(id,c){ 
	var d=eval(id)==null||eval(id+".closed");
	if(!d){eval(id+"."+c);}
}