﻿//*********************************************
//
//  Sierra College Career Technical Education
//
//**********************************************


//******************
// search
function search() 
{
    openNewWindow("http://www.google.com/search?q="+document.form1.input1.value+"+site%3Awww.sierracollege.edu/programs/cte");
}

//*****************
// Clears a form field when the user clicks in the field
//
function clearMe(formfield) {
   if (formfield.defaultValue==formfield.value)
     formfield.value = "";
}	

function openNewWindow(newURL) 
{     
   var MyWindowOptions = 'width=850,height=600,status=yes,toolbar=no,scrollbars=yes,resizable=yes';
   window.open(newURL, '', MyWindowOptions);
}

// Used to add stripes to table data for easier reading
function setStripes() {
   $(".striped tr").removeClass("stripe"); // reset 
   $(".striped tr:even").addClass("stripe");
}
   

function compareColumnValues(colNum) 
{
    return function compareTRs(oTR1, oTR2) {
      var sValue1 = oTR1.cells[colNum].firstChild.nodeValue;
      var sValue2 = oTR2.cells[colNum].firstChild.nodeValue;
       return sValue1.localeCompare(sValue2);
    };
}

function sortTable(sTableID, colNum) 
{
   var theTable = document.getElementById(sTableID);
   var oTBody = theTable.tBodies[0];
   var colDataRows = oTBody.rows;
   var aTRs = new Array;
   for (var i=0; i<colDataRows.length; i++) {
      aTRs[i] = colDataRows[i];
   }
   if (theTable.sortCol == colNum) {
      aTRs.reverse();
   }
   else {
      aTRs.sort(compareColumnValues(colNum));
   }

   //-- Build back up table with the newly sorted values
   var oFragment = document.createDocumentFragment();
   for (var i=0; i<aTRs.length; i++) {
      oFragment.appendChild(aTRs[i]);
   }
   oTBody.appendChild(oFragment);
   theTable.sortCol = colNum;

   setStripes();
}    


function sendEmail(displaytext,mail1,mail2,mailSubject) 
{  
  //var subject = "?subject=CTE%20Questions"; 
  var subject = "?subject=" + mailSubject;
  document.write("<a href=" + "mail" + "to:" + mail1 + "@" + mail2 + subject + ">" 
	      + displaytext + "</a>")
}


$(document).ready(function(){

  $(".degree_list .degree_body").hide();		
		
  //toggle degree_body
  $(".degree_head").click(function(){
	$(this).next(".degree_body").slideToggle(500)
	return false;
  });

  $("#tabcontent a.close").click(function(event) {
        event.preventDefault();
        $(".degree_body").slideUp();
  });

  setStripes();
	
  
   
});	