
var agt = navigator.userAgent.toLowerCase();
var ns6 = (!document.all && document.getElementById);
var ie5 = (agt.indexOf('msie') != -1);
var ie4 = document.all;
var ns4 = (document.layers);
var t;
var t1;
var t2;
var submenus = ["aboutus","news","help","help1","events"];
var topstory = ["topstory1","topstory2","topstory3","topstory4"];
var currentStory = -1;
var currentLength = 0;
var objTicker;
var characterTimeout = 50;
var storyTimeout = 5000;
var WidgetOne = "_";
var WidgetTwo = "-";
var NoWidget = "";
var headLines = new Array();
var headLineLinks = new Array();
var objTicker;



function jsfnTopUp(menuid,action)
{
//alert();
var obj,v;

v = action;
if (t) {
      clearTimeout(t);
      t = null;
}
if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
            obj=obj.style; 
			
            v=(action=='show')?'block':(action=='hide')?'none':action; 
			//alert(v);
          }
        obj.display=v; 
	}	
}





function jsfnfindObj(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&&d.layers&&i<d.layers.length;i++) 
    x=jsfnfindObj(n,d.layers[i].document);
  if(!x && d.getElementById) 
	x=d.getElementById(n); 
  return x;
}
//////////////////////////////////////////////////////////////////////////


function jsfnHighlight(obj)
{
  //var classString = obj.className;
  //if (classString.match("ft_Mtext")==null)	
	  obj.className = "ft_MtextH";

}

function jsfnDimMe(obj)
{
 // var classString = obj.className;
  //if (classString.match("ft_Mtext")==null)	
	 obj.className = "ft_Mtext";
}
function jsfnHighlightItem(item,item1)
{
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenuH";	
}

function jsfnHighlightItem1(item)
{
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenuH1";
}




function jsfnBoldItem(item)
{//alert(item);
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "ft_moreB";
}

function jsfnUnBoldItem()
{
  var obj;
  obj = jsfnfindObj("imgid1");
  obj.className = "ft_more";
  obj = jsfnfindObj("imgid2");
  obj.className = "ft_more";
  obj = jsfnfindObj("imgid3");
  obj.className = "ft_more";
}



function jsfnDimItem(item,item1)
{
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenu";	
   if (item1=='micro')
  {
  obj.className = "td_popmenu2";	
  }
   if (item1=='civic')
  {
  obj.className = "td_popmenu";
  }
  if (item1=='aware')
  {
  obj.className = "td_popmenu3";
  }
  if (item1=='health')
  {
  obj.className = "td_popmenu4";
  }
  if (item1=='award')
  {
  obj.className = "td_popmenu5";
  }
  if (item1=='agri')
  {
  obj.className = "td_popmenu6";
  }
   if (item1=='special')
  {
  obj.className = "td_popmenu";
  }
}


function jsfnDimItem1(item)
{
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenu1";
}

function jsfnPopUp(menuid,action)
{

var obj,v;

v = action;
if (t) {
      clearTimeout(t);
      t = null;
}
if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
            obj=obj.style; 
			
            v=(action=='show')?'block':(action=='hide')?'none':action; 
			//alert(v);
          }
        obj.display=v; 
	}	
}



function jsfnPopUp1(menuid,action)
{
     
var obj,v;

v = action;
if (t1) {
      clearTimeout(t1);
      t1 = null;
}
if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
            obj=obj.style; 
			
            v=(action=='show')?'block':(action=='hide')?'none':action; 
			//alert(v);
          }
        obj.display=v; 
	}	
}


function jsfnfitmainpane(xwidth)
{

var obj;

if (ns6) {
            obj = document.getElementById('mainpane');
}

else if (ie4){
            obj = document.all['mainpane'];
}

else if (ns4) {
            obj = document.layers['mainpane'];
}

 obj.style.width=xwidth;

}

function jsfnsetTimer(menuid)
{ 

 t = setTimeout("jsfnPopUp('" + menuid + "','hide')",1000);

}

function jsfnsetTimer1(menuid)
{ 

 t1 = setTimeout("jsfnPopUp1('" + menuid + "','hide')",1000);

}


function jsfnlayersCloseAll_old(){

for (var i=0;i < submenus.length;i++)
	jsfnPopUp(submenus[i],'hide');
}


function jsfnSubPopUp(menuid,parentid){
	if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
		 obj=obj.style;
		
           (obj.display=='none') ? (obj.display='block'):((obj.display=='block') ? (obj.display='none') : obj.display='block');
	}
	}
}

function jsfnfindObj(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&&d.layers&&i<d.layers.length;i++) 
    x=jsfnfindObj(n,d.layers[i].document);
  if(!x && d.getElementById) 
	x=d.getElementById(n); 
  return x;
}


function jsfnBeginTick() {
	
	currentStory = -1;
	currentLength = 0;

	if (document.getElementById) {
		objTicker = jsfnfindObj("tickbar");
		jsfnRunTicker();
	}
	else
	{
		document.write("<style>.tickerbar{display:none;}</style>");
            return true;
	}

}

function jsfnRunTicker()
{
	
	var myTimeout;

	if (currentLength==0) {
		currentStory++;
		currentStory = currentStory % theItemCount;
		currentHeadline = headLines[currentStory].replace(/&quot;/g,'"');
		targetLink = headLineLinks[currentStory];
		objTicker.href = targetLink;
	}

	objTicker.innerHTML = currentHeadline.substring(0,currentLength) + jsfnWhatWidget();
	// Modify the length for the substring and define the timer

	if(currentLength != currentHeadline.length)
	{
		currentLength++;
		myTimeout = characterTimeout;
	}
	else
	{
		currentLength = 0;
		myTimeout = storyTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("jsfnRunTicker()", myTimeout);	
}

function jsfnWhatWidget() {

	if (currentLength == currentHeadline.length)
	{
		return NoWidget;
	}
	if ((currentLength % 2) == 1) 
	{
		return WidgetOne;
	}
	else
	{
		return WidgetTwo;
	}
}



function jsfnlayersCloseAll()
	{
	
   var popup = document.getElementById("aboutus");
	
	
	popup.style.display="none";
	
 popup = document.getElementById("news");
	
	
	popup.style.display="none";
	
popup = document.getElementById("help");
	
	
	popup.style.display="none";	
	popup = document.getElementById("help1");
	
	
	popup.style.display="none";	
	
	popup = document.getElementById("events");
	
	
	popup.style.display="none";	
	//popup = document.getElementById("lawyers");
	
	
	//popup.style.display="none";
	//popup = document.getElementById("news");
	
	
	//popup.style.display="none";
	//popup = document.getElementById("contact");
	
	
	//popup.style.display="none";
	//popup = document.getElementById("about");
	
	
	//popup.style.display="none";
	
	//popup = document.getElementById("intel");
	
	
	//popup.style.display="none";
	//popup = document.getElementById("pub");
	
	
	//popup.style.display="none";
	
	//popup = document.getElementById("events");
	
	
	//popup.style.display="none";
	//popup = document.getElementById("login");
	
	//popup.style.display="none";

}   
function pr_hidden()
{
} 

function jsfnlayers_CloseAll()
	{
   var popup = document.getElementById("civic");
	popup.style.display="none";
	

}    




///////////////////////////////////////////////////////////////////////




function jsfnStoryCloseAll()
	{
	
   var topup = document.getElementById("topstory1");
	topup.style.display="none";
	
	topup = document.getElementById("topstory2");
	topup.style.display="none";
	
	topup = document.getElementById("topstory3");
	topup.style.display="none";
	
	topup = document.getElementById("topstory4");
	topup.style.display="none";
	
	topup = document.getElementById("topstory5");
	topup.style.display="none";
	
}   







// Code to switch images

var currentHighlight='img_temp';

		img1on = new Image();
        img1on.src = "images/btn_topstory1.gif";
        
		img1off = new Image();
        img1off.src = "images/btn_topstory1-over.gif";
        
		img2on = new Image();
        img2on.src = "images/btn_topstory2.gif";
        
		img2off = new Image();
        img2off.src = "images/btn_topstory2-over.gif";
        
		img3on = new Image();
        img3on.src = "images/btn_topstory3.gif";

		img3off = new Image();
        img3off.src = "images/btn_topstory3-over.gif";
        
		img4on = new Image();
        img4on.src = "images/btn_topstory4.gif";
        
		img4off = new Image();
        img4off.src = "images/btn_topstory4-over.gif";
        
		
		img5on = new Image();
        img5on.src = "images/btn_topstory5.gif";
        
		img5off = new Image();
        img5off.src = "images/btn_topstory5-over.gif";
        
		function jsfnimg_act(imgName)
		{
		 imgOn = eval(imgName + "on.src");
		 document.images[imgName] = imgOn;
		}

		function jsfnimg_inact(imgName)
		{
        imgOff = eval(imgName + "off.src");
        document.images[imgName].src = imgOff;
      	}   
      	
      	
      	function jsfnimg_inact1(imgName) {
      
        imgOn = eval(imgName + "on.src");
        document.images[imgName].src = imgOn;
       
		}
      	
		function jsfnshift(imgName)
		{//alert(imgName);
			
			if (imgName!=currentHighlight)
			{
			jsfnimg_inact(imgName);
			currentHighlight='img_temp';
			}

		}
		
		function jsfnshift1(imgName)
			{//alert(imgName);
			jsfnimg_inact1(imgName);
			currentHighlight='img_temp';
			}
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		
		
		
		
		 var xhttp;
		
	function getKeyword(siteurl)
	 {		 
      var kyword = document.forms[0].keyword.value;
      //alert(kyword);      
      dv.innerHTML= "";
      
      
      
      if (document.all) { 
            xhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
           } else { 
          // Mozilla - based browser 
            xhttp = new XMLHttpRequest(); 
          }
          //hook the event handler
          xhttp.onreadystatechange = HandlerOnReadyStateChange;
          //prepare the call, http method=GET, true=asynchronous call
          xhttp.open("GET",siteurl + "/galleryhandler.ashx?kw=" + kyword, true);

		 //window.open("galleryhandler.ashx?kw=" + kyword)
          //finally send the call
          xhttp.send(null);        
      }	
      
      
      function HandlerOnReadyStateChange(){
        var kwtxt = document.forms[0].keyword.value;
       // alert(kwtxt);
        // This handler is called 4 times for each 
        // state change of xmlhttp
        // States are: 0 uninitialized
        //      1 loading
        //      2 loaded
        //      3 interactive
        //      4 complete

		var dv= document.getElementById("dv");


        if (xhttp.readyState==4){
          kwtxt.innerHTML = "";
          
          //responseXML contains an XMLDOM object
          var response = xhttp.responseText;
		  dv.innerHTML= dv.innerHTML + response;
		//document.forms[0].keyword.value=response;
		//alert(response);
		//document.write(response);
		//alert(response);
	
		


        }
      }
      
///////////////////////////////////////////////////////////////////

function jsfnImgCloseAll()
	{
	
   var imgup = document.getElementById("img1");
	imgup.style.display="none";
	
	imgup = document.getElementById("img2");
	imgup.style.display="none";
	
	imgup = document.getElementById("img3");
	imgup.style.display="none";
	
	
}   