$(document).ready(function(){
	try {
		var pageTracker = _gat._getTracker("UA-2710263-1");
		pageTracker._trackPageview();
	} catch(err) {} 
	$('.column4').cycle({
		fx:	'fade',
		speed: 2500
	}); 
	$('#display').cycle({ cleartype: 1 }); 
	$("#tabs").tabs();

	$("ul.topnav li").hover(
		function() {
			$(this).find("ul.subnav").show();
		},
		function() {
			$(this).find("ul.subnav").hide();
		}
	);

	initPagination();
});

            // This is a very simple demo that shows how a range of elements can
            // be paginated.
        
            /**
             * Callback function that displays the content.
             *
             * Gets called every time the user clicks on a pagination link.
             *
             * @param {int}page_index New Page index
             * @param {jQuery} jq the container with the pagination links as a jQuery object
             */
	function pageselectCallback(page_index, jq){
                var new_content = '';
		var items_per_page = 6;
                var num_entries = $('#hiddenresult tbody tr').length;
		var max_elem = Math.min((page_index+1) * items_per_page, num_entries);
	
                for(var i=page_index*items_per_page;i<max_elem;i++)
                {
			new_content += '<tr>'+$('#hiddenresult tbody tr:eq('+i+')').html()+'</tr>';
		}
                $('#Searchresult tbody').html(new_content);
                return false;
            }
           
            /** 
             * Callback function for the AJAX content loader.
             */
            function initPagination() {
                var num_entries = $('#hiddenresult tr').length;
                // Create pagination element
                $("#Pagination").pagination(num_entries, {
                    num_edge_entries: 2,
                    num_display_entries: 6,
                    callback: pageselectCallback,
                    items_per_page:6
                });
             }
                    
            // Load HTML snippet with AJAX and insert it into the Hiddenresult element
            // When the HTML has loaded, call initPagination to paginate the elements        

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=645,height=410,left = 520,top = 300');");
}

