<!--

var drs_pers = new Array("foto_street","foto_jim","foto_drsequip","foto_drstrucktrailer","foto_stephanie","foto_msphone","foto_sheriMike");
var drs_persDesc = new Array("","","","","","","");
//var altDesc = new Array("The DRS Team, On Site","Project Manager, Jim Carswell","DRS Equipment","DRS Project Truck & Trailer","Account Manager, Stephanie Fernandez","President, Mike Strain","Project Manager Sheri Colvell and Mike Strain");
var drs_intro = new Array("foto_before","foto_after","foto_street","foto_kitchen","foto_fire","foto_jim","foto_atwork","foto_structure","foto_generator");
var drs_introDesc = new Array("","","","","","","","","","","");

var msb_pers = new Array("foto_sheriMike","foto_msbstaff05","foto_msphone","foto_sheri","foto_projdept","foto_acctdept");
var msb_persDesc = new Array("Project Manager Sheri Colvell and Mike Strain","MSB Staff","Mike Strain, President","Sheri Colvell, Project Manager","MSB Project Department","MSB Accounting Staff");
var msb_intro = new Array("foto_mastercuts","foto_luckyFront","foto_sunglass","foto_radioshack","foto_regis","foto_walmart","foto_jamba","foto_motherhood","foto_luckyInterior");
var msb_introDesc = new Array("Mastercuts, Kukui Grove, Li'hue, Kau'ai, Hawaii","Lucky Brand Jeans, Portland, Oregon","Sunglass Hut, Las Americas, San Ysidro, CA","Radio Shack, Santa Cruz, California","Regis, Bayshore Inn, Eureka California","Walmart Garden Center, Riverside, California","Jamba Juice, Escondido, California","Motherhood, Culver City, Nevada","Lucky Brand Jeans, Portland, Oregon");

var RAs = new Array(drs_intro,drs_introDesc,drs_pers,drs_persDesc,msb_intro,msb_introDesc,msb_pers,msb_persDesc);

function toggleDivs (obj) {
	$('#'+obj).removeAttr('style').css('display','block');
	sibClass = $('#'+obj).attr('class');
	$('#'+obj).siblings().each(function() {
		if (this.id != "" && this.id != "NULL" && this.className == sibClass) {
			this.style.display = "none";
		}
	});	
	$('a[title="'+obj+'"]').parent().find('a').removeClass("tabon");
	$('a[title="'+obj+'"]').addClass("tabon");
}
function setNums(w,n) {
	tx = document.getElementById("txt");
	tx.innerHTML = RAs[w+1][n];
	nm = document.getElementById("numbers");
	nm.innerHTML = '';
	for (i=0; i<RAs[w].length; i++) {
		if (i== n) {
			wot = '';
		} else {
			wot = 'numoff';
		}
		nm.innerHTML += '<a class="numon floatLeft center fontBold textWhite ' + wot + '" href="javascript:slideshow(' + w + ',' + i + ');">' + (i+1) + '</a>';
	}
}

function slideshow(w,z) {
	setNums(w,z);
	ft = document.getElementById("slide");
	ft.src = "/media/photos/" + RAs[w][z] + ".jpg";
	var z = z + 1;
	if (z == RAs[w].length) {
		var z = 0;
	}
	clearTimeout(theTimer);
	theTimer = setTimeout('slideshow(' + w + ',' + z + ')',10000);
}

function init(w) {
	setNums(w,0);
	theTimer = setTimeout('slideshow(' + w + ',1)',10000);
}
function swaphoto(photo) {
	$('.fadeshow > .fourhun').html('<img src="/media/photos/'+photo+'" width="400" />');	
}
$(document).ready(function() {

	var hash = window.location.hash;
	if (hash.length) {
		toggleDivs(hash.substring(1));
	}
	// XHTML COMPLIANT TARGET="_BLANK"
	$("a").each(function() {
		if ($(this).attr("href") &&
			$(this).attr("rel") == "external")
			$(this).attr("target","_blank");
	});
	if ($('.fadeshow').length) {
		$('head').append('<script type="text/javascript" src="/scripts/jquery.cycle.all.min.js"></script>');
		$('.fourhun').cycle({
			fx: 'fade'
		});
	}

	//SETUP FLEXIBLE TOGGLING
	if ($('.pagenav').length) {
		$('.pagenav').find('a').click(function() {
			if ($(this).attr('title')) {
				var obj = $(this).attr('title');
				toggleDivs(obj);
			}
		});
	}
	if ($('.toggle').length) {
		$('.toggle').each(function() {
			$(this).click(function() {
				var parentTag = $(this).parent().get(0).tagName.toLowerCase();
				var toggled = parentTag == 'p' || parentTag == 'h2' ? $(this).parent().nextAll('.guts') : $(this).nextAll('.guts')
				obj = parentTag == 'h2' ? $(this).parents('div.module').find('a.toggle') : $(this);
				var collapsed = obj.hasClass('btn-collapse') ? true : false;
				var linkhtml = obj.html().split(' ');
				if ( collapsed )  {
					obj.removeClass('btn-collapse').attr('title','Expand');
					linkhtml[0] = 'Show';
				} else {
					obj.addClass('btn-collapse').attr('title','Collapse');
					linkhtml[0] = 'Hide';
				}
				var newhtml = linkhtml.join(' ');
				obj.html(newhtml);
				toggled.slideToggle(300,'swing');
				
			});
		});
	}
});

//-->
