/**
 * Post Code Anywhere Javascript for iFrame resizing
 * 
 * Requires: jquery
 * 
 * Expects that the iframe has an id of 'pca-iframe'
 * 
 * Author: clifton.cunningham@capgemini.com
 * Edited-by: martin.moen@capgemini.com
 * 
 */

// Ensure that document.domain is the url suffix (e.g. postoffice.co.uk and not server + domain).
document.domain = document.location.hostname.replace(document.location.hostname.split(".")[0] + '.','');

$(document).ready(function () {

    function setHeight() {
        //alert($("body").height());
        var documentHeight = $("body").height();
        //documentHeight = $(document).height();
        //alert(documentHeight);
        var iframe = $('#pca-iframe', window.parent.document);
        $(iframe).height(documentHeight + 100);
    }

    // Run on page load
    setHeight();

});
