var ptkdtest_status = 0; // Testimonial popup window starts disabled



// Display the popup
function ptkdtest_display()
{
	if ( ptkdtest_status == 0 ) {		
		jQuery( "#ptkdtestbackground" ).css({
			"opacity": "0.7"
		});
		jQuery( "#ptkdtestbackground" ).fadeIn( "slow" );
		jQuery( "#ptkdtestfull" ).fadeIn( "slow" );
		ptkdtest_status = 1;
	}
}



// Hide the popup
function ptkdtest_hide()
{
	if ( ptkdtest_status == 1 ) {
		jQuery( "#ptkdtestbackground" ).fadeOut( "slow" );
		jQuery( "#ptkdtestfull" ).fadeOut( "slow" );
		ptkdtest_status = 0;
	}
}



// Center the popup
function ptkdtest_center()
{
	// Get the window height and width
	var windowWidth = jQuery( window ).width();
	var windowHeight = jQuery( window ).height();
	
	// Get the popup height and width
	var popupWidth = jQuery( "#ptkdtestfull" ).width();
	var popupHeight = jQuery( "#ptkdtestfull" ).height();
	
	// Center the popup in the window
	jQuery( "#ptkdtestfull" ).css({
		"top": ( windowHeight / 2 ) - ( popupHeight / 2 ),
		"left": ( windowWidth / 2 ) - ( popupWidth / 2 )
	});
	
	//Get the screen height and width
	var maskHeight = jQuery( document ).height();
	var maskWidth = jQuery( window ).width();
 
	//Set height and width to mask to fill up the whole screen
	jQuery( "#ptkdtestbackground" ).css({ "width": maskWidth, "height": maskHeight });
}



jQuery( document ).ready( function($) {
	// Display the popup when the 'read more' link is clicked
	$( "#ptkdtestmore" ).click( function( e ) {
		e.preventDefault();
		ptkdtest_center();
		ptkdtest_display();
	} );
	
	// Hide the popup when the close 'X' link is clicked
	$( "#ptkdtestclose" ).click( function( e ) {
		e.preventDefault();
		ptkdtest_hide();
	} );
	
	// Hide the popup when the background (area outside the popup) is clicked
	$( "#ptkdtestbackground" ).click( function() {
		ptkdtest_hide();
	} );
} );
