function update(month, year)
{
	var day_container = document.getElementById('day_container');
	var month_days = new Array(12);
	month_days['01'] = 31;
	month_days['02'] = 28;
	month_days['03'] = 31;
	month_days['04'] = 30;
	month_days['05'] = 31;
	month_days['06'] = 30;
	month_days['07'] = 31;
	month_days['08'] = 31;
	month_days['09'] = 30;
	month_days['10'] = 31;
	month_days['11'] = 30;
	month_days['12'] = 31;
	
	if( month.value != '' && year.value != '' )
	{
		if( (year.value % 4 ) == 0 && month.value == '02' )
		{
			 month_days['02'] = 29;
		}
		var days = ' DD <select name="date">';
		for(var i=0; i < month_days[month.value]; i++)
		{
			var x = i + 1;
			x = x + '"';
	
			if( x.length < 3 ) x = '0' + x;
			var y = x.substr(0, 2 );
	
			days += '<option value="' + y + '">' + y + '</option>';
		}
		days += '</select>';
		day_container.innerHTML = days;
	}
}

function updatefields()
{
	var sameas = document.getElementById('sameas');
	
	var customer_name = document.getElementById('customer_name');
	var customer_address = document.getElementById('customer_address');
	var customer_telephone_contact = document.getElementById('customer_telephone_contact');
	var customer_mobile = document.getElementById('customer_mobile');
	var customer_email = document.getElementById('customer_email');

	var name_of_recipient = document.getElementById('name_of_recipient');
	var address = document.getElementById('address');
	var telephone_contact = document.getElementById('telephone_contact');
	var mobile = document.getElementById('mobile');
	var email = document.getElementById('email');
	
	if( sameas.checked )
	{
		customer_name.value = name_of_recipient.value;
		customer_address.value = address.value;
		customer_telephone_contact.value = telephone_contact.value;
		customer_mobile.value = mobile.value;
		customer_email.value = email.value;
		
		customer_name.readOnly = true;
		customer_address.readOnly = true;
		customer_telephone_contact.readOnly = true;
		customer_mobile.readOnly = true;
		customer_email.readOnly = true;
		
		customer_name.style.backgroundColor = '#ccc';
		customer_address.style.backgroundColor = '#ccc';
		customer_telephone_contact.style.backgroundColor = '#ccc';
		customer_mobile.style.backgroundColor = '#ccc';
		customer_email.style.backgroundColor = '#ccc';
	}
	else
	{
		customer_name.value = '';
		customer_address.value = '';
		customer_telephone_contact.value = '';
		customer_mobile.value = '';
		customer_email.value = '';
		
		customer_name.readOnly = false;
		customer_address.readOnly = false;
		customer_telephone_contact.readOnly = false;
		customer_mobile.readOnly = false;
		customer_email.readOnly = false;
		
		customer_name.style.backgroundColor = '#fff';
		customer_address.style.backgroundColor = '#fff';
		customer_telephone_contact.style.backgroundColor = '#fff';
		customer_mobile.style.backgroundColor = '#fff';
		customer_email.style.backgroundColor = '#fff';
	}

}


function textUpdate()
{
	var sameas = document.getElementById('sameas');
	
	var customer_name = document.getElementById('customer_name');
	var customer_address = document.getElementById('customer_address');
	var customer_telephone_contact = document.getElementById('customer_telephone_contact');
	var customer_mobile = document.getElementById('customer_mobile');
	var customer_email = document.getElementById('customer_email');

	var name_of_recipient = document.getElementById('name_of_recipient');
	var address = document.getElementById('address');
	var telephone_contact = document.getElementById('telephone_contact');
	var mobile = document.getElementById('mobile');
	var email = document.getElementById('email');
	
	if( sameas.checked )
	{
		customer_name.value = name_of_recipient.value;
		customer_address.value = address.value;
		customer_telephone_contact.value = telephone_contact.value;
		customer_mobile.value = mobile.value;
		customer_email.value = email.value;
	}
}


function clearMe(obj)
{
	obj.value = '';
}


var pop_window = '';
function open_window( url ) {
    if ( ! url ) {
         return false;
    }

    if (!pop_window.closed && pop_window.location) {
        pop_window.focus();
    } else {
        pop_window=window.open( url, '',
            'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
            'scrollbars=yes,resizable=yes,' +
            'width=' + 620 + ',' +
            'height=' + 600 );
    }

    if ( ! pop_window.opener ) {
       pop_window.opener = window.window;
    }

    if ( window.focus ) {
        pop_window.focus();
    }

    return true;
}