var browser=navigator.appName;
var b_version=navigator.appVersion;
function swapImage(imgName, beforeImg, paddingTopNum) {
	newImg = '<img src="images/gallery/' + imgName + '.jpg" class="floatLeft"/>';
	if (beforeImg) {
		newImg = newImg + '<div id="beforeImage" class="beforeImg">Before<br/><img style="align-vertical: bottom;" src="images/gallery/before/' + beforeImg +'.jpg"/></div>';
	}
	document.getElementById('centralImage').innerHTML = newImg;	
	if (paddingTopNum) {
		paddingTopPx = paddingTopNum + 'px';
		document.getElementById('centralImage').style.paddingTop = paddingTopPx;
		if (beforeImg) {
			paddingDifference = paddingTopNum - 29;
			adjustment = 230 - paddingDifference;
			beforePaddingTop = adjustment + 'px';
			document.getElementById('beforeImage').style.paddingTop = beforePaddingTop;		
		}
	}
	else {
		document.getElementById('centralImage').style.paddingTop = '29px';
		if (beforeImg) {
			document.getElementById('beforeImage').style.paddingTop = '230px';
		}
	}
}

function loadIframe(category) {
	iframeSrc = 'resources/' + category + '.html';
	document.getElementById('resourcesFrame').src = iframeSrc;
	document.getElementById('startImage').style.display = 'none';
	document.getElementById('resourcesFrame').style.display = 'block';
}
var onQuote = 1;
var onImg = 1;
function fadeDownUp() {
	var downId = 'rotatingText' + onQuote;
	if (onQuote == 4) {
		nextQuote = 1;
	}
	else {
		nextQuote = onQuote + 1;
	}
	var upId = 'rotatingText' + nextQuote;
	new Effect.Fade(downId);
	_(downId).className = 'rotatingText unhide';
	_(upId).className = 'rotatingText unhide';
	new Effect.Appear(upId);	
	onQuote = nextQuote;
	rotateQuote();
}
function rotateQuote() {		
		var t = setTimeout("fadeDownUp()",9000);	 
}
function fadeDownUpImg() {
	_('centralImage').style.backgroundImage = 'none';
	var downId = 'rotatingImage' + onImg;
	if (onImg == 3) {
		nextImg = 1;
	}
	else {
		nextImg = onImg + 1;
	}
	var upId = 'rotatingImage' + nextImg;
	new Effect.Fade(downId);
	/*_(downId).className = 'rotatingImage hide';*/
	_(upId).className = 'rotatingImage unhide';
	new Effect.Appear(upId);	
  
	onImg = nextImg;
	rotateImage();
}
function rotateImage() {
    if (b_version.indexOf('Safari')!= -1) {
      return
    }
		var t = setTimeout("fadeDownUpImg()",5000);	 
}
function testimonialsOn() {
	_('allTestimonials').style.visibility = 'visible';
	_('allTestimonials').style.overflowY = 'auto';
	_('allTestimonials').style.opacity = 0;
	_('allTestimonials').style.filter = 'alpha(opacity=0)';
	new Effect.Appear('allTestimonials');
	_('allTestimonials').className = 'unhide';
	_('rotatingTextContainer').style.display = 'none';
}
function testimonialsOff() {	
	_('allTestimonials').style.visibility = 'hidden';
	_('allTestimonials').style.overflowY = 'hidden';
	_('allTestimonials').className = 'hide';
	_('rotatingTextContainer').style.display = 'block';
}