
// JavaScript Document
function popWindow(url,w,h){
	window.open(url,"","width="+w+",height="+h+",scrollbars=1,resizable=1,status=1")
}

function printPop(url){
	window.open(url ,'printwindow','width=570,height=600,resizable=1');
}

function checkForm(){
	passFail = 1;
	formName = document.getElementById('FormName');
	
	if(formName.Name.value=="") { passFail=0; }
	if(formName.email.value=="") { passFail=0; }
	if(formName.address.value=="") { passFail=0; }
	if(formName.city.value=="") { passFail=0; }
	if(formName.zip.value=="") { passFail=0; }
	if(formName.state_province.value=="") { passFail=0; }
	if(formName.country.value=="") { passFail=0; }
	if(formName.brochure.value=="") { passFail=0; }
	
	if(passFail){
		return true;
	} else {
		alert('please fill required "*" fields.');
		return false;
	}
}


function revealBox(targ){
	Effect.SlideDown(targ);
}
function hideBox(targ){
	Effect.SlideUp(targ);
}

var oldTarg = "blurb";
function swapBox(targ,togg){
	if(oldTarg!=targ){
		if(togg){
			$(oldTarg).toggle();
		}
		$(targ).toggle();
		oldTarg = targ;
	}
}
function swapFlashBox(){
	$('top_flash').toggle();
	$('top_flash_sm').toggle();
	$('navcontainer').toggle();
	Effect.BlindDown('type_container');
}

// pre-populate images
var headImages = new Array();
headImages[0] = "top_photo_arts.jpg";
headImages[1] = "top_photo_band.jpg";
headImages[2] = "top_photo_computers.jpg";
headImages[3] = "top_photo_computers_2.jpg";
headImages[4] = "top_photo_departments.jpg";
headImages[5] = "top_photo_english.jpg";
headImages[6] = "top_photo_fr_imm.jpg";
headImages[7] = "top_photo_library.jpg";
headImages[8] = "top_photo_math.jpg";
headImages[09] = "top_photo_math_2.jpg";
headImages[10] = "top_photo_optional_courses.jpg";
headImages[11] = "top_photo_phys_ed.jpg";
headImages[12] = "top_photo_phys_ed_2.jpg";
headImages[13] = "top_photo_resources.jpg";
headImages[14] = "top_photo_science.jpg";
headImages[15] = "top_photo_science_3.jpg";
headImages[16] = "top_photo_study2.jpg";

var secs
var timerID = null
var timerRunning = false
var delay = 1000
var orgMax = 5
function headRotate()
{
    // Set the length of the timer, in seconds
    secs = orgMax
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        //StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
		secs = orgMax;
		summ = Math.floor(Math.random()*17);
		if(summ == 0) { summ = 1; }
		document.head_img.src= "../images/department/" + headImages[summ];
	
    }
	self.status = secs
	secs = secs - 1
	timerRunning = true
	timerID = self.setTimeout("StartTheTimer()", delay)
    
}


//javascript date/time script
function startclock()
{
var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";

if (nhours>=12)
    AorP="P.M.";
else
    AorP="A.M.";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
   nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

if (nday==0)
  nday="Sunday";
if (nday==1)
  nday="Monday";
if (nday==2)
  nday="Tuesday";
if (nday==3)
  nday="Wednesday";
if (nday==4)
  nday="Thursday";
if (nday==5)
  nday="Friday";
if (nday==6)
  nday="Saturday";

nmonth+=1;

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

clockBox = document.getElementById('clock');

clockBox.innerHTML=nhours+": "+nmins+": "+nsecn+" "+AorP+"<br />"+nday+", "+nmonth+"/"+ntoday+"/"+nyear;

setTimeout('startclock()',1000);

} 