/**
 * Author: Avinash Kadaji
 * Date: 12/05/2008
 * Email: kadaji@gmail.com
 *
 * Parser JS methods
 */
 var reqCount = 0;
function getPortfolio(pars)
{
	
	if(reqCount > 0)
		reqCount = 1;
	pars += "&firstreq="+reqCount;
	
	jQuery.ajax({
		type: "POST",
		url: "parser.lib.php",
		data: pars,
		success: function(response) {
			if(reqCount == 0) {
				jQuery.facebox(response);
				reqCount = 1;
			} else {
				jQuery("#portfolio-container").html(response);
			}
		},
		failure: function(response) {
			alert("Failed with HTML Response Code (1) : " + response.status);
		}
	});
}

/**
 * Does the followin operations
 * - update count div
 * - fetch image and write to 'image-container'
 */
function fetchImage(caseid, imageindex, totalimages)
{
	/*
	//update the image navigator
	jQuery(".project_image").removeClass('active');
	jQuery("#image_" + imageindex).addClass('active');

	//update the image count
	jQuery("#imagecount").html((imageindex+1) + "/" + totalimages + " Website&nbsp;&nbsp;");
	*/
	jQuery.ajax({
		type: "POST",
		url: "parser.lib.php",
		data: "action=getimage&caseid="+caseid+"&imageindex="+imageindex,
		success: function(response) {
			//modify here to include animation
			jQuery("#bottom-container").html(response);
		},
		failure: function(response) {
			alert("Failed with HTML Response Code (2) : " + response.status);
		}
	});	
}
