function changeForm()
{
	$("#activity-media").addClass('changed');
}

function remSet(set,item_id)
{
	$.post(base_url + '/ajax/remove-flickr', {flickr_set_id: set,item_id: item_id}, function(data){
		if(data === "success")
			{ $("#flickr_set_" + set).remove(); } 
		else 
			{ alert("error"); }
            }
        );
}

function getSubCategoryOptions()
{	
	$('#categories_level_1_loader').css('display', 'block');
	
	var value = $('#categories_level_0').val();	
		
	//$('#categories_level_1').hide('fast').find('option').remove(); // 2010-01-18 KG this breaks chrome
	$('#categories_level_1').children().remove().end();
	$("#category_id").val('');
	$.getJSON(base_url + '/ajax/get-categories', {parent_category_id: value}, function(data){
	
				if(data.error == 'no_children')
				{									
					$('#categories_level_1_loader').css('display', 'none');						
				}
				else
				{
					$.each(data, function(key, category)
						{								
							$('#categories_level_1').append($("<option></option>").val(category['category_id']).text(category['category_name'])); 
						});

					$('#categories_level_1').show('fast');
					$('#categories_level_1_loader').css('display', 'none');			
	 			}
            }
        );        
}

function recountDuration(type)
{
	var value = $('#int_value_' + type);
	var period = $('#period_' + type);
	var result = $('#' + type);
	
	var period_values = new Array();
	period_values['minutes'] = 60;
	period_values['hours'] = 3600;
	period_values['days'] = 86400;
	
	if (value.val() > 0)
	{
		seconds = period_values[period.val()] * value.val();
		result.val(seconds);
	}	
}

function checkCurrency()
{
	var selected_value = $('#currency').val();
	var array = $('#currency option:selected').text().split(" ");
	//var currency =  $('#currency').html($(this).children('[@selected]').text());
	$('.activity-currency').html(array.pop());
	if (selected_value != 'en_US' && selected_value != 'en_GB')
	{		
		$('#google_merchant_id').attr('disabled', true);
		$('#google_merchant_id-label').parent().css('background-color', '#EEEEEE');		
		$('#google_merchant_key').attr('disabled', true);
		$('#google_merchant_key-label').parent().css('background-color', '#EEEEEE');	
	}
	else
	{
		$('#google_merchant_id').removeAttr('disabled');				
		$('#google_merchant_id-label').parent().css('background-color', '#FFFFFF');
		$('#google_merchant_key').removeAttr('disabled');				
		$('#google_merchant_key-label').parent().css('background-color', '#FFFFFF');
	}
}
