
function AddAllButton()
{$('#source option').remove().appendTo('#destination');$('#destination option:selected').removeAttr("selected");var list=document.getElementById('destination');SortOptions(list);}
function AddButton()
{$('#source option:selected').remove().appendTo('#destination');$('#destination option:selected').removeAttr("selected");var list=document.getElementById('destination');SortOptions(list);}
function RemoveButton()
{$('#destination option:selected').remove().appendTo('#source');$('#source option:selected').removeAttr("selected");var list=document.getElementById('source');SortOptions(list);}
function RemoveAllButton()
{$('#destination option').remove().appendTo('#source');$('#source option:selected').removeAttr("selected");var list=document.getElementById('source');SortOptions(list);}
function FilterSuccess(response)
{$('#source option').remove();$('#source').append(response);var list=document.getElementById('source');SortOptions(list);$('#source option:selected').removeAttr("selected");return false;}
function FilterDataCallback(response,ex)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{FilterSuccess(response.value);}}
return false;}
function FilterSearch(strEntry)
{var strFilterTypeID="";var mySplitResult="";var strPageName="";var strSelectedItems="";mySplitResult=$("#frmModal").attr("action").split(".aspx");strPageName=$.trim(mySplitResult[0])+".aspx";if($("input[@name='filtertype']:checked").val()=="Keyword")
{strFilterTypeID="2";}
else
{strFilterTypeID="1";}
$('#destination option').each
(function()
{strSelectedItems=strSelectedItems+"<div id="+$(this).val()+" class='selectItem'>"+$(this).text()+"</div>";});Anthem_InvokePageMethod
('FilterData',[strEntry,strFilterTypeID,strSelectedItems],FilterDataCallback);return false;}
function ResetList()
{strEntry=$("#search").val();if(strEntry.length>0)
{FilterSearch(strEntry);}
$("#search").focus();}
function CloseModalWindow(response)
{tb_remove();}
function SaveSelectedItemsCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{CloseModalWindow();}}
return false;}
function ExitButton()
{var strSelectedItems="";var mySplitResult="";var strPageName="";$('#destination option').each
(function()
{strSelectedItems=strSelectedItems+"<div id="+$(this).val()+" class='selectItem'>"+$(this).text()+"</div>";});mySplitResult=$("#frmModal").attr("action").split(".aspx");strPageName=$.trim(mySplitResult[0]);switch(strPageName)
{case"PublisherList":$('#ctl00_cphTemplateContent_SelectedPublishers').children().remove(".selectItem");$('#ctl00_cphTemplateContent_SelectedPublishers').prepend(strSelectedItems);if(strSelectedItems.length===0)
{$("input[@name='pub']:nth(0)").attr("checked","checked");}
break;case"SubjectList":$('#ctl00_cphTemplateContent_SelectedSubjects').children().remove(".selectItem");$('#ctl00_cphTemplateContent_SelectedSubjects').prepend(strSelectedItems);if(strSelectedItems.length===0)
{$("input[@name='subj']:nth(0)").attr("checked","checked");}
break;case"LanguageList":$('#ctl00_cphTemplateContent_SelectedLanguages').children().remove(".selectItem");$('#ctl00_cphTemplateContent_SelectedLanguages').prepend(strSelectedItems);if(strSelectedItems.length===0)
{$("input[@name='lang']:nth(0)").attr("checked","checked");}
break;default:alert('Unexpected error has occured.');}
Anthem_InvokeMasterPageMethod
('SaveSelectedItems',[strPageName,strSelectedItems],SaveSelectedItemsCallback);}
function Focus(str)
{if($("#search").val()=='Search for '+str)
{$("#search").val("");}}
function Blur(str)
{if($("#search").val()=='')
{$("#search").val("Search for "+str);var list=document.getElementById('source');SortOptions(list);}}
function KeyUp(e)
{if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum==8)
{strEntry=$("#search").val();FilterSearch(strEntry);return true;}
if(keynum==46)
{strEntry=$("#search").val();FilterSearch(strEntry);return true;}}
function KeyPress(e)
{var keynum;var keychar;if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum==13)
{return false;}
keychar=String.fromCharCode(keynum);strEntry=$("#search").val()+keychar;FilterSearch(strEntry);}