function showhide(showthis, hidethis){
	
        new Effect.Fade(hidethis, {
	afterFinish: function() {
	    var theurl = document.URL;
	    var theurl = theurl.split('#');
	    if(theurl[1]){
		    document.location.href = theurl[1];
	    }else{
		//alert('now show ' + showthis); 
		new Effect.BlindDown(showthis);
	    }
	}
    });
}


function changepage(pageto){
  var pages = $('pages').getElementsByTagName('li');
  var nextbit = pages.length-1;
  var prevbit = 1;
  var totalpages = pages.length-3;
  var lastpage = 'page' + totalpages;
  /*Find Current Page*/
  var pageto = pageto;
  //alert(pageto);
  if(pageto=='next'){
    for(a=1;a<=totalpages-1;a++){
	var item1 = 'page' + a;
	//alert(item1);
	var thepage1 = $(item1);
	if(thepage1.style.display!='none'){
	    var newpage = (a+1)*1;
	    var pageto = 'page' + newpage;
	    //alert(pageto + ' 1');
	}
    }
  }
  
  if(pageto=='prev'){
    for(a=1;a<=totalpages;a++){
	var item1 = 'page' + a;
	//alert(item1);
	var thepage1 = $(item1);
	if(thepage1.style.display!='none'){
	    var newpage = (a-1)*1;
	    var pageto = 'page' + newpage;
	    //alert(pageto + '  -- 1');
	}
    }
  }
  
  //alert(pageto + '-1');
  
  if(pageto=='page1'){
	pages[prevbit].style.visibility = 'hidden';
  }else{
  	pages[prevbit].style.visibility = 'visible';
  }
  
  if(lastpage==pageto){
	pages[nextbit].style.visibility = 'hidden';
  }else{
  	pages[nextbit].style.visibility = 'visible';
  }
  
  var newheight = $(pageto).style.height;
  
  var pagenum = pageto.replace("page",""); 
  //alert(pagenum);
  if(pagenum<=totalpages){
      for(i=1;i<=totalpages;i++){
	var item = 'page' + i;
	var thepage = $(item);
	var itemNum = (i+1)*1;
	if(pageto==item){
	    pages[itemNum].className = 'pageon';
	}else{
	    pages[itemNum].className = 'pageoff';
	}
	new Effect.Fade(item, {
	    afterFinish: function() {
		$('pagescontent').morph({height:newheight})
		new Effect.Appear(pageto);				
	    }
	}); 
      
      }
   }
}

/*Cookie Stuff*/

function setcookie(name,value,duration){
    cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
    document.cookie=cookiestring;
}

function getexpirydate(nodays){
    var UTCstring;
    Today = new Date();
    nomilli=Date.parse(Today);
    Today.setTime(nomilli+nodays*24*60*60*1000);
    UTCstring = Today.toUTCString();
    return UTCstring;
}

function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function jumpto(newloc){
 if(newloc!=''){
  document.location.href = newloc;
 }
}

function jumptotech(newloc){
 if(newloc!=''){
  var thecookie = getcookie('consortium_tech_terms');
	
  if(thecookie){
    //alert('has cookie');
    document.location.href = newloc;
  }else{
    //alert('no cookie');
    var name = 'consortium_tech_terms';
    var value = 'yes';
    var duration = '1';
    setcookie(name,value,duration);
    /*set a cookie is this is the tech terms page*/
    document.location.href = 'technical-information.aspx#' + newloc;
  }
 }
}


function showperson(person){
  
  var people = $('peoplelist').getElementsByTagName('li');
  var totalpeople = people.length;
  for(i=1;i<=totalpeople;i++){
  
    var item = 'person' + i;
    var theperson = $(item);
   
    new Effect.Fade(item, {
	afterFinish: function() {
	    //alert('now show ' + person); 
	    new Effect.Appear(person);				
	}
    }); 
  
  }

}
