//object oriented javascript by Mike Hallatt - diavista.com copyright 2009 all rights reserved

window.onload = function() {
	checkVersion();
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer') {
	var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    	if (re.exec(ua) != null) {
      		rv = parseFloat( RegExp.$1 );
		}
  }
  return rv;
}

function checkVersion() {
  var ver = getInternetExplorerVersion();

	if ( ver > -1 ) {
    	if ( ver >= 8.0 ) {
   			homePage = new createHomePage();
    	} else {
			homePage = new createIEPage();  
		}
	} else {
		homePage = new createHomePage();
	}
}

var text = new Array;
text[11] = 'Tucked into a 12 acre private hill overlooking Los Barriles, the Sea of Cortez and the Sierra Mountains is a handcrafted glass and stone house called Casa Panorama.';
text[12] = 'Casa Panorama is offered for sale at $595,000 USD.<br><br>Agents:<br><br>Pam Gray or Carlene Lokey<br><br>www.homesandlandofbaja.com<br><br>310-494-5700  ';
text[13] = 'Hand-excavated several hundred feet above Arroyo Buenos Aires, the house has panoramic views, south from the Sea of Cortez in the east to the Sierras in the west.';
text[14] = 'Casa Panorama is part of \'The Saddle\', a ridgeline of elegant homes overlooking the pueblo. This is the preferred place to enjoy the solitude of Baja and convenience of living near the beach and town.';
text[15] = 'Baja wouldn\'t be much fun without the beach and the sea. Casa Panorama is three quarters of a mile to white sandy beaches and water\'s edge.';
text[16] = 'When you purchase this home (and we know you want to), you join a subdivision which owns a beautiful beachfront lot within a short trail walk or few minutes drive. Services and foundations are complete for a palapa-style cabana to be used exclusively by owners.';
text[17] = 'Over 15 years, Los Barriles has grown from a dusty fishing village into a beautiful pueblo. It has Cabo influences: banks, sports bars and supermarkets. It has authenticity: local ranchers and fishermen sell fresh seafood and organic vegetables from rustic shops.';
text[18] = 'Los Barriles is relaxed, with a critical mass of friendly and active outdoor enthusiasts who enjoy Baja living.';
text[19] = 'View northwest of the saddle and hilltop from Los Barriles - about two and a half miles.';
text[110] = 'The kiteboarding season now runs all year long with peak winds November through February. View of North beach from the Cabana.'

text[21] = 'The design goal was to interplay modern, rustic and antique Mexican styles with natural materials and the subtle Baja desert landscape.';
text[22] = 'The main observation deck is a wonderful living and dining space. The floors are heated with hot water so the room is comfortable on cool December nights.';
text[23] = 'The elevation combined with the view southwest is dramatic all day. It is the perfect place to watch the sun rise over the sea or set behind the mountains.';
text[24] = 'Overlooking the sea of Cortez is an excercise pool/spa. Eight feet at its deepest point, it has five high pressure jets and salt purification. The water is heated by a solar thermal array.';
text[25] = 'The light combines with the materials in the house to create captivating spaces. The curved stone wall on the right is a gas fireplace.';
text[26] = 'View at sunrise from the arroyo below the house';
text[27] = 'Descending through the garden to the front door of the house. A roof deck has two access points: one off the upper master bedroom and one off the garden.';
text[28] = 'View from the reading deck off the upper master bedroom. It doubles as a \'getaway within a getaway\'';
text[29] = 'View south east at sunrise. Every angle from every room offers breathtaking vistas day or night.';
text[210] = 'View from the the Buenos Aires arroyo, also known as the \'1st Arroyo\'.';

text[31] = 'The inside of the home is Parota hardwood, high lustre white plaster and black satin concrete. What\'s missing is an eclectic mix of expensive furniture from India, Indonesia, South America and Spain. Spend the $250 grand you save on the price of this house on a shopping trip.';
text[32] = 'Curvilinear walls mute interior sound reverberations so it\'s easy to fill the home with lush ambient music <i>and</i> conversation.';
text[33] = 'All of the woodwork in the house is made from a local hardwood called Parota. It is impervious to insects so no pesticide treatment is ever required to maintain this home.';
text[34] = 'The kitchen is designed for entertaining and every day casual use. It\'s equipped with quiet high performance Bosch appliances and powerful ventilation over the gas range.';
text[35] = 'Both master bedrooms have large ensuite bathrooms with oversized walk-in showers that were carved into the hillside.';
text[36] = 'View from the dome-roofed upper master bedroom. Almost all of the windows open to the ocean breeze. If you normally have trouble sleeping, your nights will never be the same again.';
text[37] = 'This is a great place to brush your teeth.';
text[38] = 'View east of the Sea of Cortez from the deck off of the upper master bedroom';
text[39] = 'The lower master bedroom has a private entrance and ensuite bathroom. Sunrises are amazing throughout the house but this room is a truly incredible place to wake up in.';
text[310] = 'The interplay of Mexican modern, antique rustic vernaculars extends through materials, form and color.';

text[41] = 'Meet Rubin Ganiz. This house would not have been possible without his loyalty to the project. He can stare down any granite boulder, trecherous slope or insurmountable snafu.';
text[42] = 'The foundations were excavated by hand to avoid disruption of the natural beauty of the site. Walls were dug two meters deep into the ground and built a meter thick of granite rock selected from neighboring arroyos.';
text[43] = 'Concrete was mixed on level ground and sent down the slope though a large pipe to the massive foundation wall construction.';
text[44] = 'The house plan meanders the topography of the hillside. When we ran into an important stabilizing rock we included it in the structure.';
text[45] = 'The hand-excavated approach ensures very little natural landscape is disturbed by the construction.';
text[46] = 'View of the front entrance as the structure is starting to take shape. The giant Cardon castuses were either transplanted or built around.';
text[47] = 'The boveda was constructed by a local expert. The ceiling radius was done by eye - a method called \'Radio Buscar\' which appears more natural than would a true hemispherical shape.';
text[48] = 'The house plan was \'terrassed\' into the slope to ensure a feeling of being \'on the ground\' rather than cantilevered high over the arroyo.';
text[49] = 'To ensure storm resistance and durability, the 80 windows were made from commercial grade aluminum and pinned into the concrete by steel bolts. The glass is double normal thickness. The paint is 99% glass and bonds with the concrete permanently. Natural pigments respond to the changing light of the day.';
text[410] = 'Casa Panorama was built by hand over three years by a small crew of local tradesmen. Designer/builder Mike Hallatt worked closely with the crew and looks forward to starting on Casa Mondasa with them soon.';

text[51] ='The \'Great Recession\' has seen market values for homes in most countries drop significantly. Mexico is no exception. Casa Panorama was an expensive house to build but its price reflects market realities. ';
text[52] ='Baja is the second most popular vacation destination after Hawaii for Canadians and Americans.';
text[53] ='Purchasing property in Mexico is a highly secure transaction for foreigners. Your deed is backed by a Mexican bank, some of which are subsidiaries of major banks in Canada and the U.S.';
text[54] ='Owning this home at this price means you can earn a decent return renting it out. Based on enquiries from vrbo.com in 2008, you should expect to earn $20,000 annually.<br><br>Owning a home in this architectural class enables you to trade it through exclusive house exchanges for a home anywhere in the world.';
text[55] ='Call Mike Hallatt directly at 415-578-3441 or his agent Pam Gray at 310-494-5700 about your purchasing options.<br><br>If you want to get away to a place that truly transforms your surroundings to one of comfort and peacefulness, Casa Panorama is your home.';


var images = new Array;

images[11] = 'images/casa84.jpg';
images[12] = 'images/casa111.jpg';
images[13] = 'images/casa89.jpg';
images[14] = 'images/casa83.jpg';
images[15] = 'images/casa99.jpg';
images[16] = 'images/casa88.jpg';
images[17] = 'images/casa87.jpg';
images[18] = 'images/casa96.jpg';
images[19] = 'images/casa86.jpg';
images[110] = 'images/casa85.jpg';

images[21] = 'images/casa79.jpg';
images[22] = 'images/casa78.jpg';
images[23] = 'images/casa77.jpg';
images[24] = 'images/casa76.jpg';
images[25] = 'images/casa71.jpg';
images[26] = 'images/casa115.jpg';
images[27] = 'images/casa73.jpg';
images[28] = 'images/casa70.jpg';
images[29] = 'images/casa112.jpg';
images[210] = 'images/casa114.jpg';

images[31] = 'images/casa67.jpg';
images[32] = 'images/casa66.jpg';
images[33] = 'images/casa64.jpg';
images[34] = 'images/casa65.jpg';
images[35] = 'images/casa63.jpg';
images[36] = 'images/casa62.jpg';
images[37] = 'images/casa43.jpg';
images[38] = 'images/casa60.jpg';
images[39] = 'images/casa59.jpg';
images[310] = 'images/casa58.jpg';

images[41] = 'images/casa57.jpg';
images[42] = 'images/casa56.jpg';
images[43] = 'images/casa55.jpg';
images[44] = 'images/casa54.jpg';
images[45] = 'images/casa53.jpg';
images[46] = 'images/casa52.jpg';
images[47] = 'images/casa51.jpg';
images[48] = 'images/casa50.jpg';
images[49] = 'images/casa49.jpg';
images[410] = 'images/casa48.jpg';

images[51] = 'images/casa47.jpg';
images[52] = 'images/casa38.jpg';
images[53] = 'images/casa42.jpg';
images[54] = 'images/casa41.jpg';
images[55] = 'images/casa39.jpg';


var headings = new Array;
headings[1] = 'images/about.png';
headings[2] = 'images/exterior.png';
headings[3] = 'images/interior.png';
headings[4] = 'images/construction.png';
headings[5] = 'images/purchase.png';

o = new Object;
o.panelLeft = 1;
o.panelRight = 1;
o.transitionLeft = 'slide';
o.transitionRight = 'fade';
o.navLeftPosition = 1;
o.navRightPosition = 1;
o.textRight = text;
o.leftPanelCountPerRightPanel = new Object();
o.leftPanelCountPerRightPanel[1] = 10;
o.leftPanelCountPerRightPanel[2] = 10;
o.leftPanelCountPerRightPanel[3] = 10;
o.leftPanelCountPerRightPanel[4] = 10;
o.leftPanelCountPerRightPanel[5] = 5;
o.rightPanelCount = 5;


function createIEPage() {
	 var _this = this; 
		this.backgroundContainer = makeElement('div', 'backgroundContainer');
		this.backgroundContainer.setAttribute('style', 'width:100%;height:100%;position:absolute;top:0px;left:0px');
		
		this.IETextContainer = makeElement('div', 'IETextContainer');
		this.IETextContainer.setAttribute('style', 'position:absolute;top:225px;left:300px;font-family:Trebuchet MS;font-size:16pt');
		this.IETextContainer.innerHTML = 'Sorry, this site does not support older Internet Explorer versions.<br><br>This is a great opportunity to upgrade your browser to IE 8 or Firefox (best).<br><br><a style=\'color:#d74b05\' href=\'http://www.firefox.com\'>www.firefox.com</a>';
		
		this.ffIcon = makeElement('img', 'ffIcon', 'src', 'images/ff_icon.png');
		this.ffIcon.setAttribute('style', 'display:block;position:absolute;top:50px;left:275px');
		
		document.body.appendChild(this.backgroundContainer);
		this.backgroundContainer.appendChild(this.IETextContainer);
		this.backgroundContainer.appendChild(this.ffIcon);
		
}

function createHomePage() {
	 var _this = this; 
		this.backgroundContainer = makeElement('div', 'backgroundContainer');
		this.backgroundContainer.setAttribute('style', 'width:100%;height:100%;position:absolute;top:20px;left:0px;text-align:center');
		
		this.logo = makeElement('img', 'logo', 'src', 'images/casa_panorama_head.png');
		this.logo.setAttribute('style', 'width:1099px;height:111px;cursor:pointer');
		this.logo.onclick = function() { _this.resetToHome();};
		
		this.rectangle = makeElement('div', 'rectangle');
		this.rectangle.setAttribute('style', 'position:relative;z-index:0;width:1100px;height:428px;background-color:#332724;margin:0 auto');	
		
		this.leftPanel = makeElement('div', 'leftPanel');
		this.leftPanel.setAttribute('style', 'width:542px;height:428px;z-index:1;opacity:100;background:url() no-repeat');
		this.leftPanel.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
		this.leftPanel.style.filter='alpha(opacity=100)';

		this.panelOverlay = makeElement('div', 'panelOverlay');
		this.panelOverlay.setAttribute('style', 'position:relative;background-color:#000000;opacity:.60;top:353px;cursor:pointer;margin:0px auto;z-index:4;width:542px;height:75px;');		
		this.panelOverlay.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=60)';
		this.panelOverlay.style.filter='alpha(opacity=60)';
		
		this.leftPanelNavContainer = makeElement('div', 'leftPanelNavContainer');
		this.leftPanelNavContainer.setAttribute('style', 'position:relative;top:305px;cursor:pointer;margin:0px auto;z-index:6;width:255px;height:30px;');		
		
		this.leftPanelNav = new Object();
		
		this.makeLeftNavAssy = function() {
			for (i=1; i<=o.leftPanelCountPerRightPanel[o.navRightPosition]; i++) {
				_this.leftPanelNav[i] = makeElement('img', 'leftPanelNav' + [i], 'src', 'images/dot.png');
				_this.leftPanelNav[i].setAttribute('style', 'padding:5px;opacity:.40');
				_this.leftPanelNav[i].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=40)';
				_this.leftPanelNav[i].style.filter='alpha(opacity=40)';
				_this.leftPanelNav[i].position = i;
				_this.leftPanelNav[i].onclick = function() {_this.dotNavigationManagerLeft(this.position)};
				_this.leftPanelNavContainer.appendChild(_this.leftPanelNav[i]);	
			}
		}
		
		this.makeLeftNavAssy();
		
		this.rightPanel = makeElement('div', 'rightPanel');
		this.rightPanel.setAttribute('style', 'width:542px;height:428px;margin:-428px 0 0 542px');
	
	
		this.rightPanelText = makeElement('div', 'rightPanelText');
		this.rightPanelText.setAttribute('style', 'margin:50px auto;width:400px;height:215px;color:#ffffff;font-family:Trebuchet MS;font-size:18px;text-align:left;line-height:22px');
		this.rightPanelText.innerHTML = 'not defined';
		
		this.rightPanelIcon = makeElement('img', 'rightPanelIcon', 'src', 'images/mexican_icon_med.png');
		this.rightPanelIcon.setAttribute('style', 'margin:-50px 0 0 0');
		
		this.rightPanelNavContainer = makeElement('div', 'rightPanelNavContainer');
		this.rightPanelNavContainer.setAttribute('style', 'cursor:pointer;margin:20px auto;z-index:6;width:550px;height:30px;');
		
		this.rightPanelNav = new Object();
		
		this.makeRightNavAssy = function() {
			for (i=1; i<=o.rightPanelCount; i++) {
				_this.rightPanelNav[i] = makeElement('img', 'rightPanelNav' + i, 'src', headings[i]);
			
				_this.rightPanelNav[i].setAttribute('style', 'padding:5px;opacity:.40;width:96px;height:24px');
				_this.rightPanelNav[i].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=40)';
				_this.rightPanelNav[i].style.filter='alpha(opacity=40)';
				_this.rightPanelNav[i].position = i;
				_this.rightPanelNav[i].onclick = function() { _this.dotNavigationManagerRight(this.position)};
				_this.rightPanelNavContainer.appendChild(_this.rightPanelNav[i]);
			}
		}

		this.makeRightNavAssy();
		
		this.leftPanelTriggerLeft = makeElement('div', 'leftPanelTriggerLeft');
		this.leftPanelTriggerLeft.setAttribute('style', 'position:relative;margin:-428px 0 0 0;width:269px;height:426px;z-index:5;cursor:pointer');
		this.leftPanelTriggerLeft.onclick = function() { _this.panelManagerLeft('previous')};

		this.leftPanelTriggerRight = makeElement('div', 'leftPanelTriggerRight');
		this.leftPanelTriggerRight.setAttribute('style', 'position:relative;margin:-428px 0 0 271px;width:269px;height:426px;z-index:5;cursor:pointer');
		this.leftPanelTriggerRight.onclick = function() { _this.panelManagerLeft('next')};
		
		this.rightPanelTriggerLeft = makeElement('div', 'rightPanelTriggerLeft');
		this.rightPanelTriggerLeft.setAttribute('style', 'position:relative;margin:-358px 0 0 540px;width:275px;height:350px;z-index:5;cursor:pointer');
		this.rightPanelTriggerLeft.onclick = function() { _this.panelManagerRight('previous');o.navLeftPosition = 1;_this.panelManagerLeft();};

		this.rightPanelTriggerRight = makeElement('div', 'rightPanelTriggerRight');
		this.rightPanelTriggerRight.setAttribute('style', 'position:relative;margin:-358px 0 0 817px;width:275px;height:350px;z-index:5;cursor:pointer');
		this.rightPanelTriggerRight.onclick = function() { _this.panelManagerRight('next');o.navLeftPosition = 1;_this.panelManagerLeft();};
	
		this.backgroundContainer.appendChild(this.logo);
		this.backgroundContainer.appendChild(this.rectangle);
			
		this.rectangle.appendChild(this.leftPanel);
		this.leftPanel.appendChild(this.panelOverlay);
		this.leftPanel.appendChild(this.leftPanelNavContainer);
	
		this.rectangle.appendChild(this.leftPanelTriggerLeft);
		this.rectangle.appendChild(this.leftPanelTriggerRight);
		
		this.rectangle.appendChild(this.rightPanel);
		this.rightPanel.appendChild(this.rightPanelNavContainer);
		
		this.rightPanel.appendChild(this.rightPanelText);
		this.rightPanel.appendChild(this.rightPanelIcon);
	
		this.rectangle.appendChild(this.rightPanelTriggerLeft);
		this.rectangle.appendChild(this.rightPanelTriggerRight);
		
		document.body.appendChild(this.backgroundContainer);
		
			this.panelManagerLeft = function(direction) {
				if (direction == 'previous') {
					if (o.navLeftPosition > 1) {
						o.navLeftPosition--;
					} else {
						o.navLeftPosition = o.leftPanelCountPerRightPanel[o.navRightPosition];
					}
				this.populatePanelsPrevious();

				} else if (direction == 'next') {
					if (o.navLeftPosition < o.leftPanelCountPerRightPanel[o.navRightPosition]) {
					o.navLeftPosition++;
				    } else {
						o.navLeftPosition = 1;
					}
					this.populatePanelsNext();
				} else {
					this.populatePanelsNext();
				}

				this.updateNavIndicatorLeft();
			}
			
				this.dotNavigationManagerRight = function(dotPosition) {
					
					o.navRightPosition = dotPosition;
					o.navLeftPosition = 1;
					this.populatePanels();
				
					this.updateNavIndicatorRight();
					
				}
				
				this.dotNavigationManagerLeft = function(dotPosition) {
					
					var currentPosition = o.navLeftPosition;
					o.navLeftPosition = dotPosition;
					if (dotPosition < currentPosition) {
					this.populatePanelsPrevious();
					} else if (dotPosition > currentPosition) {
					this.populatePanelsNext();
					}
					this.updateNavIndicatorLeft();
				}

				this.panelManagerRight = function(direction) {
					if (direction == 'previous') {
						if (o.navRightPosition > 1) {
							o.navRightPosition--;
						} else {
							o.navRightPosition = o.rightPanelCount;
						}
					this.populatePanelsPrevious();

					} else if (direction == 'next'){
						if (o.navRightPosition < o.rightPanelCount) {
						o.navRightPosition++;
					    } else {
							o.navRightPosition = 1;
						}
					this.populatePanelsNext();	
					} else {
						this.populatePanelsNext();	
					}

					this.updateNavIndicatorRight();
					this.updateHeadings();
				}

			this.populatePanelsNext = function() {
				var navLeftPositionAsString = o.navLeftPosition + '';
				var navRightPositionAsString = o.navRightPosition + '';
				var panelNumberAsString = navRightPositionAsString + navLeftPositionAsString;
				o.panelNumber = parseInt(panelNumberAsString);
				this.animateLeftPanelOutSlideRight();
				this.animateRightPanelTextOut();
			}
			
			this.populatePanels = function() {
					var navLeftPositionAsString = o.navLeftPosition + '';
					var navRightPositionAsString = o.navRightPosition + '';
					var panelNumberAsString = navRightPositionAsString + navLeftPositionAsString;
					o.panelNumber = parseInt(panelNumberAsString);
					this.animateLeftPanelOutSlideRight();
					this.animateRightPanelTextOut();
				}

			this.populatePanelsPrevious = function() {
				var navLeftPositionAsString = o.navLeftPosition + '';
				var navRightPositionAsString = o.navRightPosition + '';
				var panelNumberAsString = navRightPositionAsString + navLeftPositionAsString;
				o.panelNumber = parseInt(panelNumberAsString);
				this.animateLeftPanelOutSlideLeft();
				this.animateRightPanelTextOut();
			}

			this.updateNavIndicatorLeft = function(which) {
				if (which == 'rightNav') {
					clearContainer(this.leftPanelNavContainer);
					this.makeLeftNavAssy(o.leftPanelCountPerRightPanel[o.navRightPosition]);
					this.leftPanelNav[o.navLeftPosition].style.opacity = '100';
					this.leftPanelNav[o.navLeftPosition].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
					this.leftPanelNav[o.navLeftPosition].style.filter='alpha(opacity=100)';
					

				} else {
					for (i=1; i<=o.leftPanelCountPerRightPanel[o.navRightPosition]; i++) {
						this.leftPanelNav[i].style.opacity = '.40';
						this.leftPanelNav[i].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=40)';
						this.leftPanelNav[i].style.filter='alpha(opacity=40)';
												
						this.leftPanelNav[o.navLeftPosition].style.opacity = '100';
						this.leftPanelNav[o.navLeftPosition].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
						this.leftPanelNav[o.navLeftPosition].style.filter='alpha(opacity=100)';						
					}
				}

			}

			this.updateNavIndicatorRight = function() {
				//this method clears all the elments of the leftNav object so it can be repopulatd with the correct number
				this.updateNavIndicatorLeft('rightNav');

				for (i=1; i<=o.rightPanelCount; i++) {
					this.rightPanelNav[i].style.opacity = '.40';
					this.rightPanelNav[i].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=40)';
					this.rightPanelNav[i].style.filter='alpha(opacity=40)';
										
					this.rightPanelNav[o.navRightPosition].style.opacity = '100';
					this.rightPanelNav[o.navRightPosition].style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
					this.rightPanelNav[o.navRightPosition].style.filter='alpha(opacity=100)';					
				}


			}

			this.updateHeadings = function() {
				this.rightPanelHeading.src = headings[o.navRightPosition];
			}

			this.animateLeftPanelInSlideRight = function() {
				var _this = this; 
					_this.leftPanel.style.backgroundImage = 'url(' + images[o.panelNumber] + ')';

				var anime = new iAnime();
				anime.add({id:'leftPanel', effect:'style', duration:200, from:{ 'backgroundPosition':'-550px 0px'}, to:{'backgroundPosition':'0px 0px'}});
			}

			this.animateLeftPanelOutSlideRight = function() {
				var _this = this; 
				var resetPanel = function() {
					_this.leftPanel.style.visibility = 'hidden';
					_this.leftPanel.style.backgroundPosition = '-550px 0px';
					_this.leftPanel.style.visibility = 'visible';
					_this.animateLeftPanelInSlideRight();
				}
				var anime = new iAnime();

				anime.add({id:'leftPanel', effect:'style', duration:200, from:{ 'backgroundPosition':'0px 0px'}, to:{'backgroundPosition':'550px 0px'}, onComplete:resetPanel});
			}

			this.animateLeftPanelInSlideLeft = function() {
				var _this = this; 
					_this.leftPanel.style.backgroundImage = 'url(' + images[o.panelNumber] + ')';
				var anime = new iAnime();

				anime.add({id:'leftPanel', effect:'style', duration:200, from:{ 'backgroundPosition':'550px 0px'}, to:{'backgroundPosition':'0px 0px'}});
			}

			this.animateLeftPanelOutSlideLeft = function() {
				var _this = this; 
				var resetPanel = function() {
					_this.leftPanel.style.visibility = 'hidden';
					_this.leftPanel.style.backgroundPosition = '550px 0px';
					_this.leftPanel.style.visibility = 'visible';
					_this.animateLeftPanelInSlideLeft();
				}
				var anime = new iAnime();

				anime.add({id:'leftPanel', effect:'style', duration:200, from:{ 'backgroundPosition':'0px 0px'}, to:{'backgroundPosition':'-550px 0px'}, onComplete:resetPanel});
			}


			this.animateRightPanelTextIn = function() {
				var _this = this; 
				var anime = new iAnime();
				anime.add({id:'rightPanelText', effect:'style', duration:300, from:{ 'font-size':'0px'}, to:{'font-size':'18px'}});
			}

			this.animateRightPanelTextOut = function() {
				this.rightPanelText.style.fontSize = '0px';
				this.rightPanelText.innerHTML = text[o.panelNumber];
				this.animateRightPanelTextIn();			
			}

			this.resetToHome = function() {
				o.navLeftPosition = 1;
				o.navRightPosition = 1;
				this.panelManagerLeft();
				this.panelManagerRight();
			}

			this.resetToHome();
		
}

function makeElement(element, xId, xProperty, xParameters) {
	var theElement = document.createElement(element);
	theElement[xProperty] = xParameters;
	theElement.id = xId;
	return theElement;
}

function clearContainer(which) {
	while (which.hasChildNodes()) {
			which.removeChild(which.firstChild);
	}
}