  function expandMap(recenter) {
  	
  	m = $("HomeMap");
  	w = m.getStyle("width").toInt();
  	
  	
  	if (w == 900) {
  		
  		map.closeExtInfoWindow();
  	
   	m.setStyle("width",200);
   	m.setStyle("height",200);
   	m.removeClass("MapShadow");    	
  		
  		map.checkResize();
  		map.setCenter(new GLatLng(26.207419, -98.229346), 12);
  		
  	} else {
  	
   	coords = m.getCoordinates();
   	m.setStyle("position","absolute");
   	m.setStyles(coords);
   	m.setStyle("width",900);
   	m.setStyle("height",400);
   	m.addClass("MapShadow");
   	
   	map.checkResize();
   	
   	if (recenter) {
   		map.setCenter(new GLatLng(26.207419, -98.229346), 12);
   	}
  	
  	}
  	
  	
  }
    
    function addCustomMarker(point, name, desc, style) {
    	
    	merchantAjaxPath = name;
    	markerIcon = desc;
    	
    	specialCount = markerIcon.substr(markerIcon.length-10,markerIcon.length-9);
		
  		var icon = new GIcon(baseIcon);
  		icon.image = markerIcon;
  		
  		var marker = new GMarker(point, icon);
  		marker.merchantAjaxPath = merchantAjaxPath;
  		marker.specialCount = specialCount;
    	
          GEvent.addListener(marker, 'click', function(){
          	
          	expandMap(false);
          	marker.setImage("/numbered_marker.php?image=images/pointers/visited.png&text=" + marker.specialCount + "&ext=.png");
          	
            marker.openExtInfoWindow(
              map,
              "custom_info_window_red",
              "<div>Loading...</div>",
              {
                ajaxUrl: marker.merchantAjaxPath, 
                beakOffset: 3
              }
            ); 
          });    	
    	
    	map.addOverlay(marker);
    }



var totalCoupons = 0;

function removeCoupon(id,obj,e) {
	
	sp = $("Special_" + id);
	var fade = new Fx.Style(sp, 'opacity', {duration: 200}).set(1);
	fade.start(1,0.25);	
	
	if (confirm("Are you sure you want to delete this special?")) {
	
		var savedCoupons = new Hash.Cookie('savedCoupons', {duration: 365,path:'/'});
		savedCoupons.remove("special"+id);

		sp.remove();
			
	} else {
		fade.start(0.25,1);
	}	
	
	
	
}


function saveCoupon(id,e) {
	
	var savedCoupons = new Hash.Cookie('savedCoupons', {duration: 365,path:'/'});
	
	
	savedCoupons.set("special" + id,id);
	
	s = $("Special_" + id);
	coords = s.getCoordinates();
	
	c = s.clone();
	c.setStyles(coords);
	c.setStyle("position","absolute");
	
	document.getElementsByTagName("body")[0].appendChild(c);
	
	// remove toolbar
	tb = c.getElement(".Tools");
	tb.remove();	
	
	// resize text
	t = c.getElement(".Summary");

	var myMorph = new Fx.Morph(t, {wait: false});
	myMorph.start({'opacity':0 });

	t = c.getElement(".Title");
	t.setStyle("font-size",12);
	
	// remove legal
	l = c.getElement(".Legal");
	l.remove();	
	
	ex = c.getElement(".Expiry");
	if (ex) {
		ex.remove();
	}
	
	//TODO: enable company name
	
	
	new Event(e).stop();
 	var myMorph = new Fx.Morph(c, {wait: false});
 	
 	//TODO: offset
 	cp = $("CouponBook");
 	
 	cps = cp.getElements(".Special").length;
 	totalCoupons = totalCoupons + cps;
 	
 	topOffset = totalCoupons * 45;
 	totalCoupons++;
 	
 	cp.setStyle("height",topOffset + 20);
 	
 	cp_coords = cp.getCoordinates();
 	
	myMorph.start({'top':cp_coords.top + topOffset,'left':cp_coords.left, 'width': 200, 'line-height': 10,'font-size':10,'height':40 });
	
}
