
function drop( id ){
	
	var ok = confirm("Dieses Ad wirklich unwiderruflich aus der Kategorie löschen?");
	
	if( ok ){
		document.location.href = '?action=bannerliste&mode=drop&id='+ id;
	}
}

function mdrop( arr ){
	
	var ok = confirm("Diese Ads wirklich unwiderruflich aus der Kategorie löschen?");
	
	var ids = "";
	for(var i = 0; i < arr.length; i++ ){
		if(i != arr.length){
			ids += arr[i]+",";
		}else{
			ids += arr[i];
		}
	}
	
	if( ok ){
		document.location.href = '?action=bannerliste&mode=drop&ids='+ ids;
	}
}

function bview( id ){
	
	if( id != 0 ){
		document.location.href='?action=bannerview&id=' + id;
	}
	return false;
}

function bdrop( id ){
	
	if( id != 0 ){
		var ok = confirm("Diesen Banner wirklich unwiderruflich löschen? Es werden alle Ads mit diesem Banner ebenfalls unwiderruflich gelöscht!");
		
		if( ok ){
			document.location.href = '?action=bannereintragen&mode=b_drop&id='+ id;
		}
	}
}

function bcdrop( id ){
	
	if( id != 0 ){
		var ok = confirm("Diesen Bannercode wirklich unwiderruflich löschen? Es werden alle Ads mit diesem Banner ebenfalls gelöscht!");
		
		if( ok ){
			document.location.href = '?action=bannercodeeintragen&mode=b_drop&id='+ id;
		}
	}
}

function status( id ){
	
	var ok = confirm("Status dieses Ads wirklich ändern?");
	
	if( ok ){
		document.location.href = '?action=bannerliste&mode=status&id='+ id;
	}	
}

function mstatus( ids ){
	
}

function reset( id ){
	var ok = confirm("Ad wirklich unwiderruflich auf 0 zurücksetzen?");
	
	if( ok ){
		document.location.href = '?action=bannerliste&mode=reset&id='+ id;
	}
}

function mreset( ids ){
	
}

var checkflag = "false";
function check(field) {

	var i = 0;
	if (checkflag == "false"){
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = "true";
		return " keine "; 
	}
	else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false; 
		}
		checkflag = "false";
		return " alle "; 
	}
}

function replaceAll(text, strA, strB)
{
	while ( text.indexOf(strA) != -1)
	{
    	text = text.replace(strA,strB);
	}
	return text;
}

function mover(id){
	id.setAttribute('bgcolor', '#DDDDEF', 0);
}

function mout(id){
	id.setAttribute('bgcolor', '#FFFFFF', 0);
}


/**
 * Kategorie editieren
 * @param id
 * @return
 */
function cat_edit( id, name, format, color ){
	
	document.getElementById('kategoriebearbeiten').style.display='block';
	document.getElementById('kategorietable').style.display='none';
	document.getElementById('cat_id').value=id;
	document.getElementById('cat_name').value=name;
	document.getElementById('cat_format').value=format;
	document.getElementById('cat_color').value=color;
}

function cat_view(){
	
	document.getElementById('kategoriebearbeiten').style.display='none';
	document.getElementById('kategorietable').style.display='table';
}

function cat_drop( id ){
	
	var ok = confirm("Diese Kategorie wirklich unwiderruflich löschen? Alle enthaltenen Ads werden ebenfalls gelöscht!");
	
	if( ok ){
		document.location.href = '?action=kategorien&mode=drop&id='+ id;
	}
}