﻿

function change_parent_url(url){
	    document.location=url;
}

jQuery(document).ready(
    function() {
        $("#globalmenu ul li a").filter(':last').css('background-image', 'none');
        
        
        
        var searchBoxes = $(".searchText");
        
        var searchText = "Søk her";
        
        
        if(searchBoxes.attr("value") == ""){
                searchBoxes.attr("value", searchText);
                searchBoxes.addClass("intputDefaultText");
            }
        
        
        
        
        //Effects for both searchbox
        searchBoxes.focus(function(e){
           $(this).addClass("active");
           if($(this).attr("value") == searchText){
            $(this).attr("value", "");
            $(this).removeClass("intputDefaultText");
            }
        });

        searchBoxes.blur(function(e){
           $(this).removeClass("active");
           if($(this).attr("value") == ""){
                $(this).attr("value", searchText);
                $(this).addClass("intputDefaultText");
            }
        }); 
        
        
        
        SetHeight();
        
        
        //Iframe på database i lightbox
        $("#jQueryIframe").fancybox({
				'width'				: '75%',
				'height'			: '75%',
		        'autoScale'     	: false,
		        'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
        
        
});

function SetHeight(){

    var msie=160;
    var url = document.location.toString();
    if(url.indexOf("idkeep=True")!=-1){
        msie=190;
    }

    jQuery.each(jQuery.browser, function(i) {
          if($.browser.msie){
             $("#wrap").attr("style","height:"+
                        (
                            $("#content").height()+
                            $("#top").height()+
                            msie
                        )
                    +"px;");
             return false;
         }
         else if($.browser.mozilla)
         {
             $("#wrap").attr("style","height:"+($(document).height()-187)+"px;");
             return false;
             
          }else{
             $("#wrap").attr("style","height:"+($(document).height()-60)+"px;");
             return false;
          }
        });
}
