function adjustBody()
	{
		
		// listen for changes to divs on the page, and double check that nothing needs to be re-drawn (this is because of mootools)
		// this needs to be done last. balances the colums
		if(j("#content_wrap").height() < j("#content").height())
		{
			j("#content_wrap").height(j("#content").height() + 50);
			
		}
	
	
	} // adjustBody
	
var j = jQuery.noConflict();



(function() {
    var ev = new j.Event('style'),
        orig = j.fn.css;
    j.fn.css = function() {
        orig.apply(this, arguments);
        j(this).trigger(ev);
    }
})();

j(document).ready(function() {
						   
						   
	// this needs to be done last. balances the colums
	if(j("#column_right").height() > j("#column_left").height())
	{
		 j("#column_left").height(j("#column_right").height());
	}
		if(j("#column_left").height() > j("#column_right").height())
	{
		 j("#column_right").height(j("#column_left").height());
	}
	
	// this needs to be done last. balances the colums
	if(j("#content_wrap").height() > j("#sponsor_bar").height())
	{
		 j("#sponsor_bar").height(j("#content_wrap").height());
		 
	}
		if(j("#sponsor_bar").height() > j("#content_wrap").height())
	{
		 j("#content_wrap").height(j("#sponsor_bar").height() + 30);
	}

	setTimeout(function() {  // this line was required for safari
	if(j("#column_right").height() > j("#column_left").height())
	{
		 j("#column_left").height(j("#column_right").height());
	}
		if(j("#column_left").height() > j("#column_right").height())
	{
		 j("#column_right").height(j("#column_left").height());
	}
	}, 300);
	
	
	
	
	j('#content').bind('style', function() {
											 
	//	alert(" ");
		adjustBody();
	
	
	});

	
					
	//-------- end column balance
	j("body").append("<iframe width=\"1\" height=\"1\" frameborder=\"0\" style=\"background:#000000; position:absolute; top:0; left:0;\" name=\"iframe\" id=\"iframe\"></iframe>");						  

	j(".item14").click(function() {
		j("#iframe").attr("src","index.php?option=com_user&view=login&task=logout"); 
		j("#30flashPlayer").hide();
	j("body").append("<div id=\"notification-window\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center; background-color:#000000\"></div>").append("<div id=\"notification-inner\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center;\"><img id=\"logout-window\" src=\""+workingDir+"/templates/supporters_default/images/logout_thanks.gif\" alt=\"Thanks for your visit. See you again\" style=\"margin:0 auto; margin-top:200px;\" /></div>");

 	j("#notification-window").animate({ 
        opacity: 0.0
      }, 0 ).animate({ 
        opacity: 0.8
      }, 1500 );
	 
	 j("#logout-window").click(function() {
		window.location = "http://www.parachutemusic.com";	  
	});
	 
	});
	//-------------------
	
	j("#submit_testimony").click(function() {
		j("#submit_testimony_form").attr("target","iframe"); 
		j("#submit_testimony_form").attr("action", workingDir+"/includes/process_form.php"); 
		
		j("#submit_testimony_form").attr("method", "POST"); 

		j("#submit_testimony_form").submit();
		j("body").append("<div id=\"notification-window\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center; background-color:#000000\"></div>").append("<div id=\"notification-inner\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center;\"><img id=\"message-window\" src=\""+workingDir+"/templates/supporters_default/images/message-thanks.gif\" alt=\"Thanks for your message\" style=\"margin:0 auto; margin-top:200px;\" /></div>");
			j("#notification-window").animate({ 
        opacity: 0.0
      }, 0 ).animate({ 
        opacity: 0.8
      }, 1500 );
			
			//======================
		j("#message-window").click(function() {
				  	
					j("#notification-window").animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					j("#notification-window").next().animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					j("#notification-window").next().next().animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					
		});
		}); 


	//-------------------
		//-------------------
	
	j("#submit_feedback").click(function() {
		j("#submit_feedback_form").attr("target","iframe"); 
		j("#submit_feedback_form").attr("action", workingDir+"/includes/process_form.php"); 
		j("#submit_feedback_form").attr("method", "POST"); 
		j("#submit_feedback_form").submit();
		j("body").append("<div id=\"notification-window\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center; background-color:#000000\"></div>").append("<div id=\"notification-inner\" style=\"position:absolute; top:0; left:0; width:"+j(document).width()+"px; height:"+j(document).height()+"px; z-index:1000; text-align:center;\"><img id=\"message-window\" src=\""+workingDir+"/templates/supporters_default/images/message-thanks.gif\" alt=\"Thanks for your message\" style=\"margin:0 auto; margin-top:200px;\" /></div>");
			j("#notification-window").animate({ 
        opacity: 0.0
      }, 0 ).animate({ 
        opacity: 0.8
      }, 1500 );
			
			//======================
		j("#message-window").click(function() {
				  	
					j("#notification-window").animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					j("#notification-window").next().animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					j("#notification-window").next().next().animate({ 
        opacity: 0.0
      }, 1000 ).fadeOut('slow', function() {

      j(this).remove();

    });
					
		});
		}); 

	//-------------------
	
	j(".grow_input").focus(function() {
		if (j(this).val() == "Type question here") {
            j(this).val("");
        }
	 });
	
	//-- check if there is an image in the news box, and put it under the content
	if(j('.moduletablenewsexpand img').length == 0)
	{
		// no image found
		
	} else
	{
		j('.moduletablenewsexpand img').insertAfter('.moduletablenewsexpand').css("padding-top","20px");
	}
	
	
	//--------- Internet Explorer has a funny bug that is only avoided by reloading the page. only needs to happen once per sesison
if(jQuery.browser.msie)
{
	try
	{
 if($.cookie("ieloaded") == null)
 {
 $.cookie("ieloaded", 'yes');
 window.location = window.location + '&1=1'; 
 }
}

catch(err) {
	
}
}
 
 });
