// Image Cycle

$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'scrollLeft',
		speed:  500,
		timeout:  5000,
		pause:1,
        next:   '#next', 
    prev:   '#prev'

	});
});

// Newsletter validate
function validateForm()
{
var x=document.forms["newsletter"]["email"].value
if (x==null || x=="")
  {
  	alert("You must enter an email address to signup to the newsletter");
  	return false;
  }
  else
  {
	validemail=0;
	var checkStr = x;
	for (i = 0; i < checkStr.length; i++){
		if(checkStr.charAt(i)=="@")
			validemail |= 1;
		if(checkStr.charAt(i)==".")
			validemail |= 2;
	}		
	if(validemail != 3){
		alert("Please enter a valid email address.");
		return (false);
	}  
  }
}

//////////////Lightbox 
$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto();
		});


//////////////Validate Form
$(document).ready(function(){
	$("#commentForm").validate();
});

//////////////Validate Quick Quote
$(document).ready(function(){
	$("#quickquoteForm").validate();
});


///////Javascript Email Address Encoder
//  by www.stevedawson.com
function emailAddress()
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var name = 'sales';
	var domain1 = 'vant';
	var domain2 = 'age';
	var domain3 = 'cric';
	var domain4 = 'ket';
	var ext = 'co.uk'; 
	document.write('<a href="');
	document.write(first+second+third);
	document.write(name);
	document.write('&#64;');
	document.write(domain1+domain2+domain3+domain4);
	document.write('.');
	document.write(ext);  
	document.write('">'); 
	document.write('sales@vantagecricket.co.uk</a>');}
