//Google Analytics

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-2625105-1']);

  _gaq.push(['_trackPageview']);



  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

// Variable Initialize


function listView(name,status){

	return listView[name] = {

		name:name,

		status:status,

		checkInfo:function(){

			alert (this.name +" forces "+ this.status);

		},

		hide:function(){

			document.getElementById(this.name).style.display = 'none';

		},

		show:function(){

			document.getElementById(this.name).style.display = 'block';

		}

	}

}

//var someobj = {field1:10,field2:"string",field3:{field1:10,field2:"string")); 



var flipHistory ={current:null,previous:'homeSubFlipA_O',state:null};



function showDisplay(nameCalled,selfElement){

	if(listView[nameCalled] == undefined){

	listView(nameCalled,'show')

	listView[nameCalled].show();

	//selfElement.innerHTML = '[-]';	

	}

	else{

		if(listView[nameCalled].status == 'hide'){

		listView(nameCalled,'show')

		listView[nameCalled].show();

		//selfElement.innerHTML = '[-]';	

		}

		else{

		listView(nameCalled,'hide')

		listView[nameCalled].hide();

		//selfElement.innerHTML = '[+]';

		}

		

	}

}



function replaceFlip(){  

  divId = arguments[0];

  originatingId = (arguments[1]) ? arguments[1]:'Wrecked';

  placement = (arguments[2]) ? arguments[2]:'homeSubFlip1';



  var tempHTML = document.getElementById(divId).innerHTML;

  document.getElementById(placement).innerHTML = tempHTML;

  

  //prepare Variables for color Switch and maintain History

  flipHistory.current = originatingId.id;



      if(flipHistory.previous != flipHistory.current){

      //Grab Colors before switching

      originateColor = document.getElementById(flipHistory.current).style.color;

      autoColor = document.getElementById(flipHistory.previous).style.color;

      //alert(originatingId.id+'Color1: '+originateColor+'Color2: '+autoColor);

      //Switch Colors

      document.getElementById(flipHistory.current).style.color = autoColor;

      document.getElementById(flipHistory.previous).style.color = originateColor;

      //Add-Item to History 

      flipHistory.previous = flipHistory.current;     

      } 
}

currentPoster =1;
var timerId;
function mainPosterReplace(){
  
  divId = 'posterCaption';

  divId2 = arguments[0];

  contentReplace = document.getElementById(divId2[0]).innerHTML;

  document.getElementById(divId).innerHTML = contentReplace;
	
  fullPath = "url(../images/"+divId2[1]+")";
  
  document.getElementById('posterHome').style.backgroundImage = fullPath;
  clearTimeout(timerId);
  slideShow();
  
}
function nextSlide(passedSlide){timerId=setTimeout(passedSlide,5*1000); }

function slideShow(){
 if(currentPoster <= posterMain.length-1){
 	currentPosterCommand = "mainPosterReplace(posterMain["+currentPoster+"])";
  	if(currentPoster == posterMain.length-1){currentPoster = 0;
 	}
 	else{currentPoster++;}
 }
 nextSlide(currentPosterCommand);
}

