﻿// Core CMS class
function _cms() {
    this.location = "";     // current page location
    this.page = "";         // current page name
    
    this.Init = function(location,page)
    {
        this.location = location;
        this.page = page;
        $("body").append(CWM.Mask);
        this.Mask = CWM.Mask
        this.Mask.css({'width':$(window).width(), 'height':$(window).height()});
        $(window).bind("resize",function(e) {
            cms.Mask.css({'width':$(window).width(), 'height':$(window).height()});
        });
    }  
    this.CurrentPath = function()
    {
        return "/" + this.location + "/" + this.page;
    }
    this.Login = function()
    {
        new CaveWindow('SiteAdmin Login','/Login/Login',{Theme:'/Content/Sparta-Popup.htm'});
    }
    this.QuickContact = function()
    {
        new CaveWindow("Quick Contact", "/Ajax/Contact", {Theme:'/Content/Sparta-Popup.htm',type:"POST",data:{"Name":"Quick Contact","Email":"Shelly.Dunneback@staff.spartaschools.org"}});
    }
    this.Contact = function(name)
    {
        new CaveWindow("Staff Contact", "/Contact/"+name,{Theme:'/Content/Sparta-Popup.htm'});
    }
    this.SendContact = function()
    {
        $.ajax({
            type:"POST",
            url:"/Contact/Send",
            data: {"ToAddress":$("#ToAddress").val(),"FromAddress":$("#FromAddress").val(),"EmailSubject":$("#EmailSubject").val(),"EmailBody":$("EmailBody").val()},
            dataType: "script",
            success: function(result) {
                eval(result);
            }
        });
    }
}

cms = new _cms();