﻿


    $(document).ready(function () {

        function getformheight(formpass) {
            //get the height of the form passed to this function

            //var formdata = {};

            var formdata = { "Capabilities.htm": 300,
                "Consignment.htm": 300,
                "Index.htm": 300,
                "Intro.htm": 300,
                "ManagementTeam.htm": 560,
                "Manufacturing.htm": 300,
                "MaterialManagement.htm": 300,
                "OurStory.htm": 300,
                "ProductionControl.htm": 300,
                "Certifications.htm": 300,
                "Rework.htm": 300,
                "Rohs.htm": 300,
                "Standards.htm": 300,
                "Testing.htm": 300,
                "Turnkey.htm": 300,
                "ftplogin.aspx": 300,
                "Positions.htm": 300,
                "ApplyOnline.htm": 300,
                "Employment.htm": 300
            };

            $.each(formdata, function (i, val) {

                if (i == formpass) {
                    formheight = val;
                }

            });

            return formheight;
        }

        /* end getformheight*/

        $("#iframeMain").css("display", "none");
        $("#iframeMain").css("height", 300);
        $("#iframeMain").fadeIn(2000);
        $("a").click(function (event) {
            event.preventDefault();
            linkLocation = this.href;
            $("#iframeMain").fadeOut(1000, redirectPage);
        });



        function redirectPage() {
            // window.frames['iframeMain'].location = linkLocation;
            var formheight = getformname();
            $("#iframeMain").css("height", formheight);
            $("#iframeMain").fadeIn(1000);
            document.getElementById("iframeMain").src = linkLocation;
        }

        function getformname() {
            //get the form name from the link that is clicked.
            //link will be in this format: http://server/directory/formname.htm

            //get the entire length of the link
            //example: 37
            var totallength = 0;
            totallength = linkLocation.length;

            //get the start location of the last "/"
            //example: 27
            var lastfound = 0;
            lastfound = linkLocation.lastIndexOf("/");
            lastfound = lastfound + 1;

            //get the form name
            var formname = "";
            formname = linkLocation.substring(lastfound, totallength)

            return getformheight(formname);
        }








    });
