/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Timothy Groves | http://www.brandspankingnew.net/ */
var useBSNns;

if (useBSNns) {
	 if (typeof(bsn) == 'undefined')
		  bsn = {}
	   var _bsn = bsn;
} else {
	  var _bsn = this;
}

_bsn.Crossfader = function (divs, fadetime, delay ) {	
	 this.nAct = -1;
	 this.aDivs = divs;
	
	 for (var i=0;i<divs.length;i++) {
	   document.getElementById(divs[i]).style.opacity = 0;
   	document.getElementById(divs[i]).style.position = 'absolute';
	   document.getElementById(divs[i]).style.filter = 'alpha(opacity=0)';
 	  document.getElementById(divs[i]).style.visibility = 'hidden';
	 }
	
	 this.nDur = fadetime;
  this.nDelay = delay;
  this._newfade();
}

_bsn.Crossfader.prototype._newfade = function() {
  if (this.nID1)
    clearInterval(this.nID1);
	   this.nOldAct = this.nAct;
    this.nAct++;

 	if (!this.aDivs[this.nAct])	this.nAct = 0;

 	if (this.nAct == this.nOldAct)
    return false;

  document.getElementById( this.aDivs[this.nAct] ).style.visibility = 'visible';
  this.nInt = 50;
  this.nTime = 0;
  var p=this;
  this.nID2 = setInterval(function() { p._fade() }, this.nInt);
}

_bsn.Crossfader.prototype._fade = function() {
  this.nTime += this.nInt;
 	var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
 	var op = ieop / 100;
 	document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
 	document.getElementById( this.aDivs[this.nAct] ).style.filter = 'alpha(opacity='+ieop+')';

  if (this.nOldAct > -1) {
    document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
  		document.getElementById( this.aDivs[this.nOldAct] ).style.filter = 'alpha(opacity='+(100 - ieop)+')';
	 }
	
	 if (this.nTime == this.nDur) {
		  clearInterval( this.nID2 );
		
  if (this.nOldAct > -1)
	   document.getElementById( this.aDivs[this.nOldAct] ).style.visibility = 'hidden';	
    var p=this;
    this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
  }
}

_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d) {
  return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}





















//Nested Side Bar Menu (Mar 20th, 09)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=['sidebarmenu1'] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

function initsidebarmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName('ul')
    for (var t=0; t<ultags.length; t++){
    ultags[t].parentNode.getElementsByTagName('a')[0].className+=' subfolderstyle'
  if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
   ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
  else //else if this is a sub level submenu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName('ul')[0].style.display='block'
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName('ul')[0].style.display='none'
    }
    }
  for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use 'display:none' to hide menus (to prevent possible page scrollbars
  ultags[t].style.visibility='visible'
  ultags[t].style.display='none'
  }
  }
}



function displayHidePricing(element) {  
	 document.getElementById('weddingPricing').style.display= 'none'; 
	 document.getElementById('seniorPricing').style.display= 'none'; 
	 document.getElementById('childrenPricing').style.display= 'none';
	 document.getElementById('familyPricing').style.display= 'none';
	 document.getElementById('otherPricing').style.display= 'none';
	 document.getElementById(element).style.display = 'inline';
}

function displayHide(element) {  
	 document.getElementById('weddingdetails').style.display= 'none'; 
	 document.getElementById('weddingsgallery').style.display= 'none';
	 document.getElementById('engagementportraits').style.display= 'none';
	 document.getElementById('childrendetails').style.display= 'none';
	 document.getElementById('childrenportraits').style.display= 'none';
	 document.getElementById('familydetials').style.display= 'none';
	 document.getElementById('familyportraits').style.display= 'none';
	 document.getElementById('weddings').style.display= 'none'; 
	 
	 
	 if (element == 'weddingdetails' || element == 'childrendetails'  || element == 'familydetials'){
	 	document.getElementById('photosPage').style.display= 'none'; 
	 }
	 document.getElementById(element).style.display = 'inline';
}

