// Wrap code with module pattern.
(function() {
  var global = this;

  // widget constructor function
  global.HFE_TravelFinds_450_150_1 = function(dealData) {
	
	var widget_style = '450_150_1';
	var widget_id=Math.floor(Math.random()*10000);
	
	var styleHTML = '<style> \
		#hfe-widget {clear:both; width:450px;height:145px;overflow:hidden;border-top:5px solid #f60;font:12px/18px Verdana,Arial,Helvetica,sans-serif;color:#06c; background: #FFFFFF;} \
		#hfe-widget a{color:#06c;text-decoration:none;} \
		#hfe-widget a:hover{text-decoration:underline;}  \
		#hfe-widget div.header {padding:8px 8px 6px; background:url(http://'+dealData.img_domain+'/widgets/images/hfe-widget-450-150-heading.gif) repeat-x;} \
		#hfe-widget .header a {margin:0;font:15px/16px Verdana,Arial,Helvetica,sans-serif; font-weight:bold;color:#f60; background:none; width:420px;} \
		#hfe-widget ul{list-style:none;margin:0 0 0 8px;padding:0;} \
		#hfe-widget ul li{overflow:hidden;border-top:1px solid #fc9;padding:3px 7px 2px;vertical-align:middle;} \
		#hfe-widget ul li.last {padding-top:6px} #hfe-widget ul li.last a {font:14px/16px Verdana,Arial,Helvetica,sans-serif; font-weight:bold;color:#f60;} \
		#hfe-widget ul strong{float:left;width:42 0px;} #hfe-widget ul li.last strong{width:350px;} \
		#hfe-widget ul em {color:#06c; font-style: normal;} \
		#hfe-widget ul em:before {content: " ";} \
		#hfe-widget ul a.found {float:right; width:30px; margin-right:8px; text-align:center; text-decoration:none; font:11px/20px Arial,Helvetica,sans-serif;color:#333;} ';

	// Before we close this out, let's make some adjustments if the landmark name is too long

	if (dealData.title_1 && dealData.title_1.length > 38) {
		styleHTML += '#hfe-widget div.header {padding-top: 6px;padding-bottom:6px;}';
		styleHTML += '#hfe-widget ul li {padding-top:2px; padding-bottom:1px;}'
	}
	
	styleHTML += '</style>';
		
	// Drop in the widget's id
	styleHTML = styleHTML.replace(/#hfe-widget/g,"#hfe-widget-"+widget_id);

	document.write(styleHTML);
	document.write('<div id="hfe-widget-'+widget_id+'"></div>');

	
	// Create header widget DOM fragment
	var header = document.createElement('div');
	var dealList = document.createElement('div'); 
	var widget = document.getElementById('hfe-widget-'+widget_id);

	header.className = "header";
	header.innerHTML = '<a '+dealData.click_tracking_code+' href="'+dealData.default_url+'" target="_blank">'+dealData.title_1+'</a>';
	var dealListHTML = '<ul>';
	
	for (var i = 0; i < dealData.deals.length; i++) { 
	
		var deal = dealData.deals[i];

		dealListHTML += '<li><strong><a '+dealData.click_tracking_code+' href="'+deal.url+'" target="_blank">'+deal.promo_text+'</a></strong></li>';
	}


	dealListHTML += '<li class="last"><strong><a '+dealData.click_tracking_code+' href="'+dealData.default_url+'" target="_blank">';
	
	if (dealData.deals && dealData.deals.length > 0) {
		dealListHTML += 'Deals found '+dealData.deals[0].discovered+' - ';
	}
	
	dealListHTML += 'Find yours now!</a></strong><a '+dealData.click_tracking_code+' href="'+dealData.default_url+'" target="_blank" class="found"><img src="http://'+dealData.img_domain+'/widgets/images/hfe-fodors_go_btn.gif" width="42" height="21" alt="Find yours now!"></a></li>';
	dealListHTML +='</ul>';

	// Analytics call
	dealListHTML += '<iframe src="http://'+dealData.domain+'/widget-load/'+widget_style+'/'+dealData.type+'/'+dealData.name_slug+'.html" style="display: none;" border="0" scrolling="no"></iframe>';
	
	dealList.innerHTML = dealListHTML;
	
	widget.appendChild(header);
	widget.appendChild(dealList);



  };
})();
var dealData = {"default_url" : "http://fodors.hotels-for-everyone.com/landmark_pages/view_point/Hauz+Khas+Village/28.5539547/77.1943451?pid=515&spec=0", "title_1" : "Fodor's Finds Hotels Near Hauz Khas Village", "title_2" : "Hauz Khas Village", "title_3" : "hotels near Hauz Khas Village", "title_4" : "near Hauz Khas Village", "title_5" : "near Hauz Khas Village", "domain" : "fodors.hotels-for-everyone.com", "type" : "landmark", "img_domain" : "img1.hotels-for-everyone.com", "phone" : "800-559-7314", "partner_id" : "515", "destination" : "delhi", "name_slug" : "hauz-khas-village", "city_state_country" : "Delhi, India", "min_date" : "03/16/2010", "max_date" : "02/09/2011", "click_tracking_code" : "onclick=\"linkCode(this,'event32');\" rel=\"nofollow\"", "category" : "", "deals" : [ {"promo_text" : "Hotel La Suite - <em>One Free Night Offer</em>", "url" : "http://fodors.hotels-for-everyone.com/booking/hotel_details?pid=&hid=312307&checkIn=03/22/2010&checkOut=03/29/2010", "discovered" : "03/16/2010", "source" : "Promotion from 10"}, {"promo_text" : "Taj Palace Hotel - <em>Stay 3 Nts, Save 20%</em>", "url" : "http://fodors.hotels-for-everyone.com/booking/hotel_details?pid=&hid=151699&checkIn=03/22/2010&checkOut=03/29/2010", "discovered" : "03/16/2010", "source" : "Promotion from 10"}, {"promo_text" : "2 Star Hotel <em>from $8</em>", "url" : "http://fodors.hotels-for-everyone.com/landmark_pages/view_point/Hauz+Khas+Village/28.5539547/77.1943451?pid=515&spec=0&hhid=268524", "discovered" : "03/16/2010", "source" : "Inventory from 10"}]};
HFE_TravelFinds_450_150_1(dealData);
