/// Banner Object
function createBanner(bannerImage){

	this.bannerImage=bannerImage;

 	this.loadBanner=function(){

		myBanner=document.createElement('img');
		//myBanner=document.createElement('embed');
 		myBanner.setAttribute('src',this.bannerImage);
		//myBanner.setAttribute('width','782');
		//myBanner.setAttribute('height','102');
		
	
		myBannerHeading=document.createElement('h1');
		mySecondHeading=document.createElement('h2');


		//// IE is non-standard in their approach to creating spans and adding text
		//// Here we check for IE using document.all. If it is IE the build the banner
		//// based upon the IE approach
		if(document.all){
			myShadowText=document.createElement("<span class='banner'>");
			mySecondShadow=document.createElement("<span class='bannerShadow'>");
			myAddress=document.createElement("<span class='collegeAddress'>");


			myBannerHeading.innerText="Carteret";
			myShadowText.innerText="Carteret";
			mySecondHeading.innerText="Community College";
			mySecondShadow.innerText="Community College";
		} else {

			myShadowText=document.createElement('span');
			myShadowText.setAttribute('class','banner');
			mySecondShadow=document.createElement('span');
			mySecondShadow.setAttribute('class','bannerShadow');
			myAddress=document.createElement('span');
			myAddress.setAttribute('class','collegeAddress');

			myBannerHeading.textContent="Carteret";
			myShadowText.textContent="Carteret";
			mySecondHeading.textContent="Community College";
			mySecondShadow.textContent="Community College";


		}

		myAddress.innerHTML="3505 Arendell Street<br/>"+
			"Morehead City, NC 28557-2989<br />"+
			"Telephone 252-222-6000";

		document.getElementById("banner").appendChild(myBanner);		
		document.getElementById("banner").appendChild(myBannerHeading);		
		document.getElementById("banner").appendChild(myShadowText);
		document.getElementById("banner").appendChild(mySecondHeading);
		document.getElementById("banner").appendChild(mySecondShadow);
		document.getElementById("banner").appendChild(myAddress);

	}

}


// horizontalmenu object
function loadHorizontalBar(myEmployeeAccess,myEmployment,myEmployeeDirectory,myLibrary,myHome){
	
	this.buttonArray=new Array();
	this.buttonArray['Employee Page']=myEmployeeAccess;
	this.buttonArray['Employment']=myEmployment;
	this.buttonArray['Employee Directory']=myEmployeeDirectory;
	this.buttonArray['Library']=myLibrary;
	this.buttonArray['Home']=myHome;


	this.createHorizontalButtons=function(){
		for(buttonName in this.buttonArray){

			this.createButton(buttonName,this.buttonArray[buttonName]);
		}
	}


	this.createButton=function(buttonName,buttonLink){

		var newElement=document.createElement('a');
 		newElement.setAttribute('href',buttonLink);


		if(document.all){
			newElement.innerText=buttonName;
		} else {
			newElement.textContent=buttonName;
		}


		document.getElementById("horizontalBar").appendChild(newElement);


	}


	/// Define event listeners here
	this.watchforevents=function(eventNode){

		this.eventNode=eventNode;

		e=document.getElementById(eventNode);

		switch(eventNode){
			
			case "employeeList":
				if (e.addEventListener){
  					e.addEventListener('dblclick', this.restore, false); 
				} else if (e.attachEvent){
  					e.attachEvent('ondblclick', this.restore);
				}
			break;

			case "pageContent":
				if (e.addEventListener){
					e.addEventListener('click', extractWindow, false); 
  					e.addEventListener('dblclick', restoreWindow, false); 
				} else if (e.attachEvent){
					e.attachEvent('onclick', extractWindow);
  					e.attachEvent('ondblclick', restoreWindow);
				}
			break;

		}

	}


	this.restore=function(){
		e=document.getElementById("employeeList");

		e.style.top='0px';
		e.style.width='0px';
		e.style.height='0px';
		e.style.borderStyle='none';
		e.style.position='absolute';
		e.style.zIndex='1';
		e.innerHTML="";
	
		displayWindow=true;

	}

}