function TVFact() {
  this.protocol = 'http:'
  this.host     = 'techvalidate.com',
  this.tvid     = '',
  this.width    = '400',
  this.height   = '300',
  this.initialize = function(params){
    for(key in params){
      this[key] = params[key];
    }
  },
  this.iframe = function(){
    var fact_url = this.protocol + '//www.' + this.host + '/embed/facts/' + this.tvid + '?width=' + this.width + '&height=' + this.height
    var src = '<iframe noresize="noresize" scrolling="no" frameborder="0" border="0" width="'+this.width+'" height="'+this.height+'" src="'+fact_url+'"><p>Your browser does not support iframes.</p></iframe>'
    return src
  },
  this.display = function(){
		document.getElementById('iframe_container_' + this.tvid).innerHTML = this.iframe();
  }
}

function TVCaseStudy() {
  this.protocol = 'http:'
  this.host     = 'techvalidate.com',
  this.tvid     = '',
  this.height   = '500',
  this.width    = '500',
  this.initialize = function(params){
    for(key in params){
      this[key] = params[key];
    }
  },
  this.iframe = function(){
    var case_study_url = this.protocol + '//www.' + this.host + '/embed/case_studies/' + this.tvid + '?width=' + this.width + '&height=' + this.height
    var src = '<iframe noresize="noresize" scrolling="no" frameborder="0" border="0" width="'+this.width+'" height="'+this.height+'" src="'+case_study_url+'"><p>Your browser does not support iframes.</p></iframe>'
    return src
  },
  this.display = function(){
		document.getElementById('iframe_container_' + this.tvid).innerHTML = this.iframe();
  }
}

function TVChart() {
  this.protocol = 'http:'
  this.host     = 'techvalidate.com',
  this.tvid     = '',
  this.height   = '500',
  this.width    = '500',
  this.initialize = function(params){
    for(key in params){
      this[key] = params[key];
    }
  },
  this.iframe = function(){
    var chart_url = this.protocol + '//www.' + this.host + '/embed/charts/' + this.tvid + '?width=' + this.width + '&height=' + this.height
    var src = '<iframe noresize="noresize" scrolling="no" frameborder="0" border="0" width="'+this.width+'" height="'+this.height+'" src="'+chart_url+'"><p>Your browser does not support iframes.</p></iframe>'
    return src
  },
  this.display = function(){
		document.getElementById('iframe_container_' + this.tvid).innerHTML = this.iframe();
  }
}

function TVMarketFact() {
  this.protocol = 'http:'
  this.host     = 'techvalidate.com',
  this.tvid     = '',
  this.height   = '400',
  this.width    = '300',
  this.initialize = function(params){
    for(key in params){
      this[key] = params[key];
    }
  },
  this.iframe = function(){
    var fact_url = this.protocol + '//www.' + this.host + '/embed/market_facts/' + this.tvid + '?width=' + this.width + '&height=' + this.height
    var src = '<iframe noresize="noresize" scrolling="no" frameborder="0" border="0" width="'+this.width+'" height="'+this.height+'" src="'+fact_url+'"><p>Your browser does not support iframes.</p></iframe>'
    return src
  },
  this.display = function(){
		document.getElementById('iframe_container_' + this.tvid).innerHTML = this.iframe();
  }
}

function TVCategory() {
  this.protocol = 'http:'
  this.host     = 'techvalidate.com',
  this.param    = '',
  this.height   = '360',
  this.width    = '298',
  this.initialize = function(params){
    for(key in params){
      this[key] = params[key];
    }
  },
  this.iframe = function(){
		var category_url = this.protocol + '//www.' + this.host + '/embed/categories/' + this.param
    var src = '<iframe noresize="noresize" scrolling="no" frameborder="0" border="0" width="'+this.width+'" height="'+this.height+'" src="'+category_url+'" style="border:solid 1px #ccc;"><p>Your browser does not support iframes.</p></iframe>'
    return src
  },
  this.display = function(){
		var elm = document.getElementById('iframe_container_' + this.param)
		if(elm) {
			elm.innerHTML = this.iframe();
		} else {
			document.write(this.iframe()); // this is for the old markup we gave InfoStor
		}
  }
}
