<!-- Usage: Used Across Marsh.com -updated fully on 28th Feb by sunil -->

//popup a full-screen window

function popupFS(url) {

popupWindow = window.open(url, "popupWindow", "status=yes,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,menubar=yes,resizable=yes");

//var aw = screen.availWidth;
//var ah = screen.availHeight;

//popupWindow.moveTo(0, 0);
//popupWindow.resizeTo(aw, ah);


}



<!-- Generic function to ret document type-->

function getFormDocument(){

    var dirDocument = document;
    if( document.layers ){
         dirDocument = document.contentspace.document;

    }

    return dirDocument ;
}






<!-- This is supporting function used by submitForm() function below  :sunil 23 Feb-->
<!-- It is asssumed the all the forms are within 'contentspace' DIV tag of this Layout -->
function getFormObject(formName ){

    if( document.layers ){

        if( typeof formName == "string" ){

            var formObject = eval("document.contentspace.document." + formName );

            return formObject;
        }

    }
    else{
        if( typeof formName == "string" ){

            var formObject = eval("document."+ formName );

            return formObject;
        }
    }

    return formName;

}

<!-- NN : Netscape needs the div tag reference while submitting the form inside the div.  sunil 23 Feb 02 -->
<!-- NN : Also Netscape doesnot submit the form if the submit function is written inside the div tag -->
<!-- Used for getting the form object references inside contentspace div tag  -->
<!-- NOTE:  All portal pages in the Marsh.com are supposed use this function for submitting the form -->
function submitForm(formName){

    var formObject = getFormObject(formName);

    if( formObject != null ){

        formObject.submit();

    }else{

        alert('Requested form is undefined. Please contact System Administrator with this page name');
    }

}

<!-- used for getting input objects of a form -->
function getFormInputObject(formName, inputName ){

    if( document.layers ){

        if( typeof formName == "string" ){

            var inputObject = eval( "document.contentspace.document." + formName +"." + inputName );

            return inputObject;
        }

    }
    else{
        if( typeof formName == "string" ){

            var inputObject = eval("document."+ formName +"." + inputName );

            return inputObject;
        }
    }

    return inputName;

}

<!-- generic function for setting the hidden field values in a form -->
function setValue(formName, inputName , inputValue ){

    // get form object
    var inputObject = getFormInputObject(formName,inputName);

    if( inputObject != null ){

        inputObject.value = inputValue;
    }else{
        alert('Requested form is undefined. Please contact System Administrator with this page name');
    }

}


//Shows the window of Marsh.com site Terms
function popupTerms(url){
    var w = window.open(url, "terms", "width=600,height=500,status=yes,resizable=yes,scrollbars=yes");
}

//Shows the window with no status bar
function popupNoStatus(url){
    var w = window.open(url, "", "status=no,resizable=yes,scrollbars=yes");
}




//For AdminstrateView.xsl........Functions need to be changed for removing xsl.

    function addAdminView(addEditMode) {

        if (getFormDocument().VIEWFORM.VIEWNAME.value != '') {

            strViewName = getFormDocument().VIEWFORM.VIEWNAME.value;
            if ( strViewName == 'New' || strViewName == 'NEW' || strViewName == 'new') {
                alert('Please select other word for View Name. This is reserved word.');
            }
            else{
                getFormDocument().VIEWFORM.ACTION.value = addEditMode;
                getFormDocument().VIEWFORM.submit();
           }
        }
        else{
            alert('Please enter the View Name');
        }
    }

    function removeAdminContacts() {

        if (getFormDocument().VIEWFORM.VIEWNAME.value != '') {

            if( confirm('Are you sure you want to remove the checked contacts ?') ){
                getFormDocument().VIEWFORM.ACTION.value = "REMOVECONTACTS";
                getFormDocument().VIEWFORM.submit();
            }
        }
    }

    function setAdminSelectedView() {

        getFormDocument().SELECTVIEWFORM.SELECTEDVIEW.value = getFormDocument().SELECTVIEWFORM.SELECTEDTYPE.options[getFormDocument().SELECTVIEWFORM.SELECTEDTYPE.selectedIndex].text;

        getFormDocument().SELECTVIEWFORM.submit();
    }

    function newAdminWin(addContactLink){

        strFeatures='resizable=no,width=750,height=500,scrollbars=yes';
        //msgWindow=window.open('<xsl:value-of select="ADDCONTACTLINK/@LINK"/>ADD&amp;ACTION=ADDCONTACTS','AddContacts','resizable=no,width=750,height=500,scrollbars=yes');
        msgWindow=window.open(addContactLink + 'ADD&ACTION=ADDCONTACTS','AddContacts','resizable=no,width=750,height=500,scrollbars=yes');
        msgWindow.focus();

    }


    function deleteAdminView(delViewURL){

        if( confirm('Are you sure you want to delete the this view ?') ){

            window.location = delViewURL;
        }

    }


//function for opening a print ready page
//function appends "PrintReady" to PID name and opens in new window
//assumptions: a "PrintReady" PID exists which is associated with MarshLayoutPrintReady.xsl

function openPrintPIDWindow() {

    var url = window.location.href;
    var pid = url.indexOf("PID=");
    var end = url.indexOf("&");

    if (pid == -1) {
        alert('cannot open print window - no PID found in url');
        return;
    }
    if (end == -1) {
        end = url.length;
    }

    var url_part1 = url.substring(0, end);
    var url_part2 = url.substring(end, url.length);
    var url_new = url_part1 + "PrintReady" + url_part2;

    var win = window.open(url_new, "Print");


}


//the following function are for policy summary summary page delete:
//V3 added javascript to confirm delete
function policyConfirmDelete(companyName,name) {
	if (confirm("Delete the policy summary for " + companyName + " - " + name+"?")) {
		setValue( 'PSHead' , 'BUTTON', 'delete' ); 
		submitForm('PSHead');
	}
}

// hack so textarea isn't editable in NS 
 function nsBlur(which) {which.blur();}

