var addEvent = function(elem, type, eventHandle) { if (elem == null || elem == undefined) return; if ( elem.addEventListener ) {elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) {elem.attachEvent( "on" + type, eventHandle );} }; addEvent(window, "resize", function() {checkHeight();} ); oldFreeText = ""; cfSearchForm = { initialized: false, hasCookie: false, ltMSIE8: false, hasExpanded: false } function checkHeight() { var country = (typeof window.country != 'undefined') ? window.country : ''; // Using global country if ( cfSearchForm.hasExpanded ) { return; } if ( cfSearchForm.initialized === false ) { cfSearchForm.initialized = true; if ( getCookie("lastSearchResult") ) { cfSearchForm.hasCookie = true; } if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number if ((ieversion==6) || (ieversion==7)) { cfSearchForm.ltMSIE8 = true; //Vi viser ikke den lille søgeform for IE6&IE7 } } } var height = 1000, limit = 700 - $(window).scrollTop(); if ( !cfSearchForm.hasCookie && !cfSearchForm.ltMSIE8 ) { if (window.innerHeight) height = window.innerHeight; else if(document.documentElement.clientHeight) height = document.documentElement.clientHeight; } var hideableLabels = '#label_energyFriendly,' + '#label_anglerHouse,' + '#label_wheelchairFriendly,' + '#label_sauna'; var hideableCheckboxes = '#energyFriendly,' + '#anglerHouse,' + '#wheelchairFriendly,' + '#sauna'; if(height < limit) { $(hideableCheckboxes).attr('checked', false); $(hideableLabels).hide(); $('#normalSearchForm .searchFormParts').css('margin-bottom', '0px'); $('#normalSearchForm .hideable').hide(); $('#normalSearchForm .hideable2').hide(); $('#textSearch').val(""); if ( "DK" == country ) { $('#searchFormTheHouse').css("margin-top", "20px"); } else { $('#searchFormTheHouse').css("margin-top", "0"); } setTimeout(ssr,1000); } else { cfSearchForm.hasExpanded = true; $(hideableLabels).show(); $('#normalSearchForm .searchFormParts').css('margin-bottom', ''); $('#normalSearchForm .hideable').show(); $('#normalSearchForm .hideable2').show(); if ( "DK" == country || "EU" == country ) { $('#searchFormTheHouse').css("margin-top", "0"); } else { $('#searchFormTheHouse').css("margin-top", "26px"); } } $('#showHousesTD').css("padding-bottom", "10px"); if (country == "DK") { $("#searchForm_undermap_spacer").css("margin-top", "48px"); $("#sfmapmain").css("padding-top", "25px"); } else if(country == "EU") { $("#searchForm_undermap_spacer").css("margin-top", "78px"); $("#sfmapmain").css("padding-top", "25px"); } else { $("#searchForm_undermap_spacer").css("margin-top", "15px"); } }