function closePrintView(){
	if (document.getElementById('printLayout')) {
		document.getElementById('printLayout').disabled = true;
		document.getElementById('printLayout').rel = 'alternate stylesheet';
		document.getElementById('printLayout').old_href = document.getElementById('printLayout').href;
		document.getElementById('printLayout').href = '#';
	}
}

function printView(){
	if (document.getElementById('printLayout')) {
		document.getElementById('printLayout').disabled = false;
		document.getElementById('printLayout').rel = 'stylesheet';
		if(document.getElementById('printLayout').old_href){
			document.getElementById('printLayout').href = document.getElementById('printLayout').old_href;
		}
	}
}

var form_array = Array('1','1','1','1','1','1','1','1','1','1','1','1','1');
var form_b_array = Array('1','1','1','1','1','1','1','1','1','1','1','1','1');
function fill_form(a_array, b_array){
	if(document.getElementById('same').checked == true){
		if((a_array[0] == 1)&&(b_array[0] == 1)){
			document.getElementById('s_title').value = document.getElementById('b_title').value;
		}
		if((a_array[1] == 1)&&(b_array[1] == 1)){
			document.getElementById('s_first_name').value = document.getElementById('b_first_name').value;
		}
		if((a_array[2] == 1)&&(b_array[2] == 1)){
			document.getElementById('s_last_name').value = document.getElementById('b_last_name').value;
		}
		if((a_array[3] == 1)&&(b_array[3] == 1)){
			document.getElementById('s_company').value = document.getElementById('b_company').value;
		}
		if((a_array[4] == 1)&&(b_array[4] == 1)){
			document.getElementById('s_address_1').value = document.getElementById('b_address_1').value;
		}
		if((a_array[5] == 1)&&(b_array[5] == 1)){
			document.getElementById('s_address_2').value = document.getElementById('b_address_2').value;
		}
		if((a_array[6] == 1)&&(b_array[6] == 1)){
			document.getElementById('s_postcode').value = document.getElementById('b_postcode').value;
		}
		if((a_array[7] == 1)&&(b_array[7] == 1)){
			document.getElementById('s_city').value = document.getElementById('b_city').value;
		}
		if((a_array[8] == 1)&&(b_array[8] == 1)){
			document.getElementById('s_country').value = document.getElementById('b_country').value;
		}
		if((a_array[9] == 1)&&(b_array[9] == 1)){
			document.getElementById('s_state').value = document.getElementById('b_state').value;
		}
		if((a_array[10] == 1)&&(b_array[10] == 1)){
			document.getElementById('s_phone').value = document.getElementById('b_phone').value;
		}
		if((a_array[11] == 1)&&(b_array[11] == 1)){
			document.getElementById('s_fax').value = document.getElementById('b_fax').value;
		}
		if((a_array[12] == 1)&&(b_array[12] == 1)){
			document.getElementById('s_email').value = document.getElementById('b_email').value;
		}
	}else{
		if((a_array[0] == 1)&&(b_array[0] == 1)){
			document.getElementById('s_title').value = '';
		}
		if((a_array[1] == 1)&&(b_array[1] == 1)){
			document.getElementById('s_first_name').value = '';
		}
		if((a_array[2] == 1)&&(b_array[2] == 1)){
			document.getElementById('s_last_name').value = '';
		}
		if((a_array[3] == 1)&&(b_array[3] == 1)){
			document.getElementById('s_company').value = '';
		}
		if((a_array[4] == 1)&&(b_array[4] == 1)){
			document.getElementById('s_address_1').value = '';
		}
		if((a_array[5] == 1)&&(b_array[5] == 1)){
			document.getElementById('s_address_2').value = '';
		}
		if((a_array[6] == 1)&&(b_array[6] == 1)){
			document.getElementById('s_postcode').value = '';
		}
		if((a_array[7] == 1)&&(b_array[7] == 1)){
			document.getElementById('s_city').value = '';
		}
		if((a_array[8] == 1)&&(b_array[8] == 1)){
			document.getElementById('s_country').value = '';
		}
		if((a_array[9] == 1)&&(b_array[9] == 1)){
			document.getElementById('s_state').value = '';
		}
		if((a_array[10] == 1)&&(b_array[10] == 1)){
			document.getElementById('s_phone').value = '';
		}
		if((a_array[11] == 1)&&(b_array[11] == 1)){
			document.getElementById('s_fax').value = '';
		}
		if((a_array[12] == 1)&&(b_array[12] == 1)){
			document.getElementById('s_email').value = '';
		}
	}
}

function display_livrare_fields(){
	if(document.getElementById('same').checked == true){
		document.getElementById('divLivrare').style.display = '';
	}else{
		document.getElementById('divLivrare').style.display = 'none';
	}
}
function change_s(val, field, contor, a_array, b_array){
	if(document.getElementById('same').checked == false){
		if((a_array[contor] == 1)&&(b_array[contor] == 1)){
			document.getElementById(field).value = val;
		}
	}
}
function clear_textarea(value){
	if(value == "Precizati alte informatii privind comanda"){
		document.getElementById('notes').value = "";
	}
}
