/// Banner Object
function createBanner(bannerImage){

	this.bannerImage=bannerImage;

 	this.loadBanner=function(){

		myBanner=document.createElement('img');
 		myBanner.setAttribute('src',this.bannerImage);
	
		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 then 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);

	}

}


// hmenu object
function loadHorizontalBar(myEmployment,myEmployeeDirectory,myLibrary){
	
	this.buttonArray=new Array();
	this.buttonArray['Employment']=myEmployment;
	this.buttonArray['Employee Directory']=myEmployeeDirectory;
	this.buttonArray['Library']=myLibrary;
	


	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.innerHTML="<span>"+buttonName+"</span>";
		} else {
			newElement.innerHTML="<span>"+buttonName+"</span>";
		}


		dm=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;

	}

	this.addSearch=function(){
		var myElement=document.createElement('div');
		myElement.setAttribute('id','searchengine');

		myElement.innerHTML="<span><form>Enter Keyword: <input type=\"text\" name=\"keyword\" size=\"30\" />"+
			"Search In: <select style=\"z-index:4\""+
			"name=\"searchArea\"><option value=\"0\">All Areas</option>"+
			"<option value=\"1\">Curriculum Admissions</option>"+
			"<option value=\"2\">College Catalog</option>"+
			"<option value=\"3\">Curriculum Classes</option>"+
			"<option value=\"4\">Continuing Education Classes</option>"+
			"<option value=\"5\">Policies and Procedures Manual</option>"+
			"<option value=\"6\">Operations Manual</option>"+
			"<option value=\"7\">Faculty Handbook</option>"+
			"</select><input type=\"button\" name=\"search\" value=\"Find\" />"+
			"<span>"+
			"<input type=\"button\" name=\"helpme\" value=\"Find the Answer\"/ "+
			"onClick=\"openKnowledgeDB()\"></span></form></span>";

		
		document.getElementById("searchBar").appendChild(myElement);	

	}

	this.addSiteMap=function(){

		var mySiteMap=document.createElement('div');
		mySiteMap.setAttribute('id','siteMap');
		mySiteMap.innerHTML="<span style=\"float:right;padding-right:10px;font-size:14px;\">"+
			"<a href=\"http://www.carteret.edu/SiteMap/\" target=\"_blank\">Site Map</a></span>";

		document.getElementById("searchBar").appendChild(mySiteMap);

	}

}