﻿///////added 1/9/2008 by Brandon Kaid /////////////
function CheckBoxToggleButtonEnabled(chkId, btnId)
{
    var button = document.getElementById(btnId);
    var chkbox = document.getElementById(chkId);
    
    if (button && chkbox)
    {
        button.disabled = !chkbox.checked;
    }
}	
/////////////////////////////////////////////////


function expandCollapse(obj, SpanID) 
{
	var element = document.getElementById(obj);
	var spanElement = document.getElementById(SpanID);
	var content = document.getElementById(SpanID).innerText;
		
	if ( element.style.display != 'none' ) 
	{
		
		spanElement.className = 'expand';
		element.style.display = 'none';
		
		spanElement.innerText = content;
	}
	else 
	{
		spanElement.className = 'collapse';
		element.style.display = '';
		spanElement.innerText = content;
	}
}

function mousePointer(obj) 
{
	document.getElementById(obj).style.cursor="pointer";
}

function mouseDefault(obj) 
{
	document.getElementById(obj).style.cursor="default";
}

//added by betsy cohen 10/23/08

     function CreateBookmarkLink() {
        //title="http://www.ppic.org/main/home.asp?"; 
       // url="http://www.ppic.org/main///main/home.asp";
	   
	   title = document.title;
		url = window.location.href;
        if (window.sidebar) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url,"");
        } else if( window.external ) { // IE Favorite
            window.external.AddFavorite( url, title); }
        else if(window.opera && window.print) { // Opera Hotlist
			//var elem = document.createElement('a');
			//elem.setAttribute('href',url);
			//elem.setAttribute('title',title);
			//elem.setAttribute('rel','sidebar');
			//elem.click();
        return true; }
     }

//added by Mike Fair 10/31/08
     function onAppointmentClick(sender, eventArgs) {
	    
        // Redirect to the appropriate website
		window.location.href = eventArgs.get_appointment().get_attributes().getAttribute("RedirectURL")

     }
     
     
//     script to make search box accept the enter key -- added by BKaid

	function OSBEK(event1)
	{ 
	      var kCode = String.fromCharCode(event1.keyCode);
	      if(kCode == "\n" || kCode == "\r")
	      {   
	            var strGoButtonFunction = document.getElementById("ctl00_PlaceHolderSearchArea_SearchBox_go").href.replace(/javascript:/, "");
	            eval(strGoButtonFunction);
	            return false;
	      }
	}

// Please leave this comment in place
// Created by: Randy Drisgill (The Mossman)
// August 17, 2007
//
// THIS OVERRIDES THE OOTB SHAREPOINT FUNCTION WHICH CAUSES ACTIVEX INSTALL ISSUES
//
// Essentially it overrides the ootb sharepoint function which calls the activex object
// See http://support.microsoft.com/default.aspx/kb/931509 for info on the issue
//
// To use in masterpage use this syntax in the <head>:
//  	<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>
//   	<script type="text/javascript" src="/_catalogs/masterpage/custom_activex_override.js"></script>


	function ProcessDefaultOnLoad(onLoadFunctionNames)
	{
		//** Uncomment this to see when this runs
		//alert('Fixing the Issue');
		
		ProcessPNGImages();
		UpdateAccessibilityUI();
		
		//** We comment out the offending ootb function
		//** and leave the rest of the functions as they were
		//ProcessImn();
		for (var i=0; i < onLoadFunctionNames.length; i++)
		{
			var expr="if(typeof("+onLoadFunctionNames[i]+")=='function'){"+onLoadFunctionNames[i]+"();}";
			eval(expr);
		}
		if (typeof(_spUseDefaultFocus)!="undefined")
			DefaultFocus();
	}	

//Added by Brandon Kaid 1/5/09 to allow different CSS clases based on browser/os type
/*
CSS Browser Selector v0.3.1
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors

Available OS Codes [os]:
    * win - Microsoft Windows
    * linux - Linux (x11 and linux)
    * mac - Mac OS
    * freebsd - FreeBSD new
    * ipod - iPod Touch new
    * iphone - iPhone new
    * webtv - WebTV new
    * mobile - J2ME Devices (ex: Opera mini) new

Available Browser Codes [browser]:
    * ie - Internet Explorer (All versions)
    * ie8 - Internet Explorer 8.x
    * ie7 - Internet Explorer 7.x
    * ie6 - Internet Explorer 6.x
    * ie5 - Internet Explorer 5.x
    * gecko - Mozilla, Firefox (all versions), Camino
    * ff2 - Firefox 2
    * ff3 - Firefox 3
    * opera - Opera (All versions)
    * opera8 - Opera 8.x
    * opera9 - Opera 9.x
    * opera10 - Opera 10.x
    * konqueror - Konqueror
    * webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira, Google Chrome
    * safari3 - Safari 3.x new
    * chrome - Google Chrome

CSS Examples:
	.ie .example 
	{
	  background-color: yellow
	}
	.ie7 .example 
	{
	  background-color: orange
	}
	.gecko .example 
	{
	  background-color: gray
	}
	.win.gecko .example 
	{
	  background-color: red
	}
	.linux.gecko .example 
	{
	  background-color: pink
	}
	.opera .example 
	{
	  background-color: green
	}
	.konqueror .example 
	{
	  background-color: blue
	}
	.webkit .example 
	{
	  background-color: black
	}
	.example 
	{
	  width: 100px;
	  height: 100px;
	}
*/
function css_browser_selector(u) {
   var ua = u.toLowerCase(), is = function(t) {
      return ua.indexOf(t) >- 1;
      }
   , g = 'gecko', w = 'webkit', s = 'safari', h = document.getElementsByTagName('html')[0], b = [(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s | \/)(\d+)/.test(ua) ? 'opera opera' + RegExp.$2 : is('konqueror') ? 'konqueror':is('chrome') ? w + ' ' + s + ' chrome':is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js'];
   c = b.join(' ');
   h.className += ' ' + c;
   return c;
   };
css_browser_selector(navigator.userAgent); 


//Used to change the "Specify your own value" to "Other". To call, add this to your page:
//_spBodyOnLoadFunctionNames.push("changeSpecifyOwnValue");
function changeSpecifyOwnValue()
{
	   var node_list = document.getElementsByTagName('input');
	   for (var i = 0; i < node_list.length; i++)
	   {
			var node = node_list[i];
			if (((node.getAttribute('type') == 'radio') && (node.getAttribute('value') != 'DropDownButton')) || (node.getAttribute('type') == 'checkbox')) 
			{
				if (node.nextSibling.innerHTML == "Specify your own value:")
				{
            		node.nextSibling.innerHTML = "Other:";
            	}
         	}
      }
}

