﻿// JScript File
//Function display alert message from the Edit Facility page when user select Inactive from drop down list.
function Warning()
{
    alert("To deactivate this facility and any attached Construction and/or Title V permits click Ok and then Submit.")
}

////Function provides cross browser functionality
//function HTMLElementFix()
//{
//        if(typeof HTMLElement!="undefined" && ! HTMLElement.prototype.insertAdjacentElement)
//      {
//      	        HTMLElement.prototype.insertAdjacentElement = 
//	    function(where,parsedNode)
//	    {
//            switch (where)
//            {
//                case 'beforeBegin':
//                        this.parentNode.insertBefore(parsedNode, this)
//                        break;
//                case 'afterBegain':
//                        this.insertBefore(parsedNode, this.firstChild);
//                        break;
//                case 'beforeEnd':
//                        this.appendChild(parsedNode);
//                        break;
//                case 'afterEnd':
//                        if(this.nextSibling)
//                        this.parentNode.insertBefore(parsedNode, this.nextSibling);
//                        else this.parentNode.appendChild(parsedNode)
//                        break;
//            }
//        }

//	HTMLElement.prototype.insertAdjacentHTML = 
//	function(where,htmlStr)
//	{
//		var r = this.ownerDocument.createRange();
//		r.setStartBefore(this);
//		var parsedHTML = r.createContextualFragment(htmlStr);
//		this.insertAdjacentElement(where,parsedHTML)
//	}

//	HTMLElement.prototype.insertAdjacentText =
//	 function(where,txtStr)
//	 {
//		var parsedText = document.createTextNode(txtStr)
//		this.insertAdjacentElement(where,parsedText)
//	}
//}

//Function use on both editfacility and edit permit pages.
function ErrorMsg()
{
    alert("An error has occurred while updating the record.");
}
//Function use on both editfacility and edit permit pages.
function SuccessMsg()
{
    alert('Update successful.');
}
//Function use no both editfacility and edit permit pages.
function ErrorMsgLoad()
{
    alert('An error has occurred while loading the record.');
}
//Function use no both editfacility and edit permit pages.
function NoRecordFound()
{
    alert('No record found.');
}

//Function use no both .
function InvalidAirsNum()
{
    alert('Not a valid airsnumber.');
}
//Function use on the edit permit pages.
function DisplayPermitMsg(input)
{
    var value = input;
    if(value == -1) 
    {
        alert('Please upload pdf document only.');
    }
    else if(value == -2)
    {
        alert('File Upload fail! Please try again.');
    }
    else if(value == -3)
    {
    alert('Not a valid engineer.');
    }
    else if(value == -4)
    {
        alert('AIRS Number can not be modified. Please make correction and try again.');
    }
    else if(value == -5)
    {
        alert('Project Number can not be modified. Please make correction and try again.');
    }
}
//Function Create new facility.
function CreateFacility()
{
    alert("New facility created.");
}
//Function Create new permit.
function CreatePermit()
{
    alert("New permit created.");
}
//Function  facility exists.
function FacilityExists()
{
   alert(' This Facility Already Exists.');
}
//Function  permit exists.
function PermitExists()
{
   alert(' This Permit Already Exists.');
}
function ErrorMsgAdd()
{
   alert(' An error has occurred while adding the record.');
}
function ErrorMsgFacility()
{
   alert('An error has occurred while adding the record.');
}
