
function insertMyData(){
	// The page is designated in the URL-- parse the page
	var myURL=document.URL.split(/\?/);
	var myPage="Curriculum Home";
	
	/// Now that the page request is known get the information from the server

	
	newBannerObj= new createBanner('images/standardBanner3.jpg');

	newBannerObj.loadBanner();

	var myHBar= new loadHorizontalBar("http://www.carteret.edu/HR/",
		"http://www.carteret.edu/Directory/",
		"http://www.carteret.edu/library",
		"http://www.carteret.edu/");
	myHBar.createHorizontalButtons();
		
	myHBar.watchforevents("employeeList");
/////////
/// This is commented out until the knowledge database can be coded.

	//myHBar.addSearch();

	myHBar.addSiteMap();

//////
	MyObject= new getMyPageObj('newFront/php/listRotatorImages.php','get','null','null');


	MyObject.requestInfo();

	//myHBar.watchforevents("pageContent");

	document.getElementById('AnnHeader').innerHTML="<h1 align=\"center\"><a href=\"#\" onClick=\"javascript:openAnnWindow()\" title=\"Click to view the announcements\">"+
		"Click to Read Announcements</a></h1>";
		

	loadLeftMenu();	
	loadRightMenu();
	/// Add the photo to the center
	
	document.getElementById('pageContent').innerHTML="<script type=\"text/javascript\" language=\"javascript\">"+
		"insertMyRotatorData();</script>";

	/// get the announcement data and load into the announcement area

	
	//var announcements=new getasyncdata('newFront/php/getAnn.php','get','null','loadAnn');
	//announcements.requestInfo();

	loadH1N1();
	var Backgroundcookie = ReadCookie("CCCBackground");
	if(Backgroundcookie.length == 0) { 
		loadBackground('Fabric');
	}else { 
		//alert("You successfully saved the "+Backgroundcookie+" background");


		loadBackground(Backgroundcookie); 
	}
	



}

function loadH1N1(){

	var myH1N1=document.getElementById("Announcements");

	myH1N1.innerHTML="<span style=\"font-size:14px;font-weight:bold; padding-left:150px;\">H1N1 Flu Information</span><br />"+
	"With the start of the academic year, Carteret Community College, "+
	"like other public schools and institutions of higher learning nationwide, is concerned about the health "+
	"and safety of its employees and students as they might be affected by the spread of the H1N1 virus."+
	"<br />Please click the following link to learn more details: <a href=\"http://www.carteret.edu/Announcements/H1N1\""+
	" target=\"_blank\">http://www.carteret.edu/Announcements/H1N1</a>";


}
function openAnnWindow(){

	window.open("newFront/php/viewAnnoucements.php","announcementWindow","scrollbar=1,menubar=0,status=0,width=500,height=600");
}

function showDescription(itemType,menuItem){

	switch(menuItem){

		case 'advisors':
			itemType.style.backgroundColor='yellow';
			

		break;



	}

	return true;

}

function closeDescription(itemType){
	itemType.style.backgroundColor="oldLace";

	return true;
}

function loadLeftMenu(){

	mlm=document.getElementById('LeftMenus').innerHTML="<div id=\"leftHeading\">"+
	"Curriculum Education</div><a href=\"http://www.carteret.edu/Admission/"+
	"\" title=\"Find requirements for joining CCC in the curriculum area, complete online application, learn about disability services,"+
	" transcript requests, registration dates and times, tuition and fees, and much more\">Admissions</a>"+
	"<a href=\"#\" title=\"Find Curriculum Academic Advisors and contact information\" onFocus=\"showDescription(this,'advisors')\""+
	"onBlur=\"closeDescription(this)\" onClick=\"javascript:getAdvisors();\">Academic Advisors</a>"+
	"<a href=\"http://www.carteret.edu/AcademicCalendar\""+
	" title=\"Curriculum calendar of important dates\">Academic Calendar</a>"+
	"<a href=\"http://www.carteret.edu/catalog/courses\" title=\"Search for curriculum courses and details including"+
	" co-requisites,prerequisites, and credit hours\" >"+
	"Course Catalog</a><a href=\"http://www.carteret.edu/catalog/schedules\""+
	" title=\"Find the classes offered in the curriculum area of CCC-past, present, and future\">Class Schedules</a>"+
	"<a href=\"http://www.carteret.edu/CurriculumPrograms\""+
	" title=\"View all the programs offered in the curriculum area and the details of each program, find syllabi for classes, "+
	" and find the contact information for your program of choice\">"+
	"Programs Of Study</a>"+
	"<a href=\"http://www.carteret.edu/financialAid\" title=\"Find the financial aid possibilities offered at CCC, PELL , Veterans, etc\">"+
	"Financial Aid</a>"+
	"<a href=\"http://www.carteret.edu/registrar\" title=\"Information about FERPA,grade replacement,grade computation,graduation and more\">"+
	"Office of the Registrar</a><a href=\"http://www.carteret.edu/caps"+
	"\" title=\"Find your future through academic planning. Learn more about the services.\">Career and Academic Planning Services</a>"+
	"<a href=\"http://www.carteret.edu/CatalogArchives/\" title=\"PDF versions of recently published college catalogs\">College Catalogs</a>"+
	"<a href=\"http://start.mailccc.net/\" title=\"Google Enterprise Network-Email, Instant Message, Google Docs, and more\">Student G-mail</a>"+
	"<a href=\"http://www.carteret.edu/OnlineRegistration/Online%20Registration%20for%20Curriculum%20Students.htm\""+
	" title=\"Returning students registration through WebAdvisor. Requires prior approval from academic advisors\">"+
	"Online Registration </a>"+
	"<a href=\"http://www.carteret.edu/academic/\" title=\"Academic Computer Lab,Free tutoring services, Student Handbook,and Student Support Services at CCC\">Computer Lab, Student Handbook,Tutoring,TRIO</a>"+
	"<a href=\"https://wa.carteret.edu/WA/WebAdvisor?&TOKENIDX=1639655493&CONSTITUENCY=WBST&TYPE=M&PID=CORE-WBST\""+
	" title=\"Use WebAdvisor to view your transcript and other information\">"+
	"Web Advisor</a>"+
	"<span class=\"curheading\">Distance Learning</span><a href=\"http://blackboard.carteret.edu/\">Blackboard</a>"+
	"<a href=\"http://d2.parature.com/ics/support/default.asp?deptID=4308\" target=\"_blank\">"+
	"Blackboard Helpdesk</a>"+
	"<a href=\"http://web.carteret.edu/keoughp/Distance%20Learning/CCCDLweb/dl.html\">DL Homepage</a>"+
	"<a href=\"http://www.carteret.edu/DLOrientation/\">DL Orientation</a>"+
	"<span class=\"curheading\">SGA and Students</span>"+
	"<a href=\"http://www.carteret.edu/studentlife/sga.htm\">Student Government</a>"+
	"<a href=\"http://www.carteret.edu/IntranetHome/StudentJobs/studentJobs.php\">Student Jobs</a>"+
	"<a href=\"http://n4chealth.com/\">Student Health Plan</a>"+
	"<a href=\"http://www.carteret.edu/StudentsRights\" title=\"Curriculum student's rights and responsibilities\">Students Rights</a>";
	
}

function loadRightMenu(){
	mrm=document.getElementById('RightMenus').innerHTML="<div id=\"rightHeading\">"+
	"Continuing Education</div>"+
	"<a href=\"http://www.carteret.edu/CCEDHome/schedules/otherPages.php?pageName=Registration\" "+
	" title=\"Find how to register for continuing education classes\">Registration</a>"+
	"<a href=\"javascript:changewidth('800','500','5','19','outset','corporatePrograms');\""+
	" title=\"View a list of programs offered in Continuing Education\">"+
	"Programs of Study</a>"+
	"<a href=\"http://www.ed2go.com/carteret/\" title=\"Online classes offered in the Continuing Education area\">Online Learning</a>"+
	"<a href=\"http://www.carteret.edu/CCEDHome/index.php\">Corp and Com Homepage</a>"+
	"<a href=\"http://www.carteret.edu/CCEDHome/schedules/getAllClasses.php\" target=\"_blank\""+
	"title=\"View or print a complete and current list of classes offered through Continuing Education\">"+
	"Class Schedules</a>"+
	"<a href=\"http://www.carteret.edu/ccedhome/schedules/mysearch.php\" target=\"_blank\""+
	"title=\"Use the search engine to find classes offered in the continuing education area by title, program, or keyword\">"+
	"Search for Classes</a>"+
	"<div id=\"aboutCCC\">The College</div>"+
	"<a href=\"http://www.carteret.edu/cccinfo/\" title=\"Accreditation information,message from the college president, college mission, vision, and values\">More About CCC</a>"+
	"<a href=\"http://www.carteret.edu/eventCalendar/\" target=\"_blank\""+
	"title=\"Events in Carteret County and at the College\">External Event Calendar</a>"+
	"<a href=\"http://www.carteret.edu/camps/summerCamps.htm\" target=\"_blank\" "+
	"title=\"Summer camps offered by Carteret Community College\">"+
	"CCC Summer Camps</a>"+
	"<a href=\"http://www.carteretccbookstore.com/\" title=\"View or purchase your books online\" target=\"_blank\">"+
	"Campus Book Store</a>"+
	"<a href=\"http://www.carteret.edu/ResearchandReports/randrIndex.htm\""+
	"title=\"View economic impact studies, performance measures and standards, and the latest report to the community\" >Effectiveness and Reports</a>"+
	"<a href=\"http://ccctitle3.wordpress.com/\">Title III Grant</a>"+
	"<a href=\"http://web.carteret.edu/Sustainability\" target=\"_blank\" title=\"College Green Initiative\">Sustainability Web Site</a>"+
	"<div id=\"foundation\">The Foundation</div>"+
	"<a href=\"http://www.carteret.edu/Foundation/ \" target=\"_blank\">"+
	"Alumni and Friends</a>"+
	"<a href=\"http://www.carteret.edu/foundation/php/foundation.php?page=boat\" target=\"_blank\">Boat Donation/Resale</a>"+
	"<a href=\"http://www.carteret.edu/foundation/php/foundation.php?page=donate\" target=\"_blank\">Donate Now</a>"+
	"<div id=\"technologyHelp\">Technology Help</div>"+
	"<a href=\"http://www.carteret.edu/ITHelp/email\" title=\"Campus email account information and instruction\""+
	">Campus Email</a>"+
	"<a href=\"http://www.carteret.edu/ITHelp/Wireless\" title=\"How to set-up your device for access to the campus wireless network\">"+
	"Campus Wireless Network</a><a href=\"http://docs.google.com/support/bin/topic.py?hl=en&topic=15114\""+
	"title=\"Free software that includes word processing, spreadsheet, presentation, and much more\" target=\"_blank\">"+
	"Using Google Docs</a>"+
	"<hr><a href=\"https://www.carteret.edu/IntranetHome/Login/login.html\">Employee Login</a>"+
	"<a href=\"http://mail.carteret.edu\">Employee Email</a>"+
	"<div id=setBackground><hr><a href=\"#\" onClick=\"javascript:chooseBackground();\">Customize Site</a></div>";
	

}


function getAdvisors(){
	/// get the advisors

	var advisors=document.createElement('div');
	advisors.setAttribute('id','advisor');
	advisors.style.width='650px';
	advisors.style.fontSize='14px';
	advisors.style.position='absolute';
	advisors.style.top='0px';
	advisors.style.left='50px';
	advisors.style.zIndex='6';
	advisors.style.backgroundColor='#fffab2';
	

	var md=document.getElementById('blankpage');

	advisors.innerHTML="Loading ...<img src=\"http://www.carteret.edu/NewFrontPage/pleasewait.gif\">";

	md.appendChild(advisors);

	var showAdvisors=new getasyncdata('newFront/php/getAdvisors.php','get','null','advisor');
	
	showAdvisors.requestInfo();

	/// hide the searchBar

	msb=document.getElementById("searchBar");

	msb.style.visibility='hidden';




}

function closeAdvisors(){

	md=document.getElementById('blankpage');
	md.removeChild(md.firstChild);
	msb=document.getElementById("searchBar");

	msb.style.visibility='visible';


}

function extractWindow(){

	e=document.getElementById("pageContent");
	e.style.visibility='visible';
	e.style.zIndex='5';
	e.style.width = '750px';
	e.style.top= '0px';
	e.style.left='0px';
	e.style.paddingRight='50px';
	e.style.backgroundColor='#fffab2';
	e.style.overflow='visible';
	e.style.borderStyle='none';


}

function restoreWindow(){


	e=document.getElementById("pageContent");
	e.style.position='absolute';
	e.style.top='156px';
	e.style.left='284px';
	e.style.zIndex='3';
	e.style.height='366px';
	e.style.width='553px';
	e.style.borderStyle='inset';
	e.style.overflow='auto';

}
var cubeimage=new Array();
var delay=5000;
var count =1;
function loadMainRotator(results){

	///image list is returned in results

	var imageArray=Array();

	var switchImage=Array();
	imageArray=results.split(',');

	/// include the path in the array
	for(ima=0;ima < imageArray.length;ima++){
		switchImage[ima]="Rotator/"+imageArray[ima];
	}
	

	
	for (i=0;i<imageArray.length;i++){
		cubeimage[i]=new Image()
		cubeimage[i].src=switchImage[i]
	}


		//window.onload=new Function("setTimeout('movecube()',delay)")

	d=document.getElementById("pageContent");

	d.innerHTML="<img onLoad=setTimeout(\"movecube()\",delay) src=\""+switchImage[0]+"\" name=\"cube\""+  "height=\"366\" width=\"580\" >";

	
}


function movecube(){


	d=document.getElementsByTagName("img");

	delay=5000;
	if(count == cubeimage.length) {
		count =0;
	}

	if (window.createPopup){
		
		d[1].src=cubeimage[count++].src;
	}

/***
	if (count==cubeimage.length){
		count=0;
		setTimeout("movecube()",delay);
	}
***/
}
function loadPageMenus(){
	


	this.loadleftmenus= function(){

	//
	leftmenu=document.getElementById("LeftMenus");

	leftmenu.innerHTML="<a href=\"http://www.carteret.edu/newfrontpage/"+
		"Newtemplate.php?sectionNumber=3&pageName=Admissions&folderPath="+
		"Admissions/&includeName=content.php&tableName=admissioncontent\" />Admissions</a><br />"+
		"<a href=\"http://www.carteret.edu/newfrontpage/"+
		"Newtemplate.php?sectionNumber=5&pageName=Financial%20Aid&folderPath="+
		"Admissions/&includeName=content.php&tableName=financialaidcontent\" />Financial Aid</a>";
	

	}


	this.loadrightmenus= function(){



	}
}


function getMyPageObj(myURL,reqType,myData,pgType){

	this.myURL=myURL;
	this.reqType=reqType;
	this.myData=myData;
	this.pgType=pgType;

	this.getHTTPObject=function(){ 
  		var xmlhttp; 

  		if(window.XMLHttpRequest){ 
   		 	xmlhttp = new XMLHttpRequest(); 
 		} 
 		else if (window.ActiveXObject){ 
    			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    			if (!xmlhttp){ 
        			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    			} 
    
		} 


  		return xmlhttp; 

  
	} 

	var http=this.getHTTPObject();

	this.handleHttpResponse=function(){

       		 if (http.readyState == 4) { 
             		if(http.status==200) { 
                 		 var results=http.responseText; 
				if(pgType=='normal'){

					var menus=results.split(/MYCONTENT:/);
					document.getElementById("pageMenus").innerHTML=menus[0];
					document.getElementById("pageContent").innerHTML=menus[1];
				} else {
					loadMainRotator(results);
              				//document.getElementById("pageContent").innerHTML = results; 

				}
             		} 
         	} 
	}
            
	this.requestInfo=function () {

		if(reqType=="get"){
		         
       	 		http.open("GET",this.myURL,true); 
        		http.onreadystatechange = this.handleHttpResponse; 

		} else {
			         
        		http.open("POST",this.myURL,true); 
			http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        		http.onreadystatechange = this.handleHttpResponse; 
     	
		} 

		http.send(this.myData);
	} 
}

function openKnowledgeDB(){

	knowledgewindow=document.createElement('div');
	knowledgewindow.setAttribute('id','kw');

	knowledgewindow.innerHTML="<input style=\"top:0px;float:right\" type=\"button\" name=\"closeKDB\""+
		" value=\"Close\" onclick=\"closeKDB()\" />"+
		"<p>Search knowledge database</p>"+
		"Enter Question: <input type=\"text\" name=\"myQuestion\" size=\"60\">"+
		"Select Area: <select name=\"kdArea\" >"+
		"<option value=\"completeSer\">Entire Knowledge Database</options>"+
		"<option value=\"allAreasCur\">All Areas Curriculum</options>"+
		"<option value=\"allAreasCon\">All Areas Continuing Education</options>"+
		"<option value=\"admission\">Curriculum Admission</option>"+
		"<option value=\"ceAdmission\">Continuing Education Admission</option>"+
		"<option value=\"cregistrar\">Curriculum Registrar</option>"+
		"<option value=\"cedregis\">Continuing Education Registrar</options>"+
		"<option value=\"caps\">Career and Academic Planning</option>"+
		"<option value=\"fa\">Financial Aid</option>"+
		"<option value=\"it\">Information Technology</option>"+
		"<option value=\"bo\">Business Office</option>"+
		"<option value=\"hr\">Human Resources</option>"+
		"<option value=\"sga\">Student Government Association</option>"+
		"</select>"+
		"<input type=\"button\" name=\"searchKDB\" value=\"Search for Answer\" "+
		"onclick=\"searchForAnswer()\">";

	md=document.getElementById('knowledgeDB');
	md.style.visibility='visible';

	md.appendChild(knowledgewindow);
	

	

}


function closeKDB(){
	md=document.getElementById("knowledgeDB");
	md.style.visibility='hidden';
	md.removeChild(md.firstChild);

}
