
	/**
	 * Cute Menu
	 *
	 * Developed by: Arlind Nushi
	 * Developer mail: arlindd@gmail.com
	 *
	 * File version: 1.0
	 * Last update/release: 7 may 2010
	 *
	 */

jQuery.fn.cuteMenu=function(trans_type,speed_params){var menu_get=$(this);var hover_show_speed=250,out_hide_speed=250;var span_height;if(speed_params){hover_show_speed=speed_params.show_speed;out_hide_speed=speed_params.hide_speed}if(!toString(hover_show_speed).match(/^[0-9]+$/))hover_show_speed=250;if(!toString(out_hide_speed).match(/^[0-9]+$/))out_hide_speed=250;if(menu_get.attr("tagName").toLowerCase()!="ul"){alert("Cute Menu must applied only to UL elements! Current element: <"+menu_get.attr("tagName")+">");return false}if(trans_type)trans_type=trans_type.toLowerCase();var max_ul_height=0;var max_img_height=0;var hoverFunction=null,blurFunction=null;menu_get.children("li").each(function(){var ul_curr_height=$(this).height();var im_curr_height=$(this).children("a").children("img").height();if(max_ul_height<ul_curr_height)max_ul_height=ul_curr_height;if(max_img_height<im_curr_height){max_img_height=im_curr_height}});menu_get.children("li").each(function(index){var text_span=jQuery.trim($(this).text());$(this).html($(this).html().replace(text_span,'<span>'+text_span+'</span>'));var li_element=$(this);var menu_item=$(this).children("a").children("img");var span_text=menu_item.parent().children("span");var span_height=max_ul_height-max_img_height;menu_get.css({'overflow':'hidden','height':max_img_height+'px','position':'relative'});li_element.css({'position':'relative','top':'0px'});span_text.css({'display':'block','position':'relative'});var extra_px=0;if($.browser.msie)extra_px+=3;if($.browser.msie&&Number($.browser.version)<8){span_text.css('cursor','pointer');span_text.click(function(){window.location=menu_item.parent().attr("href")})}var active_class=false;if(li_element.hasClass("active")){active_class=true}switch(trans_type){case 1:case"rollup":span_text.css({'height':max_img_height+'px','line-height':max_img_height+'px'});if(active_class)li_element.css({'top':-max_img_height+'px'});hoverFunction=function(){if(li_element.hasClass("active")){li_element.animate({'top':'0px'},hover_show_speed)}else li_element.animate({'top':-max_img_height+'px'},hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':-max_img_height+'px'},hover_show_speed);else li_element.animate({'top':'0px'},hover_show_speed)};break;case 2:case"rolldown":span_text.css({'height':max_img_height+'px','line-height':max_img_height+'px','top':-(max_img_height+max_img_height)+'px'});if(active_class)li_element.css({'top':max_img_height+'px'});hoverFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':'0px'},out_hide_speed);else li_element.animate({'top':max_img_height+'px'},hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':max_img_height+'px'},hover_show_speed);else li_element.animate({'top':'0px'},out_hide_speed)};break;case 3:case"imageup":menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':span_height+'px'});if(active_class)li_element.css({'top':'0px'});hoverFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':span_height+'px'},out_hide_speed);else li_element.animate({'top':'0px'},hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':'0px'},hover_show_speed);else li_element.animate({'top':span_height+'px'},out_hide_speed)};break;case 4:case"imagedown":menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':'0px'});span_text.css({'display':'block','top':-(max_ul_height+extra_px)+'px'});if(active_class)li_element.css({'top':span_height+'px'});hoverFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':'0px'},out_hide_speed);else li_element.animate({'top':span_height+'px'},hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))li_element.animate({'top':span_height+'px'},hover_show_speed);else li_element.animate({'top':'0px'},out_hide_speed)};break;case 5:case"fadeup":menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':span_height+'px'});span_text.css({'display':'none','top':-(max_ul_height+extra_px)+'px'});if(active_class)span_text.css({'display':'block'});hoverFunction=function(){if(li_element.hasClass("active"))span_text.fadeOut(out_hide_speed);else span_text.fadeIn(hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))span_text.fadeIn(hover_show_speed);else span_text.fadeOut(out_hide_speed)};break;case 6:case"fadedown":menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':'0px'});span_text.css({'display':'none'});if(active_class)span_text.css({'display':'block'});hoverFunction=function(){if(li_element.hasClass("active"))span_text.fadeOut(out_hide_speed);else span_text.fadeIn(hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))span_text.fadeIn(hover_show_speed);else span_text.fadeOut(out_hide_speed)};break;case 7:case"upslide":menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':span_height+'px'});span_text.css({'display':'none','top':-(max_ul_height+extra_px)+'px'});if(active_class)span_text.css({'display':'block'});hoverFunction=function(){if(li_element.hasClass("active"))span_text.slideUp(out_hide_speed);else span_text.slideDown(hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))span_text.slideDown(hover_show_speed);else span_text.slideUp(out_hide_speed)};break;case 8:case"downslide":default:menu_get.css({'overflow':'hidden','height':extra_px+max_ul_height+'px'});li_element.css({'top':'0px'});span_text.css({'display':'none'});if(active_class)span_text.css({'display':'block'});hoverFunction=function(){if(li_element.hasClass("active"))span_text.slideUp(out_hide_speed);else span_text.slideDown(hover_show_speed)};blurFunction=function(){if(li_element.hasClass("active"))span_text.slideDown(hover_show_speed);else span_text.slideUp(out_hide_speed)};break}span_text.mouseenter(hoverFunction);menu_item.mouseenter(hoverFunction);menu_item.parent().parent().mouseleave(blurFunction)})}
