$(document).ready(function(){

    //HEADER IMAGE SWAP
    $(".header_menu li a").each(function(){
        //REMOVE TEXT
        $(this).html('');
    });
    
    //ACTIVE HEADER MENU
    $(".header_menu li a").each(
    function(){
      var target = $(this).attr("href");
      
      if(target == window.location.href){        
        $(this).parent().attr("class", "active");
      }      
    });
    
    $(".footer_menu li a").each(
    function(){
      var target = $(this).attr("href");
      
      if(target == window.location.href){        
        $(this).parent().attr("class", "active");
      }      
    });
    
    //THIS WILL FIX THE POSITION OF THE BACKGROUND
    if(window.location.href != "http://sel.clientprojectpreview.com/"){    
        var cssObj = {
            'background-position' : "0 -80px"     
        }
        $("#main_wrap").css(cssObj );    
    }
    
    checkVersion();
    
});

function getInternetExplorerVersion(){
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).

  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer'){
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null){
      rv = parseFloat( RegExp.$1 );
    }
  }
  return rv;
}

function checkVersion(){
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  //alert(ver);

  if ( ver > -1 ){
    if ( ver >= 7.0 ){
      //msg = "You're using a recent copy of Internet Explorer."
    }else{
      msg = "This site has been optimised for IE 7 and above. Please click ok to download the latest browser.";
      var redirect_confirmation = confirm(msg);
     
      if (redirect_confirmation== true){
        window.location.href = 'http://www.microsoft.com/windows/Internet-explorer/default.aspx';
      }
    }

  } 
}
