// Initially set the onload up
var ResultsheaderPos;

init = function (){
	var radios = $$('input[type="radio"]');;
	for(i = 0; i < radios.length; i++) {
		radios[i].className = "nobrdr";
	}
	
	var checkboxes = $$('input[type="checkbox"]');;
	for(i = 0; i < checkboxes.length; i++) {
		checkboxes[i].className = "nobrdr";
	}
	
	var searchbtns = $$('input[type="submit"]');;
	for(i = 0; i < searchbtns.length; i++) {
		searchbtns[i].className = "submit";
	}
	
	$$('a[target="_blank"]').each(function(link){        
    	link.addClassName('extlink');
    });
    
    if($('resultsheader')){
		ResultsheaderPos = $('resultsheader').positionedOffset();
	}
	/*
	if($('fixed')){
		FixedPos = $('fixed').positionedOffset();
		//FixedHeight = $('fixed').offsetHeight;
		//FixedHeight = document.defaultView.getComputedStyle(document.getElementById('fixed'), null).getPropertyValue('height', null);
		
	}
  	*/
} 


// Attach the onload function to the window
Event.observe(window, 'load', init, false);

var printWindow = null;

       function print()
       {
          var iWidth = 480;
          var iHeight = 640;
          var iLeft = (screen.width / 2) - (iWidth / 2);
          var iTop = (screen.height / 2) - (iHeight / 2);

          if (printWindow != null)
          {  printWindow.close();
          }
          printWindow = window.open('/smartsite.htm?ch=DEF&id=15230', 'PrintPopup', 'height='+iHeight+',width=' + iWidth + ',left=' + iLeft + ',top=' + iTop + ',scrollbars=yes,resizable=no,toolbar=no,statusbar=no');

          if (!printWindow.opener)
          {  printWindow.opener = self;
          }
       }


/*	Set the Resultsheader fixed when scrolling
	Expanded from http://www.derekallard.com/blog/post/conditionally-sticky-sidebar/
******************************************** */
window.onscroll = function(){
	
	if($('resultsheader')){
		// If we scrolled past the y position of the resultsheader, then fix it
		if (document.documentElement.scrollTop > ResultsheaderPos.top) {
			$('resultsheader').style.position = 'fixed'; 
			$('resultsheader').style.top = '0';
		// Otherwise make it relative to make it flow inline with the rest
		} else {
			$('resultsheader').style.position = 'relative'; 
			$('resultsheader').style.top = 'auto';
		}
	}
}


/*	Prototype onload event
********************************************
Event.observe(window, 'load', function() { 
		//get the position of the resultsheader for fixing it when scrolling
		if($('resultsheader')){
			ResultsheaderPos = $('resultsheader').positionedOffset();
		}
	}
);
 */

/*	Set the Resultsheader fixed when scrolling
	Expanded from http://www.derekallard.com/blog/post/conditionally-sticky-sidebar/
******************************************** */	
/*
window.onscroll = function(){
	//if( window.XMLHttpRequest ) { // IE 6 doesn't implement position fixed nicely...
		// If we scrolled past the y position of the resultsheader, then fix it
		if (document.documentElement.scrollTop > FixedPos.top) {
			$('fixed').style.position = 'fixed'; 
			$('fixed').style.top = '0';
		// Otherwise make it relative to make it flow inline with the rest
		} else {
			$('fixed').style.position = 'relative'; 
			$('fixed').style.top = 'auto';
		}
	//}
}
*/
