(function() {
	var
	  questions = [ { "title": "Laser resurfacing or non-surgical procedures to tighten under eye area?", "nid": "139501", "url": "/question/Fractional-or-Confluent-Ultrapulse-CO2-Laser-Laser-resurfacing-or-non-surgical-procedures-t" }, { "title": "How to remove old insect bite scars on legs?", "nid": "138884", "url": "/question/Treating-old-scars-depends-on-the-type-of-scar-How-to-remove-old-insect-bite-scars-on-legs" }, { "title": "Does SmartLipo or CoolLipo work on people with darker skin?", "nid": "32084", "url": "/question/Does-SmartLipo-or-CoolLipo-work-on-people-with-darker-skin-All-skin-types-respond-well-to-SmartLipo-and-CoolLipo" }, { "title": "How can I tighten sagging skin without surgery?", "nid": "8619", "url": "/question/How-can-I-tighten-sagging-skin-without-surgery-4-treatments-for-sagging-skin" }, { "title": "With CoolLipo, what happens to the fat melted by the laser?", "nid": "10430", "url": "/question/With-CoolLipo-what-happens-to-the-fat-melted-by-the-laser" }, { "title": "How is Laser Lipo different than liposuction surgery?", "nid": "25333", "url": "/question/How-is-Cool-Lipo-different-than-traditional-liposuction" }, { "title": "Can laser liposuction be combined with treatments?", "nid": "10432", "url": "/question/Can-laser-lipo-be-combined-with-other-laser-treatments-We-combine-Triactive-with-Liposculpture" }, { "title": "Is Cool Lipo better than Smart Lipo?", "nid": "10345", "url": "/question/Is-Cool-Lipo-better-than-Smart-Lipo-Cool-Lipo-and-Smart-Lipo-are-both-good-choices" }, { "title": "What is laser liposuction?", "nid": "10344", "url": "/question/What-is-laser-liposuction-How-laser-liposuction-works-to-remove-unwanted-fat" }, { "title": "Cool Lipo - when is it most effective?", "nid": "10436", "url": "/question/Cool-Lipo-when-is-it-most-effective-What-Cool-Lipo-treats" } ],
	  pro = { "nid": 10325, "title": "Mitchel Goldman, MD", "uri": "find/California/La-Jolla/Dermatologist/Mitchel-Goldman" },
	  domain = 'http://www.realself.com';
	
	function parse_questions() {
	  var
	    contains_link = false;
	    links = document.getElementsByTagName('A');
	  
	  for (var i in links) {
	    if (typeof links[i] != 'undefined' && links[i].protocol + '//' + links[i].hostname == domain) {
	      contains_link = true;
	      break;
	    }
	  }
	  
	  var output = '<div>';
	  if (contains_link) {
	    var i = 0;
      while(typeof questions[i] != 'undefined') {
        output += '<p><a href="' + domain + questions[i].url + '" target="_blank">' + questions[i].title + '</a></p>';
        i++;
      }
	  }
	  else {
	    output += "This page must link to www.realself.com to use this widget";
	  }
	  output += '<div>';
		
		var cont = document.getElementById('rs_questions');
		cont.innerHTML = output + cont.innerHTML;
		
		var links = cont.getElementsByTagName('A');
		if (links.length) {
			var s = 'pro_hdr=' + pro.nid
			for (var i = 0; i < links.length; i++) {
				links[i].href += (links[i].href.indexOf('#') == -1 ? '#' : '') + s;
			}
		}
	}
	
	function add_event(el, type, listener) {
		if (document.addEventListener) {
			el.addEventListener(type, listener, true);
		}
		else {
			el.attachEvent('on' + type, listener);
		}
	}
	
	add_event(window, 'load', parse_questions);
})();
