var image1 = new Image();
image1.src = '/static/hustler/images/fav-scene-dvd.gif';

var image2 = new Image();
image2.src = '/static/hustler/images/remove-fav.gif';

var image3 = new Image();
image3.src = '/static/hustler/images/fav-photo.gif';

var image4 = new Image();
image4.src = '/static/hustler/images/remove-fav-sm.gif';

function add_favorite(type, id){
	var url = '/favorites/add/type/' + type + '/id/' + id;
	new Ajax.Request(url, {
		method: 'post',
		onSuccess: function(transport){
			if(transport.responseText == 'success'){
				var arrAdd = $$('.fav-add-btn');
				var arrRemove = $$('.remove-fav-btn');
				for(i=0; i<arrAdd.length; ++i){
					arrAdd[i].style.display = 'none';
				}
				for(i=0; i<arrRemove.length; ++i){
					arrRemove[i].style.display = 'block';
				}
			}
		}
	});
}

function remove_favorite(type, id){
	var url = '/favorites/remove/type/' + type + '/id/' + id;
	new Ajax.Request(url, {
		method: 'post',
		onSuccess: function(transport){
			if(transport.responseText == 'success'){
				var arrAdd = $$('.fav-add-btn');
				var arrRemove = $$('.remove-fav-btn');
				for(i=0; i<arrAdd.length; ++i){
					arrAdd[i].style.display = 'block';
				}
				for(i=0; i<arrRemove.length; ++i){
					arrRemove[i].style.display = 'none';
				}
			}
		}
	});
}

function add_fav_photo(type, id){
	var url = '/favorites/add/type/' + type + '/id/' + id;
	new Ajax.Request(url, {
		method: 'post',
		onSuccess: function(transport){
			if(transport.responseText == 'success'){
				var arrAdd = $$('.fav-add-btn-sm');
				var arrRemove = $$('.fav-remove-btn-sm');
				for(i=0; i<arrAdd.length; ++i){
					arrAdd[i].style.display = 'none';
				}
				for(i=0; i<arrRemove.length; ++i){
					arrRemove[i].style.display = 'block';
				}
			}
		}
	});
}

function remove_fav_photo(type, id){
	var url = '/favorites/remove/type/' + type + '/id/' + id;
	new Ajax.Request(url, {
		method: 'post',
		onSuccess: function(transport){
			if(transport.responseText == 'success'){
				var arrAdd = $$('.fav-add-btn-sm');
				var arrRemove = $$('.fav-remove-btn-sm');
				for(i=0; i<arrAdd.length; ++i){
					arrAdd[i].style.display = 'block';
				}
				for(i=0; i<arrRemove.length; ++i){
					arrRemove[i].style.display = 'none';
				}
			}
		}
	});
}
