/* thema Voting ------------------------------------------------------  */   	    
function thema_sendvoting (tid, node_id, note, div_punkte, div_info, div_punkte_second) {	
				//thema_id, kategorie, note: 1 oder -1, html_element Punkte, html_element Info, 2. Element Punkte (2 Listen auf einer Seite)	
	
	if (thema_sendvoting_flag[tid] == false)
	{
		thema_sendvoting_flag[tid] = true;
		
		var sUrlVoting = "index.php?Action=setThemaVoting&node_id="+node_id+"&tid="+tid+"&note="+note;
	
		var handleSuccessVoting = function(o){   
	
			if(o.responseText !== undefined){   			
				aResponses = o.responseText.split("^"); /* ok^note^note_pos^note_neg*/	
			
				if (aResponses[0] == "ok") {
					/* zahl refreshen */								
					
					document.getElementById(div_punkte).innerHTML = aResponses[1];
					currentThemaVoting[tid] = aResponses[1];
					
					//Detailnoten (nur Detailseite) ------------------------------
					if (document.getElementById('thema_votes_pos')) document.getElementById('thema_votes_pos').innerHTML = aResponses[2];
					if (document.getElementById('thema_votes_neg')) document.getElementById('thema_votes_neg').innerHTML = aResponses[3];
					
					//schriftfarben (nur Detailseite) -----------------------------
					if ('thema_votes_box_detail_'+tid == div_punkte) {
						if (aResponses[1] >= 0) mycolor = '#7BB779';
						else mycolor = '#FB7A36';
						
						if (document.getElementById(div_punkte)) document.getElementById(div_punkte).style.color = mycolor;
						if (document.getElementById(div_punkte+'_label')) document.getElementById(div_punkte+'_label').style.color = mycolor;
					}
					
					showVotingInfo ("Deine Stimme wurde erfasst", div_info);
					
					//zweite Liste - Wert updaten ----------------------------------
					if (div_punkte_second != "") {
						if (document.getElementById(div_punkte_second)) document.getElementById(div_punkte_second).innerHTML = aResponses[1];
					}
					
					
					
				}
				else {
					/* error */	
					if (aResponses[0] == "doppelvote") showVotingInfo ("Thema wurde bereits von dir bewertet.", div_info);
				}
			
				
		
	
			}   
		}

		var handleFailureVoting = function(o){   
			/* Fehlerbehandlung */					
			thema_sendvoting_flag[tid] = false;
	   
		}   

		var callbackVoting =   
		{   
			success:handleSuccessVoting,   
			failure: handleFailureVoting,   
			argument: { foo:"foo", bar:"bar" }   
		};

		var requestVoting = YAHOO.util.Connect.asyncRequest('GET', sUrlVoting, callbackVoting);
	
	} //wenn nicht schon geklickt -------------------------------
	else {
		showVotingInfo ("Thema wurde bereits von dir bewertet.", div_info); 
	} 

}

function showVotingInfo (txt, div_info) {

	document.getElementById(div_info).innerHTML = txt;
	document.getElementById(div_info).style.display = 'block'; 
	
	window.setTimeout("closeVotingInfo ('"+div_info+"')", 2000);

}

function closeVotingInfo (div_info) {
	el = document.getElementById(div_info);
	el.style.display = 'none';
}

/*
function previewVoting(nr) {
	document.votinggfx.src = "images/voting_big_"+nr+".gif";
	document.getElementById('votinglabel').innerHTML = aVotingLabel[nr];
					
}

function remPrieviewVoting() {
	document.votinggfx.src = "images/voting_big_"+currentVoting+".gif";	
	document.getElementById('votinglabel').innerHTML = aVotingLabel[currentVoting];
}
*/
