(function( $ ){

$(function(){
  $('iframe[src*=zagran.php]').css('height','850px')
  $('iframe[src*=egrul.php]').css('min-height','620px')
  $('iframe[src*=egrul_el.php]').css('height','600px')
  $('iframe[src*=egrul_el_upload.php]').css('height','260px')
  $('iframe[src*=egrp.php]').css('height','520px')
  $('iframe[src*=zgrn-anketa.php]').css('height','685px')
  $('iframe[src*=reg_gbr]').css('min-height','420px')
  $('iframe[src*=ocenka]').css('height','350px')
  $('iframe[src*=nedvigimostj_prodaga]').css('height','500px')
  $('iframe[src*=nasledstvo]').css('height','350px')
  $('iframe[src*=privat_spb]').css('height','350px')

  $('iframe[src*=kadastr]').css('height','500px')

  $('iframe[src*=egrp.php]').css('height','400px')
  $('iframe[src*=egrp_forma_3.php]').css('height','672px')
  $('iframe[src*=dogovor_property.php.php]').css('height','350px')

init_iframe_height('inforaspb.ru')

setTimeout(function(){$('#zingaya_widget').hide();},100)

})
}(jQuery))


function init_iframe_height(currentDomain)
{
    //if (currentDomain) document.domain = currentDomain;//getRootDomain(currentDomain);
  	function doIframe() {
  		o = document.getElementsByTagName('iframe');
  		for (i = 0; i < o.length; i++) {
  			if (o[i].className) if (/\bautoHeight\b/.test(o[i].className)) {
  				setHeight(o[i]);
  			}
  		}
  	}

  	function setHeight(e) {
  		var ifrm = jQuery(('iframe[src*='+e.contentDocument.baseURI+']'));

		if (ifrm.length == 0)
			ifrm = jQuery(('iframe[src*='+e.contentDocument.location.pathname+']'));

		var max_height = ifrm.height();
		ifrm.css('overflow','visible')
		ifrm.css('height','')

  		if (e.contentDocument && e.contentDocument.body) {
  			e.height = e.contentDocument.body.offsetHeight + 35;
  		} else {
  			e.height = max_height;//850; //e.contentWindow.document.body.scrollHeight+20;
  		}
		ifrm.css('overflow','visible')
//alert(e.height)
  	}


    function getRootDomain(fullDomainName) {
        var periodParts = fullDomainName.split('.');

        if (periodParts.length == 3) { //we know it's [sub].[domain].[com]
            return periodParts[1] + '.' + periodParts[2]; //[domain].[com]
        }
        else {
            return fullDomainName;
        }
    }

    //doIframe()
    setInterval(function(){doIframe()},50);
}

var g_imageIndex=1;

function updateOnlineImage()
{

  var img = document.getElementById('online-consult-image');
  img.src='/webim/button.php?i=infora&amp;lang=ru&rnd='+g_imageIndex;
  g_imageIndex++;
  setTimeout(updateOnlineImage, 600000)

}

function blinkWindow()
{
  var oldTitle = document.title;
  var msg = "new!";
  var timeoutId = setInterval(function(){
   document.title = document.title == msg ? ' ' : msg;
   },1000)
  window.onmousemove=function(){
    clearInterval(timeoutId);
    document.title = oldTitle;
    window.onmousemove = null;
}
}


