/*the following line is used for checking source against javascript lint*/
/*global window, document */

if (!window.Msn) { window.Msn = {}; } // Future proof in case the framework is released.

Msn.Navigation = new function() {
  //shortcuts
  var w = window;
  var d = document;
    
  // public method for ONCLICK attributes
  // opens the target of an anchor tag in a new window (similar to target=_blank)
  // will navigate the main window if the open action is blocked.
  // WILL TRACK if out-of-band g-tracking is available
  this.OpenNew = function( a ) {
    var win = null;
    // must have an href to continue
    if ( a.href ) {
      // open the link in a new window
      win = w.open( a.href );
      // if gtracking is enabled....
      if ( win && Msn.Gtracking ) {
        // track the click (does not navigate)
        Msn.Gtracking.TrackClick( a );
      }
    }
    // force the event to have a return value
    if ( event ) {
		event.returnValue = (win === null);
	}
    
    // if the window opened (win != null), then return false to cancel
    // the default action. Otherwise the url will open in the main window.
    return (win === null);
  };
  
  // public method for ONCLICK attributes
  // opens the target of an anchor in a popup window
  // will do nothing is popup is blocked (always cancels default navigation)
  // WILL TRACK if out-of-band g-tracking is available
  this.OpenPopup = function(a, p) {
    // must have an href to continue
    if ( a.href ) {
      // open the link in a new window
      var win = w.open( a.href, "", p);
      // if gtracking is enabled....
      if ( Msn.Gtracking ) {
        // track the click (does not navigate)
        // append "BLOCKED" to the CM value if this click was blocked
        Msn.Gtracking.TrackClick( a, (!win ? 'BLOCKED' : '') );
      }
    }
    
     // force the event to have a return value
    if ( event ) {
		event.returnValue = false;
	}
    
    // always cancel the default navigation
    return false;
  };
  
  // general method for adding bookmark
  // a is the anchor tag that fires the onclick
  // if a has non-blank title attribute, it will be used as the bookmark title; otherwise page title
  // if a has non "#" href, it will be used as bookmark url; otherwise page url
  // msg is the message to use if not IE -- {0} will be replaced by the appropriate key combination
  this.AddBookmark = function( a, msg ) {
    if ( w.external && typeof(w.external.AddFavorite) != "undefined" ) {
      var u = a.href;
      var t = a.getAttribute("title");
      w.external.AddFavorite(
        (((u != '#') && (u != d.location.href + '#')) ? u : d.location.href),
        (t ? t : d.title) );
    }
    else {
      // pop up an alert telling the user the key combination
      var m = (msg ? msg : "Press {0} to bookmark this page.");
      w.alert( m.replace("{0}", (w.navigator.platform.indexOf("Mac") < 0 ? "Ctrl+D" : "Command+D")) );
    }
    // always cancel default action
    return false;
  };
};
function smmsSearch()
{  
    var s_val  = document.getElementById("q").value;
    var s_url  = "http://search.sympatico.msn.ca/results.aspx?q="+s_val;
    
    window.location.href = s_url; 
}