
function do_search( dest ) {
	var obj = document.getElementById( 'txt_search' );
	var loc = www_main + 'action.php?search=' + obj.value;
	//alert(loc);
	getData( dest , loc );
} 

function do_add_rel() {
		alert('in');
		var sel = document.getElementById("rel_sel");
		
		alert(sel.value);
		
		alert(document.frm_rel.rel_sel.length);

var val = 0;

for( i = 0; i < document.frm_rel.rel_sel.length; i++ )
{
if( document.document.frm_rel.rel_sel.length[i].checked == true )
val = document.document.frm_rel.rel_sel.length[i].value;
}
alert( "val = " + val );

		var loc = www_main;
		var cat = document.getElementById("rel_id");
		loc += 'action.php?add_rel=' + sel.value + 
			   '&parent_id=' + current_item + 
			   '&rel_id=' + cat.options[cat.selectedIndex].value;
		alert(loc);
		//getData( 'sres' , loc );
}

function do_vote( uid , stat , base ) {
	obj = document.getElementById('item_' + uid );
	
	if( stat == 1 || stat==-1 ) {
		url = base.replace('templates/main/default','') + 'action.php?user_vote=1&uid=' + uid + '&vote=' + stat ; 
		//alert(url);
		getData( 'item_' + uid , url );
		return;
	}

	img = base + '/img/ctrl/';

	if( stat == 2 ) //show up
		img += 'rating_up.png';
	if( stat == 3 ) //show down
		img += 'rating_down.png';
	if( stat == 0 ) //reset
		img += 'rating.png';

	obj.style.background = 'url(' + img + ')';
	obj.style.backgroundRepeat = 'no-repeat';

}

var rel_marked;
function mark_item_rel( itm , max , state ,uid ) {
	
	if(max > 0 && state >= 0 && itm == rel_marked)  return;

	var obj = document.getElementById( itm );

	if(state == 1) 
	{
		//obj.style.border	= '1px dashed #990000';
		obj.style.background= '#ffcccc';
	}
	if(state == 0) {
		//obj.style.border	= '0px';
		obj.style.background = '#eeeeee';
	}
	if(state == -1) {
		//set selection
		var sel = document.getElementById("selected_rel");
		sel.innerHTML = uid ;
		rel_marked = itm;
		//obj.style.border	= '1px dashed #990000';
		obj.style.background= '#FF6666';
		//unmark previous
		for(i=0;i<max;i++){
			var s = 'rel_' + i;
			if( itm != s )
				mark_item_rel( s , -1 , 0 );
		}
	}
}

function top_hover( target , status , base ) {
	
	obj = document.getElementById(target);
	img = base ;
	if(status == 0) img += '_n.png';
	if(status == 1) img += '_h.png';
	//alert(img);
	obj.style.background = 'url(' + img + ')';
	obj.style.backgroundRepeat = 'repeat-x';
}

function open_mail(order_id) {
	loc = www_main + 'inc/page.mail.php?order_id=' + order_id;
	w = window.open( loc , 'Drumcenter Print' , "width=800,height=600,left=100,top=100,status=1,toolbar=1,menubar=1,scrollbars=1");
	w.focus();
}

function open_print(order_id) {
	loc = www_main + 'inc/page.print.php?order_id=' + order_id;
	w = window.open( loc , 'Drumcenter Print' , "width=800,height=600,left=100,top=100,status=1,toolbar=1,menubar=1,scrollbars=1");
	w.focus();
}

function do_sc_refresh( ) {
	loc = www_main + 'class.action.php?action=sc_refresh';
	getData( 'sc_navi' , loc );
}

function do_sc_change( target , idx , item ) {
	var cbo = get_object( 'd_combo_item_' + idx , 'select' , 0 );
	loc = www_main + 'action.php?action=sc_change&cnt=' + cbo.options[cbo.selectedIndex].value + '&uid=' + item ;
	getData( target , loc );
	do_sc_refresh( target );
}

function do_sc_change_class( target , idx , item ) {
	var cbo = get_object( 'd_combo_item_class_' + idx , 'select' , 0 );
	loc = www_main + 'action.php?action=sc_change_class&class=' + cbo.options[cbo.selectedIndex].value + '&uid=' + item ;
	alert(loc);
	getData( target , loc );
}

function do_sc_remove( target , idx , item ) {
	loc = www_main + 'action.php?action=sc_remove&uid=' + item ;
	if (confirm("Sind Sie sicher?"))  {
		getData( target , loc );
		do_sc_refresh( );
	}
}