

var sgSearchProposalCurrent = 0;
var sgSearchInitial = '';

function tx_sgsearchCursors (Ereignis) {

  if (!Ereignis)
	// alert ('tx_sgsearchCursors');
    Ereignis = window.event;
	var process = 0;
	if (Ereignis.keyCode==40) {
		var maxLine = document.sgsearchform_ajax['tx_sgsearch[maxElements]'].value;
		if (sgSearchProposalCurrent<maxLine) {
			if (sgSearchProposalCurrent>0) {
				document.getElementById('sg_proposal_'+sgSearchProposalCurrent).className = '';
			}
			sgSearchProposalCurrent++;
			process = 1;
		}
	} 
	else if (Ereignis.keyCode==38) {
		if (sgSearchProposalCurrent>0) {
			document.getElementById('sg_proposal_'+sgSearchProposalCurrent).className = '';
			sgSearchProposalCurrent--;
 			process = 1;
		}
	}
	

	if (process) {
		//alert ('sgSearchProposalCurrent='+sgSearchProposalCurrent);

		if (sgSearchProposalCurrent<1) {
		   document.sgsearchform_ajax['tx_sgsearch[sword]'].focus();
		} else {
		   document.getElementById('sg_proposal_'+sgSearchProposalCurrent).className = 'sg_proposal_activ';
		}
	} else {
		word = document.sgsearchform_ajax['tx_sgsearch[sword]'].value;
		if (sgSearchInitial!=word) {
			tx_sgsearchprocessFormData(word);
		} 
	}
}

function tx_sgsearchMouseclick(Value) {
	document.sgsearchform_ajax['tx_sgsearch[sword]'].value=Value; 
	document.getElementById('sg_search_proposal').innerHTML=''; 
	document.sgsearchform_ajax['tx_sgsearch[sword]'].focus(); 
return(false);
}


function tx_sgsearchCheckProposal() {
	if (sgSearchProposalCurrent>0) {
	    myText = document.getElementById('sg_proposal_'+sgSearchProposalCurrent).text;
		if (!myText) {
			 myText = document.getElementById('sg_proposal_'+sgSearchProposalCurrent).innerText;
		}
		document.sgsearchform_ajax['tx_sgsearch[sword]'].value=myText;
		document.getElementById('sg_proposal_'+sgSearchProposalCurrent).className = '';
	}
    //alert ('Proposal was '+sgSearchProposalCurrent+' value='+myText);
	return (true);
}

