$(document).ready(function(){
  Wd.init();         			
});

Wd = new function(){
  
  var self = this;
  
  this.init = function(){};
  
  // Search DOM for element with id #name_id
  this.elementById = function(name, id){
    var list = $('#' + name + '_' + id);
    if(list.length){
      return list.first();
    }
    else{
      return null
    }
  };

  // Search DOM for element with class .name_id  
  this.elementByClass = function(name, id){
    return $('.' + name + '_' + id);
  };
  
  // Search DOM for element with class name and rel attribute
  this.elementByRel = function(name, id){
    var list = $('.' + name + '[rel=' + id + ']');
    if(list.length){
      return list.first();
    }
    else{
      return null
    }
  };
 
  // Access query string parameters
  this.getQueryParamByName = function(name){
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
  }; 
}
