	// Jquery ready function ...
	jQuery(function($) {		
		$("#indexLastFadeBlock").val('0');										
		$("#content ol li").each(function(i) {											
			//$(this).bind("click", {idx: i, tot_idx: $("#content ol li").length}, my_function);
			$(this).bind("click", {idx: i}, my_function);					
		});

		$("#content ol li").eq(0).trigger('click');
		$("#content ol li").eq(0).addClass('active');
		$("#indexLastFadeBlock").val('0');
	});
	
	function my_function(event) {
		callAjax = false;
		lastIndex = $("#indexLastFadeBlock").val();									
		curIndex = event.data.idx;
		
		if ($("#content div.last div").is('.swapcontent')) {
			if ($("#content div.last div").is('.idx_' + curIndex)) {
				
				// hide last one
				$("#content div.last div.idx_" + lastIndex).hide(); 
				// bind click event to last li
				$("#content ol li").eq(parseInt(lastIndex)).bind("click", {idx: parseInt(lastIndex)}, my_function); 
				// setting last fade index value
				$("#indexLastFadeBlock").val(parseInt(curIndex));
				// displaying current clicked div
				$("#content div.last div.idx_" + curIndex).fadeIn(800);	
				$("#content ol li").eq(parseInt(curIndex)).unbind('click');
				// setting / removing li's classes : actiove
				$("#content ol li").eq(parseInt(lastIndex)).removeClass('active');
				$("#content ol li").eq(parseInt(curIndex)).addClass('active');
				return true;
			} else {
				//alert('new index ' + curIndex);
				callAjax = true;
			}		
		} else {
			callAjax = true;
		}
		
		// If call ajax is true
		if (callAjax) {
			$.ajax({
				type: "GET",
				url: rootURL + fadeInURL,
				timeout: 40000,
				data: 'idx='+event.data.idx+'&rURL='+rootURL,
				beforeSend: function(msg)
				{
					
					$("#indexLastFadeBlock").val(parseInt(curIndex));
					
					$("#content ol li").unbind('click');
					/*if (curIndex == lastIndex) {
						$("#content ol li").eq(curIndex).unbind('click');
					} else {
						$("#content ol li").eq(curIndex).unbind('click');
						$("#content ol li").eq(lastIndex).bind("click", {idx: lastIndex}, my_function);
					}*/
					
					$("#content ol li").eq(parseInt(lastIndex)).removeClass('active');
					$("#content ol li").eq(parseInt(curIndex)).addClass('active');
	
					//$("#content div.last").text('');
					$("#content div.last div.idx_" + lastIndex).hide();
					//alert(lastIndex);
					$("<span id='loader'><img src='"+rootURL+"common/images/kneoteric_loader.gif' style='float:left;margin-left:20px;' /><span style='float:left;padding:6px 0 0 5px;'> Loading information ... please wait!</span></span>").appendTo("#content div.last");					
				},
				success: function(msg)
				{	
					msg = $.trim(msg);					
					$("#content div.last span").remove("#loader");
					$(msg).appendTo("#content div.last");
					//alert(msg);
					$("#content div.last div.idx_" + curIndex).fadeIn(800);				
				},
				complete: function()
				{				
						$("#content ol li").each(function(i) {
							if (curIndex != i) {
								
								$(this).bind("click", {idx: parseInt(i)}, my_function);
							}
						});	
						//alert(rootURL);
						load_SIFR_Content(rootURL);
						//alert(sIFR);
						//sIFR.replaceElement("h3.heading_large", rootURL+"common/font/jfr1.swf", "#0a6aa4", null, null, null, 0, 0, 0, 0);
				}
			});
			
		} // end of call ajax check
	}
									
