﻿

    function getAdHeight() 
    {
        var adurl = document.getElementsByName("adurl")[0];
        var url1 = adurl.value.toString();
//        alert(url1);
        if (url1.match(/^[\s]*$/)) 
        {
            return '0';
        }
        else 
        {
            return '50';
        }
    }
    function iframeAutoFit()
    {
        var ex;
        try
        {
            if(window!=parent)
            {
                var a = parent.document.getElementsByTagName("IFRAME");
                for(var i=0; i<a.length; i++)
                {
                    if(a[i].contentWindow==window)
                    {
                        var h1=0, h2=0;
                        var w1=0, w2=0, pw1=0, pw2=0;
                        if(document.documentElement&&document.documentElement.scrollHeight)
                        {
                            h1=document.documentElement.scrollHeight;
                            pw1=window.parent.document.documentElement.scrollWidth;
                            w1 =document.documentElement.scrollWidth;
                        }
                        if(document.body) 
                        {
							h2=document.body.scrollHeight;
							pw2 = window.parent.document.body.scrollWidth;
							w2 =document.body.scrollWidth;
                        }

                        var h=Math.max(h1, h2);
						var pw = Math.max(pw1,pw2);
						var w = Math.max(w1,w2);

                   				
//                        if(document.all) 
//						{
//							h += 4;
//							w += 4;
//						}
//                        if(window.opera) 
//						{
//							h += 1;
//							w += 1;
//						}
						a[i].style.width = 100 +"%";
                        a[i].style.height = h +"px";
                    }
                }
            }
        }
        catch (ex){}
    }
    if(document.attachEvent)
    {
        window.attachEvent("onload",  iframeAutoFit);
        window.attachEvent("onresize",  iframeAutoFit);
    }
    else
    {
        window.addEventListener('load',  iframeAutoFit,  false);
        window.addEventListener('resize',  iframeAutoFit,  false);
    }


