$(document).ready(function(){
	$("a.abook").click(function(){
		$("div.sdvd").hide();
		$("div.sbook").show();
	});
	$("a.advd").click(function(){
		$("div.sbook").hide();
		$("div.sdvd").show();
	});
	$("a.all").click(function(){
		$("div.sdvd").show();
		$("div.sbook").show();
	});
});

function showHide(shID) 
{
    if (document.getElementById(shID)) 
	{
        if (document.getElementById(shID+'-show').style.display != 'none') 
		{
            document.getElementById(shID+'-show').style.display = 'none';
            document.getElementById(shID).style.display = 'block';
        }
        else 
		{
            document.getElementById(shID+'-show').style.display = 'inline';
            document.getElementById(shID).style.display = 'none';
        }
    }
}


//variable that will increment through the images
var step = 1;
var whichimage = 1;

function slideit(){
	//if browser does not support the image object, exit.
	if (!document.images)
		return;

	document.images.slide.src = eval("image" + step + ".src");
	whichimage = step;
	if(step < 2)
		step++;
	else
		step = 1
	//call function "slideit()" every 2.5 seconds
	setTimeout("slideit()", 6500);
}

function slidelink()
{
	if (whichimage==1)
		window.location="/store"
	else if (whichimage==2)
		window.location="/news-events"
}


function fixH(one,two) {
if (document.getElementById(one)) {
var lh=document.getElementById(one).offsetHeight;
var rh=document.getElementById(two).offsetHeight;
var nh = Math.max(lh, rh); 
document.getElementById(one).style.height=nh+"px";
document.getElementById(two).style.height=nh+"px";
}
}

//this does it for three
function sortNum(a,b) { return b-a} 
function fixH2(one,two,three) {
if (document.getElementById(one)) {
var obj=new Array(3);
var option=[one,two,three];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum);
}	
nh1=nh.splice(1,2);
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";
}
}
}
//


window.onload=function(){
fixH('sidebar','content'); 
fixH2('left','right','centre');
}
