jQuery(document).ready(function($) {
	
	// change ul#selectLanguage into select#jsSelectLanguage
	var newSelect = '<select id="jsSelectLanguage">';
	var options = "";
	$("#selectLanguage li").each(function() {
		if ($(this).children('a').length > 0) {
			options += '<option value="' + $(this).children('a').attr("href") + '">' + $(this).text() + '</option>';
		} else {
			options += '<option selected="selected" value="' + $(this).children('strong').attr("title") + '">' + $(this).text() + '</option>';
		}
	});
	newSelect += options;
	newSelect += '</select>';
	$("#selectLanguage").parent().append(newSelect);
	$("#selectLanguage").remove();
	$("#jsSelectLanguage").change(function() {
		window.location = $(this).val();
	});
	
	// open popup windows
	$("#jsFooterTerms").click(function(event) {
		event.preventDefault();
		window.open($(this).attr("href"),'help','hotkeys=no,resizable=yes,toolbar=yes,status=yes,dependent=yes,scrollbars=1,width=720,height=550');
	});
	
	// mouseover/out effect for search button in header
	$("#searchSubmit").mouseover(function() {
		var img_url = $(this).attr("src");
		$(this).attr("src", img_url.substring(0, img_url.length-4) + "-hover" + img_url.substring(img_url.length-4));
	});
	$("#searchSubmit").mouseout(function() {
		var img_url = $(this).attr("src");
		$(this).attr("src", img_url.replace("-hover", ""));
	});
		
	// Trigger a repaint in IE7 to correct rendering issues on load
	if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 7) {
		$('.dsBottom').css('zoom', '1');
	}
	
});
