// Contact Form

function blankInput(orgValue,newValue)
{
	if (orgValue==newValue)
		return "";
	else
		return newValue;
}

function sendForm()
{
	if($("#contact").val()=="" || $("#email").val()=="" || $("#company").val()=="" || $("#phone").val()==""|| $("#message").val()=="")
	{
		alert('Have you filled in all the boxes?'); return;
	}

$.post("/cgi-sys/formmail.pl",
	{
		recipient: $("#recipient").val(), subject: $("#subject").val(), company: $("#company").val(),contact: $("#contact").val(), email: $("#email").val(),phone: $("#phone").val(), message: $("#message").val() 
	},
	function(data)
	{
		$("#mailform").remove();
		$("#contactform").append("<p>Thank you for your enquiry.<br />We will respond shortly.</p>");
	});
}

// Newsticker

$(document).ready(function() 
{
	var options = 
	{
  		newsList: "#twitter",
 		startDelay: 10,
 		tickerRate: 70,
 		controls: false,
 		ownControls: false,
 		stopOnHover: false,
 		resumeOffHover: true
	}
	$().newsTicker(options);


// FancyBox

$("a[rel=example_group]").fancybox(
		{
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) 
		{
			return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	/*
	*   Examples - various
	*/
	
	$("#various1").fancybox(
	{
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("#various2").fancybox(
	{
		ajax : 
		{
			type	: "POST",
			example	: 'myexample=test'
		}
	});

	$("#various3").fancybox(
	{
		'width'				: '100%',
		'height'			: '100%',
		'autoScale'     	: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	$("#various4").fancybox(
	{
		'padding'           : 0,
		'autoScale'     	: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
});


// Google Analytics

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-655222-35']);
_gaq.push(['_trackPageview']);

(function() 
{
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


