// JavaScript Document

// ---JavaScript HREF Evaluation --- By Robbie Lewis --------------------------
// Check for 'www.' prefix on URL from the client-side.
var tmpurl=location.href;
if (tmpurl.substring(7,11)=="www.") {
prefix="www.";
} else {
window.location = "http://www.documentlogic.co.uk/default.php"
}
// document.write(prefix);
// ----------------------------------------------------------------------------

$(document).ready(function(){
$("a.cat").attr("href","#");


$("a.cat1").click(function(){
$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand1").load("http://" + prefix + "documentlogic.co.uk/subcats/1.html", function() { $("img.buynowimg").hide() });
$("div.navbar").find("div#toexpand1:hidden").slideDown("5000", function() { $("img.buynowimg").show() });  
});




$("a.cat2").click(function(){ 
	$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand2").load("http://" + prefix + "documentlogic.co.uk/subcats/2.html");
$("div.navbar").find("div#toexpand2:hidden").slideDown("5000"); 
});

$("a.cat3").click(function(){ 
	$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand3").load("http://" + prefix + "documentlogic.co.uk/subcats/3.html");
$("div.navbar").find("div#toexpand3:hidden").slideDown("5000"); 
});

$("a.cat4").click(function(){ 
	$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand4").load("http://" + prefix + "documentlogic.co.uk/subcats/4.html");
$("div.navbar").find("div#toexpand4:hidden").slideDown("5000"); 
});

$("a.cat5").click(function(){ 
	$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand5").load("http://" + prefix + "documentlogic.co.uk/subcats/5.html");
$("div.navbar").find("div#toexpand5:hidden").slideDown("5000"); 
});


$("a.cat6").click(function(){ 
	$("div.navbar").find("div.toexpand:visible").slideUp("5000"); 
$("div#toexpand6").load("http://" + prefix + "documentlogic.co.uk/subcats/3.html");
$("div.navbar").find("div#toexpand6:hidden").slideDown("5000"); 
});



$("a.retract").click(function(){ $("div.navbar").find("div.toexpand:visible").slideUp("5000"); });
$("input.buttonCslideup").click(function(){ $("div.navbar").find("div.toexpand:visible").slideUp("5000"); });



function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}

function addFade() {
		doBGFade(this,[255,255,100],[255,255,255],'transparent',75,20,4);
	}
	
function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) {
	if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
	var actStep = 0;
	elem.bgFadeInt = window.setInterval(
		function() {
			elem.style.backgroundColor = "rgb("+
				easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
				easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
				easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
			actStep++;
			if (actStep > steps) {
			elem.style.backgroundColor = finalColor;
			window.clearInterval(elem.bgFadeInt);
			}
		}
		,intervals)
}


});