function overlay(href, iframe, width, height){
	if(iframe == undefined){ iframe = false; }
	if(width == undefined){ width = 'auto'; }
	if(height == undefined){ height = 'auto'; }
	$.fn.colorbox({
		width:width, 
		height:height, 
		iframe:iframe, 
		opacity:0.5, 
		speed:700,
		onComplete: function(){
			$('#cboxLoadedContent').css({height: $('#cboxLoadedContent').height() + 33});
			$($('#cboxLoadedContent div').get(0)).css({paddingBottom: 33})
		},
		onClosed: function(){ },
		overlayClose:true, 
		href:href}
	)
	return false;
}

var current_press_clip = '';
function show_press_clips(element){
	current_press_clip = element.id;
	overlay(element.href);
	return false;
}

function next_press_clip(){
	index = press_links.indexOf(current_press_clip);
	index++;
	if(index > press_links.length){
		index--;
	}else{
		show_press_clips($('a#' + press_links[index]).get(0));
	}
}

function prev_press_clip(){
	index = press_links.indexOf(current_press_clip);
	index--;
	if(index < 0){
		index++;
	}else{
		show_press_clips($('a#' + press_links[index]).get(0));
	}
}


function smp_show_popup(){
    $.fn.colorbox({
        width:"508px",
        height:"650px",
        iframe:false,
        opacity:0.5,
        speed:700,
        overlayClose:true,
        href:'http://www.melimelogreenwich.com/i.php'
    })
}


var press_links = [
	//'greenwich_magazine',
	'newyorktimes',
	'zagatsurvey',
	'homesteader',
	'hartfordcourant',
	'fairfieldweekly',
	'westchester_spotlight',
	'philadelphia',
	'connecticut_magazine',
	'serendipity',
	'greenwichtime_press',
	'ctbites',
	'westchester_magazine',
	'where_locals_eat',
	//catering press
	'geenwich_magazine_catering',
	'sunday_greenwich_time'
]

var open_foursquare = function(){
	window.open('http://foursquare.com/remote_todo?vid=314311',
				  '_blank',
				  'toolbar=0,status=0,height=380,width=650,scrollbars=no,resizable=no');
}
