// JavaScript Document
/*----------------------------{
 * Open source under the BSD License. 
 * Copyright 2010 Mr.Zhao XiaoDong
 * All rights reserved.
 * Supported by jQuery and easing plugin
}----------------------------*/
$(document).ready(function() {

    $('.spr_menu').each(function(i) {
        $(this).css({ left: $(this).offset().left, top: $(this).offset().top });
        $(this).bind({
            mouseover: function() {
                l_spr_div = this;
                z_m_f_t = setTimeout("spr_m_f(l_spr_div)", 300);
            },
            mouseout: function() {
                clearTimeout(z_m_f_t);
            }
        })
    });

    $('.spr_menu').css({ position: "absolute", zIndex: 10000 });
    var fix_i = $('#spr_m_f_div').attr("class").substring(21);
    fix_i = fix_i - 1;
    $('#spr_m_f_div').css({ left: $('.spr_menu').eq(fix_i).offset().left, top: $('.spr_menu').eq(fix_i).offset().top, zIndex: 9999 });
    $('.spr_menu').eq(0).children('a').css({ 'color': '#ffffff' });
});


function spr_m_f(div_id){
	var n_offset = $(div_id).offset();
	var easing_typ_value = $('#spr_m_f_div').attr("class");
	easing_typ_value = easing_typ_value.substring(19,20);
	easing_typ_value = parseInt(easing_typ_value);
	switch(easing_typ_value){
		case 1:
			easing_typ = 'easeOutQuad';
			break;
		case 2:
			easing_typ = 'easeOutBack';
			break;
		default:
			easing_typ = 'easeOutBounce';
	}
	$('#spr_m_f_div').animate({ left: n_offset.left, top: n_offset.top }, { duration: 900, easing: easing_typ });
	$('.spr_menu').children('a').css({ 'color': '#000000' });
	$(div_id).children('a').css({ 'color': '#ffffff' });
}
