var setupLinks = function() {
	if(!document.getElementsByTagName) return;
	var links = document.getElementsByTagName("a");
	for(var i=0;i<links.length;i++) {
		var link = links[i];
		if(link.getAttribute("href") && link.getAttribute("rel") == "external") {
			link.onclick = function() { window.open(this.getAttribute("href")); return false; };
		}
		if(link.getAttribute("href") && link.getAttribute("rel") == "additonal") {
			link.onclick = function() { window.open(this.getAttribute("href")); return false; };
		}
		if(link.getAttribute("href") && link.getAttribute("rel") == "pdf") {
			link.onclick = function() { window.open(this.getAttribute("href"),"popup","height=500,width=750,toolbar=no"); return false; };
		} 
		if(link.getAttribute("href") && link.getAttribute("rel") == "help") {
			link.onclick = function() {
				window.open(this.getAttribute("href")); return false;
			}
		}
	}
}

$(document).ready(setupLinks);


function beta_footer()
{
	preload = new Image();
	preload.src = '/img/loadbar-06C.gif';
	
	$('form#feedback').submit(function(){
		$(".submit",this).css("background-image","url(/img/loadbar-06C.gif)");
		$(".submit",this).children().hide();
		$(".submit",this).append('<p class="submitstatus">Sending feedback...</p>');
		$(this).ajaxSubmit({success:function(data){
			$('.right','#beta_footer').html(data);
			beta_footer();
		}});
		return false;
	});
}
$(document).ready(beta_footer);


$(document).ready(function() {
	$("textarea").after('<p class="textarea-funcs"><a href="#" class="textarea-more" title="Click to increase the writing area of this field">more writing space</a></p>');

	$("a.textarea-more").click( function()
	{
		var td = $(this).parent().parent();
		var height = $('textarea',td).height();
		$('textarea',td).animate({
			height : (height+100)
		},'slow');
		return false;
	});
});

