function textFieldActivate(id){
	if($("#"+id).attr('class').indexOf('activated') < 0 ) {
		// add activated class
		$("#"+id).addClass('activated');
		// reset value
		$("#"+id).val("");
		// set color black
		$("#"+id).css({'color' : 'black'});
	}
	return false;
}

function limitChars(textid, limit, infodiv)
{
	var text = $('#'+textid).val();	
	var textlength = text.length;
	if(textlength > limit)
	{
		$('#'+infodiv).css({'color' : '#c80000', 'font-weight': '700'});
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}
	else
	{
		$('#'+infodiv).css({'color' : 'black', 'font-weight': '500'});
		$('#' + infodiv).html(limit - textlength);
		return true;
	}
}

function setCompanyName(elementIdFrom, elementIdOn) {
	$('#'+elementIdOn).html( $('#'+elementIdFrom).val() );
}


function nominate(elementId, symbolDivId) {
	// if not nominated
	if($('#'+elementId).val() == 0) {
		$('#'+elementId).val(1);
		$('#'+symbolDivId).addClass('active');
	}
	else {
		$('#'+elementId).val(0);
		$('#'+symbolDivId).removeClass('active');
	}
}

function feedbackKleur(sliderId, waarde) {
	var r; var g; var b;
	if(waarde < 40) {
		r = 255;
		g = 150 * (waarde / 40);
		b = 0;
	}
	else {
		r = 255 - (255 - 15) / 40 * (waarde - 40);
		g = 180 + (180 - 150) / 40 * (waarde - 40);
		b = 40 - 40 / 40 * (waarde - 40);
	}
	r = Math.round(r);
	g = Math.round(g);
	b = Math.round(b);

	$("#"+sliderId).children('.ui-slider-range').css("background-color", 'rgb('+r+','+g+','+b+')');
}
