/* CFE JAVASCRIPT */

// jQuery — change photo and caption in right column

var slideshowImageCount = 8; // no. of images
var quoteImageCount = 4;	 // no. quote images
var siteRootURL = "http://www.goodflow.net/";

/* captions */
captions = Array (
"Parents from across the state march on the Capitol in Albany to show support for CFE.",
"Students, parents and education advocates rally in support of CFE.",
"CFE Executive Director Geri Palast rallies crowd calling on state and city leaders to Keep the Promise for CFE funding.", 
"CFE Deputy Director Helaine Doran calls on Regents to ensure that CFE regulations require strong accountability.",
"CFE Counsel Joseph Wayland, Esq., CFE Executive Director Geri Palast and CFE Co-Counsel Michael Rebell at press conference following final arguments before New York State Court of Appeals.",
"Students, parents and education advocates march to Court of Appeals for final arguments.",
"CFE Executive Director Geri Palast and New York Assembly Speaker Sheldon Silver demand that New York City join New York State and Keep its Promise to fully fund city schools.",
"CFE Deputy Director Helaine Doran and Billy Easton, Executive Director, Alliance for Quality Education, a CFE coalition partner, brief the community on CFE law.");  

$(document).ready(
	function() 
	{ 
		changePhoto(); 
		changeQuote();
	}
); 
function changePhoto () // use this to iterate through slideshow
{  
	var photoIndex = $.cookie("header_index") ? parseInt($.cookie("header_index")) : 1; // sets first image as 1
	
	$("#rightColumnPhoto").src = siteRootURL + "_resources/photo_images/photo4.jpg";
	
	$("#sidePhotoBox").html("<img src=\"" + siteRootURL +  "_resources/photo_images/photo" + photoIndex + ".jpg\">");
	// change caption
	$("#sidePhotoCaption").html(captions[photoIndex-1]);
	$.cookie("header_index", (photoIndex % slideshowImageCount) + 1, { path: "/" }); // iterates cookie for text time
};

function changeQuote () // iterate through quotataions 
{ 
	var quoteIndex = $.cookie("quote_index") ? parseInt($.cookie("quote_index")) : 1; // sets first image as 1
	$("#quoteBox").html("<img src=\"" + siteRootURL +  "_resources/quote_images/quote" + quoteIndex + ".png\">");
	 $.cookie("quote_index", (quoteIndex % quoteImageCount) + 1, { path: "/" }); // iterates cookie for text time 
}
 
 
// JavaScript Document
 
function clearInput() { 	
	
	if (document.emailForm["emailAddress"].value == "Enter email address" ){
		document.emailForm["emailAddress"].value = "";
	}  
} 

function restoreInput () { 	
	if (document.emailForm["emailAddress"].value == "" ){
		document.emailForm["emailAddress"].value = "Enter email address";
	}  
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
 
