jQuery(document).ready(function(){
	if (document.getElementById("phytracker")) {
		var $phytracker = jQuery("#phytracker"), $addaphysician = jQuery("#addaphysician"), phytracker = 1, $phy_inputs = jQuery("#phy_inputs"),methods={};
		
		methods.rowtoadd = function(phytracker){
			return '<tr><td class="labelpad"><label for="physician_name_' + phytracker + '">Physician Name</label></td><td class="labelpad"><label for="phy_member_' + phytracker + '">Member of:</label></td></tr><tr><td><input type="text" name="physician_name_' + phytracker + '" id="physician_name_' + phytracker + '" size="10" maxlength="50" value="" class="small" /></td><td><select id="phy_member_' + phytracker + '" name="phy_member_' + phytracker + '"><option value="neither">neither</option><option value="ACG">ACG</option><option value="ASGE">ASGE</option><option value="ACG and ASGE">ACG and ASGE</option></select> - <a href="#" class="removephy">remove</a></td></tr>';	
		}
		
		$addaphysician.live("click", function(){
			phytracker++;
			$phy_inputs.append(methods.rowtoadd(phytracker));
			$phytracker.val(phytracker);
			return false;
		});
		
		jQuery("a.removephy").live("click",function(){
			var $this = jQuery(this), $thisrow = $this.parents("tr:first"), $prevrow = $thisrow.prev("tr");
			$prevrow.remove();
			$thisrow.remove();
			return false;
		});
	}
});

