$(document).ready(function(){

	$(".submit").hover(function () {
		  $(this).css({
			'background' : 'url("images/on-get-call-back.gif") top center no-repeat',
			'color' : '#fff'
			});
		}, function () {
		  var cssObj = {
			'background' : 'url("images/get-call-back.gif") top center no-repeat',
			'color' : '#4d4a47'
		  }
		  $(this).css(cssObj);
		});

	$(function() {
		$('#photos').crossSlide({
		  sleep: 4, //in sec
		  fade: 1   //in sec
		}, [
		  { src: 'images/sheds/banner-garden-shed.jpg', href: 'garden-sheds.html' },
		  { src: 'images/sheds/banner-potting-shed-1.jpg', href: 'garden-sheds.html' },
		  { src: 'images/sheds/banner-summerhouse-1.jpg', href: 'garden-sheds.html' },
		  { src: 'images/garages/banner-double-garage-1.jpg', href: 'concrete-garages.html' },
		  { src: 'images/greenhouses/banner-greenhouse-1.jpg', href: 'glass-greenhouses.html' }
		]);
	});

	$(function() {
		$('#garages').crossSlide({
		  sleep: 4, //in sec
		  fade: 1   //in sec
		}, [
		  { src: 'images/garages/banner-double-garage-1.jpg', href: 'garages/double-garage-1b.jpg' },
		  { src: 'images/garages/banner-concrete-garage-1.jpg', href: 'garages/concrete-garage-1b.jpg' },
		  { src: 'images/garages/banner-concrete-garage-2.jpg', href: 'garages/concrete-garage-2b.jpg' }
		]);
	});

	$(function() {
		$('#greenhouses').crossSlide({
		  sleep: 4, //in sec
		  fade: 1   //in sec
		}, [
		  { src: 'images/greenhouses/banner-greenhouse-3.jpg', href: 'greenhouses/greenhouse-3b.jpg' },
		  { src: 'images/greenhouses/banner-greenhouse-1.jpg', href: 'greenhouses/lean-to-greenhouse-b.jpg' },
		  { src: 'images/greenhouses/banner-greenhouse-7.jpg', href: 'greenhouses/greenhouse-7b.jpg' }
		]);
	});

	$(function() {
		$('#sheds').crossSlide({
		  sleep: 4, //in sec
		  fade: 1   //in sec
		}, [
		  { src: 'images/sheds/banner-bespoke-summerhouse.jpg', href: 'sheds/bespoke-shed-decking-b.jpg' },
		  { src: 'images/sheds/banner-summerhouse-1.jpg', href: 'sheds/kensington-summerhouse.jpg' },
		  { src: 'images/sheds/banner-potting-shed-1.jpg', href: 'sheds/shedlands-potting-shed-b.jpg' },
		  { src: 'images/sheds/banner-garden-shed.jpg', href: 'sheds/bespoke-summerhouse-b.jpg' }
		]);
	});

});					
					
/*
Colorbox Call

This is for all inline content
the link needs to be done like this...

<a href="#blah" class="colorbox">blah</a>

and the hidden div like this...

<div class="details">
<div id="blah" class="colorbox">

</div>
</div>

*/

$("a.colorbox").click(
	function(){
		var href = "";
		href = $(this).attr("href");
		$(".colorbox").colorbox({width:"860px", inline:true, href:href});
		}
	);
	
$("a.colorboxphoto").colorbox({
	opacity:0.3
});

$("a.colorboxiframe").colorbox({
	width:"80%", height:"80%", iframe:true
});


/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+' '
win = window.open(mypage,myname,settings)
}


//the end



//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('hover')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/hover (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/hover (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/hover (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();







//Defines bookmark/favourite details and messeges for different browsers

var bookmarkurl="http://www.garagesandsheds.co.uk/";
var bookmarktitle="Garages, Sheds and Greenhouses - GSG Buildings";

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle);

else if (window.sidebar) 
        alert('This feature only works for Internet Explorer, use Control+D to bookmark This website');
        
else if( window.opera && window.print ) 
        alert('This feature only works for Internet Explorer, use Control+T to bookmark This website');
}

