// JavaScript Document
/*
	FEEDBURNER CLASS
	----------------------
*/
var Feedburner = Class.create({
	initialize: function(){

		//attributes
		this.hostName 			= location.hostname; //host name of site (so we don't have to arse around making dev and test versions of the code.	
				
		this.strAspInterface	= 'http://'+this.hostName+'/code/classes/ajax/reader/feedburner.asp'; //url of asp client interface which is called by the ajax functions
				
		this.parameters 		= new Object();		//object containing any parameters to be passed to the server side script via ajax.
		this.responseText		= ""; //text response from ajax call
		
		this.myAjax;
			
		
		
	},

	GetFeed: function(total, noToShow){
		
		var obj = new Object();
		
		obj["total"] = total;
		obj["notoshow"] = noToShow;
		
		oFeedburner.ajaxPost(obj, {onComplete:oFeedburner.DisplayFeed});
		
	},
	
	DisplayFeed: function(objResponse){
		

		$("Feedburner_content").innerHTML = objResponse.responseText;
		
		$("JobsFeedList").style.opacity = "0";
		Effect.Appear($("JobsFeedList"), {duration:2} );
		
		var  list_height = $("JobsFeedList").getDimensions().height;	

		$("JobsFeed").style.minHeight = "10px";

		new Effect.Morph("JobsFeedList", {
			  style: {
				height: (list_height +35) + "px"
			  }, // CSS Properties
			  duration: 1.5 // Core Effect properties
			});
		
		Effect.Fade($("JobsFeedLoading"), {duration:0.5} );
		
	},
	
	
	/*
		AJAX FUNCTIONS
	*/
	
	//build the parameter string to be passed into the ajax call from the parameters object
	buildParameterString:function(){
	
		var strPars = '';
		
		for (var i in this.parameters){
			strPars = strPars + i + "=" + this.parameters[i] + "&";
		}
		
		return strPars;
	
	},


	//perform ajaxcall using 'post'
	ajaxPost:function(params, opts){
		

		
		var oOptions = new Object();
		
		if (typeof params != "undefined") {
			this.parameters = params;			
		}
		
		if (typeof opts != "undefined"){
			oOptions = opts;	
		}			
			
		var pars = this.buildParameterString();
	
		oOptions['parameters'] = pars;
	
		
	
		//alert(pars);
		//communicate with webserver via ajax
		this.myAjax = new Ajax.Request(this.strAspInterface, oOptions);
	
	}


});


	




