function stickySidebar() {
	if( window.XMLHttpRequest && !( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))	 || (navigator.userAgent.match(/iPad/i)) ) ) {
		if (document.documentElement.scrollTop > 188 || self.pageYOffset > 188) {
			$('#side_bar').css('position', 'fixed'); 
			$('#side_bar').css('top', '0');
		} else {
			$('#side_bar').css('position', 'absolute'); 
			$('#side_bar').css('top', 'auto');
		}
	}
}

$(document).ready(function() {
		try {
			// Tooltips
			$('span[title].tooltip').qtip({ hide: {effect: { type: 'fade', length: 500}}, style: { name: 'cream', color: 'white', background: '#737177', border: { radius: 4, color: '#737177'}, tip: true }, position: {corner: { target: 'topMiddle', tooltip: 'bottomMiddle'} } })
			
			$('a[title].tooltip').qtip({ hide: {effect: { type: 'fade', length: 500}}, style: { name: 'cream', color: 'white', background: '#737177', border: { radius: 4, color: '#737177'}, tip: true }, position: {corner: { target: 'topMiddle', tooltip: 'bottomMiddle'} } })
			
			$('input[title].tooltip').qtip({ show: "focus", hide: {effect: { type: 'fade', length: 500}, when: { event: 'blur' }}, style: { name: 'cream', color: 'white', background: '#737177', border: { radius: 4, color: '#737177'}, tip: true }, position: {corner: { target: 'topRight', tooltip: 'bottomLeft'} } })
			
			// Standard Tabs
			var tabContainers1 = $('div.tabs > div');
			    
			$('div.tabs ul.tabNavigation a').click(function () {
				tabContainers1.hide().filter(this.hash).show();
			    
			    $('div.tabs ul.tabNavigation a').removeClass('selected');
			    $(this).addClass('selected');
			    
			    return false;
			}).filter(':first').click();
			
			// Code Tabs
			var tabContainers = $('div.tabs > pre');
			    
			    $('div.tabs ul.tabNavigation a').click(function () {
			        tabContainers.hide().filter(this.hash).show();
			        
			        $('div.tabs ul.tabNavigation a').removeClass('selected');
			        $(this).addClass('selected');
			        
			        return false;
			    }).filter(':first').click();
			
			
			
			// Code Tabs2
			var tabContainers2 = $('div.tabs2 > pre');
			    
			$('div.tabs2 ul.tabNavigation a').click(function () {
				tabContainers2.hide().filter(this.hash).show();
			    
			    $('div.tabs2 ul.tabNavigation a').removeClass('selected');
			    $(this).addClass('selected');
			    
			    return false;
			}).filter(':first').click();
			
			// Toggle boxes
			$('.toggler').addClass("link");
			$('.toggled').hide();
			$('.toggler').click(function () {
				$(this).next().slideToggle("slow");
			});
			// Lightbox
			$("a[rel*='lightbox']").colorbox();
			$("a[class*='iframe']").colorbox({iframe:true, maxHeight:"90%", innerHeight:function(){
			   return parseInt($(this).attr('data-height'));
			}, innerWidth:function(){
			   return parseInt($(this).attr('data-width'));
			}});
			// apply odd/even classes to our rows
			$(".infotable tbody tr:not(.subhead)").each(
			function( intIndex ){
				var rowNum = intIndex + 1;
				if(rowNum % 2)
					$(this).addClass("odd");
				else
					$(this).addClass("even");
			});
			stickySidebar();
			// Sidebar stickyness
			$(window).scroll(stickySidebar);
			} catch(e) {}
	});
