//GLOBAL'''''''''''''''''''''''''''''

	function ControlPopupClose(){
	document.body.style.overflowY = "scroll";
	document.getElementById("ControlPopup").style.display = 'none';
	document.getElementById("ControlPopup").innerHTML = "";
	}
	
	function ForceFormat(Format){
	if(Format=='Money'){re = /[^0-9.]/g; if (re.test(String.fromCharCode(event.keyCode))){event.returnValue = false}}
	if(Format=='Zip'){re = /[^0-9-]/g; if (re.test(String.fromCharCode(event.keyCode))){event.returnValue = false}}
	if(Format=='Date'){re = /[^0-9-/]/g; if (re.test(String.fromCharCode(event.keyCode))){event.returnValue = false}}
	}

	function Panel(PanelLink){

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")
	 PanelLinks = document.getElementById("AdminMenu").rows[0].getElementsByTagName("td")

        for(i=0;i<PanelLinks.length;i++){
            if(PanelLinks[i].id =="AdminMenuButton"){PanelLinks[i].className = null}
            if((i/2)==PanelLink){PanelLinks[i].className = "select"}
        } 

        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none"
             if(x==PanelLink){PanelArray[i].style.display="block"}
                x++
            }
        } 

//            if(PanelLink==0){PanelArray[0].innerHTML = tinyMCE.get('BlockText').getContent()}
	}


    function LocationListGet(){
    document.getElementById("LocationList").style.display = (document.getElementById("LocationList").style.display=="none") ? "block" : "none"
    }  	


    function LocationListSet(LocationGuid){

        var Form = document.forms['Location'];
        Form.action = "?Location=" + LocationGuid;
        Form.submit();

    }  	

    

//LOGIN'''''''''''''''''''''''''''''

	UserLoginFocus = function(){ 
	 document.forms['Login'].UserLogin.focus()
	}
	
	UserLoginGet = function(){ 
	 if(event.keyCode==13){document.forms["Login"].submit()}
	}
	
	UserLoginFailed = function(){ //FAILED LOGIN MESSAGE
	 document.getElementById("UserLoginFailed").style.display = "block"
	}
	

//PAGE'''''''''''''''''''''''''''''

function DanceImageSwap(Src){

    document.getElementById("DanceImage").src = Src
    
}

function PageAddEdit(ConfigurationGuid){

    var Form = document.forms["Administration"];

        var NoCache = new Date()
              Url = "/Page/AddEdit.asp?ConfigurationGuid="+ConfigurationGuid+"&NoCacheUrl="+NoCache.getDate()+"_"+NoCache.getMonth()+"_"+NoCache.getYear()+"_"+NoCache.getHours()+"_"+NoCache.getMinutes()+"_"+NoCache.getSeconds()

            if (window.XMLHttpRequest){XmlHttp=new XMLHttpRequest()}
            else if (window.ActiveXObject){XmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}
	          
	          XmlHttp.open("POST", Url, false);
              XmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
              XmlHttp.setRequestHeader("Content-length", ("PageLink="+escape(Form.PageLink.value)+"&PageName="+escape(Form.PageName.value)+"&PageBlurb="+escape(Form.PageBlurb.value)+"&TransformationXsl="+escape(Form.TransformationXsl.value)+"&BlockText="+escape(tinyMCE.get('BlockText').getContent())).length);
	          XmlHttp.send("PageLink="+escape(Form.PageLink.value)+"&PageName="+escape(Form.PageName.value)+"&PageBlurb="+escape(Form.PageBlurb.value)+"&TransformationXsl="+escape(Form.TransformationXsl.value)+"&BlockText="+escape(tinyMCE.get('BlockText').getContent()));

}

//CLASS
function ClassGet(ClassGuid){

     ClassGuid = (ClassGuid==undefined) ? "" : ClassGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/Class/Get.asp?ClassGuid="+ClassGuid, false);
	  Xml.send(null);

        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function ClassAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.ClassName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.ClassName.value!="" || Form.ClassText.value != "" || Form.ClassCategoryGuid.selectedIndex > 0 || Form.ClassLevelGuid.selectedIndex > 0 || Form.DanceGuid.selectedIndex > 0){ 

	    if(Form.ClassName.value==""){Error.push("Name")}
		if(Form.ClassCategoryGuid.selectedIndex<1){Error.push("Category")}
		if(Form.ClassLevelGuid.selectedIndex<1){Error.push("Level")}
		if(Form.DanceGuid.selectedIndex<1){Error.push("Dance")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required fields " + Error.join(", ") + " are missing"; }
		else{
         Form.action = "/Class/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function ClassDelete(ClassGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/Class/Delete.asp?ClassGuid="+ClassGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//ROOM
function RoomGet(RoomGuid){

     RoomGuid = (RoomGuid==undefined) ? "" : RoomGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/Room/Get.asp?RoomGuid="+RoomGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function RoomAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.RoomName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.RoomName.value!="" || Form.RoomSize.value!="" || Form.RoomRate.value!=""){ 

	    if(Form.RoomName.value==""){Error.push("Name")}
	    if(Form.RoomSize.value==""){Error.push("Size")}
	    if(Form.RoomRate.value==""){Error.push("Rate")}
	    if(Form.RoomTypeGuid.selectedIndex<1){Error.push("Type")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/Room/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function RoomDelete(RoomGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/Room/Delete.asp?RoomGuid="+RoomGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//DANCE
function DanceGet(DanceGuid){

     DanceGuid = (DanceGuid==undefined) ? "" : DanceGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/Dance/Get.asp?DanceGuid="+DanceGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function DanceAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.DanceName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.DanceName.value!="" || Form.DanceText.value!="" || Form.DanceCategoryGuid.selectedIndex > 0){ 

	    if(Form.DanceName.value==""){Error.push("Name")}
//	    if(Form.DanceText.value==""){Error.push("Text")}
	    if(Form.DanceCategoryGuid.selectedIndex<1){Error.push("Category")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/Dance/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function DanceDelete(DanceGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/Dance/Delete.asp?DanceGuid="+DanceGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//MANAGEMENT
function ManagementGet(ManagementGuid){

    tinyMCE.execCommand('mceRemoveControl', true, 'StaffImage');

          tinyMCE.init({
          // Image
          mode : "none",
          elements : "StaffImage",
          theme : "advanced",
          skin : "o2k7",
          skin_variant : "silver",
          plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

          // Theme options
          theme_advanced_buttons1 : "image",
          theme_advanced_buttons2 : "",
          theme_advanced_buttons3 : "",
          theme_advanced_toolbar_location : "top",
          theme_advanced_toolbar_align : "left",
          theme_advanced_statusbar_location : "none",
          theme_advanced_resizing : false,

          // Example content CSS (should be your site CSS)
          content_css : "/Style/Page.css",

          // Drop lists for link/image/media/template dialogs
          template_external_list_url : "lists/template_list.js",
          external_link_list_url : "lists/link_list.js",
          external_image_list_url : "lists/image_list.js",
          media_external_list_url : "lists/media_list.js",
          remove_trailing_nbsp : true,
          forced_root_block : '',
          entity_encoding : "numeric"
          });

     ManagementGuid = (ManagementGuid==undefined) ? "" : ManagementGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/About/Management/Get.asp?ManagementGuid="+ManagementGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 

    tinyMCE.execCommand("mceAddControl", true, "StaffImage"); 
}


function ManagementAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.StaffName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.StaffName.value!="" || Form.StaffText.value!="" || Form.StaffImage.value!=""){ 

	    if(Form.StaffName.value==""){Error.push("Name")}
	    if(Form.StaffText.value==""){Error.push("Text")}
//	    if(Form.StaffImage.value==""){Error.push("Image")}
        if(tinyMCE.get('StaffImage').getContent()	==""){Error.push("Image")}
	    if(Form.StaffSequence.selectedIndex<0){Error.push("Place Before")}
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/About/Management/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function ManagementDelete(ManagementGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/About/Management/Delete.asp?ManagementGuid="+ManagementGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//INSTRUCTOR
function InstructorGet(InstructorGuid){

    tinyMCE.execCommand('mceRemoveControl', true, 'StaffImage');

          tinyMCE.init({
          // Image
          mode : "none",
          elements : "StaffImage",
          theme : "advanced",
          skin : "o2k7",
          skin_variant : "silver",
          plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

          // Theme options
          theme_advanced_buttons1 : "image",
          theme_advanced_buttons2 : "",
          theme_advanced_buttons3 : "",
          theme_advanced_toolbar_location : "top",
          theme_advanced_toolbar_align : "left",
          theme_advanced_statusbar_location : "none",
          theme_advanced_resizing : false,

          // Example content CSS (should be your site CSS)
          content_css : "/Style/Page.css",

          // Drop lists for link/image/media/template dialogs
          template_external_list_url : "lists/template_list.js",
          external_link_list_url : "lists/link_list.js",
          external_image_list_url : "lists/image_list.js",
          media_external_list_url : "lists/media_list.js",
          remove_trailing_nbsp : true,
          forced_root_block : '',
          entity_encoding : "numeric"
          });

     InstructorGuid = (InstructorGuid==undefined) ? "" : InstructorGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/About/Instructor/Get.asp?InstructorGuid="+InstructorGuid, false);
	  Xml.send(null);

        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 

    tinyMCE.execCommand("mceAddControl", true, "StaffImage"); 
}


function InstructorAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.StaffName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.StaffName.value!="" || Form.StaffText.value!="" || Form.StaffImage.value!=""){ 

	    if(Form.StaffName.value==""){Error.push("Name")}
	    if(Form.StaffText.value==""){Error.push("Text")}
//	    if(Form.StaffImage.value==""){Error.push("Image")}
        if(tinyMCE.get('StaffImage').getContent()	==""){Error.push("Image")}
	    if(Form.StaffSequence.selectedIndex<0){Error.push("Place Before")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/About/Instructor/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function InstructorDelete(InstructorGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/About/Instructor/Delete.asp?InstructorGuid="+InstructorGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//LOCATION
function LocationGet(LocationGuid){

     LocationGuid = (LocationGuid==undefined) ? "" : LocationGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/About/Location/Get.asp?LocationGuid="+LocationGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function LocationAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.LocationName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.LocationName.value!="" || Form.LocationAddress.value!="" || Form.LocationCity.value!="" || Form.LocationState.value!="" || Form.LocationZip.value!="" || Form.LocationPhone.value!="" || Form.LocationEmail.value!=""){ 

	    if(Form.LocationName.value==""){Error.push("Name")}
	    if(Form.LocationAddress.value==""){Error.push("Address")}
	    if(Form.LocationCity.value==""){Error.push("City")}
	    if(Form.LocationState.value==""){Error.push("State")}
	    if(Form.LocationZip.value==""){Error.push("Zip")}
	    if(Form.LocationPhone.value==""){Error.push("Phone")}
	    if(Form.LocationEmail.value==""){Error.push("Email")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/About/Location/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function LocationDelete(LocationGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/About/Location/Delete.asp?LocationGuid="+LocationGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//RESOURCE
function ResourceGet(ResourceGuid){

     ResourceGuid = (ResourceGuid==undefined) ? "" : ResourceGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/About/Resource/Get.asp?ResourceGuid="+ResourceGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function ResourceAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.ResourceName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.ResourceName.value!="" || Form.ResourceHref.value!="" || Form.ResourceText.value!=""){ 

	    if(Form.ResourceName.value==""){Error.push("Name")}
	    if(Form.ResourceHref.value==""){Error.push("Link")}
	    if(Form.ResourceText.value==""){Error.push("Description")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/About/Resource/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function ResourceDelete(ResourceGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/About/Resource/Delete.asp?ResourceGuid="+ResourceGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//CAREER
function CareerGet(CareerGuid){

     CareerGuid = (CareerGuid==undefined) ? "" : CareerGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/About/Career/Get.asp?CareerGuid="+CareerGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 
}


function CareerAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.CareerName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.CareerName.value!="" || Form.CareerText.value!="" || Form.LocationGuid.selectedIndex>0){ 

	    if(Form.CareerName.value==""){Error.push("Name")}
	    if(Form.CareerText.value==""){Error.push("Description")}
//	    if(Form.LocationGuid.selectedIndex<1){Error.push("Location")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/About/Career/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function CareerDelete(CareerGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/About/Career/Delete.asp?CareerGuid="+CareerGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//PRESS
function PressGet(PressGuid){

    tinyMCE.execCommand('mceRemoveControl', true, 'PressText');

     PressGuid = (PressGuid==undefined) ? "" : PressGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/Media/Press/Get.asp?PressGuid="+PressGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 

    tinyMCE.execCommand("mceAddControl", true, "PressText"); 
}


function PressAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.PressName) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.PressName.value!="" || Form.PressDate.value!="" || Form.PressText.value!=""){ 

	    if(Form.PressName.value==""){Error.push("Name")}
	    if(Form.PressDate.value==""){Error.push("Date")}
//	    if(Form.PressText.value==""){Error.push("Description")}
        if(tinyMCE.get('PressText').getContent()	==""){Error.push("Description")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/Media/Press/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function PressDelete(PressGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/Media/Press/Delete.asp?PressGuid="+PressGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}


//NEWS
function NewsGet(NewsGuid){

    tinyMCE.execCommand("mceRemoveControl", true, "NewsText"); 

     NewsGuid = (NewsGuid==undefined) ? "" : NewsGuid;

	 PanelArray = document.getElementById("ContentArea").getElementsByTagName("div")

    if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
    else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
	  Xml.open("GET", "/Media/News/Get.asp?NewsGuid="+NewsGuid, false);
	  Xml.send(null);
	 
        var x = 0;
        for(i=0;i<PanelArray.length;i++){
            if(x==4){
                PanelArray[i].innerHTML = Xml.responseText
                PanelArray[i].style.display="block";
                break; 
            }
            if(PanelArray[i].id =="Panel"){
                PanelArray[i].style.display="none";
                x++;
            }
        } 

    tinyMCE.execCommand("mceAddControl", true, "NewsText"); 

}

function NewsAddEdit(){

    var Form = document.forms["Administration"]; var Error = new Array;

    //CHECK
    if(typeof(Form.NewsTitle) != "undefined"){

    //CHECK PASS THROUGH
    if(Form.NewsTitle.value!="" || Form.NewsDate.value!="" || Form.NewsText.value!=""){ 

	    if(Form.NewsTitle.value==""){Error.push("Name")}
	    if(Form.NewsDate.value==""){Error.push("Date")}
//	    if(Form.NewsText.value==""){Error.push("News")}
        if(tinyMCE.get('NewsText').getContent()	==""){Error.push("Description")}
	
		if(Error!=""){document.getElementById("ErrorMessage").innerHTML="ERROR: Required field(s) " + Error.join(", ") + " missing"; }
		else{
         Form.action = "/Media/News/AddEdit.asp"
         Form.submit()
		}

    }

   }

}


function NewsDelete(NewsGuid){
document.getElementById("ControlPopup").style.display = "block";

if (window.XMLHttpRequest){Xml=new XMLHttpRequest()}
else if (window.ActiveXObject){Xml=new ActiveXObject("Microsoft.XMLHTTP")}
  Xml.open("GET", "/Media/News/Delete.asp?NewsGuid="+NewsGuid, false);
  Xml.send(null);

var Content = document.getElementById("ControlPopup")
Content.innerHTML = Xml.responseText;
}