function center_popup(url,name,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='
win = window.open(url,name,settings)
if(win.window.focus){win.window.focus();}
}


function popup(URL,Name,features) { 
  window.open(URL,Name,features);
}

function com_search_addField(f) {
	var table = document.getElementById('com_tblSearchFields');
	var caption;
	var completeraction;
	
	switch (f) {
		case 'name':
			caption = "Name:"
		break;
		
		case 'band':
			caption = "Band:"
			completeraction = "bands";
		break;
		
		case 'genre':
			caption = "Genre:"
			completeraction = "genres";
		break;
		
		case 'location':
			caption = "Location:"
			completeraction = "clubs";
		break;
	}
	
	if (fields%2 == 0) {
		var newRow = document.createElement("tr");
		var td = document.createElement("td");
		var newCaptionInput = document.createElement("input");
		
		newCaptionInput.id = "com_frmSearchField" + fields; 
		newCaptionInput.name = f;
		td.appendChild(document.createTextNode(caption));
		td.style.display = "none";
		newRow.appendChild(td);
		
		td = document.createElement("td");
		td.style.display = "none";
		td.appendChild(newCaptionInput);
		if (completeraction) {
			var newAutocompleterDiv = document.createElement("div");
			newAutocompleterDiv.className = "autocomplete";
			newAutocompleterDiv.id = "com_SearchFieldCompleter"+fields;
			document.getElementsByTagName("body")[0].appendChild(newAutocompleterDiv);
		}	
		newRow.appendChild(td);
		
		table.appendChild(newRow);
		
		new Effect.Appear(table.lastChild.firstChild, {duration: 0.2});
		new Effect.Appear(table.lastChild.childNodes[1], {duration: 0.2});
	} else {
		var td = document.createElement("td");
		td.style.display = "none";

		
		td.appendChild(document.createTextNode(caption));
		table.lastChild.appendChild(td);
		
		var newCaptionInput = document.createElement("input");
		newCaptionInput.id = "com_frmSearchField" + fields; 
		newCaptionInput.name = f;

		td = document.createElement("td");
		td.style.display = "none";
		td.appendChild(newCaptionInput);
		if (completeraction) {
			var newAutocompleterDiv = document.createElement("div");
			newAutocompleterDiv.id = "com_SearchFieldCompleter"+fields
			newAutocompleterDiv.className = "autocomplete";
			document.getElementsByTagName("body")[0].appendChild(newAutocompleterDiv);
		}
		table.lastChild.appendChild(td);
		new Effect.Appear(table.lastChild.childNodes[2], {duration: 0.2});
		new Effect.Appear(table.lastChild.lastChild, {duration: 0.2});
	}
	if (completeraction)
		new Ajax.Autocompleter("com_frmSearchField" + fields, "com_SearchFieldCompleter"+fields, 'member_autocompleter.php?aid=' + completeraction, {paramName: "value", minChars: 1});
	fields++;
}

var fields=0;
var page=0;
var searchFields = new Array();

function com_Search() {
	page = 0;
	var table = document.getElementById('com_tblSearchFields');
	var i = 0;
	
	searchFields = new Array();

	while (i < table.childNodes.length) {
		var ib1 = table.childNodes[i].childNodes[1].firstChild;

		var n = new Object();
		n["class"] = ib1.name;
		n["value"] = ib1.value;
		if (n["value"] != "") searchFields.push(n);
		
		if (table.childNodes[i].childNodes[3]) {
			var ib2 = table.childNodes[i].childNodes[3].firstChild;
			var n = new Object();
			n["class"] = ib2.name;
			n["value"] = ib2.value;
			if (n["value"] != "") searchFields.push(n);
		}
		i++;
	}
	document.getElementById('com_searchResults').innerHTML = "Lade...<br>";
	new Effect.SlideDown('com_searchResults', {duration: 0.2, queue: 'start'});
	xajax_com_Search(searchFields);
}

function com_SearchNextPage() {
	page++;
	xajax_com_Search(searchFields, page);
}

function com_SearchPage(p) {
	page = p;
	xajax_com_Search(searchFields, page);
}

function com_SearchPrevPage() {
	page--;
	xajax_com_Search(searchFields, page);
}

  function openplayer()
        {
			window.open('http://kunden.wundermedia.de/livedome/player/64/rockster.tv/','MBC','height=620,width=990,menubar=no,location=no,resizeable=no,status=no,toolbar=no,dependent=no,scrollbars=no');
        }