$.fn.getanddisplay = function(options,page) {

	var $this = $(this);

	var settings = {
		xml: "cgi-bin/main.cgi?q=pd&p="+page,
		xsl: "xml/lofreq_v1.xsl",
		success: null,
		complete: XsltCompleted,
		page: page,
		pass: $this
	};
	
	if(options) { // check if options are present before extending the settings
		$.extend(settings, options);
	}

	// ...
	// rest of the code
	// ...

	//if (settings.page == "menu") {
		//alert('settings page should be menu and is '+settings.page+' and height is not toggled');
		$this.animate({opacity: 'toggle'},1000,function(){
			//alert('middle ani');
			$this.transform({ 
									xml: settings.xml,
									xsl: settings.xsl,
									success: settings.success,
									complete: settings.complete,
									pass: {param1: settings.page, param2: $this}
			}); // transform 

		}); // animate callback
	//} else {
		//alert('settings page is '+settings.page+' and height is toggle');
	//	$this.animate({height: 'toggle', opacity: 'toggle'},"slow",function(){
	//		$this.transform({ 
	//								xml: settings.xml,
	//								xsl: settings.xsl,
	//								success: settings.success,
	//								complete: settings.complete,
	//								pass: {param1: settings.page, param2: $this}
	//		}); // transform 
//
//		}); // animate callback	
//	
//	}
	return $this; // if possible, return "this" to not break the chain
}

// general callback function - used a lot 
	
function XsltCompleted(html,xsl,xml,obj) {
	//alert('xsltcomp html: '+xml);
	// we pass in the dom element id as obj.pass parameter
	// and then replace all < and > tag bits
	str = $(obj.pass.param2).html();
	b = str.replace(/&lt;/g,"<");
	c = b.replace(/&gt;/g,">");
	$(obj.pass.param2).html(c);
	
	//if (obj.pass.param1 == "menu") {
	//	$(obj.pass.param2).animate({opacity: 'toggle'},"fast");
	//} else {
		$(obj.pass.param2).animate({height: 'toggle', opacity: 'toggle'},"normal");
	//}
}
