function tool_bar_load_ajax(id, RelativePath)
    {
    jQuery().ajaxSend(function(r, s)
        {
        jQuery("#" + id + "_loading").show();
        });

    jQuery("#" + id).load(RelativePath + "/services/Notifications.php",
        {
        FormFilter: "2pm",
		Path: RelativePath
        });

    jQuery().ajaxStop(function(r, s)
        {
        jQuery("#" + id + "_loading").fadeOut("fast");
        });
    }


function hide_notifications_count(RelativePath)
    {
	if (jQuery(".webeserve_traypopup").is(":hidden")){
        jQuery.post(RelativePath + "/services/Notifications.php",
			{
				hide_notification_count: "1",
				FormFilter: "2pm"
			});	
	}
	}


function get_notifications_count(RelativePath)
    {
    if (jQuery(".webeserve_traypopup").is(":hidden"))
        {
        jQuery.post(RelativePath + "/services/Notifications.php",
            {
            notification_count: "beshoo",
            FormFilter: "2pm"
            }, function(data)
            {
            notifications = data.split('#');
            notifications_count = notifications[0];
            webepoints_count = notifications[1];
			user_primary_cash = notifications[2];
            user_cash = notifications[3];
			

            jQuery(".webepoints_count").html('Webepoints : ' + webepoints_count);
            jQuery(".withdraw_money").html('Withdrawable Balance : ' + user_cash);
			jQuery(".primary_money").html('Cash Balance: ' + user_primary_cash);
            if (notifications_count > 0)
                {

                jQuery(".new_notification").css("display", "block");
                jQuery(".new_notification").html(notifications_count);
                }

            else
                {
                jQuery(".new_notification").css("display", "none");
                }
            });
        }
    }

function close_notifications(id, RelativePath)
    {
    jQuery().ajaxSend(function(r, s)
        {
        jQuery(".notification_ajax_loading").show();
        });
    jQuery.post(RelativePath + "/services/Notifications.php?rand=" + Math.floor(Math.random() * 11),
        {
        close_notification: id,
        FormFilter: "2pm"
        }, function(data)
        {
        if (data)
            {
            jQuery(".notification_txt_" + id).fadeOut("normal");
            jQuery(".notification_txt_2_" + id).fadeOut("normal");
            }

        else
            {
            alert('Error : Unable to hide this notification');
            }
        });
    jQuery().ajaxStop(function(r, s)
        {
        jQuery(".notification_ajax_loading").fadeOut("fast");
        });
    }

function hide_all_notifications(RelativePath)
    {
    jQuery().ajaxSend(function(r, s)
        {
        jQuery(".notification_ajax_loading").show();
        });
    jQuery.post(RelativePath + "/services/Notifications.php?rand=" + Math.floor(Math.random() * 11),
        {
        hide_all_notifications: "1",
        FormFilter: "2pm"
        }, function(data)
        {
        if (data == 1)
            {
            jQuery(".hide_line").css("display", "none");
            jQuery("#webeserve1").removeClass("webeserve_button_active");
            jQuery("#webeserve1").removeClass("webeserve_button_hover");
            jQuery(".webeserve_traypopup").fadeOut("fast");
            jQuery("#notifications_table").fadeOut("fast");
            jQuery("#notifications_table").html("<br>No new notification :)<br><br>");
            jQuery("#notifications_table").fadeIn("slow");
            }

        else
            {
            //alert('All notifications are already hidden.');
            jQuery(".no_notifications").html('All notifications are already hidden');
            }
        });

    jQuery().ajaxStop(function(r, s)
        {
        jQuery(".notification_ajax_loading").fadeOut("fast");
        });
    }

function webeserve_tray(id, left_right, ajax_panel, RelativePath)
    {
    // cal.
    //return alert(document.getElementById("webeserve"+id+"_popup").style.width);
    //notification_ajax_loading
if (navigator.appVersion.indexOf("X11")!=-1 || navigator.appVersion.indexOf("Linux")!=-1) {
    var offSet = ((left_right)? jQuery("#webeserve" + id).offset().left : jQuery("#webeserve" + id).offset().left - 267);
	}
	else
	{
    var offSet = ((left_right)? jQuery("#webeserve" + id).offset().left : jQuery("#webeserve" + id).offset().left - 280);	
	}
	
    if (document.getElementById("webeserve" + id + "_popup").style.display == 'none')
        {
        jQuery("#hide_line"+ id).css("display", "block");
        jQuery("#webeserve" + id).addClass("webeserve_button_active");
        jQuery("#webeserve" + id + "_popup").css("left", offSet - 1).css("bottom", "24px").fadeIn("slow");
        jQuery(".new_notification").css("display", "none");
		if(ajax_panel) tool_bar_load_ajax(ajax_panel, RelativePath);
        webeserve_hide_others(id);
        }

    else
        {

        jQuery(".hide_line").css("display", "none");
        jQuery("#webeserve" + id + "_popup").fadeOut("fast");
        jQuery("#webeserve" + id).removeClass("webeserve_button_active");
        jQuery("#webeserve" + id).removeClass("webeserve_button_hover");
        }
    }

function webeserve_hide_others(id)
    {
    // my array
    var Arr = Array();
    var webeserve_id = "webeserve" + id + '_popup';
    jQuery('.webeserve_traypopup').each(function()
        {
        Arr.push($(this).attr('id'));
        });

    for (i = 0; i <= Arr.length; i++)
        {
        if (Arr[i] != webeserve_id)
            {
            jQuery(".hide_line").css("display", "none");
            jQuery("#" + Arr[i]).css("display", "none");
            myVar = Arr[i].split('_');
            jQuery("#" + myVar[0]).removeClass("webeserve_button_active");
            }
        }
    }

function is_over(id)
    {
    jQuery("#webeserve" + id).addClass("webeserve_button_hover");
    }

function is_out(id)
    {
		
    if (jQuery("#webeserve" + id + "_popup").is(":hidden"))
        {
        jQuery("#webeserve" + id).removeClass("webeserve_button_hover");
        }

    else
        {
        jQuery("#webeserve" + id).addClass("webeserve_button_active");
        }
    }

function hide_all_toolbar()
    {
    var Arr = Array();
    jQuery(".hide_line").css("display", "none");
    jQuery(".webeserve_traypopup").fadeOut("fast");
    jQuery('.webeserve_button').each(function()
        {
        jQuery("#" + jQuery(this).attr('id')).removeClass("webeserve_button_active");
        jQuery("#" + jQuery(this).attr('id')).removeClass("webeserve_button_hover");
        });
    }

function notification_ajax_hide_all_over()
    {
    jQuery(".notification_ajax_hide_all").css("background-color", "#FFFFFF");
    }

function notification_ajax_hide_all_out()
    {
    jQuery(".notification_ajax_hide_all").css("background-color", "#adbed8");
    }
