﻿function nav(ctl,path) {
    if (path == null)
        path = "";
        
	if (ctl.value == 'Home')
		top.location = path + 'default.htm';
	else if (ctl.value == 'Worship')
		top.location = path + 'worship.htm';
	else if (ctl.value == 'History')
		top.location = path + 'history.htm';
	else if (ctl.value == 'Music')
		top.location = path + 'music.htm';
	else if (ctl.value == 'Kids')
		top.location = path + 'kids.htm';
	else if (ctl.value == 'Youth')
		top.location = path + 'youth.htm';
	else if (ctl.value == 'Adults')
		top.location = path + 'adults.htm';
	else if (ctl.value == 'Visitors')
		top.location = path + 'visitors.htm';
	else if (ctl.value == 'Newsletter')
		top.location = path + 'newsletter.htm';
	else if (ctl.value == 'Staff')
		top.location = path + 'staff.htm';
	else if (ctl.value == 'Resources')
		top.location = path + 'resources.htm';
	else if (ctl.value == 'Contact Us')
		top.location = path + 'contact.htm';
	else if (ctl.value == 'Events')
		top.location = path + 'UpcomingEvents.htm';
}

var Controller = Class.create();
Controller.prototype = {
    initialize: function(xslt,xml,divToUpdate) {
        this.xslt = xmlHelper.loadXslt(xslt);
        this.xml = xmlHelper.loadDoc(xml);
        this.divToUpdate = divToUpdate;
    },
    
    renderHtml: function() {
        var html = xmlHelper.xslTransform(this.xml, this.xslt, null);
        $(this.divToUpdate).innerHTML = html;
    }
};