var pngua =  navigator.userAgent.toUpperCase();
if(window.attachEvent && pngua.indexOf('OPERA') == -1 && (pngua.indexOf('MSIE 6') != -1 || pngua.indexOf('MSIE 5.5') != -1))
	document.write('<script type="text/javascript" src="/js/png.js"></script>');

$(document).ready(function() {
	$('.goright').addClass('ui-icon-right').button({ icons: { secondary: 'ui-icon-circle-arrow-e' } });
	$('.goleft').button({ icons: { primary: 'ui-icon-circle-arrow-w' } });
	var sz = 100;
	while($('#menu h5').height() > 25) {
		sz -= 10;
		$('#menu h5').css('font-size', sz+'%');
	}
	$('input:submit,.button').button();
	$('.button.icon-only').button('option', 'text', false);
	$('.button[primary]').each(function() { var el = this; $(el).button('option', { icons: { primary: 'ui-icon-'+$(el).attr('primary').replace('ui-icon-', '') } }); });
	$('.button[secondary]').each(function() { var el = this; $(el).button('option', { icons: { secondary: 'ui-icon-'+$(el).attr('secondary').replace('ui-icon-', '') } }); });
	$('.buttonset').buttonset();
	$('input:reset').each(function(i) {
		el = $(this);
		val = ($(el).val() == '') ? 'Reset' : $(el).val();
		$('<span class="reset">'+val+'</span>')
			.click(function() { $(el).click(); })
			.insertAfter($(el));
		$(el).hide();
	});
	$('input[hint]').each(function() {
		if($(this).val() == '' || $(this).val() == $(this).attr('hint'))
			$(this).addClass('dim').val($(this).attr('hint'));
		$(this).focus(function() { if($(this).val() == $(this).attr('hint')) $(this).val('').removeClass('dim'); })
			.blur(function() { if($(this).val() == '') $(this).val($(this).attr('hint')).addClass('dim'); })
	});
});

function refreshInpHints() {
	$('input[hint]').each(function() {
		if($(this).val() == '' || $(this).val() == $(this).attr('hint'))
			$(this).addClass('dim').val($(this).attr('hint'));
		else
			$(this).removeClass('dim');
	});
}

function removeInpHints() {
	$('input[hint]').each(function() {
		if($(this).val() == $(this).attr('hint'))
			$(this).val('');
	});
}
