$(document).ready(function() {
//document.domain = NT_DOMAIN;
$("#note").click(function(){

loadRequest();
});

$("#chat").click(function(){
loadNotificationdata();
});

$("#inbox").click(function(){
loadMessages();
});


function loadRequest(){
                        $("#chatalertbox").hide();
                        $("#chatone").removeClass("opennotebox");
                        $("#inboxcontent").hide();
                        $("#inboxmessage").removeClass("opennotebox");
                        $.ajax({
                        url: "/notification/notificationdata?category=Request",
                        async: true,
                        cache: false,
                        success: function(sourceData){
                                if(sourceData)
                                {
									var dataarr = sourceData.split("||");
                                    var myNewString = dataarr[0].replace(/||/, "");


                                    $("#notification").html(myNewString);
                                    var countstr = dataarr[1].replace(/||/, "");
									if(dataarr[1]==0)
									{
										$("#requestcountred").hide();
									} else {
										$("#requestcountred-inside").html(countstr);
									}
                                    //return false;
                                } // EO if()
                            }
                        });
                        $("#notification").toggle();
                        $("#noterequest").toggleClass("opennotebox");
          }
		 function loadNotificationdata(){
                        $("#notification").hide();
                        $("#noterequest").removeClass("opennotebox");
                        $("#inboxcontent").hide();
                        $("#inboxmessage").removeClass("opennotebox");
                        $.ajax({
                        url: "/notification/notificationdata?category=Notification",
                        async: true,
                        cache: false,
                        success: function(sourceData){
                        
                                if(sourceData)
                                {
									var dataarr = sourceData.split("||");
                                    var myNewString = dataarr[0].replace(/||/, "");
                                    $("#chatalertbox").html(myNewString);
                                    var countstr = dataarr[1].replace(/||/, "");
									if(dataarr[1]==0)
									{
										$("#notificationcountred").hide();
									} else {
										$("#notificationcountred-inside").html(countstr);
									}
                                    //return false;
                                } // EO if()
                            }
                        });
                        $("#chatalertbox").toggle();
                        $("#chatone").toggleClass("opennotebox");
            }
			
			function loadMessages(){
                        $("#notification").hide();
                        $("#noterequest").removeClass("opennotebox");
                        $("#chatalertbox").hide();
                        $("#chatone").removeClass("opennotebox");
                        $.ajax({
                        url: "/notification/notificationdata?category=Messages",
                        async: true,
                        cache: false,
                        success: function(sourceData){

                                if(sourceData)
                                {
									var dataarr = sourceData.split("||");
                                    var myNewString = dataarr[0].replace(/||/, "");
                                    $("#inboxcontent").html(myNewString);
                                    var countstr = dataarr[1].replace(/||/, "");
									if(dataarr[1]==0)
									{
										$("#messagecountred").hide();
									} else {
										$("#messagecountred-inside").html(countstr);
									}
                                    //return false;
                                } // EO if()
                            }
                        });
                        $("#inboxcontent").toggle();
                        $("#inboxmessage").toggleClass("opennotebox");
            }
});
