/**
 * @author Piotr
 */

function copy_licensor_details(){
	document.edit_form.elements["form[licensor]"].value = document.edit_form.licensor.value;
	document.edit_form.elements["form[licensor_id]"].value = document.edit_form.licensor_id.value;
}

function copy_licensee_details(){
	document.edit_form.elements["form[licensee]"].value = document.edit_form.licensee.value;
	document.edit_form.elements["form[licensee_id]"].value = document.edit_form.licensee_id.value;
}

function reload_indication(elem, container, indication, name){
	ShowPage('licensing_disease_area.php?mode=indication&disease_id=' + elem.value + '&indication=' + indication + '&name=' + name,container);
}

function validateForm(){
	output = '';
	
	document.edit_form['form[licensor]'].style.background="white";
	document.edit_form['form[licensor_id]'].style.background="white";
	document.edit_form['form[licensee]'].style.background="white";
	document.edit_form['form[licensee_id]'].style.background="white";
	document.edit_form['form[currency_id]'].style.background="white";
	document.edit_form['form[deal_date]'].style.background="white";
	
	if (document.edit_form['form[licensor]'].value == '') {
		document.edit_form['form[licensor]'].style.background="yellow";
		output+='Licensor\n';
	}
	if (document.edit_form['form[licensor_id]'].value == '') {
		document.edit_form['form[licensor_id]'].style.background="yellow";
		output+='Licensor ID\n';
	}
	if (document.edit_form['form[licensee]'].value == '') {
		document.edit_form['form[licensee]'].style.background="yellow";
		output+='Licensee\n';
	}
	if (document.edit_form['form[licensee_id]'].value == '') {
		document.edit_form['form[licensee_id]'].style.background="yellow";
		output+='Licensee ID\n';
	}
	if (document.edit_form['form[currency_id]'].value == '0') {
		document.edit_form['form[currency_id]'].style.background="yellow";
		output+='Currency\n';
	}
	if (document.edit_form['form[deal_date]'].value == '') {
		document.edit_form['form[deal_date]'].style.background="yellow";
		output+='Year of deal\n';
	}
	
	
	if (output == ''){
		document.edit_form.submit();
		//alert('ok');
	}
	else {
		alert('Please enter a value in following fields:\n\n'+output);
	}
}