var mafURL = "";
JSSendURL = function() {

  this.defaultWidth = 450;
  this.defaultHeight = 440;

  this.show = function (url, width, height) {
    if (!Global.isDefined(width)) {
      width = this.defaultWidth;
    }
    if (!Global.isDefined(height)) {
      height = this.defaultHeight;
    }

    var attributes ="height="+height+", width="+width+", resizable=1, location=0, scrollbars=1";
    

		mafURL = url;
    window.SendEmailWin = window.open(ComponentConfig.sendEmailPageURL,"SendEmailWin",attributes);
  }
  this.getPreviewURL = function() {
  	return opener.mafURL;
    
  }

  this.showMailLink = function(url, width, height) {
	    if (!Global.isDefined(width)) {
      width = this.defaultWidth;
    }
    if (!Global.isDefined(height)) {
      height = this.defaultHeight;
    }
    if (!Global.isDefined(url)) {
    	url = mafURL;
  	}

    var html = '<a href="#" onClick="SendURL.show(\''+url+'\', '+width+', '+height+'); return false;">';
      html += '<img border="0" src="'+ComponentConfig.imagePath+'ico_mail.gif" alt="Mail a friend" >';
      html += '</a>';

    document.write(html); 
  }
}

SendURL = new JSSendURL();