//MM Function to open Windows. 
//@depricated
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
} 

//Tobe
//Objekt zur Browsererkennung
function UserRef() {
	this.ua = navigator.userAgent.toLowerCase();
	this.nn4 = (document.layers);
	this.ie4 = (document.all && !document.getElementById);
	this.ie = (document.all);
	this.opera = (window.opera);
	this.gecko = (this.ua.indexOf('gecko') != -1 && this.ua.indexOf('safari') == -1);
	this.mozilla = (this.gecko && this.ua.indexOf('gecko/') + 14 == this.ua.length);
	this.safari = (this.ua.indexOf('safari') != -1);
	this.aol = (this.ua.indexOf('aol') != -1);
	this.dom = (document.getElementById);
}

var ur = new UserRef();


//Bookmark fr allle Browser
function bookmark(url, titel, comment) {    

 if (ur.ie && !ur.opera) { 
  	window.external.AddFavorite(url, titel)
 } else if (ur.gecko) {
  	window.sidebar.addPanel(titel, url, comment);
 } else {
	 window.alert('Bitte im Browser die Funktion STRG-D benutzen');
 }

}


//Alles markieren
checkflak = false;	
function check_all_boxes(obj,msg1,msg2){
  var o = document.forms[obj].elements;
  		
	if(!checkflak){	
		for (i=0; i<o.length; i++){
		
			  if (o[i].type == 'checkbox'){
				o[i].checked = true;
			  }
		}
		checkflak = true;
		return msg2;
	}
	
	if(checkflak){	
		for (i=0; i<o.length; i++){
		
			  if (o[i].type == 'checkbox'){
				o[i].checked = false;
			  }
		}
		checkflak = false;
		return msg1;
	}	
   
}


//Replaced alle Links zu mp3s mit einem Flashmusicplayer
function replaceMp3Links() {

	var page_links = document.links;
	for (var i=0; i<page_links.length; i++){
		if (page_links[i].href.match(/\.mp3$/i)) {
			var span = document.createElement("span");
			var url = "http://musicplayer.sourceforge.net/button/musicplayer.swf?&song_url="+escape(page_links[i].href)+"&song_title="+escape(page_links[i].innerHTML)
			var width = 12
			var height = 12
			code_str = ""
			code_str += " <object type=\"application/x-shockwave-flash\"\n"
			code_str += "data=\""+url+"\" \n"
			code_str += "width=\""+width+"\" height=\""+height+"\">\n"
			code_str += "<param name=\"movie\" \n"
			code_str += "value=\""+url+"\" />\n"
			code_str += "<param name=\"wmode\" \n"
			code_str +=	"value=\"transparent\" />\n"
			code_str += "</object>\n"
			span.innerHTML = code_str
			page_links[i].parentNode.insertBefore(span, page_links[i].nextSibling)
		}
	}

}

//jquery based funktion to put all links with the class "extern" open a new window 
function externlinks(){
	$('.extern').attr({ target: "_blank"});
}
