﻿ var _strSrc = '';
        
        $(document).ready(function(){
            var strLocation;
            var strURL;
            
            strLocation = window.top.location.toString();
            
            if(strLocation.indexOf("#") > -1){
                strLocation = strLocation.substring(strLocation.indexOf("#")+1,strLocation.length);
                $('#main_window').attr('src',strLocation);
                _strSrc = strLocation;
            }else{
                $('#main_window').attr('src','Frontpage.html');
            }
            
            //Ressizing so the iFrame that shows the main content will always display the footer to the needed size.
            ResizeIFrame();
            
            //Incase the window is resized we'll need to resize the iFrame so the footer shows
            window.onresize = function(){
                ResizeIFrame();
            }
            
            $('a').click(function(){
                strLocation = $(this).attr('href');
                _strSrc = strLocation;
                SetURL(strLocation);
            });
        });
        
        function SetURL(strLocation){
            strURL = "http://" + window.top.location.host + window.top.location.pathname;
            window.top.location = strURL + '#' + strLocation;
        }
        
        function ResizeIFrame(){
            var _intWinHt, _intMenuHeight, _intFooterHeight;
            
            _intMenuHeight = $('#div_menu')[0].offsetHeight;
            _intFooterHeight = $('#tbl_footer')[0].offsetHeight;
            _intWinHt = window.innerHeight || window.document.documentElement.clientHeight;
            _intWinHt -= (_intMenuHeight+_intFooterHeight+15);
            
            $('#main_window').css({height:_intWinHt+'px'});
        }
        
        function runSomething(){
            $('#main_window').contents().find('a').click(function(){
                var strLocation = $(this).attr('href');
                var intIndex = _strSrc.indexOf('/');
                
                strLocation = _strSrc.substring(0,intIndex+1) + strLocation;
                SetURL(strLocation);
            });

           $('#main_window').contents().find("body").append("<script type='text/javascript'>var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-1744141-4']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>");
        }