	
function Trim(String,TrimChar) {
	String += ""         // Force argument to string.
	TrimChar += ""       // Force argument to string.
 	if((TrimChar == "") || (!(TrimChar.length == 1)))
  		TrimChar = " "
 
 	if(String.length == 0)
  		return(String)
 
 	var Count = 0
 	for(Count = 0;Count < String.length;Count++) {
  		if(!(String.charAt(Count) == TrimChar))
   			return(String.substring(Count,String.length))
 	}
 	return("")
}

//Handles Key press on search boc
function handleKeyUpSearch4(){
	var k;
	if(event.which)
		k = event.which.keyCode;
	else
		k = event.keyCode;
		alert(k);
	if(k == 13)
		GoSearch();
	return true;
}
function handleKeyUpSearch(e){    
	e = e || window.event;    
	var code = e.keyCode || e.which;    
	if(code == 13)        
	GoSearch();
}	
		
//Function to start search
function GoSearch() {
//alert(document.frInfo.searchBox.value);
	if 	((Trim(document.frInfo.searchBox.value,' ') != "")
		&&(Trim(document.frInfo.searchBox.value,' ') != "Search")) 
		{
			document.frInfo.action = "/searchresults.asp";
			document.frInfo.submit();
		}
	else {
		document.frInfo.action = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
		document.frInfo.submit();
	}
}//function GoSearch(
	
	
//Function sends the information to Constant Contact
function SubmitToConstantContact() {
	msg =""
	if (Trim(document.frInfo.ea.value,' ') == "")
	{
  			msg = msg + "Please fill in an email address.\n\n"
	}

	if( msg != "" ) 
	{
		alert(msg);
	} 
	else 
	{  
		document.frInfo.action = "http://visitor.r20.constantcontact.com/d.jsp";
		document.frInfo.target="_blank"; 
		document.frInfo.submit();
	}
}//SubmitToConstantContact()
	
// Start of Google Analytics Code 
 var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16727124-1']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// End of Google Analytics Code 



document.onclick = function(e)
{
  var target = e ? e.target : window.event.srcElement;

  while (target && !/^(a|body)$/i.test(target.nodeName))
  {
    target = target.parentNode;
  }

  if (target && target.getAttribute('rel')
      && target.rel == 'external')
  {
    var external = window.open(target.href);

    return external.closed;
  }
return e;
}

function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
		window.addEventListener('load', fn, false);
	}
	else if (typeof document.addEventListener != 'undefined')
	{
		document.addEventListener('load', fn, false);
	}
	else if (typeof window.attachEvent != 'undefined')
	{
		window.attachEvent('onload', fn);
	}
	else
	{
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
		{
			window.onload = fn;
		}
		else
		{
			window.onload = function()
			{
				oldfn();
				fn();
			};
		}
	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

	//determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(var i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        opacity(id, 0, 100, millisec); 
    } else { 
        opacity(id, 100, 0, millisec); 
    } 
}

function makeOpacityZero(id) {
	var thisZero = document.getElementById(id);
	thisZero.style.opacity = (0 / 100); 
	thisZero.style.MozOpacity = (0 / 100); 
	thisZero.style.KhtmlOpacity = (0 / 100); 
	thisZero.style.filter = "alpha(opacity=0)";
}





