var SmokeEffect = {
	
	imgLocation: "", //url to image here
	smokeWidth: 80, //standard width
	smokeHeight: 45, //standard height
	
	//don't touch this:
	smokePos: new Array(),
		
	makeEffect: function(id, posX, posY) {
		//set position from the "parent"
		SmokeEffect.smokePos[id] = new Array();
		SmokeEffect.smokePos[id]['x'] = posX;
		SmokeEffect.smokePos[id]['y'] = posY;
		
		//set a random time to start puffing
		var time = 1000;//(Math.floor(Math.random()*3001));
		setTimeout("SmokeEffect.animate('" + id + "')", time);
	},
	
	animate: function(id) {

		//create the smoke cloud
		var puff = document.createElement("IMG");
		jQuery(puff).attr("src", SmokeEffect.imgLocation);
		jQuery(puff).attr("alt", "puff");
		jQuery(puff).attr("class", "puff");
		
		
		//create timeout to read each bubble
		var timeTillNew = 20400;
		
		//create a temp id for the cloud so we can delete it later on
		var tempId = "puff" + Math.floor(Math.random()*1001);
		jQuery(puff).attr("id", tempId);
		
		//append the cloud to the body
		jQuery("#rotator").append(jQuery(puff));
		
		var objPos = jQuery('#' + id).offset();
		
		//do smoke animation
		jQuery(puff).css({
			//top: (objPos['top'] + SmokeEffect.smokePos[id]['y']) + "px",
			//left: (objPos['left'] + SmokeEffect.smokePos[id]['x']) + "px",
			marginLeft:"5px",
			marginTop: "95px",
			zIndex: 25
		});
		jQuery(puff).animate({
			marginTop: "35px"
		},{
			duration: 1000
		});
		jQuery(puff).animate({
			marginTop: "35px"
		},{
			duration: 1500
		});
		
		
		jQuery(puff).animate({
			marginTop: "10px"
		},{
			duration: 1000
		});
				jQuery(puff).animate({
			marginTop: "10px"
		},{
			duration: 1500
		});
		
		
		
		
		jQuery(puff).animate({
			marginTop: "-35px"
		},{
			duration: 1000
		});
				jQuery(puff).animate({
			marginTop: "-35px"
		},{
			duration: 1500
		});
		
		
		jQuery(puff).animate({
			marginTop: "-85px"
		},{
			duration: 1000
		});
				jQuery(puff).animate({
			marginTop: "-85px"
		},{
			duration: 3500
		});
		
		
				jQuery(puff).animate({
			marginTop: "-250px"
		},{
			duration: 1000
		});
		
		setTimeout("SmokeEffect.animate('" + id + "')", timeTillNew);
		
		//remove the old one
		setTimeout("jQuery('#" + tempId + "').remove()", 15400);
		
	}
}
