
function togglepage(mode){
		 var pa = document.getElementById('page').style.display;
		 if (pa != 'block') openpage(mode);
}

function openpage(mode){
		 var pa = document.getElementById('page');
		 var isMSIE = /*@cc_on!@*/false;
		 if (isMSIE){
		 var ct = document.getElementById('iecontent');
		 } else {
		 var ct = document.getElementById('content');
		 }
		 pa.style.display = 'block';
		 //alert(sURL);
		 opacity('page', 0, 85, 1000, mode);
		 ct.style.background = "#FFFFFF url('images/loading.gif') center center no-repeat";
		 }
		 
function closepage(){
		 var pa = document.getElementById('page');
		 var isMSIE = /*@cc_on!@*/false;
		 if (isMSIE){
		 var ct = document.getElementById('iecontent');
		 } else {
		 var ct = document.getElementById('content');
		 }
		 ct.innerHTML = '';
		 ct.style.background = "#FFFFFF url('images/closing.gif') center center no-repeat";
		 doWidthChangeMem(pa,pa.currentWidth,31,100,5,0.5);
		 doHeightChangeMem(pa,pa.currentHeight,31,100,5,0.5, 'hide');
		 }


function load_hide(result){
		 var result = result;
		 
		 var isMSIE = /*@cc_on!@*/false;
		 if (isMSIE){
		 var ct = document.getElementById('iecontent');
		 } else {
		 var ct = document.getElementById('content');
		 }
		 if (result !='maintenance'){
		 if (result !='ie_fix'){
		 if (result != 'hide') {
		 //load page
		 ct.style.background = "#FFFFFF";
		 var hp = document.getElementById('homepage');
		 hp.style.display = 'block';
		 setTimeout('expand_gallery()', 300);

		 
		 
var isMSIE = /*@cc_on!@*/false;
		if (isMSIE){
		document.getElementById('valid').innerHTML += '<span id="getfirefox" style="display: inline-block;"><a href="http://www.getfirefox.com/" target="_blank" title="Get Firefox"><img src="images/getfirefox.png" height="48" width="126" style="margin-left: 10px; border: 0px;" /></a></span>';
		
		}
		 
		 } else {
		 //hide page
		 opacity('page', 85, 10, 1000, 'hide');
		 }
		 }
		 } else {
		 //alert("maintenance picture");
		 ct.style.background = "#FFFFFF url('images/maintenance.gif') center center no-repeat";
		 }
		 }

function opacity(id, opacStart, opacEnd, millisec, func) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
	var result = func;    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
			//if (i = opacEnd) finished_fade(result);
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
		
    }
	if (i = opacEnd) {
			finished_fade(result);
	}}
	
function finished_fade(result){
var pa = document.getElementById('page');
if (result != 'hide') {
		doWidthChangeMem(pa,31,pageWidth(),100,5,0.5);
		doHeightChangeMem(pa,31,pageHeight(),100,5,0.5, result);
		
		var isMSIE = /*@cc_on!@*/false;
		if (isMSIE){
		var ct = document.getElementById('iecontent');
		doHeightChangeMem(ct,31,pageHeight()-30,100,5,0.5, 'ie_fix');
		}
		} else {
		document.getElementById('page').style.display = 'none';
		}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function doWidthChangeMem(elem,startWidth,endWidth,steps,intervals,powr) { 
//Width changer with Memory by www.hesido.com
    if (elem.widthChangeMemInt)
	window.clearInterval(elem.widthChangeMemInt);
    var actStep = 0;
    elem.widthChangeMemInt = window.setInterval(
	function() { 
	  elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
	  elem.style.width = elem.currentWidth + "px"; 
	  actStep++;
	  if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
	} 
	,intervals)
}

function doHeightChangeMem(elem,startHeight,endHeight,steps,intervals,powr,func) { 
//Height changer with Memory by www.hesido.com
    if (elem.heightChangeMemInt)
	window.clearInterval(elem.heightChangeMemInt);
    var actStep = 0;
    elem.heightChangeMemInt = window.setInterval(
	function() { 
	  elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
	  elem.style.height = elem.currentHeight + "px"; 
	  actStep++;
	  if (actStep > steps) {
	  window.clearInterval(elem.heightChangeMemInt);
	  load_hide(func);
	  }
	} 
	,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 pageHeight() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return (myHeight-100);
}

function pageWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return (myWidth-100);
}

function expand_gallery() {
		 if (document.getElementById('stage')){
		 var elem = document.getElementById('stage');
		 var endWidth = (pageWidth()-240);
		 doWidthChangeMem(elem,400,endWidth,50,2,0.5)
		 var items = elem.getElementsByTagName("li");
		 var itemsize = 312;
		 var listsize = (items.length * itemsize) - 60;
		 //alert(listsize);
		 document.getElementById('myList').style.width = listsize + "px";
		 }

}
var scroll_ready = 'true';

function scroll(dist,id,steps,interval,pwr) {
		 pa = document.getElementById(id);
	if (scroll_ready != 'false'){
    	 var actStep = 0;
		 var steps = steps;
		 var start = pa.scrollLeft;
		 var end = start + dist;
		 scroll_ready = 'false';
    	 var bob = window.setInterval(
		 function() { 

	  	 var stepp = easeInOut(start,end,steps,actStep,pwr);
	  	 pa.scrollLeft = stepp; 
	  	 actStep++;
	  	 if (actStep > steps) {
		 window.clearInterval(bob);
		 scroll_ready = 'true';
		 }
		 } 
		 ,interval)
		 }
}