// JavaScript Document



var addthis_config = {
   ui_click: true
}

function contactFormSubmit() 
	{
	var strPrivacy; 
	var strURL = "/ajax/contact-form.php";
	var strFirstname = $F('firstname');
	var strSurname = $F('surname');
	var strTel = $F('tel');
	var strEmail = $F('email');
	var strMessage = $F('message');
	if (document.contactForm.privacy.checked == true)
		{
		strPrivacy = '&privacy=' + $F('privacy');
		}
	else 
		{
		strPrivacy = "";
		}
	
	var strSubmit = $F('submit');
	
		
	$('contactFormWrapper').update("<div style=\"text-align:center; padding:16px\"><img src=\"/images/load.gif\" title=\"loading\" alt=\"loading\" /><br/><br/><b>please wait... message being sent</b></div>");
		
	new Ajax.Request(strURL, 
		{ 
		method: 'post', 
		postBody: 	'firstname=' + strFirstname + 
				'&surname=' + strSurname + 
				'&tel=' + strTel + 
				'&email=' + strEmail + 
				strPrivacy +  
				'&message=' + strMessage +
				'&submit=' + strSubmit ,
		onComplete: contactFormResponse 
		});
	}
						
function contactFormResponse(req)
	{
	var contactResponse = req.responseText;
	$('contactFormWrapper').update(contactResponse);
	}

function confirmLogout()
	{
	if (confirm('Are you sure you want to log-out?\nAny cart details will be lost!')) 
		{
    		document.location = 'users.php?action=logout';
 		}
	}
function doShow(lyr,but)
	{
	if ($(lyr))
		{
		$('divOverview').hide();
		if ($('divIng'))
			{
			$('divIng').hide();
			}
		$('divDirections').hide();
		if ($('divColours'))
			{
			$('divColours').hide();
			}
		$(lyr).show();
		
		$('butOverview').className='';
		if ($('divIng'))
			{
			$('butIng').className='';
			}
		$('butDirections').className='';
		if ($('divColours'))
			{
			$('butColours').className='';
			}
		$(but).className='currentTab';
		}
	}
function selectSwatch(id,txt,hex)
	{
	$('SwatchID').value=id; 
	$('colourPopup').fade({duration: 0.5}); 
	$('colourIndicatorUpdate').update('<img src=\"images/swatch.gif\" width=\"8\" height=\"8\" alt=\"\" hspace=\"3\" style=\"background-color: #' + hex + ';\" />'+txt); 
	}