jQuery(function(){
	$('img[class^="btn_o"]').each(function(){
		var theImgType = $(this).attr('src').toString().match(/\.[a-z][a-z][a-z][a-z]?$/);
		var theExt = $(this).attr('class').toString().match(/btn_[a-zA-Z0-9]*/gi).toString().replace('btn', '');
		$(this).mouseover(function(){
			$(this).attr('src', $(this).attr('src').toString().replace(''+theImgType,''+theExt+theImgType));
	    }).mouseout(function(){
			$(this).attr('src', $(this).attr('src').toString().replace(''+theExt+theImgType,''+theImgType));
	    });
	});

	$('input[class^="btn_o"]').each(function(){
		var theImgType = $(this).attr('src').toString().match(/\.[a-z][a-z][a-z][a-z]?$/);
		var theExt = $(this).attr('class').toString().match(/btn_[a-zA-Z0-9]*/gi).toString().replace('btn', '');
		$(this).mouseover(function(){
			$(this).attr('src', $(this).attr('src').toString().replace(''+theImgType,''+theExt+theImgType));
	    }).mouseout(function(){
			$(this).attr('src', $(this).attr('src').toString().replace(''+theExt+theImgType,''+theImgType));
	    });
	});

	$('img').not($('.showAltText')).each(function(){
		$(this).attr('title','');
		$(this).attr('alt','');
/*
		if ($(this).attr('title')=='' && $(this).attr('alt')!='') {
			$(this).attr('title', $(this).attr('alt'));
		}
*/
	});

	$('input[type="image"]').not($('.showAltText')).each(function(){
		$(this).attr('title','');
		$(this).attr('alt','');
/*
		if ($(this).attr('title')=='' && $(this).attr('alt')!='') {
			$(this).attr('title', $(this).attr('alt'));
		}
*/
	});

	$(".menu .submenu").each(function() { 
		var currSub = $(this);
		var bodyWidth = document.body.clientWidth;

		$(this).parent().hover(function(){
			var xpos = getX(this);
			if (xpos + currSub.width()>bodyWidth) {
				xpos = bodyWidth - currSub.width();
			}
			currSub.css("left", xpos);
			currSub.show();
		}, function() {
			currSub.hide();
		});
	});
/*
	$("object, embed").each(function() {
		this.outerHTML = this.outerHTML;
	});
*/
	$("table.tableframe tr:even").not($("table.notableframe tr")).addClass("even");
	if (typeof(configureLeftMenu)=="function") {
		configureLeftMenu();
	}
	if (typeof(updatelink)=="function") {
		updatelink();
	}
	if (typeof($.preloadImages)=="function") {
		$.preloadImages();
	}

	configureTextAreaMaxLength();
});


function debug(msg){
	if($('div[id="debug"]').length == 0){
		$('body').append('<div id="debug" style="position:absolute; left: 10px; top: 10px; background: #999999; color: #333333;"></div>');
	}$('div[id="debug"]').html(msg);
}
