/* Kotisivukone JS */
var MoogoWeb = {
  init: function() {
    var host = location.hostname;
    if (host == '' || host.indexOf("moogo") == -1) host = "moogo.com";
    if (host.indexOf("www.") == 0 || host.indexOf("app") == 0) host = host.substring(4);

    // Add site's URL to wizard links
    var wizardlinks = $("page").getElementsByTagName("a");
    for (var i=0; i<wizardlinks.length; i++)
      if (wizardlinks[i].href.indexOf("moogo_website_wizard") != -1)
        wizardlinks[i].href = wizardlinks[i].href + "?site=" + host;

    // Show right content
    var hostContent = $("page").getElementsByClassName(host);
    for (var i=0; i<hostContent.length; i++)
      Element.show(hostContent[i]);

    // Prices
    if ($("basic_prices_table")) {
      var rows = $("basic_prices_table").getElementsByTagName("tr");
      for (var i=1; i<rows.length; i++) {
        rows[i].onmouseover = function() { Element.addClassName(this, "basic_prices_table_onmouseover"); }
        rows[i].onmouseout = function() { Element.removeClassName(this, "basic_prices_table_onmouseover"); }
      }
    }
  }
}
