// Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use

//Enter domain of site to search.
var domainroot="www.tjcog.dst.nc.us"

function Gsitesearch(curobj){
curobj.q.value="site:"+domainroot+" "+curobj.qfront.value
}

/* IMAGE PRELOADER */

var arImages=new Array();
function Preload() {
var temp = Preload.arguments; 
for(x=0; x < temp.length; x++) {
 arImages[x]=new Image();
 arImages[x].src=Preload.arguments[x];
}
}

/* 'DISPLAY' script */

function display(proj) {
var proj1 = proj
if (document.getElementById('dwnldbl')) {
transformXML('xmls/downloads2.xml', 'xmls/downloads.xsl', 'dwnldbl', proj1);}
if (document.getElementById('res2')) {
transformXML('xmls/links.xml', 'xmls/links.xsl', 'res2', proj1);}
if (document.getElementById('testblock')) {
transformXML('xmls/committee.xml', 'xmls/'+proj1+'.xsl', 'testblock', proj1);}
}



/* SIDEBAR FILLER */

function transformXML(xmlDocURL, xslDocURL, divID, proj1)
{
 // declare the local variables
 var xmlDoc, xslDoc, docProcessor, docCache, DocRequest, docFragment;
 var proj = proj1;
 // try the following
 try
 {
   // instantiate and load the xml document
   xmlDoc = new ActiveXObject("MSXML2.DOMDocument");
   xmlDoc.async = false;
   xmlDoc.load(xmlDocURL);
   // instantiate and load the xsl document
   xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
   xslDoc.async = false;
   xslDoc.load(xslDocURL);
   // prepare the xsl document for transformation
   docCache = new ActiveXObject("MSXML2.XSLTemplate");
   docCache.stylesheet = xslDoc;
	// get date and set date variables
		var today = new Date();
		var theDay = today.getUTCDate();
		var theMonth = today.getMonth() + 1;
		var theYear = today.getFullYear()+"";
		if (theDay.toString().length==1)
		{
			theDay = "0" + theDay;
		}
		if (theMonth.toString().length==1)
		{
			theMonth = "0" + theMonth;
		}

		var myDate = theYear + theMonth + theDay;
		var dow = today.getDay();
   // instantiate the document processor and submit the xml document
   docProcessor = docCache.createProcessor();
   docProcessor.input = xmlDoc;
   // add parameters to the xsl document
   		docProcessor.addParameter("project", proj, "");
   		docProcessor.addParameter("today", myDate, "");
		docProcessor.addParameter("day", dow, "");
   // process the documents into html and submit to the passed div box
   docProcessor.transform();
   // divID.innerHTML = docProcessor.output;
   document.getElementById(divID).innerHTML = docProcessor.output;
 }
 // catch any errors from the above code
 catch(e)
 {
   // try the following
   try
   {
     // instantiate and load the xml document
     docRequest = new XMLHttpRequest();
     docRequest.open("GET", xmlDocURL, false);
     docRequest.send(null);
     xmlDoc = docRequest.responseXML;
     // instantiate and load the xsl document
     docRequest = new XMLHttpRequest();
     docRequest.open("GET", xslDocURL, false);
     docRequest.send(null);
     xslDoc = docRequest.responseXML;
	 // get date and set date variables
		var today = new Date();
		var theDay = today.getUTCDate();
		var theMonth = today.getMonth() + 1;
		var theYear = today.getFullYear()+"";
		if (theDay.toString().length==1)
		{
			theDay = "0" + theDay;
		}
		if (theMonth.toString().length==1)
		{
			theMonth = "0" + theMonth;
		}

		var myDate = theYear + theMonth + theDay;
		var dow = today.getDay();
     // instantiate the document processor and submit the xsl document
     docProcessor = new XSLTProcessor();
     docProcessor.importStylesheet(xslDoc);
     // add parameters to the xsl document
   		docProcessor.setParameter(null, "project", proj);
   		docProcessor.setParameter(null, "today", myDate);
		docProcessor.setParameter(null, "day", dow);
     // clear the passed div if anything was in it
     document.getElementById(divID).innerHTML = "";
     // process the documents into html and submit to the passed div
     docFragment = docProcessor.transformToFragment(xmlDoc, document);
     document.getElementById(divID).appendChild(docFragment);
   }
   // catch any errors from the above code
   catch(e)
   {
     // do nothing
   }
 }
}

/* URL JUMPER */
function openURL()
{ 
// grab index number of the selected option
selInd = document.quick2.sites.selectedIndex; 

// get value of the selected option
goURL = document.quick2.sites.options[selInd].value;

// redirect browser to the grabbed value (here a URL)
top.location.href = goURL; 
}

/* TEXT RESIZER */

		/***********************************************
		* Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
		* Coded by: Taewook Kang (http://www.txkang.com)
		* This notice must stay intact for use
		* Visit http://www.dynamicdrive.com/ for full source code
		***********************************************/


//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	cEl.style.fontSize = szs[ sz ];
	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}

/* DIV TOGGLE */

  function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }
