// Test for minimal Javascript required by Drupal.
if (document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById) {
  var DrupalEmbed = DrupalEmbed || [];
  DrupalEmbed[DrupalEmbed.length] = {
    src: "http://www.gujaratimatrimonial.info/embed-widgets/content/iframe/2-Z3VSaVd10C94cDdady5ndWphcmF0aW1hdHJpbW9uaWFsLmluZm8?embed_widgets_mode=1", 
    wid: "2-Z3VSaVd10C94cDdady5ndWphcmF0aW1hdHJpbW9uaWFsLmluZm8", 
    width: 450, 
    height: 300  };
  
  for (var i in DrupalEmbed) {
    if (!DrupalEmbed[i]['processed']) {
      DrupalEmbed[i]['processed'] = true;
      
      var separator = DrupalEmbed[i].src.indexOf('?') == -1 ? '?' : '&';
      
      if(undefined===window.widget_count){
        window.widget_count = 0;
      }
      else {
        widget_count++;
      }
      
      var script = document.getElementById('widget-embed-script-' + DrupalEmbed[i].wid);
      script.setAttribute('id', 'widget-embed-script-' + DrupalEmbed[i].wid + widget_count);
      
      var iframe = document.createElement('iframe');
      iframe.setAttribute('id', 'widget-embed-' + widget_count);
      iframe.setAttribute('frameBorder', '0');
      iframe.setAttribute('width', DrupalEmbed[i].width);
      iframe.setAttribute('height', DrupalEmbed[i].height);
      iframe.setAttribute('src', DrupalEmbed[i].src + separator + 'embed_widgets_id=' + DrupalEmbed[i].wid);
      iframe.onload = function () {
        var iframeDocument = this.contentDocument ? this.contentDocument : (this.contentWindow ? this.contentWindow.document : null);
        if (iframeDocument) {
          var height = iframeDocument.height || iframeDocument.body.scrollHeight || null;
          if (height) {
            this.setAttribute('height', (height + 40) + 'px');
          }
        }
      }
      
      script.parentNode.insertBefore(iframe, script);
    }
  }
}

