var IE = /*@cc_on!@*/false;
var stu=false,bas=false,ins=false,res=false,loc=false;
var timeout,slidetimeout,lowerto,curslide=1,x,stuh,bash,insh,loch,resh,stuht,basht,insht,locht,resht;
var isstu=false,isbas=false,isins=false,isres=false,isloc=false;
function resizecontainer(){
	if(document.getElementById('faqleft')){//if not homepage
		if(document.getElementById('faqleft').offsetHeight>document.getElementById('testimonials').offsetHeight+document.getElementById('rightlinks').offsetHeight){
			thesize=document.getElementById('faqleft').offsetHeight+document.getElementById('headercenter').offsetHeight+115;
			document.getElementById('testimonials').style.height=document.getElementById('faqleft').offsetHeight-document.getElementById('rightlinks').offsetHeight-50+"px";
		}
		else{
			thesize=document.getElementById('headercenter').offsetHeight+document.getElementById('testimonials').offsetHeight+document.getElementById('rightlinks').offsetHeight+115;
			document.getElementById('faqleft').style.height=document.getElementById('testimonials').offsetHeight+document.getElementById('rightlinks').offsetHeight-60+"px";
		}
	} else
		thesize=777;
	if(window.innerHeight>=thesize-1){
		document.getElementById('container').style.height=window.innerHeight+"px";
		document.getElementById('footerLogo').style.height=window.innerHeight-(thesize-100)+"px";
		document.getElementById('footerNav').style.height=window.innerHeight-(thesize-100)+"px";
		document.getElementById('footershadow').style.height=window.innerHeight-(thesize-100)+"px";
	} else {
		document.getElementById('container').style.height=thesize+"px";
		document.getElementById('footerLogo').style.minHeight=100+"px";
		document.getElementById('footerNav').style.minHeight=100+"px";
		document.getElementById('footershadow').style.minHeight=100+"px";
	}
}
function randomtestimonial(){
	x=randomnum(0,7);
	switch(x){
		case 0:
			document.getElementById('testimonials').innerHTML="Pilates has made all the difference in the world in helping me be a successful masters athlete in softball and racquetball at the national level. I'm a 63 year old woman and has successfully recovered from a hip resurface one year ago! I have worked with Aimee Levesque over seven years and extensively during the recovery phase of my hip.  Pilates means core strength and endurance which translates into torque, power, and flexibility in sports. Smart Body Pilates Studio is state of the art and Aimee is a superb instructor and trainer. I look forward to continuing Pilates with Aimee for many sports years to come!\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Dee, 63 years old</span>";
			break;
		case 1:
			document.getElementById('testimonials').innerHTML="I have been taking Pilates for 6 years—3 years in California and 3 years in Raleigh at Smart Body Pilates. It is the best thing I have ever done and it changed by life. Building up my core muscles has toned up my body and taught me to how walk, sit, and stand more erect. Smart Body Pilates is the best studio I have found and it is like joining a small family. Aimee Levesque and Nicola Bullock are by far the two best instructors I have ever had.\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Ty</span>";
			break;
		case 2:
			document.getElementById('testimonials').innerHTML="What a treat to immerse my mind and body in a great workout at Smart Body Pilates!  I love the inviting atmosphere, the warm, smiling faces of the very professional, knowledgeable instructors that greet me, the challenging workouts and making new friends.  These fabulous instructors have tailored my workouts when I have had injuries so I can still get a great workout.  I can't seem to get enough of a good thing.\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Pat</span>";
			break;
		case 3:
			document.getElementById('testimonials').innerHTML="I wanted a total body workout in a friendly, non-threatening atmosphere and I found that at Smart Body Pilates. They have outstanding equipment, the best instructors and no matter your fitness level, this is the place for you. I always leave with a smile on my face and a sense of accomplishment that I did something for myself today!\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Karen</span>";
			break;
		case 4:
			document.getElementById('testimonials').innerHTML="For those, like me, who cannot bear mindless exercise, Pilates is definitely the way to go! It requires mental as well as physical focus. I need a challenge and I need to feel I've worked hard and accomplished something when I work out. Pilates gives that to me and it also makes me feel very positive!\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Melissa Podcasy, Carolina Ballet</span>";
			break;
		case 5:
			document.getElementById('testimonials').innerHTML="I have been taking Pilates at Smart Body with Aimee for 9 years. I started because of a chronic back condition. Within a couple of months I found my back issues greatly diminished. I look forward to my session every week and always leave feeling like a got a great workout. My back knows when I miss a week or more of Pilates! Aimee’s expertise in knowing what type of exercises work for me and how to explain proper form impressed me. I’ll continue indefinitely.\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Beth</span>";
			break;
		case 6:
			document.getElementById('testimonials').innerHTML="I love Pilates! I love the Smart Body Pilates studio, and I love the instructors. It has really changed my life, it sounds so clich&eacute;, but it is true!  I was getting \"thick\" and Pilates has made me toned.  It works like no other exercise, the burn begins immediately and I love it.   When I stopped playing tennis, I went looking for something challenging, I tried a couple of studios, but I loved yours.  I am always challenged and there is a camaraderie there that makes it so comfortable.\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Barb</span>";
			break;
		case 7:
			document.getElementById('testimonials').innerHTML="I can't wait to get there every day (except Wed, but I need to add a class in there too).  It has become essential, my family and friends know that I hate to miss a class.<br><br>I am stronger and happier and I always feel so good afterwards.  Tim loves that I am addicted and always says how good I look, my arms are smaller and my legs and stomach are stronger. I am so glad that you're here!\"<br><br><span style='text-align:right;display:block;width:240px;'>&#8212; Barb</span>";
			break;
	}

}
function randomnum(min,max){
	return Math.floor(Math.random()*(max+1))+min;
}
function addStyleDef(objectID,styleName,newVal){
	var object = document.getElementById(objectID);
	object.style [styleName] = newVal;
}
function beginrotate(){
	clearTimeout(slidetimeout);
	var navload = new Array(5);
	for(j=0;j<navload.length;j++) navload[j]= new Image();
	i=0;
	navload[i++].src='images/SBP-1-Power.png';
	navload[i++].src='images/SBP-2-Energy.png';
	navload[i++].src='images/SBP-3-Posture.png';
	navload[i++].src='images/SBP-4-Synergy.png';
	navload[i++].src='images/SBP-5-Results.png';
	x=1;
	while(curslide==x) x = Math.floor(Math.random() * 5) + 1;
	//if(IE==true)
	//	IE=true;
	//else
		lowerto=setTimeout("loweropac()",4000);
	slidetimeout=setTimeout("rotate()",5000);
}
function rotate(){
	clearTimeout(slidetimeout);
	clearTimeout(lowerto);
	//if(IE==true)
	//	IE=true;
	//else
		lowerto=setTimeout("loweropac()",4000);
	switch(x){
		case 1:
			document.getElementById('imagescroller').src='images/SBP-1-Power.png';
			curslide=1;
			break;
		case 2:
			document.getElementById('imagescroller').src='images/SBP-2-Energy.png';
			curslide=2;
			break;
		case 3:
			document.getElementById('imagescroller').src='images/SBP-3-Posture.png';
			curslide=3;
			break;
		case 4:
			document.getElementById('imagescroller').src='images/SBP-4-Synergy.png';
			curslide=4;
			break;
		case 5:
			document.getElementById('imagescroller').src='images/SBP-5-Results.png';
			curslide=5;
			break;
	}
	//if(IE==true)
	//	IE=true;
	//else
		raiseopac();
	x=curslide;
	while(curslide==x) x = Math.floor(Math.random() * 5) + 1;
	slidetimeout=setTimeout("rotate()",5000);
}
function rotateclick(){
	clearTimeout(slidetimeout);
	clearTimeout(lowerto);
	if(IE==true)
		IE=true;
	else
		lowerto=setTimeout("loweropac()",10);
	if(IE==true)
		slidetimeout=setTimeout("rotate()",10);
	else
		slidetimeout=setTimeout("rotate()",1010);
}
function loweropac(){
	elementid=document.getElementById('imagescroller');
	return doChangeMem(elementid,-100,0,20,20,.5);
}
function raiseopac(){
	elementid=document.getElementById('imagescroller');
	return doChangeMem(elementid,0,100,20,20,.5);
}
function doChangeMem(elem,startopac,endopac,steps,intervals,powr) { 
//changer with Memory by www.hesido.com
    if (elem.widthChangeMemInt)
		window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentopac = easeInOut(startopac,endopac,steps,actStep,powr);
	  elem.style.opacity = Math.abs(elem.currentopac/100);
	  elem.style.filter = 'alpha(opacity=' + Math.abs(elem.currentopac) + ')';
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
	} 
	,intervals);
}

function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) { 
//Generic Animation Step Value Generator By www.hesido.com 
    var delta = maxValue - minValue; 
    var stepp = minValue+(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
    return Math.ceil(stepp);
}
function stuhover(){
	allunhover();
	if(isstu==false)
		document.getElementById('navb').src='images/SBP-Nav2-The-Studio-OnHover.png';
	addStyleDef('stumenu','visibility','visible');
	allopac(document.getElementById('stumenu'));
	stuh=true;
	clearTimeout(stuht);
	timeout = setTimeout("allunhover()",1000);
}

function bashover(){
	allunhover();
	if(isbas==false)
		document.getElementById('navc').src='images/SBP-Nav3-The-BASI-Method-OnHover.png';
	addStyleDef('basmenu','visibility','visible');
	allopac(document.getElementById('basmenu'));
	bash=true;
	clearTimeout(basht);
	timeout = setTimeout("allunhover()",1000);
}

function inshover(){
	allunhover();
	if(isins==false)
		document.getElementById('nave').src='images/SBP-Nav5-Instructors-OnHover.png';
	addStyleDef('insmenu','visibility','visible');
	allopac(document.getElementById('insmenu'));
	insh=true;
	clearTimeout(insht);
	timeout = setTimeout("allunhover()",1000);
}

function lochover(){
	allunhover();
	if(isloc==false)
		document.getElementById('navh').src='images/SBP-Nav8-Location-OnHover.png';
	addStyleDef('locmenu','visibility','visible');
	allopac(document.getElementById('locmenu'));
	loch=true;
	clearTimeout(locht);
	timeout = setTimeout("allunhover()",1000);
}

function reshover(){
	allunhover();
	if(isres==false)
		document.getElementById('navf').src='images/SBP-Nav6-Resources-OnHover.png';
	addStyleDef('resmenu','visibility','visible');
	allopac(document.getElementById('resmenu'));
	resh=true;
	clearTimeout(resht);
	timeout = setTimeout("allunhover()",1000);
}
function stuunhover(){
	if(stuh==true){
		if(isstu==false)
			document.getElementById('navb').src='images/SBP-Nav2-The-Studio-Passive.png';
		elementid=document.getElementById('stumenu');
		doChangeMem(elementid,100,0,20,20,.5);
		clearTimeout(stuht);
		stuht=setTimeout("addStyleDef('stumenu','visibility','hidden')",750);
		stuh=false;
	}
	clearTimeout(timeout);
}

function basunhover(){
	if(bash==true){
		if(isbas==false)
			document.getElementById('navc').src='images/SBP-Nav3-The-BASI-Method-Passive.png';
		elementid=document.getElementById('basmenu');
		doChangeMem(elementid,100,0,20,20,.5);
		clearTimeout(basht);
		basht=setTimeout("addStyleDef('basmenu','visibility','hidden')",750);
		bash=false;
	}
	clearTimeout(timeout);
}

function insunhover(){
	if(insh==true){
		if(isins==false)
			document.getElementById('nave').src='images/SBP-Nav5-Instructors-Passive.png';
		elementid=document.getElementById('insmenu');
		doChangeMem(elementid,100,0,20,20,.5);
		clearTimeout(insht);
		insht=setTimeout("addStyleDef('insmenu','visibility','hidden')",750);
		insh=false;
	}
	clearTimeout(timeout);
}

function resunhover(){
	if(resh==true){
		if(isres==false)
			document.getElementById('navf').src='images/SBP-Nav6-Resources-Passive.png';
		elementid=document.getElementById('resmenu');
		doChangeMem(elementid,100,0,15,15,.5);
		clearTimeout(resht);
		resht=setTimeout("addStyleDef('resmenu','visibility','hidden')",250);
		resh=false;
	}
	clearTimeout(timeout);
}
function locunhover(){
	if(loch==true){
		if(isloc==false)
			document.getElementById('navh').src='images/SBP-Nav8-Location-Passive.png';
		elementid=document.getElementById('locmenu');
		doChangeMem(elementid,100,0,20,20,.5);
		clearTimeout(locht);
		locht=setTimeout("addStyleDef('locmenu','visibility','hidden')",750);
		loch=false;
	}
	clearTimeout(timeout);
}
function allopac(elem){
	if (elem.widthChangeMemInt)
		window.clearInterval(elem.widthChangeMemInt);
	elem.style.opacity = 1
	elem.style.filter = 'alpha(opacity=' + 100 + ')';
}
function allunhover(){
	stuunhover();
	basunhover();
	insunhover();
	resunhover();
	locunhover();
}

