

function countChars( in_elem, out_elem ){
	in_elem.bind( 'keyup', function(){ 
							var len = in_elem.val().length;
							out_elem.html(len);
							if ( len > 255 ) {
								out_elem.css( 'color', 'red' );
							} else {
								out_elem.css( 'color', '#666' );
							}
						} );
}

function checkYearGroupSend(){
	if ( $('#message').val().length <= 0 ) {
		alert( "Please enter a message" );
		return;
	} else if ( $('#message').val().length > 255 ) {
		alert( "Your message is too long!  Please reduce the number of characters to fewer than 255." );
		return;
	}
	var ret = confirm( 'Are you sure you want to submit the following message to the year book?  You do not get to change it at a later date!\n\n"' + $('#message').val() + '"' );
	if ( ret ) {
		$('#yb_form').submit();
	}
}


//
function toggleVacancy( me ){
	var triggerElem = $(me);
	var docsElem  = $( '#'+triggerElem.attr('targ') );	
	
	var vacElem = docsElem.parent();
		//vacElem.css( 'backgroundColor', 'red' );
	
	//
	if ( vacElem.attr('state') == 'closed' || vacElem.attr('state') == null ){
		//alert('Opening');
		vacElem.attr('state', 'open');
		resizeToFit( vacElem );
	} else {
		//alert('Closing');
		vacElem.attr('state', 'closed');
		resizeToSize( vacElem, 55 );
	}
}

//
function resizeToFit( me ){
	var h = 0;
	me = $(me);
	
	var children = $('#' + me.attr('id') + ' > *');
	for ( var i = 0; i< children.length; i++){
		h += $(children.get(i)).outerHeight() ;
	}
	
	//me.height( h );
	me.animate( { height:h } );
}


//
function resizeToSize( me, size ){
	me = $(me);
	//me.height( size );
	me.animate( { height:size } );
}

//	<!-- vtle assist tutorial page script
function enlargeVideo(  ){

	$('#beforeAfterSection').css( 'display', 'none' );
	$('#enlargeVideo').css( 'display', 'none' );
	
	$('#FLVPlayer_1, #FLVPlayer_2').css( 'width',  '870px' );
	$('#FLVPlayer_1, #FLVPlayer_2').css( 'height', '680px' );
	$('#vidHolder').css( 'width',  '870px' );
	$('#vidHolder').css( 'height', '700px' );
	//*/
	
	/*
	$('#FLVPlayer_1, #FLVPlayer_2').css( 'width',  '1024px' );
	$('#FLVPlayer_1, #FLVPlayer_2').css( 'height', '768px' );
	$('#vidHolder').css( 'width',  '720px' );
	$('#vidHolder').css( 'height', '550px' );
	//*/
	
	$('#author_sidebar').css( 'display',  'none' );
	//$('#vidHolder').css( 'display',  'none' );
	
	//*/
}

//
function printableVersion(){
	
	$('#beforeAfterSection').css( 'display', 'none' );
	$('#enlargeVideoContainer').css( 'display', 'none' );
	$('#topSectionVidContainer').css( 'display', 'none' );
	$('#vidHolder').css( 'display', 'none' );
	$('#author_sidebar').css( 'display',  'none' );
	
	//alert(  );
	
	var str  = '';
		str += '<html><head>';
			str += $('head').html();
		str += '</head><body>';
			str += $('#content').html();
		str += '</body></html>';
	
	var win = window.open( '', 'videoWindow', '' );
		win.document.write( str );
		win.document.close();
	
	
	$('#beforeAfterSection').css( 'display', 'block' );
	$('#enlargeVideoContainer').css( 'display', 'block' );
	$('#topSectionVidContainer').css( 'display', 'block' );
	$('#vidHolder').css( 'display', 'block' );
	$('#author_sidebar').css( 'display',  'block' );
	
		//$('body').html(  ); 
	return;
}

//
function playVideoExternally( path ){
	//alert( "This feature is not ready yet, but will be implemented in the next few days." );
	//var win = window.open( '/resources/sites/assist/vidPlayer.php?path=' + path, 'videoWindow', '' );
	
	
}













