/*
 * Copyright Web Media Group 2010 All rights reserved
 */

SiandsoNameSpace = typeof(SiandsoNameSpace) == "undefined"
    ? {}
    : SiandsoNameSpace;

SiandsoNameSpace.Mini = function(user_id, format, type, check_code) {

  this.user_id = user_id;
  this.format = format;
  this.type = type;
  this.check_code = check_code;

}

SiandsoNameSpace.Mini.prototype = {

  getHeight      : function(format) {
    switch (format) {
      case 'Wide_Skyscraper' :
        height = 600;
      break;
      case 'Leaderboard' :
        height = 90;
      break;
      case 'Medium_Rectangle' :
        height = 250;
      break;
      case 'Large_Rectangle' :
        height = 600;
      break;
      default :
        height = 0;
    }
    return height;
  },

  getWidth       : function(format) {
    switch (format) {
      case 'Wide_Skyscraper' :
        width = 160;
      break;
      case 'Leaderboard' :
        width = 728;
      break;
      case 'Medium_Rectangle' :
        width = 300;
      break;
      case 'Large_Rectangle' :
        width = 300;
      break;
      default :
        width = 0;
    }
    return width;
  },

  getFrameSource : function() {
    var host = "www.siandso.com";

    hoststring = 'http://' + host + '/' + SiandsoNameSpace.Mini.config.baseUrl
        + '?' + 'user_id=' + this.user_id + '&format=' + this.format
        + '&produits_type=' + this.type + '&check_code=' + this.check_code
        + '&referer=' + window.location.hostname;

    return hoststring;

  },

  renderIframe   : function() {
    var html = '';
    html += '<iframe ALLOWTRANSPARENCY=true style="width: '
        + this.getWidth(this.format) + 'px; ' + 'height: '
        + this.getHeight(this.format) + 'px;" ' + 'src="'
        + this.getFrameSource() + '" scrolling="no" frameborder="0">'
        + '</iframe>';
    document.write(html);
  }

}

SiandsoNameSpace.Mini.config = {
  style   : {
    thumbnail : {
      height : 83,
      width  : 84
    },
    gallery   : {
      height : 200,
      width  : 181
    }
  },
  baseUrl : "siandso-mini/siandso-mini"
};
