function addtofavorite(type, id){
	if(document.getElementById("favorites-content")){
	  	if (Element.visible('favorites-content')) {
			new Effect['BlindUp']('favorites-content', {duration: 0.10});
			document.getElementById("arrowfavorites").src = "/images/buttons/arrowclosed.gif";
		}
		
	  	new Ajax.Updater('favorites-content', '<%=url_for :controller => "member", :action => "addfavorite"%>/' + type + '/' + id, {
	        method:     'post',
	        onFailure:  function() {Element.classNames('favorites-content').add('failure')},
	        onComplete: function() {
				new Effect.ScrollTo('addfavoritepoint',{duration:1.0});
				new Effect.BlindDown('favorites-content', {duration: 0.50});
				new Effect.Highlight(document.getElementById("favorite"+type+id), {duration: 2.50});
			}
	      });
		document.getElementById("arrowfavorites").src = "/images/buttons/arrowopen.gif";
	}else{
		window.location = "/member/signin"
	}
}
        
function showlist(tag, arrowicon, action_list) {
    if (!(Element.visible(tag))) {
      new Ajax.Updater(tag, action_list, {
        method:     'post',
		onLoading: function(){ document.getElementById("img_"+tag).style.display = "";},
		onLoaded: function(){ document.getElementById("img_"+tag).style.display = "none";},
        onFailure:  function() {Element.classNames(tag).add('failure')},
        onComplete: function() {new Effect.BlindDown(tag, {duration: 0.50}); document.getElementById(arrowicon).src = "/images/buttons/arrowopen.gif"; }
      });
    } else {
      new Effect['BlindUp'](tag, {duration: 0.50});
      document.getElementById(arrowicon).src = "/images/buttons/arrowclosed.gif";
    }
}
  
function deleteItem(tag,action_delete){
  	if(confirm("Are you sure you want to delete the selected item?")){
		Effect.Puff(tag);
		new Ajax.Request(action_delete, {
            method:     'post'
          });
	}
}


