var BClogo;
var LCorner;
var RCorner;
var BCtext;
var BCBWT;
var BCto;
var Nav1;
var Nav2;
var Nav3;
var Nav4;
var Nav5;
var Nav6;
var Nav7;
var toggleAnima;
var strPage;
var BCLine;
var yEndText=225;
var yEndLogo=15;
var xlogo;
var ylogo;
var yunit;
var xunit;
var strChosen;
var bShowAnimation;

function BuildPage(bShow){
bShowAnimation = bShow;

var xText;
var xEndText;
var ymargin;
var yspacer=25;
var xstart;

yunit = getWinHeight();
xunit = getWinWidth();
ylogo = (yunit/2) - 95;
xstart = (xunit/2) -150;
xlogo = -5;
xText = xstart+80;
xEndText=xlogo + 150;
ymargin = -10;

if (document.layers){
	document.images["BackImg"].src = "images/spacer.gif";
} else if (document.all){
BackImg.src="images/spacer.gif";
}


BCLine = new Collection();

  BCLine.add(new Pelement("BC2", "BCLine ", xlogo, ylogo, xlogo, yEndLogo, xunit+5, 250, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCLine .length -1;
  createLayer(BCLine [i].name, BCLine [i].startx, BCLine [i].starty, BCLine [i].width, BCLine [i].height, true, ""); 

//moveLayer("BC2", xlogo, ylogo);

setBgImage("BC2", "images/hbar.gif");



BCLogo = new Collection();

  BCLogo.add(new Pelement("BC1", "BCLogo", xstart, ylogo, xlogo + 62, yEndLogo, 150, 250, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCLogo.length -1;
  createLayer(BCLogo[i].name, BCLogo[i].startx, BCLogo[i].starty, BCLogo[i].width, BCLogo[i].height, true, "<img src='images/bclogonoborder.gif' border='0'  hspace='0' vspace='0' />"); 

//moveLayer("BC1", xlogo + 55, ylogo);


BCBWT = new Collection();

  BCBWT.add(new Pelement("BCBWT", "BCBWT", xstart + 10, ylogo - 50, xlogo + 72, yEndLogo, 300, 100, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCBWT.length -1;
  createLayer(BCBWT[i].name, BCBWT[i].startx, BCBWT[i].starty, BCBWT[i].width, BCBWT[i].height, true, "<img src='images/bcbeadworkstext.jpg' border='0'  hspace='0' vspace='0' />"); 

//moveLayer("BC1", xlogo + 55, ylogo);



BCto = new Collection();

  BCto.add(new Pelement("BCto", "BCto", xstart - 30, ylogo - 44, xlogo + 50, yEndLogo, 55, 60, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCto.length -1;
  createLayer(BCto[i].name, BCto[i].startx, BCto[i].starty, BCto[i].width, BCto[i].height, true, "<img src='images/totext.jpg' border='0'  hspace='0' vspace='0' />"); 

BCWelcome = new Collection();

  BCWelcome.add(new Pelement("BCWelcome", "BCWelcome", xstart - 40, ylogo  - 6, xlogo + 40, yEndLogo, 55, 150, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCWelcome.length -1;
  createLayer(BCWelcome[i].name, BCWelcome[i].startx, BCWelcome[i].starty, BCWelcome[i].width, BCWelcome[i].height, true, "<img src='images/welcometext.jpg' border='0'  hspace='0' vspace='0' />"); 

LCorner = new Collection();
  LCorner.add(new Pelement("LCorner", "LCorner", xlogo-60, yEndLogo, xlogo +15, yEndLogo, 43, yunit, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = LCorner.length -1;
  createLayer(LCorner[i].name, LCorner[i].startx, LCorner[i].starty, LCorner[i].width, LCorner[i].height, true, "<img align='left' src='images/tlcorner.jpg' border='0'  hspace='0' vspace='0' />"); 

//moveLayer("", xlogo, ylogo);

setBgImage("LCorner", "images/lvbar.jpg");
//setBgRepeat("LCorner", "repeatx");

RCorner = new Collection();
  RCorner.add(new Pelement("RCorner", "RCorner", xunit + 160, yEndLogo, xunit - 63, yEndLogo, 50, yunit, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = RCorner.length -1;
  createLayer(RCorner[i].name, RCorner[i].startx, RCorner[i].starty, RCorner[i].width, RCorner[i].height, true, "<img align='left' src='images/trcorner.jpg' border='0'  hspace='0' vspace='0' />"); 

//moveLayer("", xlogo, ylogo);

setBgImage("RCorner", "images/rvbar.jpg");
//setBgRepeat("LCorner", "repeatx");


BCtext = new Collection();
  BCtext.add(new Pelement("BCtext", "BCtext", (xlogo + 205), -210, (xlogo +205) , yEndLogo + 5, 200, 200, false));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = BCtext.length -1;
  createLayer(BCtext[i].name, BCtext[i].startx, BCtext[i].starty, BCtext[i].width, BCtext[i].height, true, "<img align='left' src='images/bcname.gif' border='0'  hspace='0' vspace='0' />"); 

//moveLayer("", xlogo, ylogo);

//setBgImage("BCtext", "images/rvbar.jpg");
//setBgRepeat("LCorner", "repeatx");


Nav1 = new Collection();

  Nav1.add(new Pelement("Nav1", "Who.asp", xText,  (ylogo + ymargin), xEndText, yEndText, 300, 50, false, "<img src=\"images/whotext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav1.length -1;
  createLayer(Nav1[i].name, Nav1[i].startx, Nav1[i].starty, Nav1[i].width, Nav1[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav1');\" OnMouseOver=\"javascript: NavPic1.src='images/whotext.gif';\" OnMouseOut=\"javascript: NavPic1.src='images/whotext2.gif';\"><img src=\"images/whotext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic1\" /></a>"); 

Nav2 = new Collection();

  Nav2.add(new Pelement("Nav2", "Gallery.asp", xText, (ylogo + ymargin + yspacer), xEndText, yEndText, 300, 50, false, "<img src=\"images/gallerytext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav2.length -1;
  createLayer(Nav2[i].name, Nav2[i].startx, Nav2[i].starty, Nav2[i].width, Nav2[i].height, true,"<a href=\"javascript: MoveElements(1, 'Nav2');\" OnMouseOver=\"javascript: NavPic2.src='images/gallerytext.gif';\" OnMouseOut=\"javascript: NavPic2.src='images/gallerytext2.gif';\"><img src=\"images/gallerytext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic2\" /></a>"); 

Nav3 = new Collection();

  Nav3.add(new Pelement("Nav3", "resources.asp", xText, (ylogo + ymargin + (yspacer * 2)), xEndText, yEndText, 300, 50, false, "<img src=\"images/resourcestext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav3.length -1;
  createLayer(Nav3[i].name, Nav3[i].startx, Nav3[i].starty, Nav3[i].width, Nav3[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav3');\" OnMouseOver=\"javascript: NavPic3.src='images/resourcestext.gif';\" OnMouseOut=\"javascript: NavPic3.src='images/resourcestext2.gif';\"><img src=\"images/resourcestext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic3\" /></a>"); 

Nav4 = new Collection();

  Nav4.add(new Pelement("Nav4", "bookstore.asp", xText, (ylogo + ymargin + (yspacer * 3)), xEndText, yEndText, 300, 50, false, "<img src=\"images/bookstoretext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav4.length -1;
  createLayer(Nav4[i].name, Nav4[i].startx, Nav4[i].starty, Nav4[i].width, Nav4[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav4');\" OnMouseOver=\"javascript: NavPic4.src='images/bookstoretext.gif';\" OnMouseOut=\"javascript: NavPic4.src='images/bookstoretext2.gif';\"><img src=\"images/bookstoretext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic4\" /></a>"); 

Nav5 = new Collection();

  Nav5.add(new Pelement("Nav5", "tutorials.asp", xText, (ylogo + ymargin + (yspacer * 4)), xEndText, yEndText, 300, 50, false, "<img src=\"images/tutorialstext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav5.length -1;
  createLayer(Nav5[i].name, Nav5[i].startx, Nav5[i].starty, Nav5[i].width, Nav5[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav5');\" OnMouseOver=\"javascript: NavPic5.src='images/tutorialstext.gif';\" OnMouseOut=\"javascript: NavPic5.src='images/tutorialstext2.gif';\"><img src=\"images/tutorialstext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic5\" /></a>"); 

Nav6 = new Collection();

  Nav6.add(new Pelement("Nav6", "flocking.asp", xText, (ylogo + ymargin + (yspacer * 5)), xEndText, yEndText, 300, 50, false, "<img src=\"images/flockingtext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav6.length -1;
  createLayer(Nav6[i].name, Nav6[i].startx, Nav6[i].starty, Nav6[i].width, Nav6[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav6');\" OnMouseOver=\"javascript: NavPic6.src='images/flockingtext.gif';\" OnMouseOut=\"javascript: NavPic6.src='images/flockingtext2.gif';\"><img src=\"images/flockingtext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic6\" /></a>"); 

Nav7 = new Collection();

  Nav7.add(new Pelement("Nav7", "sponsors.asp", xText, (ylogo + ymargin + (yspacer * 6)), xEndText, yEndText, 300, 50, false, "<img src=\"images/sponsorstext.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" />"));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = Nav7.length -1;
  createLayer(Nav7[i].name, Nav7[i].startx, Nav7[i].starty, Nav7[i].width, Nav7[i].height, true, "<a href=\"javascript: MoveElements(1, 'Nav7');\" OnMouseOver=\"javascript: NavPic7.src='images/sponsorstext.gif';\" OnMouseOut=\"javascript: NavPic7.src='images/sponsorstext2.gif';\"><img src=\"images/sponsorstext2.gif\" border=\"0\"  hspace=\"60\" vspace=\"0\" name=\"NavPic7\" /></a>"); 

toggleAnima = new Collection();

  toggleAnima.add(new Pelement("toggleAnima", "", (xunit-150), (yunit-40), (xunit-200),(yunit-40), 150, 40, false, ""));
  //                                                                        sx  sy      ex  ey  w       h      vis
  i = toggleAnima.length -1;
  createLayer(toggleAnima[i].name, toggleAnima[i].startx, toggleAnima[i].starty, toggleAnima[i].width, toggleAnima[i].height, true, "<FORM ACTION=\"bluecockatoo.asp\" Method=\"Post\" NAME=\"Animation\"><input type=\"checkbox\" name=\"ShowAnimation\" " + ((bShowAnimation==true)? " CHECKED " : "") + " onClick=\"bShowAnimation = this.checked;\"></input><font face=\"Tahoma, Arial, sans-serif\" size=\"-1\" color=\"white\">Enable Animation</font></FORM>"); 
document.Animation.ShowAnimation.checked = bShowAnimation;

}

function MoveElements(intPass, strWhich){
var colWhich;
var colWhich2;
var i;
var j;

if (bShowAnimation==false){

hideLayer("toggleAnima");

colWhich = getPelement(strWhich);
i = colWhich.length -1;

window.location.href = colWhich[i].page + "?ShowAnimation=false";

}
else{

if (intPass==1){

strChosen=strWhich;

hideLayer("toggleAnima");

for (i=1; i <= 7; i++){
	if (("Nav" + i) != strWhich){
		hideLayer("Nav" + i);
	}
}

hideLayer("BCBWT");
hideLayer("BCto");
hideLayer("BCWelcome");


colWhich = getPelement(strWhich);
i = colWhich.length -1;
replaceContent(colWhich[i].name, colWhich[i].content);
strPage = colWhich[i].page;

initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].startx, ylogo + 215, 200, "MoveElements(2,\"\");");

}

if (intPass==2) {

colWhich = BCLine;
i = colWhich.length -1;
initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].endx, colWhich[i].endy, 700, "");

colWhich = BCLogo;
i = colWhich.length -1;
initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].endx, colWhich[i].endy, 700, "");

//i = BCLogo.length -1;
//j= BCLine.length -1;

//slideManyLayers(new Array(BCLine[j].name, BCLogo[i].name), BCLogo[i].endx, BCLogo[i].endy, 700, "");

colWhich = getPelement(strChosen);
i = colWhich.length -1;
initiateSlide(colWhich[i].name, colWhich[i].startx, ylogo + 215, colWhich[i].endx, colWhich[i].endy, 700, "MoveElements(3,\"\");");

i = BCLogo.length -1;
BCLogo[i].isfixed = true;
 
 }
 
 if (intPass==3){
 replaceContent("BC1", "<img src='images/bclogo.gif' border='0'  hspace=0'' vspace='0' />");
 
 moveLayer("BC2", 20, yEndLogo);
swipeLayer("BC2", 0, 20, xunit-40, 250, 500);
 
colWhich = LCorner;
i = colWhich.length -1;
 initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].endx, colWhich[i].endy, 500, "");
 
 //alert("got here");
 
 colWhich = RCorner;
i = colWhich.length -1;
 initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].endx, colWhich[i].endy, 500, "");
 
  colWhich = BCtext;
i = colWhich.length -1;
 initiateSlide(colWhich[i].name, colWhich[i].startx, colWhich[i].starty, colWhich[i].endx, colWhich[i].endy, 500, "window.location.href =\"" + strPage + "?ShowAnimation=true\";");
  
 

 }
}
}


function getPelement(strWhich){

 if (strWhich == "Nav1") { return (Nav1 == "" || Nav1 == "undefined" || Nav1 == null) ? null : Nav1;}
 if (strWhich == "Nav2") { return (Nav2 == "" || Nav2 == "undefined" || Nav2 == null) ? null : Nav2;}
if (strWhich == "Nav3") { return (Nav3 == "" || Nav3 == "undefined" || Nav3 == null) ? null : Nav3;}
if (strWhich == "Nav4") { return (Nav4 == "" || Nav4 == "undefined" || Nav4 == null) ? null : Nav4;}
if (strWhich == "Nav5") { return (Nav5 == "" || Nav5 == "undefined" || Nav5== null) ? null : Nav5;}
if (strWhich == "Nav6") { return (Nav6 == "" || Nav6 == "undefined" || Nav6 == null) ? null : Nav6;}
if (strWhich == "Nav7") { return (Nav7 == "" || Nav7 == "undefined" || Nav7 == null) ? null : Nav7;}
}



function initiateSlide(sName, lStartx, lStarty, lEndx, lEndy, lSpeed, ICode){
	//alert("got here");
   moveLayer(sName, lStartx, lStarty)
   //showLayer(sName);
   slideLayer(sName, lEndx, lEndy, lSpeed, ICode);
}



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Collection() - OBJECT - a dynamic storage structure similar to an Array.

function Collection() {
	this.length = 0; 
	this.add = add; 
	return this}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// add() - METHOD of Collection - adds an object to a Collection.

function add(object) {
	this[this.length] = object;
	this.length++;}


function Pelement(sName, sPage, lStartx, lStarty, lEndx, lEndy, lwidth, lheight, bisfixed, sContent){
	this.name = (sName=="" || sName =="undefined" || sName==null)? "" : sName;
	this.page = (sPage=="" || sPage =="undefined" || sPage==null)? "" : sPage;
	this.startx = (lStartx=="" || lStartx =="undefined" || lStartx==null)? "" : lStartx;
	this.starty = (lStarty=="" || lStarty =="undefined" || lStarty==null)? "" : lStarty;
	this.endx = (lEndx=="" || lEndx =="undefined" || lEndx==null)? "" : lEndx;
	this.endy = (lEndy=="" || lEndy =="undefined" || lEndy==null)? "" : lEndy;
	this.height = (lheight=="" || lheight =="undefined" || lheight==null)? "" : lheight;
        this.width = (lwidth=="" || lwidth =="undefined" || lwidth==null)? "" : lwidth;
	this.isfixed = (bisfixed=="" || bisfixed=="undefined" || bisfixed==null)? false: bisfixed;
	this.content=(sContent=="" || sContent=="undefined" || sContent==null)? "": sContent;
	this.initialize = pelement_initialize;
}

function pelement_initialize(){
	this.name = "";
	this.person = "";
	this.startx = 0;
	this.starty = 0;
	this.endx = 0;
	this.endy = 0;
	this.height = 0;
	this.width = 0;
	this.isfixed = false;
	this.content = "";
	return (true);
}
