jQuery.noConflict();

jQuery(document).ready(function () {
	//Check if url hash value exists (for bookmark)
	jQuery.history.init(pageload);
	
});
	
	function callpage(hash) {
		
		parent.jQuery.facebox.close();
		//remove the # value
		hash = hash.replace(/^.*#/, '');
		
		//for back button
	 	jQuery.history.load(hash);
		
		return false;

	}	

	
	function callboxBottom(list) {
		//hide the content and show the progress bar
	 	jQuery('#loading').show();
		
	 	//run the ajax
		getboxBottom(list);
	}	
	
	function callprofileInfo(userID) {
		//hide the content and show the progress bar
	 	jQuery('#loading').show();
//	 	jQuery('#right_loading_m').show();
		
	 	//run the ajax
		getProfile(userID);
	}	

	function callMyprofileInfo(userID) {
		//hide the content and show the progress bar
	 	jQuery('#loading').show();
//	 	jQuery('#right_loading_c').show();
		
	 	//run the ajax
		getMyProfile(userID);
	}	


function pageload(hash) {

	//if hash value exists, run the ajax
	if(jQuery.browser.msie) {
		if (hash) { 
		hash1 = hash.replace(/^.*#/, '');
		hash2 = hash1.replace(/\?.*$/,'');
		hash = encodeURIComponent(hash2);
		hash_value = hash1.replace(hash2,'');
		} else { 
		hash='ccover'; 
		hash_value = '';
		}

	} else {	
		if (hash) { 
		hash1 = hash.replace(/^.*#/, '');
		hash2 = hash1.replace(/\?.*$/,'');
		hash_value = hash1.replace(hash2,'');
		hash = hash2;
		} else { 
		hash='ccover'; 
		hash_value = '';
		}
	}
		
	//hide the content and show the progress bar
 	jQuery('#loading').show();
// 	jQuery('#right_loading_'+hash.charAt(0)).show();

	getPage(hash, hash_value);
	getsubPage(hash, hash_value);
	
	return false;
	
}

function getPage(hash, hash_value) {
	
	//generate the parameter for the php script
	var data = 'page=' + encodeURIComponent(hash) + '&page_value=' + encodeURIComponent(hash_value) ;
	jQuery.ajax({
		url: "panel_main.php",	
		type: "GET",		
		data: data,		
		cache: false,
		success: function (html) {	
			
			//add the content retrieved from ajax and put it in the #content div
			jQuery('#main_content').html(html);
			
			//display the body with fadeIn transition
			jQuery('#main_content').fadeIn('slow');		
		},	
		complete: function () {	
		
			//hide the progress bar
			jQuery('#loading').hide();	
		}		
	});
}
function getsubPage(hash, hash_value) {
	
	//generate the parameter for the php script
	var data = 'page=' + encodeURIComponent(hash) + '&page_value=' + encodeURIComponent(hash_value) ;
	jQuery.ajax({
		url: "panel_left.php",	
		type: "GET",		
		data: data,		
		cache: false,
		success: function (html) {	

			//add the content retrieved from ajax and put it in the #right_panel div
			jQuery('#right_panel').html(html);

			//display the #right_panel with fadeIn transition
			jQuery('#right_panel').fadeIn('slow');		
		},	
		complete: function () {	
		
			//hide the progress bar
//		 	jQuery('#right_loading_'+hash).hide();
		}		
	});
}

function getProfile(userID) {
	
	//generate the parameter for the php script
	var data = 'VUserId=' + userID;
	jQuery.ajax({
		url: "wauhh_panel.php",	
		type: "GET",		
		data: data,		
		success: function (html) {	

			//add the content retrieved from ajax and put it in the #right_panel div
			jQuery('#right_panel').html(html);

			//display the #right_panel with fadeIn transition
			jQuery('#right_panel').fadeIn('slow');		
		},	
		complete: function () {	
	
			//hide the progress bar
			jQuery('#loading').hide();	
//		 	jQuery('#right_loading_m').hide();
		}		
	});
}

function getMyProfile(userID) {
	
	//generate the parameter for the php script
	var data = 'VUserId=' + userID;
	jQuery.ajax({
		url: "social_panel.php",	
		type: "GET",		
		data: data,		
		success: function (html) {	

			//add the content retrieved from ajax and put it in the #right_panel div
			jQuery('#right_panel').html(html);

			//display the #right_panel with fadeIn transition
			jQuery('#right_panel').fadeIn('slow');		
		},	
		complete: function () {	
	
			//hide the progress bar
			jQuery('#loading').hide();	
//		 	jQuery('#right_loading_c').hide();
		}		
	});
}

function getboxBottom(list) {
	
	//generate the parameter for the php script
	var data = 'mode=' + list;
	jQuery.ajax({
		url: "summaryAction.php",	
		type: "GET",		
		data: data,		
		success: function (html) {	

			//add the content retrieved from ajax and put it in the #right_panel div
			jQuery('#showContent').html(html);

			//display the #right_panel with fadeIn transition
			jQuery('#showContent').fadeIn('slow');		
		},	
		complete: function () {	
	
			//hide the progress bar
			jQuery('#loading').hide();	
		}		
	});
}
