jQuery(document).ready( 
	function($){ 
		
		var Fields =  $('.remove_input_text_on_focus');
		
		if (Fields.length > 0){
			$.each(Fields, function(){
				var ChangeBackText = $(this).attr("value");
				
				$(this).focus(function(){
					var CurrentTextValue = $(this).attr("value");
							
					if (CurrentTextValue == ChangeBackText){
						$(this).attr("value", "");
					}
				});
				
				$(this).blur(function(){
					var CurrentTextValue2 = $(this).attr("value");
							
					if (CurrentTextValue2 == ""){
						$(this).attr("value", ChangeBackText);
					}
				});
			});
		}
		
		var Fields2 =  $('.remove_textarea_text_on_focus');
		
		if (Fields2.length > 0){
			$.each(Fields2, function(){
				var ChangeBackText3 = $(this).val();
				
				$(this).focus(function(){
					var CurrentTextValue3 = $(this).val();
							
					if (CurrentTextValue3 == ChangeBackText3){
						$(this).val("");
					}
				});
				
				$(this).blur(function(){
					var CurrentTextValue4 = $(this).val();
							
					if (CurrentTextValue4 == ""){
						$(this).val(ChangeBackText3);
					}
				});
			});
		}
		if ($("#front_featured_members ul").length > 0){
			$("#front_featured_members ul").find("li").each(function(i) {
				$(this).hover(
					function() {
						$("#front_featured_members_image").find("img").each(function(){
							$(this).removeClass("selected");
						});
						$("#front_featured_members_image img:eq(" + i + ")").addClass("selected");
						
						$("#front_featured_members ul").find("li").each(function(){
							$(this).removeClass("selected");
						});
						$("#front_featured_members ul li:eq(" + i + ")").addClass("selected");
					}
				)
			});
		}
		
		if ($('#showcase_header').length > 0){
			$('#showcase_header') 
				.after('<div id="showcase_header_nav">') 
				.cycle({ 
					fx:     'fade', 
					speed:  300, 
					timeout: 7000, 
					pager:  '#showcase_header_nav',
					after:   ImgAltText
			});
		}
		
		function ImgAltText(){
			$('#showcase_text p span a').html(this.alt);
			$('#showcase_text p span a').attr("href", "/showcase-" + $(this).attr('rel'));
		}
		
		//function stretch_portal_content() {
		//	if( $(window).height() > $('body').height() ) {
		//		$( '#portal-content' ).height(
		//		$(window).height() - ( $('body').height() - $('#portal-content').height() ));
		//	}
		//}
		
		$('<div id="image_upload_progress"></div><div id="image_upload_progress_image_container"><p>Uploading image(s)/ Processing request.<br/><strong>NOTE: This may take some time depending on file sizes.<br/>DO NOT CLICK BACK ON YOUR BROWSER</strong><br/>as this may result in your image(s) not uploading correctly...</p><img src="/site_images/loadingAnimation.gif" id="image_upload_progress_image" /></div>').appendTo('body');
		
		if ($('#btnUploadImage').length > 0){
			$('#btnUploadImage').click(function(){
				
				$('#image_upload_progress_image_container').css("top", ($('#btnUploadImage').offset().top) - 400);
				$('#image_upload_progress_image_container').css("display", "block");
				$('#image_upload_progress_image_container').css("visibility", "visible");
				
				if ($(document).height() > $(window).height() && $(document).height() > $('body').height()) {
					$('#image_upload_progress').css("height", $(document).height());
				} else if($(window).height() > $('body').height() && $(window).height() > $(document).height()) {
					$('#image_upload_progress').css("height", $(window).height());
					
				} else if($('body').height() > $(window).height() && $('body').height() > $(document).height()) {
					$('#image_upload_progress').css("height", $('body').height());
				}
				
				$('#image_upload_progress').css("display", "block");
				$('#image_upload_progress').css("visibility", "visible");
				
			});
		}
		
	} 
); 
