
// ST - 29.06.09 - Wenn Adressvorschlag und User Form ueber Enter abschickt Funktion zum Felder befuellen ausfuehren
function checkkey(e,f) { 
	if (!e) e = window.event;
	key = e.keyCode;
    if(key == 13) {
	  if (document.getElementById("adress_suggestions") && document.getElementById("adress_suggestions").value == 1) {
	  	fill_form_fields();
	  }	 
      f.submit();
   } 
}

function showfield(field_id,showit){
	var field=document.getElementById(field_id);
	if (field){
		if (showit)	field.style.display="";
		else field.style.display="none";
	}
}

function private_register(){
	// doch immer anzeigen
	// showfield('profile_field',true);
	showfield('company_firstname',false);
	showfield('company_field',false);
	showfield('company_field2',false);
	showfield('company_field3',false);
	showfield('department_field',false);
	showfield('branch_field',false);
	showfield('responsibility_field',false);
}

function company_register(){
	// showfield('profile_field',false);
	showfield('company_firstname',true);
	showfield('company_field',true);
	showfield('company_field2',true);
	showfield('company_field3',true);
	showfield('department_field',true);
	showfield('branch_field',true);
	showfield('responsibility_field',true);

}

/* wm /09.06.08 / Popups */
function MM_window(theURL,wname,features) {
window.open(theURL,wname,features);
}

function fill_form_fields()
{	
	var active_option = document.registrierungsformular.accept_adress.selectedIndex;
	document.registrierungsformular.city.value=document.registrierungsformular.accept_adress.options[active_option].getAttribute('city');
	document.registrierungsformular.address.value=document.registrierungsformular.accept_adress.options[active_option].getAttribute('street');
	document.registrierungsformular.post_code.value=document.registrierungsformular.accept_adress.options[active_option].getAttribute('plz');
	document.registrierungsformular.accept_adress.value=document.registrierungsformular.accept_adress.options[active_option].value;
}

function articledetail_popup(pid, pk) {
    window.open("/_misc/popup/detail/article_detail.cfm?pk=" + pk + "&pid=" + pid, "Artikel", "width=650,resizable=yes, scrollbars=yes,");
}

function set_rating(pk, rating)
{
	document.getElementById('ratingscore_' + pk).className = 'score score-' + rating;
}
function set_ratingmessage(pk, msg) {
	document.getElementById('ratingmessage_' + pk).innerHTML = msg;
}
function do_rating(pk, rating, link) {
	document.location.href = link + '&op=rate&opv=' + pk + '&rating=' + rating;
}