function addListener(element, type, expression) {
	try {
		if(window.attachEvent) { //For IE
			element.attachEvent('on'+type, expression);
		} else if(window.addEventListener)	{ //For FF, Opera, Safari etc
			element.addEventListener(type, expression, false);
		}
	} catch(e) { }
}

addListener(window, 'load', function() {
	addListener(document.getElementById('f_sorting_id'), 'change', submitFormItemSorting);

	var element = document.getElementById('comments_link_div');
    addListener(element, 'mouseover', function() {
		showMostRecentComments(element);
	});
    addListener(element, 'mouseout', function() {
		hideMostRecentComments(element);
	});

    var element = document.getElementById('most_recent_comments');
    addListener(element, 'mouseover', function() {
		showMostRecentComments(element);
	});
    addListener(element, 'mouseout', function() {
		hideMostRecentComments(element);
	});
});


function submitFormItemSorting() {
	document.getElementById('form_item_sorting').submit();
}

function submitForm2(id){
    //alert(id);
    var oForm = document.getElementById(id);
    oForm.submit();
}

function showMostRecentComments(eElement) {
    eMostRecentComments = document.getElementById('most_recent_comments');

    if(eMostRecentComments) {
        eMostRecentComments.style.display = 'block';
    }
}

function hideMostRecentComments(eElement) {
    eMostRecentComments = document.getElementById('most_recent_comments');

    if(eMostRecentComments) {
        eMostRecentComments.style.display = 'none';
    }
}