// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var currentType = '#type_0';

function setType(id){
	$(currentType).removeClassName('selected');
	sType = '#type_'+id;
	$(sType).addClassName('selected');
	currentType = sType;
}

function showPaymentMethod(bol){
	var sDisplay = (bol)? 'block' : 'none';
	$('#payment_method').css('display',sDisplay);
}

function showAdditional(bol){
	var sDisplay = (bol)? 'block' : 'none';
	$('#additional').css('display',sDisplay);
}
function showResource(bol){
	var sDisplay = (bol)? 'block' : 'none';
	var sNameLabel = (bol)? 'Name' : 'Title';
	$('#category').css('display',sDisplay);
	$('#resource_level').css('display',sDisplay);
	$('#resource_name > *').html(sNameLabel);
}
function showResourceExample(bol,image){
	var sDisplay = (bol)? 'block' : 'none';
	$(image).css('display',sDisplay);
}

function showMemberID(bol,obj){
	if (bol && member_id == '') { 
		var targetOffset = $('html').offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 500);
		$('#login_message').html('Please login to register as a member...');
		$('#login').addClass('highlight');
		$("input[@name='type_id']").attr("checked","");
		$('#payment_method').css('display','none');
	}
}
function showLoginAlert(bol,obj){
	if (bol && member_id == '') { 
		var targetOffset = $('html').offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 500);
		$('#login_message').html('Please login to view content...');
		$('#login').addClass('highlight');
	}
}

function setWindow(){
	$('new_item_window').style.top = document.viewport.getScrollOffsets()[1] + 'px';
	$('new_item_window').style.left = document.viewport.getScrollOffsets()[0] + 'px';
	$('new_item_window').style.width = document.viewport.getWidth() + 'px';
	$('new_item_window').style.height = document.viewport.getHeight() + 'px';
}
function clearForm(){
	$('new_item_window').style.left = '-40000px';
	$("new_item_window").innerHTML = "";
}