function changeSearchPlace(hid, value, normalClass, link, selectedClass){
	$("#"+hid).val(value);
	$("."+selectedClass).attr('className', normalClass);
	link.className = selectedClass;
}

function changeSearchType(hid, value, p_div, current){
	$("#"+hid).val(value);
	$("#"+p_div+" > input").removeAttr('checked');
	current.checked = true;
}
function beforeTopChange(){

}
function afterTopChange(){
	var id = $("#current_top_id").val();
	var img_id = "timg_" + id;
	id++;
	var rows = $("#"+img_id).attr('rows');
	$("#current_top_id").val(id);
	$("#tnt-text-link").html($("#"+img_id).attr('alt'));
	$("#tnt-text-link").attr('href', $("#"+img_id).attr('rel'));
	$("#tnt-text-link-2").html($("#"+img_id).attr('alt'));
	$("#tnt-text-link-2").attr('href', $("#"+img_id).attr('rel'));
	var row = $("#"+img_id).attr('rows');
	if (row == 1){
		$("#top-news-title").css('display', '');
		$("#top-news-title-2").css('display', 'none');
	} else {
		$("#top-news-title").css('display', 'none');
		$("#top-news-title-2").css('display', '');
	}
	if (id == 6){
		$("#current_top_id").val(1);
	}
}

window.onload = function(){
	BubbleTips.activateTipOn("tooltip");
	
	/**
	// Changes in table header on mouse over
	*/
	$(".sort-name-up").hover(
      function () {
        $(this).removeClass('sort-name-up');
        $(this).addClass('sort-name-down');
      },
      function () {
      	$(this).removeClass('sort-name-down');
        $(this).addClass('sort-name-up');
      }
    );
    $(".sort-name-down").hover(
      function () {
        $(this).removeClass('sort-name-down');
        $(this).addClass('sort-name-up');
      },
      function () {
      	$(this).removeClass('sort-name-up');
        $(this).addClass('sort-name-down');
      }
    );/*
     $(".sort-name").hover(
      function () {
        $(this).removeClass('sort-name');
        $(this).addClass('sort-name-up');
        w = $(this).width();
        $(this).width(w+30);
      },
      function () {
      	$(this).removeClass('sort-name-up');
        $(this).addClass('sort-name');
        w = $(this).width();
        $(this).width(w-30);
      }
    );*/
    // Tree handling
    if ($("#red").length){
	    $("#treeview-red").treeview({
			animated: "fast",
			collapsed: true,
			unique: true,
			persist: "cookie",
			toggle: function() {
				window.console && console.log("%o was toggled", this);
			}
		});
	}
};


var ie5 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.0") != -1);
var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

jQuery(document).ready(function(){
	//$(document).pngFix(); 

});