function AddToFavorites(guidAssetId)
{	
	//Clear Block panel
	if($('BlockPanel_' + guidAssetId)){
		$('BlockPanel_' + guidAssetId).innerHTML = "";
		Element.hide('BlockPanel_' + guidAssetId);
	}
	
	Element.show('SavePanel_' + guidAssetId);
	if($('SavePanel_' + guidAssetId).innerHTML.length == 0){
		new Ajax.Updater($('SavePanel_' + guidAssetId), "/ajax/addToFavorites.cfm?guidAssetId=" + guidAssetId, {asynchronous:true});
	}else{
		$('SavePanel_' + guidAssetId).innerHTML = "";
		Element.hide('SavePanel_' + guidAssetId);
	}
}

function AddToFavoritesAct(guidAssetId,action,theform)
{
	if(action == 1 && theform.guidMediaListId.length)
	{
		new Ajax.Updater($('SavePanel_' + guidAssetId), "/ajax/addToFavorites.cfm?guidMediaListId=" + theform.guidMediaListId.options[theform.guidMediaListId.selectedIndex].value + "&guidAssetId=" + guidAssetId, {asynchronous:true});
	} 
	if(action == 2 && theform.NewFolderName.value.length == 0)
	{
		alert('You must enter a folder name before saving.');
		return;
	}
	else if(action == 2 && theform.NewFolderName.value.length > 0)
	{
		new Ajax.Updater($('SavePanel_' + guidAssetId), "/ajax/addToFavorites.cfm?NewFolderName=" + theform.NewFolderName.value + "&guidAssetId=" + guidAssetId, {asynchronous:true});
	}
	Element.hide('SavePanel_' + guidAssetId);
}

function VideoAddToFavorites(guidAssetId)
{
	//Clear Block panel
	if($('BlockPanel')){
		$('BlockPanel').innerHTML = "";
		Element.hide('BlockPanel');
	}
	
	Element.show('SavePanel');
	if($('SavePanel').innerHTML.length == 0){
		//alert("/ajax/addToFavorites.cfm?guidAssetId=" + guidAssetId + "&Video=1");
		new Ajax.Updater($('SavePanel'), "/ajax/addToFavorites.cfm?guidAssetId=" + guidAssetId + "&Video=1", {asynchronous:true});
	}else{
		$('SavePanel').innerHTML = "";
		Element.hide('SavePanel');
	}
}

function VideoAddToFavoritesAct(guidAssetId,action,theform)
{
	if(action == 1 && theform.guidMediaListId.length)
	{
		//alert("/ajax/addToFavorites.cfm?guidMediaListId=" + theform.guidMediaListId.options[theform.guidMediaListId.selectedIndex].value + "&guidAssetId=" + guidAssetId);
		new Ajax.Updater($('SavePanel'), "/ajax/addToFavorites.cfm?guidMediaListId=" + theform.guidMediaListId.options[theform.guidMediaListId.selectedIndex].value + "&guidAssetId=" + guidAssetId, {asynchronous:true});
	} 
	if(action == 2 && theform.NewFolderName.value.length == 0)
	{
		alert('You must enter a folder name before saving.');
		return;
	}
	else if(action == 2 && theform.NewFolderName.value.length > 0)
	{
		new Ajax.Updater($('SavePanel'), "/ajax/addToFavorites.cfm?NewFolderName=" + theform.NewFolderName.value + "&guidAssetId=" + guidAssetId, {asynchronous:true});
	}
	Element.hide('SavePanel');
}

function AddNoteToFavorites(guidAssetId)
{
	savenotes();
	Element.show('SavePanelNotes_' + guidAssetId);
	if($('SavePanelNotes_' + guidAssetId).innerHTML.length == 0){
		new Ajax.Updater($('SavePanelNotes_' + guidAssetId), "/ajax/addToFavorites.cfm?guidAssetId=" + guidAssetId + "&Notes=1", {asynchronous:true});
	}else{
		$('SavePanelNotes_' + guidAssetId).innerHTML = "";
		Element.hide('SavePanelNotes_' + guidAssetId);
	}
}

function AddNotesToFavoritesAct(guidAssetId,action,theform)
{
	if(action == 1 && theform.guidMediaListId.length)
	{
		//alert("/ajax/addToFavorites.cfm?guidMediaListId=" + theform.guidMediaListId.options[theform.guidMediaListId.selectedIndex].value + "&guidParentAssetId=" + guidAssetId);
		new Ajax.Updater($('SavePanelNotes_' + guidAssetId), "/ajax/addToFavorites.cfm?guidMediaListId=" + theform.guidMediaListId.options[theform.guidMediaListId.selectedIndex].value + "&guidParentAssetId=" + guidAssetId, {asynchronous:true});
	} 
	if(action == 2 && theform.NewFolderName.value.length == 0)
	{
		alert('You must enter a folder name before saving.');
		return;
	}
	else if(action == 2 && theform.NewFolderName.value.length > 0)
	{
		new Ajax.Updater($('SavePanelNotes_' + guidAssetId), "/ajax/addToFavorites.cfm?NewFolderName=" + theform.NewFolderName.value + "&guidParentAssetId=" + guidAssetId, {asynchronous:true});
	}
	Element.hide('SavePanelNotes_' + guidAssetId);
}


