// b b d  JavaScript


// Browser / Version / Platform Detect...
var browser = "default";
if (navigator.userAgent.indexOf("Opera")!=-1) { browser = "opera"; }
if (navigator.appName == "Microsoft Internet Explorer") { browser = "ie"; }
// IE version detection...
var verDetect = navigator.userAgent.toLowerCase();
function checkIt (string) { place = verDetect.indexOf(string) + 1; thestring = string; return place; }
var ieVersion = "";
if (checkIt('msie')) { ieVersion = verDetect.charAt(place + thestring.length); }
if (navigator.userAgent.indexOf('Mac') != -1) { MacOS = true } else { MacOS = false; }  // ************************************* NEW on 06/10/2011
if (navigator && navigator.platform && navigator.platform.match(/^(iPad)$/)) { ipad = true } else { ipad = false; }
if (navigator && navigator.platform && navigator.platform.match(/^(iPod|iPhone)$/)) { iphone = true } else { iphone = false; }
// end of Detect


function warn () {
	if ((browser == "ie") && (ieVersion < 9)) {
		document.getElementById('warning').innerHTML = "You are using Internet Explorer " + ieVersion + ". ";
		document.getElementById('warningend').innerHTML = "won't work in this browser.";
	}
	
}




function domail() { window.location = "mailto:bill@broadbeandesign.com"; }

function show(theid){
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		if (switch_id) { switch_id.className = 'show'; }
    }
}
function hide(theid){
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		if (switch_id) { switch_id.className = 'hide'; }
	}
}



// T H U M B N A I L S   /   R E C E N T   W O R K

var jobs = new Array();
jobs = ["","ipua","iprism","monica","htb","marlin","sewyou","majestic","csb"]
totalJobs = jobs.length-1;

function showjob (theone) {
	for (i = 1; i <= totalJobs; i++) { hide (jobs[i]); } // Hide all job details DIVs
	show (theone);
}

var speed = 45;
function thumbsRight () {
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 27) + 'px';",speed);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 17) + 'px';",speed*2);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 10) + 'px';",speed*3);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 6) + 'px';",speed*4);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 4) + 'px';",speed*5);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 3) + 'px';",speed*6);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 2) + 'px';",speed*7);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) - 1) + 'px';",speed*8);
	setTimeout ("sortButtons()",speed*9);
}
function thumbsLeft () {
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 27) + 'px';",speed);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 17) + 'px';",speed*2);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 10) + 'px';",speed*3);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 6) + 'px';",speed*4);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 4) + 'px';",speed*5);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 3) + 'px';",speed*6);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 2) + 'px';",speed*7);
	setTimeout ("thumbsDiv.style.left = (parseInt(thumbsDiv.style.left) + 1) + 'px';",speed*8);
	setTimeout ("sortButtons()",speed*9);
}
function sortButtons () {
	if (parseInt(thumbsDiv.style.left) >= 0) {
		document.getElementById('thumbleft').innerHTML = "";
	} else {
		document.getElementById('thumbleft').innerHTML = "<a href=\"javascript:thumbsLeft();\"></a>";
	}
	if (parseInt(thumbsDiv.style.left) <= (((totalJobs-4) * 70) * -1)) {
		document.getElementById('thumbright').innerHTML = "";
	} else {
		document.getElementById('thumbright').innerHTML = "<a href=\"javascript:thumbsRight();\"></a>";
	}
}








// T E S T I M O N I A L S
var activeTest = 0;
var tests = new Array();
var dotimg = "<img src=\"images/dot.gif\" alt=\"\" />";
var dotimgon = "<img src=\"images/dot-on.gif\" alt=\"\" />";

tests[0] = [];
tests[1] = ["In our constantly-evolving, plugged-in world you need a designer that understands the whole piece and can produce inspiring work within silly timeframes. Get Bill.","Richard Oxborrow. IT Director, iprism."];
tests[2] = ["Whatever we need &ndash; branding, artwork, GUI, flyers, web &ndash; Bill delivers great work no matter how tight the deadline is.","George McKenzie. Owner,<br />Marlin Software and Training Limited."];
tests[3] = ["This is my second website devised and designed by Bill. I love the clarity, the functionality and its ease of use. If you want a professional, creative job at a reasonable price I can&rsquo;t recommend Bill highly enough.","Monica Boxley. Designer &amp; Jeweller."];
tests[4] = ["I was delighted with my website. It was creative, sharp and easy to follow. Perfect!","Caroline Blackburn. Owner &amp; Designer,<br />Sew You Designs."];

function setTestimonial () {
	document.getElementById('testdots').innerHTML = "";
	for (i = 1; i <= (tests.length-1); i++) {
		document.getElementById('testdots').innerHTML += dotimg;
	}
	activeTest = Math.floor (Math.random() * (tests.length-1)) + 1; // selects a random number between 1 and the number of Quotes we have
	nextTestimonial (activeTest);
}
function nextTestimonial () {
	activeTest ++;
	if (activeTest > tests.length-1) { activeTest = 1; }
	switchTestimonial (activeTest);
}
function switchTestimonial (id) {
	document.getElementById('theQuote').innerHTML = "&ldquo;" + tests[id][0] + "&rdquo;";
	document.getElementById('theQuotee').innerHTML = tests[id][1];
	updateDots (id);
}
function updateDots (activeDot) {
	theDotsHTML = "";
	for (i = 1; i <= (tests.length-1); i++) {
		if (i == activeDot) {
			theDotsHTML += dotimgon;
		} else {
			theDotsHTML += dotimg;
		}
	}
	document.getElementById('testdots').innerHTML = theDotsHTML;
}



