/**
* @namespace 2MC
*/

if (!window.TOOMANYCOLOURS) {
  var TOOMANYCOLOURS = { };
}

/**
* @namespace 2MC.Popup
*/

TOOMANYCOLOURS.Popup = (function () { 

  /**
  * @function openUp
  * @param {DomElement} element
  * @param {Number} width
  * @param {Number} height
  */
  var openUp = function(element, width, height) {
    
		var url = (element.attr) ? element.attr('href') : element.href;
		
		if(!url) return true; // if href is not given, no popup will be opened
		
		var width = (width === undefined)? 710 : width;
		var height = (height === undefined)? 570 : height;
		
		var pop = window.open(url, '', 'width='+width+', height='+height+', resizable=yes, scrollbars=yes');
		if (pop) {
			// if (pop.focus) pop.focus();
			return true; // prevents link to open in parent window
		} else {
			return false; // if popup could not be opened link opens in original window
		}
	}

  return {
    openUp: function (element, width, height) {
      return openUp(element, width, height);
    }
  };
})();