$(document).ready(function() {

	//resizeModal();

	// for did you mean elements
	$('.chooseListed input, .notListed input').click(function(){
		$('.itemChosen').removeClass('itemChosen');
		$(this).parent().addClass('itemChosen');
	});

	$('.chooseListed,.notListed').click(function(){
		$('.itemChosen').removeClass('itemChosen');
		$(this).addClass('itemChosen');
		$('input',this).click();
	});
 
});

function resizeModal(){

	// resize the modal window based on the amount of content.
        setTimeout(function(){
            var paddingsize  	= 9; // amount of padding at the bottom
            var hPaddingsize 	= 9; // amount of padding at the bottom
            var maxHeight		= 650; // maximum allowed height;
            var maxWidth		= 500; // maximum allowed height;
            
            var theHeight      = $('body').outerHeight()+paddingsize;
            if (theHeight > maxHeight) { hPaddingsize = 0; }
            theWidth       = $('.popWrapper').outerWidth()+hPaddingsize;
//          console.log(theWidth,theHeight);
            if (theHeight > paddingsize) { // make sure that if things haven't fully loaded so we can't get a height, don't resize
                  try {
                    $(self.parent.document.getElementById('TB_iframeContent')).css('width', Math.max(100, Math.min(theWidth, maxWidth)));
                    $(self.parent.document.getElementById('TB_iframeContent')).css('height', Math.max(100, Math.min(theHeight, maxHeight)));
                  }catch(e){
                   //ignoring exception
                   alert('problem');
                  }
            }
            
            // and reset the position on the page.
            parent.TB_HEIGHT = theHeight;
			parent.tb_position();
            parent.TB_WIDTH  = theWidth;
			parent.tb_position();
			
        }, 200);
}