// Current Page Reference

function getURL(uri) {
  uri.dir = location.href.substring(0, location.href.lastIndexOf('\/'));
  uri.dom = uri.dir;
  if (uri.dom.substr(0, 7) == 'http:\/\/')
    uri.dom = uri.dom.substr(7);
  uri.path = '';
  var pos = uri.dom.indexOf('\/');
  if (pos > -1) {
    uri.path = uri.dom.substr(pos + 1);
    uri.dom = uri.dom.substr(0, pos);
  }
  uri.page = location.href.substring(uri.dir.length + 1,
      location.href.length + 1);
  pos = uri.page.indexOf('?');
  if (pos > -1) {
    uri.page = uri.page.substring(0, pos);
  }
  pos = uri.page.indexOf('#');
  if (pos > -1) {
    uri.page = uri.page.substring(0, pos);
  }
  uri.ext = '';
  pos = uri.page.indexOf('.');
  if (pos > -1) {
    uri.ext = uri.page.substring(pos + 1);
    uri.page = uri.page.substr(0, pos);
  }
  uri.file = uri.page;
  if (uri.ext != '')
    uri.file += '.' + uri.ext;
  if (uri.file == '')
    uri.page = 'index';
  uri.args = location.search.substr(1).split("?");
  return uri;
}

function printit() {

  print();

  }

function Emailsupporto(emailpage, title, linktosend) {
  var uri = new Object();
  var currenturi = getURL(uri);
  linktosend = linktosend
      || (currenturi.dir + "/" + currenturi.page + "." + currenturi.ext);
  /*
   * location.href = emailpage + "?msg=<a href='" + currenturi.dir + "/" +
   * currenturi.page + "." + currenturi.ext + "'>" + currenturi.dir + "/" +
   * currenturi.page + "." + currenturi.ext + "</a>&obj="+title+"";
   */
  location.href = emailpage + "?linktosend=" + linktosend + "&obj=" + title
      + "";
}

function SocialShare(enginelink, linktosend) {
  var uri = new Object();
  var currenturi = getURL(uri);
  linktosend = linktosend || (currenturi.dir + "/" + currenturi.page + "." + currenturi.ext);

  location.href = enginelink + linktosend + "";
}

function vai(list) {
  location.href = list.options[list.selectedIndex].value;
}

function addToFavorites(bookmarktitle) {
  var url = location.href; /*
                 * this is for bookmarking the current page, if
                 * possible you can provide your own URL like
                 * (var url =
                 * "http://www.developersnippets.com";)
                 */

  bookmarkurl = url;
  if (document.all)
    window.external.AddFavorite(bookmarkurl, bookmarktitle)
  else if (window.sidebar) {
    window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
  }
}

