function checkquote(form){
	errors='';
	if(form.quotee.value=='')
		errors+="You forgot to enter the quotee\n";
	if(form.date.value=='')
		errors+="You forgot to enter the date\n";
	if(form.quote.value=='')
		errors+="You forgot to enter the quote\n";
	if(errors!='')
		alert(errors);
	else{
		var myRequest = new Request({
			url: 'index.php?id=99',
			data: 'quote='+form.quote.value+'&quotee='+form.quotee.value+'&date='+form.date.value,
			async: 'false',
			onSuccess: function(responseText, responseXML) {
				if(responseText=="")
				{
					window.location="index.php?id=7";
				}
				else
					alert("Something's gone wrong;\n"+responseText);				
			}
		});
		myRequest.send();
	}
	
	//we doen zelf redirecten
	return false;
}
function delete_quote(quote){
	if(confirm("Deze quote verwijderen?")){
		quoteid=quote.id.split('_')[1];
		var myRequest = new Request({
				url: 'index.php?id=98',
				data: 'deletequote='+quoteid,
				async: 'false',
				onSuccess: function(responseText, responseXML) {
					if(responseText=="")
					{
						quote.destroy();
					}
					else
						alert("Something's gone wrong;\n"+responseText);				
				}
			});
			myRequest.send();
	}
}

window.addEvent('load', function() {
	new DatePicker('.DatePickerQuotes', { pickerClass: 'datepicker_vista',allowEmpty: 'true' ,  inputOutputFormat: 'Y-m-d',format: 'Y-m-d' });
});

function morequotes(el){
	if(typeof(document.numquotes)=='undefined')
		document.numquotes=1;
	new Request.HTML({url:'index.php?id=96',append: el.getParent(),onSuccess: function(responseText, responseXML) {
		document.numquotes++;
		el.inject(el.getParent(),'bottom');
	}}).post({'viewfrom':10*document.numquotes});	
}
