$().ready(function(){   
    setInterval("checkAnchor()", 300);   
});   
  
//References   
var loading = $("#opportunityloading");   
var content = $("#opportunitycontent");   
var pageNum;   
var currentAnchor = null;   
  
//show loading bar   
function showLoading(){   
    content.hide();
	loading.show(); 
	
}   
//hide loading bar   
function hideLoading(){   
    loading.hide();
	content.show();
};   
  
function checkAnchor(){   
    //Check if it has changes   
    if(currentAnchor != document.location.hash){   
        currentAnchor = document.location.hash;   
        //if there is not anchor, the loads the default section   
        if(!currentAnchor) {   
            //default - page = 1   
            pageNum = 1;   
        }   
        else {   
            //get the page number after #   
            pageNum = currentAnchor.substring(1);   
        }   
        //Send the request and display the result   
        showLoading();   
        var targetUrl = "ajax/invopp.php?page=" + pageNum;   
        content.load(targetUrl, hideLoading);   
    }   
} 
