$(document).ready(function() {

    //$('#loader').css({ display: "block" });
    setTimeout('$("#loader").fadeOut("400")', 500);

	/* loop through a tags on page */
    $('a').each(function(idx, item) {
		/* if it is not a mailto tag */
		if ( item.href.indexOf( "mailto" ) == -1 && item.href.indexOf( "default.aspx" ) != -1) {
			var url = "javascript:delayedRedirect('" + item.href + "');"
			item.href = url;
		}
    });
    
    var loc = window.location;
    //if(loc=='http://intentus.avento.no/?test=1'){
    	//var pathname = window.location.pathname;
    	//alert($.urlParam('test'));
    	
    	//alert(pathname);
    	//alert('Denne blir kun vist på http://intentus.avento.no/');
    	$('.bottom_menu').hover(function(){
    			if ($(this).find('.popupmenu').length==1){
    				//$(this).find('.popupmenu').width(236);
    				$(this).find('.popupmenu').show();
    			}
    			
    	},function(){
    		if ($(this).find('.popupmenu').length==1){
    				$(this).find('.popupmenu').hide();
    			}
    	}
    	
    	)
    	
    	
    //}




});


$.urlParam = function(name){
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
    return results[1] || 0;
}




if(document.addEventListener)
{
      document.addEventListener("mousedown", disableTabs, false);      
}
else
{
      document.onmousedown = new Function("return disableTabs()");
      document.oncontextmenu = new Function("return disableTabs()");
}




function disableTabs(e) {
  var tgt = (e) ? e.target:event.srcElement;
  var but = null;
  if (tgt.nodeName=="A") {
   
	if(tgt.href.indexOf( "intentus" ) != -1)
	{
		location = tgt.href;
	}

    if (e) {
      if( typeof( e.which ) == 'number' ) {
        but = e.which;
      } else if( typeof( e.button ) == 'number' ) {
        but = e.button;
      }
      if (but && but== 2) return false
      e.preventDefault(); // mozilla
    }
    else {
      but = event.button;
      if (but==4) return false
    }
    return false; // IE and FF
  }
  return true
}


/* fade in loader and redirect */
function delayedRedirect(url){
	$("#loader").fadeIn("200", function(){window.location = url});
	
}


