$( function(){
	xPosition = $(window).width()/2 -150;
	$('#request_submit').click(function(){
			displayRequestBox('show');
		});
		
	$('#bgBox').click(function(){
			displayRequestBox('hide');
		});			

	$('#btn_close').click(function(){
			displayRequestBox('hide');
		});

	$('#btn_close3').click(function(){
			displayRequestBox('hide');
		});

});


function displayRequestBox(action){
//	if ($(document).height()>610){	yy = 10;	}
//	else {	 yy = 0; }

yy = $(window).height()/2 - 150;
	
	yPosition = $(document).scrollTop() + yy;
	
	iSrc = '<$MTCGIPath$><$MTCommentScript$>';
	
 if(action == 'show'){
		$('#bgBox').show();	
		$('#bgBox').height($(document).height());	
		$('#imageBox').fadeIn("slow");
		$('#imageBox').css({"left":xPosition, "top":yPosition});
		$('#request_frame').attr("src",iSrc);
		document.comments_form.submit();		
	} 
	else if(action == 'hide'){
		$('#request_frame').attr("src","/loading.php");
		$('#bgBox').hide();	
		$('#imageBox').hide();
	}
}

function closeRequestBox(){
		alert('test');
  $('#request_frame').attr("src","/loading.php");
		$('#bgBox').hide();	
		$('#imageBox').hide();
}