var button = "btn";
var panel = "pnl";
var rangetimer;

$("#pnlHome").hide();
//$("#buttons>ul").hide();

$(document).ready(function(){
    $("#buttons a").mouseover(function(){
    	//window.alert(this);
	    //window.alert(this.id);
        //var a = $(this);
        //var model = a.attr("id").split(button)[1];
        var model = this.id.split(button)[1];
        showModel(model);
        //$("#" + panel + model).fadeIn(500);
    }).mouseout(function(){
       var a = $(this);
        var model = a.attr("id").split(button)[1];
        $("#" +panel + model).fadeOut(250);
    });
    $("#pnlHome").fadeIn(500);
    //$("#buttons>ul").fadeIn(750);
});

function showModel(model){
    if(rangetimer){ clearTimeout(rangetimer); rangetimer = null; }
    $("#panels>div").each(function(){
        var a = $(this);
        if(a.attr("id") != (panel+model)){
            //window.alert(a.attr("id") + " " + (panel+model) + " " + a.css("display"));
            a.fadeOut(500);
        }
    });
    rangetimer = setTimeout(function(){$("#" + panel + model).fadeIn(250)},250);
}