var Shop = {
	
	// initialisation function
	start : function(){
	
		Shop.behaviour();
	},
	// apply behaviours to elements via CSS selectors	
	behaviour : function() {
		$$('#name').each(function(el) {
			el.onfocus = function()
			{
				if (el.value == "Your Name") {
					el.value = "";
				}
			}
			el.onblur = function()
			{
				if (el.value == "") {
					el.value = "Your Name";
				}
			}
		});
		$$('#email').each(function(el) {
			el.onfocus = function()
			{
				if (el.value == "Your email address") {
					el.value = "";
				}
			}
			el.onblur = function()
			{
				if (el.value == "") {
					el.value = "Your email address";
				}
			}
		});
		$$('#phone').each(function(el) {
			el.onfocus = function()
			{
				if (el.value == "Your contact number") {
					el.value = "";
				}
			}
			el.onblur = function()
			{
				if (el.value == "") {
					el.value = "Your contact number";
				}
			}
		});
		$$('#description').each(function(el) {
			el.onfocus = function()
			{
				if (el.value.indexOf("Please contact me about product") != -1) {
					el.value = "";
				}
			}
			
		});
	}
};
 
document.observe('dom:loaded', Shop.start);
function doOrder()
{
	$('msg').innerHTML = "";
	new Ajax.Request(baseURL + 'shop/order',
	{
			method: 'post',
			postBody: Form.serialize($('frmOrder')),
			onComplete: function(tl) {
				result = tl.responseText.evalJSON();
				
				if (result.error == 1) {
					$('msg').innerHTML = result.msg;
				} else if (result.error == 0) {
					$('order').innerHTML = result.msg;
				}
			}
		}
	);
	
	return false;
				
}


