/**
 * 
 * @author Raymond Manalo
 * @date 8/6/2010
 * @description Creates the skim effect on the listing photos
 * 
 */

var JQSKIM = {
	
	/**
	 * Build the other images dynamically on the fly
	 * @param {int} id the lotid
	 **/
	init:function(id){
		//Build the other images dynamically on the fly
		JQSKIM._buildOtherImages(id);	
	}
	
	/**
	 * Call an ajax function that gets the rest of the lotImages for the lotid
	 * build the html and add it to the DOM
	 * @param {int} id the lotid
	 **/
	,_buildOtherImages:function(id){
		var liObj = $('#first-'+id);
		//ajax call
		var ajax = $.ajax({
			type: "GET",
			url: "/includes/ajax/ajx_gateway.cfm?comp=ajx_listing&method=getOtherImages",
			dataType: 'json',
			data: {
				lotid: id
			},
			success: function(r, status){
				liObj.after(r);
			},
			complete:function(r, status){
				JQSKIM._loadSkim(id);
			}
		});
	}
	
	/**
	 * Load the skim effect after the other images were added to the DOM
	 * @param {int} id the lotid
	 **/
	,_loadSkim:function(id){
    	$("#skim-me-"+id).skim();
	}
	
	/**
	 * Load the first image on mouseout to reset to hide the other images
	 * @param {int} id the lotid  
	 **/
	,_loadFirst:function(obj,id){
		$(obj).find("li").css("display", "none");
		$('#first-'+id).css('display','block');
		
	}
}

