﻿//FUNCTION FOR SLHS CONSTRUCTION PICS IN SLIDE VIEW
//Global array set for picture slides
var arrSlides = new Array();

function Slide(filename, postedDate, caption)
{
	this.Filename = filename;
	this.PostedDate = postedDate;
	this.Caption = caption;
}

function loadSlides()
{
//Populate array
arrSlides[0] = new Slide('01_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[1] = new Slide('02_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[2] = new Slide('03_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[3] = new Slide('04_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[4] = new Slide('05_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[5] = new Slide('06_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[6] = new Slide('07_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[7] = new Slide('08_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[8] = new Slide('09_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[9] = new Slide('10_SLHS_groundbreaking.jpg', '10\/26\/07', 'Ground Breaking Ceremony');
arrSlides[10] = new Slide('SLHS_01_11.26.07.jpg', '11\/26\/07', 'Ariel View 1');
arrSlides[11] = new Slide('SLHS_02_11.26.07.jpg', '11\/26\/07', 'Ariel View 2');
arrSlides[12] = new Slide('SLHS_03_11.26.07.jpg', '11\/26\/07', 'Ariel View 3');
arrSlides[13] = new Slide('SLHS_04_12.27.07.jpg', '12\/27\/07', 'Ariel View 4');
arrSlides[14] = new Slide('SLHS_05_12.27.07.jpg', '12\/27\/07', 'Ariel View 5');
arrSlides[15] = new Slide('SLHS_06_12.27.07.jpg', '12\/27\/07', 'Ariel View 6');
arrSlides[16] = new Slide('SLHS_07_01.25.08.jpg', '01\/25\/08', 'Ariel View 7');
arrSlides[17] = new Slide('SLHS_08_01.25.08.jpg', '01\/25\/08', 'Ariel View 8');
arrSlides[18] = new Slide('SLHS_09_01.25.08.jpg', '01\/25\/08', 'Ariel View 9');
arrSlides[19] = new Slide('SLHS_01_07.28.08.jpg', '07\/28\/08', 'Ariel View 10');
arrSlides[20] = new Slide('SLHS_02_07.28.08.jpg', '07\/28\/08', 'Ariel View 11');
arrSlides[21] = new Slide('SLHS_03_07.28.08.jpg', '07\/28\/08', 'Ariel View 12');
arrSlides[22] = new Slide('SLHS08.27.08_01.jpg', '08\/27\/08', 'Ariel View 13');
arrSlides[23] = new Slide('SLHS08.27.08_02.jpg', '08\/27\/08', 'Ariel View 14');
arrSlides[24] = new Slide('SLHS08.27.08_03.jpg', '08\/27\/08', 'Ariel View 15');
}

//Declare a variable to hold the array index of picture to display
var currentIndex = 0;

function cycleSlides()
{
	
	 // Make sure that there are image filenames in the array
     if(arrSlides.length>0 && document.getElementById)
     {		
       // Increment the image index
       currentIndex++;
				
       // Check to see if the current image index is greater than the last index of the array
       if (currentIndex > arrSlides.length - 1)
          {
     	  currentIndex = 0;
     	  }
     	  
		// Update the span tag that display the number of the image that is currently displayed
    	document.getElementById('spnCounter').innerHTML='Image ' + (currentIndex+1) + ' of ' + arrSlides.length;

		//Update the image that is displayed
		document.getElementById('slideFrame').src='common/img/construction/' + arrSlides[currentIndex].Filename;
		
		// Update the span tag that contains the caption, or description of the picture 
    	document.getElementById('spnCaption').innerHTML = arrSlides[currentIndex].Caption;
		
	 	// Update the span tag that contains the date posted 
    	document.getElementById('spnDate').innerHTML = 'Date: ' + arrSlides[currentIndex].PostedDate;

	}
	
}

function picNext()
{
	// Increment counter
	currentIndex++;

	// Make sure we are not past the end of our array
	if (currentIndex < arrSlides.length)
	
	{
	    
		// Disable the Next button if we are on the last picture
		if (currentIndex == arrSlides.length-1)
		{
        document.getElementById("btnNext").disabled=true;
        }
        
		// Update the span tag that display the number of the image that is currently displayed
    	document.getElementById('spnCounter').innerHTML='Image ' + (currentIndex+1) + ' of ' + arrSlides.length;

		//Update the image that is displayed
		document.getElementById('slideFrame').src='common/img/construction/' + arrSlides[currentIndex].Filename;
		
		// Update the span tag that contains the caption, or description of the picture 
    	document.getElementById('spnCaption').innerHTML = arrSlides[currentIndex].Caption;

		// Update the span tag that contains the date posted 
    	document.getElementById('spnDate').innerHTML = 'Date: ' + arrSlides[currentIndex].PostedDate;

        document.getElementById("btnPrev").disabled=false;
	}
	
}

function picPrev()
{
	// Decrement counter
	currentIndex --;
	
	// Make sure we are not past the end of our array
	if (currentIndex >= 0)
	{
		
		if (currentIndex == 0)
		{
		// Disable the Previous button if we are on the first picture
		document.getElementById("btnPrev").disabled=true;
		}

		// Update the span tag that display the number of the image that is currently displayed
    	document.getElementById('spnCounter').innerHTML='Image ' + (currentIndex+1) + ' of ' + arrSlides.length;

		//Update the image that is displayed
		document.getElementById('slideFrame').src='common/img/construction/' + arrSlides[currentIndex].Filename;
		
		// Update the span tag that contains the caption, or description of the picture 
    	document.getElementById('spnCaption').innerHTML = arrSlides[currentIndex].Caption;

	 	// Update the span tag that contains the date posted 
    	document.getElementById('spnDate').innerHTML = 'Date: ' + arrSlides[currentIndex].PostedDate;
		
		document.getElementById("btnNext").disabled=false;
	}
	
}

var timer;
function picAuto()
{
	if(document.getElementById("btnAuto").value == 'Slide Show')
	{
	timer = window.setInterval('cycleSlides()',3000);
	document.getElementById("btnAuto").value = 'Stop';
	document.getElementById("btnNext").disabled = true;
	document.getElementById("btnPrev").disabled = true;
	}
	else
	{
	window.clearInterval(timer);
	document.getElementById("btnAuto").value = 'Slide Show';
	document.getElementById("btnNext").disabled = false;
	document.getElementById("btnPrev").disabled = false;
	}
}

//FUNCTION FOR LOADING DYNAMIC CONTENT INTO DIVS USING HTML SOURCE
var myHttpRequest = false;

if(window.XMLHttpRequest)
	myHttpRequest = new XMLHttpRequest();
else if(window.ActiveXObject)
	myHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	
	
function loadContent(source, content)
{
 	if(myHttpRequest)
	{
		var data = document.getElementById(content);
		myHttpRequest.open("GET",source);
		myHttpRequest.onreadystatechange = function()
		{
			if(myHttpRequest.readyState	== 4)
				data.innerHTML = myHttpRequest.responseText;
		}
		
		myHttpRequest.send(null);
	}
	
}

//FUNCTION FOR AJAX/XML TICKER

// -------------------------------------------------------------------
// Ajax XML Ticker (txt file source)
// Author: Dynamic Drive (http://www.dynamicdrive.com)
// -------------------------------------------------------------------

////////////No need to edit beyond here//////////////

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

// -------------------------------------------------------------------
// Main Ajax Ticker Object function
// ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot)
// -------------------------------------------------------------------

function ajax_ticker(xmlfile, divId, divClass, delay, fadeornot){
this.xmlfile=xmlfile //Variable pointing to the local ticker xml file (txt)
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=0
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
this.messages=[] //Arrays to hold each message of ticker
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">Initializing ticker...</div></div>')
this.getXMLfile()
}

// -------------------------------------------------------------------
// getXMLfile()- Use Ajax to fetch xml file (txt)
// -------------------------------------------------------------------

ajax_ticker.prototype.getXMLfile=function(){
if (this.ajaxobj){
var instanceOfTicker=this
var url=this.xmlfile+"?bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', url, true)
this.ajaxobj.send(null)
}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of xml file and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

ajax_ticker.prototype.initialize=function(){ 
if (this.ajaxobj.readyState == 4){ //if request of file completed
if (this.ajaxobj.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
var xmldata=this.ajaxobj.responseText
this.contentdiv.style.display="none"
this.contentdiv.innerHTML=xmldata
if (this.contentdiv.getElementsByTagName("div").length==0){ //if no messages were found
this.contentdiv.innerHTML="<b>Error</b> fetching remote ticker file!"
return
}
var instanceOfTicker=this
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){instanceOfTicker.contentdiv=instanceOfTicker.ajaxobj=null})
//Cycle through XML object and store each message inside array
for (var i=0; i<this.contentdiv.getElementsByTagName("div").length; i++){
if (this.contentdiv.getElementsByTagName("div")[i].className=="message")
this.messages[this.messages.length]=this.contentdiv.getElementsByTagName("div")[i].innerHTML
}
this.contentdiv.innerHTML=""
this.contentdiv.style.display="block"
this.rotatemsg()
}
}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through ticker messages and displays them
// -------------------------------------------------------------------

ajax_ticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{ //else, construct item, show and rotate it!
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.messages[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.messages.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container periodically
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

ajax_ticker.prototype.fadetransition=function(fadetype, timerid){
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.2
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.1
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}

//*******************************************************************//


//FUCNTION FOR COLLAPSING MENU IN INFO CORNER
var arrOnOff=new Array();
var arrSubmenu=new Array();
var arrExpandImg=new Array();

arrExpandImg[0]='common/img/SignDOWN.gif';
arrExpandImg[1]='common/img/SignUP.gif';

//define numOfMenus. It should be equal to the number of submenus you have.
numOfMenus=2;

//Define arrays with submenu items
arrSubmenu[0]='<span class="submenu_display"><a href="../../../docs/StudentAchievement/AcademicPlanningGuide_1011.pdf" target="_blank">10/11 School Year</a><br><a href="/docs/StudentAchievement/AcademicPlanningGuide_1011Spanish.pdf" target="_blank">10/11 en Espa&ntilde;ol</a><br><a href="../../../docs/StudentAchievement/AcademicPlanningGuide_0910.pdf" target="_blank">09/10 School Year</a><br><a href="../../../docs/StudentAchievement/AcademicPlanningGuide_0910Spanish.pdf" target="_blank">09/10 en Espa&ntilde;ol</a><br></span>';
arrSubmenu[1]='<span class="submenu_display"><a href="/docs/StudentAchievement/StudentProceduresHandbook.pdf" target="_blank">English Handbook</a><br><a href="/docs/StudentAchievement/StudentProceduresHandbookSP.pdf" target="_blank">Manual en Espa&ntilde;ol</a><br></span>';

for (loop=0; loop<numOfMenus; loop++){
 arrOnOff[loop]=0;
}

function dropmenu(menu_id, menu_number, img_id){

if (arrOnOff[menu_number]==0)
  {
    menu_id.innerHTML=arrSubmenu[menu_number];
    arrOnOff[menu_number]=1;
	img_id.src=arrExpandImg[1];	
  }
else
  {
    menu_id.innerHTML="";
    arrOnOff[menu_number]=0;
	img_id.src=arrExpandImg[0];	
  }
}


//CONTENT GLIDER JAVASCRIPT - USES jquerySTACK.js
//Featured Content Glider: By http://www.dynamicdrive.com
//http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm
//Created: Dec 22nd, 07'
//Updated (Jan 29th, 08): Added four possible slide directions: "updown", "downup", "leftright", or "rightleft"
//Updated (Feb 1st, 08): Changed glide behavior to reverse direction when previous button is clicked
//Updated (Feb 12th, 08): Added ability to retrieve gliding contents from an external file using Ajax ("remotecontent" variable added to configuration)

var featuredcontentglider={
	csszindex: 100,
	ajaxloadingmsg: '<b>Fetching Content. Please wait...</b>',
	glide:function(config, showpage, isprev){
		var selected=parseInt(showpage)
		if (selected>=config.$contentdivs.length){ //if no content exists at this index position
			alert("No content exists at page "+(selected+1)+"! Loading 1st page instead.")
			selected=0
		}
		var $target=config.$contentdivs.eq(selected)
		//Test for toggler not being initialized yet, or user clicks on the currently selected page):
		if (config.$togglerdiv.attr('lastselected')==null || parseInt(config.$togglerdiv.attr('lastselected'))!=selected){
			var $selectedlink=config.$toc.eq(selected)
			config.$next.attr('loadpage', (selected<config.$contentdivs.length-1)? selected+1+'pg' : 0+'pg')
			config.$prev.attr('loadpage', (selected==0)? config.$contentdivs.length-1+'pg' : selected-1+'pg')
			var startpoint=(isprev=="previous")? -config.startpoint : config.startpoint
			$target.css(config.leftortop, startpoint).css("zIndex", this.csszindex++) //hide content so it's just out of view before animating it
			var endpoint=(config.leftortop=="left")? {left:0} : {top:0} //animate it into view
			$target.animate(endpoint, config.speed)
			config.$toc.removeClass('selected')
			$selectedlink.addClass('selected')
			config.$togglerdiv.attr('lastselected', selected+'pg')
		}
	},

	getremotecontent:function(config){
		config.$glider.html(this.ajaxloadingmsg)
		$.ajax({
			url: config.remotecontent,
			error:function(ajaxrequest){
				config.$glider.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)
			},
			success:function(content){
				config.$glider.html(content)
				featuredcontentglider.setuptoggler(config)
			}
		})
	},

	aligncontents:function(config){
		config.$contentdivs=$("#"+config.gliderid+" ."+config.contentclass)
		config.$contentdivs.css(config.leftortop, config.startpoint).css({height: config.$glider.height(), visibility: 'visible'}) //position content divs so they're out of view:
	},

	setuptoggler:function(config){
		this.aligncontents(config)
		config.$togglerdiv.hide()
		config.$toc.each(function(index){
				$(this).attr('pagenumber', index+'pg')
				if (index > (config.$contentdivs.length-1))
					$(this).css({display: 'none'}) //hide redundant "toc" links
		})
		var $nextandprev=$("#"+config.togglerid+" .next, #"+config.togglerid+" .prev")
		$nextandprev.click(function(event){ //Assign click behavior to 'next' and 'prev' links
			featuredcontentglider.glide(config, this.getAttribute('loadpage'), this.getAttribute('buttontype'))
			event.preventDefault() //cancel default link action
		})
		config.$toc.click(function(event){ //Assign click behavior to 'toc' links
			featuredcontentglider.glide(config, this.getAttribute('pagenumber'))
			event.preventDefault()
		})
		config.$togglerdiv.fadeIn(1000, function(){
			featuredcontentglider.glide(config, config.selected)
			if (config.autorotate==true){ //auto rotate contents?
				config.stepcount=0 //set steps taken
				config.totalsteps=config.$contentdivs.length*config.autorotateconfig[1] //Total steps limit: num of contents x num of user specified cycles)
				featuredcontentglider.autorotate(config)
			}
		})
		config.$togglerdiv.click(function(){
			featuredcontentglider.cancelautorotate(config.togglerid)
		})
	},

	autorotate:function(config){
		var rotatespeed=config.speed+config.autorotateconfig[0]
		window[config.togglerid+"timer"]=setInterval(function(){
			if (config.totalsteps>0 && config.stepcount>=config.totalsteps){
				clearInterval(window[config.togglerid+"timer"])
			}
			else{
				config.$next.click()
				config.stepcount++
			}
		}, rotatespeed)
	},

	cancelautorotate:function(togglerid){
		if (window[togglerid+"timer"])
			clearInterval(window[togglerid+"timer"])
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i") //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
			return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	},

	setCookie:function(name, value){
		document.cookie = name+"="+value
	},

	init:function(config){
		$(document).ready(function(){
			config.$glider=$("#"+config.gliderid)
			config.$togglerdiv=$("#"+config.togglerid)
			config.$toc=config.$togglerdiv.children('.toc')
			config.$next=config.$togglerdiv.children('.next')
			config.$prev=config.$togglerdiv.children('.prev')
			config.$prev.attr('buttontype', 'previous')
			var selected=(config.persiststate)? featuredcontentglider.getCookie(config.gliderid) : config.selected
			config.selected=(isNaN(parseInt(selected))) ? config.selected : selected //test for cookie value containing null (1st page load) or "undefined" string	
			config.leftortop=(/up/i.test(config.direction))? "top" : "left" //set which CSS property to manipulate based on "direction"
			config.heightorwidth=(/up/i.test(config.direction))? config.$glider.height() : config.$glider.width() //Get glider height or width based on "direction"
			config.startpoint=(/^(left|up)/i.test(config.direction))? -config.heightorwidth : config.heightorwidth //set initial position of contents based on "direction"
			if (typeof config.remotecontent!="undefined" && config.remotecontent.length>0)
				featuredcontentglider.getremotecontent(config)
			else
				featuredcontentglider.setuptoggler(config)
			$(window).bind('unload', function(){ //clean up and persist
				config.$togglerdiv.unbind('click')
				config.$toc.unbind('click')
				config.$next.unbind('click')
				config.$prev.unbind('click')
				if (config.persiststate)
					featuredcontentglider.setCookie(config.gliderid, config.$togglerdiv.attr('lastselected'))
				config=null
				
			})
		})
	}
}
//-------------- end content glider script -----------------------//