/**
* @author :Pavan Sharma <pavan.sharma@acapteam.com>
* use to show tooltip around attachment
* @param string parentId of (ol)
*/



function addToolTip(parentId){

    jQuery('#'+parentId+' > li').hover(

    function() {
        this.tip =jQuery("span",this).html();  //get content to be displayed
        if(this.tip!=''){
        $(this).css({"border": "1px solid black"}) ; //apply border to selected li
        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
       
        //alert(jQuery(this span).html())
        jQuery(this).append(
        '<div class="toolTipWrapper">'
        +'<div class="toolTipTop"></div>'
        +'<div class="toolTipMid" style="color:#FFFFFF">'
        +this.tip
        +'</div>'
        +'<div class="toolTipBtm"></div>'
        +'</div>'
        );
        //this.title = "";

        // this.width = jQuery(this).width();
        jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-30+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
        //alert(jQuery(this).position().left);
        //alert(jQuery(this).position().top);
        //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
        jQuery('.toolTipWrapper').fadeIn(300);   //set time for display
        }
    },
    function() {
        this.tip =jQuery("span",this).html();  //get content to be displayed
        if(this.tip!=''){
        $(this).css({"border": "0"}) ;
        jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
        jQuery(this).find('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

        //jQuery(this).children().remove(); 
        //this.title = this.tip;
        }
    }
    )    ;

}

/**
* function  showBuiltInToolTip
* @param string parentId
* show notes for built in attachment
*/
function showBuiltInToolTip(parentId){

    jQuery('#'+parentId+' > li').hover(

    function() {     
        $(this).css({"border": "1px solid black"}) ; //apply border to selected li
        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip;
        tip =jQuery("span",this).html();  //get content to be displayed
       

        $('#built_in_notes_display').html(tip); 
         //alert($('#built_in_notes_display').html());      

    },
    function() {
        $(this).css({"border": "0"}) ;
        $('#built_in_notes_display').html('');        //remove applied tooltip on mouse out


    }
    )    ;

}

//@todo add function for member drop down 

function addToolTipByClass(){

    jQuery('.customTooltip').parent().hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        this.tip =jQuery("span",this).html();  //get content to be displayed
        //alert(jQuery(this span).html())
        jQuery(this).append(
        '<div class="toolTipWrapper">'
        +'<div class="toolTipTop"></div>'
        +'<div class="toolTipMid" style="color:#FFFFFF">'
        +this.tip
        +'</div>'
        +'<div class="toolTipBtm"></div>'
        +'</div>'
        );
        //this.title = "";

        // this.width = jQuery(this).width();
        jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-60+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
        //alert(jQuery(this).position().left);
        //alert(jQuery(this).position().top);
        //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
        jQuery('.toolTipWrapper').fadeIn(300);   //set time for display

    },
    function() {
        $(this).css({"border": "0"}) ;
        jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
        jQuery(this).find('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

        //jQuery(this).children().remove(); 
        //this.title = this.tip;
    }
    )    ;

}


function operationTooltip(){


    jQuery('.mAct').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip=''
        jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out
        jQuery(".activeMember",this).each(function(i){
            //alert($(this).html());
            tip =tip +  $(this).html()//get content to be displayed
        })  //get content to be displayed
        //alert(jQuery(this span).html())
        if(tip!='') {
            jQuery(this).append(
            '<div class="toolTipWrapper">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid" style="color:#FFFFFF">'
            +tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
            +'</div>'
            );
            //this.title = "";

            // this.width = jQuery(this).width();
            jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-38+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
            //alert(jQuery(this).position().left);
            //alert(jQuery(this).position().top);
            //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
            jQuery('.toolTipWrapper').fadeIn(300).mouseleave(
            function(){

                jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
                jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

            }
            )    ;   //set time for display
        }
    }
    )    ;



    jQuery('.mReq').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip=''
        jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out
        jQuery(".requiredMember",this).each(function(i){
            //alert($(this).html());
            tip =tip +  $(this).html()//get content to be displayed
        })  //get content to be displayed
        //alert(jQuery(this span).html())
        if(tip!='') {
            jQuery(this).append(
            '<div class="toolTipWrapper msOut">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid" style="color:#FFFFFF;height:200px;overflow:auto">'
            +tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
            +'</div>'
            );
            //this.title = "";

            // this.width = jQuery(this).width();
            jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-35+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
            //alert(jQuery(this).position().left);
            //alert(jQuery(this).position().top);
            //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
            jQuery('.toolTipWrapper').fadeIn(300).mouseleave(
            function(){

                jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
                jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

            }
            )    ;   //set time for display
        }
    }
    )    ;

    jQuery('.mInact').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip=''
        jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out
        jQuery(".inactiveMember",this).each(function(i){
            //alert($(this).html());
            tip =tip +  $(this).html()//get content to be displayed
        })  //get content to be displayed
        //alert(jQuery(this span).html())
        if(tip!='') {
            jQuery(this).append(
            '<div class="toolTipWrapper msOut">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid" style="color:#FFFFFF">'
            +tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
            +'</div>'
            );
            //this.title = "";

            // this.width = jQuery(this).width();
            jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-38+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
            //alert(jQuery(this).position().left);
            //alert(jQuery(this).position().top);
            //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
            jQuery('.toolTipWrapper').fadeIn(300).mouseleave(
            function(){

                jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
                jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

            }
            )    ;   //set time for display
        }
    }
    )    ;

    jQuery('.mExp').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip=''  ;
        jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out
        jQuery(".expiredMember",this).each(function(i){
            //alert($(this).html());
            tip =tip +  $(this).html()//get content to be displayed
        })  //get content to be displayed
        //alert(jQuery(this span).html())
        if(tip!='') {
            jQuery(this).append(
            '<div class="toolTipWrapper msOut">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid" style="color:#FFFFFF">'
            +tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
            +'</div>'
            );
            //this.title = "";

            // this.width = jQuery(this).width();
            jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-38+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
            //alert(jQuery(this).position().left);
            //alert(jQuery(this).position().top);
            //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
            jQuery('.toolTipWrapper').fadeIn(300).mouseleave(
            function(){

                jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
                jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

            }
            )    ;   //set time for display
        }
    }
    )    ;

    jQuery('.mWarn').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        var tip='' ;
        jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out
        jQuery(".warningMember",this).each(function(i){
            //alert($(this).html());
            tip =tip +  $(this).html()//get content to be displayed
        })  //get content to be displayed
        //alert(jQuery(this span).html())
        if(tip!='') {
            jQuery(this).append(
            '<div class="toolTipWrapper">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid" style="color:#FFFFFF">'
            +tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
            +'</div>'
            );
            //this.title = "";

            // this.width = jQuery(this).width();
            jQuery(this).find('.toolTipWrapper').css({'left':parseFloat(jQuery(this).position().left-38+jQuery(this).width()),'top':parseFloat(jQuery(this).position().top)+10}); //find tooltip and set its position
            //alert(jQuery(this).position().left);
            //alert(jQuery(this).position().top);
            //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
            jQuery('.toolTipWrapper').fadeIn(300).mouseleave(
            function(){

                jQuery('.toolTipWrapper').fadeOut(100);  //set time for hide
                jQuery('.toolTipWrapper').remove(); //remove applied tooltip on mouse out

            }
            )    ;   //set time for display
        }
    }
    )    ;





}


function showClassToolTip(classname){

jQuery('.'+classname+'').hover(

    function() {

        //alert(jQuery("span",this).html());
        //this.tip =jQuery(this >span).html();
        this.tip =jQuery(this).next().next("span").html();
		
        //alert(jQuery(this span).html())
        jQuery(this).append(
        '<div class="toolWrapper">'
        +'<div class="toolTop"></div>'
        +'<div class="toolmiddle" style="color:#FFFFFF;width:100%">'
        +this.tip
        +'</div>'
        +'<div class="toolBtm"></div>'
        +'</div>'
        );

        //this.title = "";

        // this.width = jQuery(this).width();
        jQuery(this).find('.toolWrapper').css({'left':parseFloat(parseFloat(jQuery(this).position().left)+10+parseFloat(jQuery(this).width())),'top':parseFloat(jQuery(this).position().top)-20}); //find tooltip and set its position
        //alert(jQuery(this).position().left);
        //alert(jQuery(this).position().top);
        //jQuery(this).find('.toolTipWrapper').css({'top':jQuery(this).position('top')});
        jQuery('.toolWrapper').fadeIn(300);   //set time for display

    },
    function() {
        $(this).css({"border": "0"}) ;
        jQuery('.toolWrapper').fadeOut(100);  //set time for hide
        jQuery(this).find('.toolWrapper').remove(); //remove applied tooltip on mouse out

        //jQuery(this).children().remove(); 
        //this.title = this.tip;
    }
    )    ;
}

