// Below obviously the suckerfish javascript from: http://www.alistapart.com/ to fake CSS compliance for IE
sfHover = function() {
	var sfEls = document.getElementById("mainMenu").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// document.ready function for all of public site template here. put any document.ready functionality here
$(document).ready(function(){
	
	// function for creating display sliders
	$('.suppressed').hide();
	$('.rightColumn').find('.suppressed').hide().end().find('.shown').click(function() {
    	$(this).next().slideToggle();
   	});
	
	// Pop-up Window function
	$("a[@rel='external']").click(function() {
		return !window.open($(this).attr("href"));
	});
	
	
	/****************************** JQuery UI DatePicker Global **********************************/
	if ($(".fieldControlDate").length > 0 || $(".fieldControlFutureDate").length > 0) {
		$('style[type="text/css"]').text('@import url("/js/jQuery/plugins/jquery.ui/themes/default/ui.datepicker.psu.css");');
		
		$.getScript('/js/jQuery/plugins/jquery.ui/jquery.ui.js',function () {
			
			/* OPEN DATEPICKER */
			if ($(".fieldControlDate").length > 0) {
				$(".fieldControlDate").datepicker({
					showOn: 'button',
					buttonImageOnly: true,
					buttonImage: '/img/ui/calendar.gif',
					buttonText: 'Calendar',
					dateFormat: 'mm/dd/yy'
				});
			}
			
			/* FUTURE ONLY DATEPICKER */
			if ($(".fieldControlFutureDate").length > 0) {
				$(".fieldControlFutureDate").datepicker({
					showOn: 'button',
					buttonImageOnly: true,
					buttonImage: '/img/ui/calendar.gif',
					buttonText: 'Calendar',
					dateFormat: 'mm/dd/yy',
					minDate:0
				});
			}
			
		});
	}
	

});

function openIR (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}

function topTen() {
    var d = document.getElementById('questionForm');
    d.requestType.value = 'TopQuestionsRequest';
} 