function autoOpenBlogBox (blogEntryId) {
 
 		//get the box id of the box which contains the previously clicked member id
 		var thisBox = $('p#blogEntry' + (blogEntryId)).parent().parent().attr('id');
		
		//console.log('thisBox: ' + thisBox);
		//console.trace();

	  	//set up a variable that identifies the box clicked on
	  	//var thisBox = whichBox; //(this.id);
 	    
	    
	  	//enlarge the box to fullsize  	
	  	var screenHeight = ($(window).height());
	  	
		if (screenHeight > 750) {
		
			$('.box#' + thisBox).animate( { width:"580px", height: "880px"}, 1 );
			//console.log('PPPPPPPP');
		} else {
		
			$('.box#' + thisBox).animate( { width:"580px", height: "580px"}, 1 );

		}


		//add class 'showButton' to the div 'closeButton' with the box...this makes it visible
	    $('.box#' + thisBox + ' .closeButton').show();
	         	     
	    //hide contentPreview
	   	$('.box#' + thisBox + ' .contentPreview').hide();
	   	
	   	//show content
	   	$('.box#' + thisBox + ' .content').show();
	   	
	   	
// call rearrangeBoxes
rearrangeBoxes(thisBox);

	   
//load in external file into content div
		
		//get link to full article (which is hidden)
		var urlLoad = $('.box#' + thisBox + ' a').attr("href"); 

		//alert('load: ' + urlLoad);
	    
	    //load into now visible content div
	    $('.box#' + thisBox + ' .content').load(urlLoad);

  
	    //enlarge content to fit new size;
	   	//$('.box#' + thisBox + ' .content').addClass('contentLarge'); 	    
	   	
		if (screenHeight > 750) {
	   	
	   		$('.box#' + thisBox + ' .content').css({'height': '765px'});
	  
		} else {
		
	   		$('.box#' + thisBox + ' .content').css({'height': '465px'});
		
		}	

var pos = $('.box#' + thisBox).position();

//alert("POSITION: \nLeft: "+pos.left + "\nTop: " + pos.top);

$.scrollTo('.box#' + thisBox, 1800);		
		

} // end function

	
$(document).ready(function() { 

	// if the pagination segment of url DOES NOT exist then call our auto open cuz it will only be on the first page of blog boxes
	if  (! (jQuery.url.segment(3)) ) {
	
		// get cookie value and assign to variable
		var blogEntryExist = $.cookie('autoOpenBlogCookie');  // get cookie value
		
		//console.log('autoOpen blog: ' + blogEntryExist);
				
		//if variable is NOT null ie cookie exists
		if (blogEntryExist) {
			//delete cookie so we don't continually open
			//$.cookie('autoOpenBlogCookie', '', { expires: -1 }); // delete cookie
			$.cookie('autoOpenBlogCookie', null, {expires: -1, path: '/', domain: 'cibcommunications.co.uk'} ); // delete cookie

			
			//alert ('in if deleted?: ' + blogEntryExist);
	
			
			//autoOpen appropriate box
			autoOpenBlogBox(blogEntryExist);
						
		}// end cookie test
	
	} //end segment test
	
		
});











/* PREVIOUS USED TO WORK FROM URL - BUT CAN'T USE EE PAGINATION SO NEEDED TO USE COOKIES
$(document).ready(function() { 
	
	
	var urlBlogEntryExist = jQuery.url.segment(3);
	
	if (urlBlogEntryExist) {
		autoOpenBlogBox(urlBlogEntryExist);
	}
		
});

/* PREVIOUS IDENTIFY MEMBER ID FROM LINK
		// get the member id from a link in a memberlist
		
		//when click on a link within the 'container-grid' in this example to diff
		$('#member-list a').click(function() { 

		var thisLink = (this.id);
		
		var urlLink = $(this).attr("href"); 
		
		//alert(urlLink);
		
		//var memberIDToView = JQuery.url.setUrl(urlLink).attr("segment(1)");
		var memberIDToView = ( jQuery.url.setUrl(urlLink).segment(3) );

		
		alert(memberIDToView);

		
		
		//goto grid but with stored click
		parent.location.href= ("http://www.cibcommunications.co.uk/index.php/TEST/grid");


		return false;
		
		
		});
*/



	