HJ.HELP = Class.create();

HJ.HELP.prototype = {	
	initialize: function() {
		this.data = null;
		this.isHelpSaved = false;
		this.contextId = null;
	},

	init: function () {
	   var req = new Af.DataRequest(svcURL,
	   this.requestEventLoadCompleted.bind(this), this.requestFailedCommon.bind(this), null, this.requestTimedoutCommon.bind(this));
	   req.addService("PublicService", "getPublicData");
	   ajaxEngine.processRequest(req);	 
	},

	requestEventLoadCompleted: function(response) {	
		
		
		// swap .png logo for .gif logo in IE6
		var browserName=navigator.appName;
		var browserVer=parseInt(navigator.appVersion);
		if (browserName=="Microsoft Internet Explorer" && browserVer<=6) {
			document.getElementById('joonersLogo').src = 'img/logo.gif';
		}
		
	   //debugA(response.responseText);
	   var xds = new Af.XMLToDataSet(response.responseXML);
	   this.data = textDisplayData(xds.data, 'name,description,helper,notes');
	   
	   this.myList = this.data["MyList"][0];
	    var templateType = this.myList.templateType;
		var template = null;
				
		switch(templateType)
		{
		case "GenericSignup":
		  template = new HJ.GenericSignup(this.myList);
		  break;    
		case "PracticeCarpool":
		  template = new HJ.PracticeCarpool(this.myList);
		  break;
		case "SnackDuty":
		  template = new HJ.SnackDuty(this.myList);
		  break;

		case "SimpleList":
		  template = new HJ.SimpleList(this.myList);
		  break;
		  
		case "OrganizeVolunteers":
		  template = new HJ.OrganizeVolunteers(this.myList);
		  break;
		
		case "OrganizeShifts":
			  template = new HJ.OrganizeShifts(this.myList);
			  break;
			

		default:
			break;
		}

		template.loadTemplate();
	},
	
	requestFailedCommon: function(dataRequest, msg) {
	    hideDialogWin();
	    if (msg == null || msg == "") {
	    	showMessageDialog("We are currently unable to display this list.  Please try again. ", "Excuse us!", 350, 100);
	    } else {
	    	showMessageDialog(msg, "Mid-air collision!", 350, 100);
	    }
    },

    requestTimedoutCommon: function(dataRequest) {
        hideDialogWin();
       showMessageDialog("We are currently unable to display this list.  Please try again.", "Excuse us!", 350, 100);
    }
}    
