// This function is called when user choose an option from the pagination command 
// area. It gets the dropdown object as a parameter
function DoPaginationAction(objDropdown)
{
    var bContinue=true;
    
    // Switch depending on the selected value
    switch (objDropdown.options[objDropdown.options.selectedIndex].value)
    {
        case "...":
            alert("Please select an action from the list.");
            bContinue = false;
            break;
            
        case "Delete Item":
            bContinue = confirm("Are you sure you want to permanently delete this item?")
            break;
    }
    
    return bContinue;
}   

function MaxLimit (textObj, maxCharacters)
{         
    if(textObj.value.length < maxCharacters)
    {
        textObj.pref = textObj.value
    }
    else
    {
        textObj.value = textObj.pref;            
    }
}

function MultiAssetUploader(itemID, assetType)
{
    Telligent_Modal.Configure('/utility/loading.html',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100);
    Telligent_Modal.Open('/Items/Wizard/MultiAssetUploader.aspx?itemid=' + itemID + '&assettype=' + assetType ,750,520,null)
    return false;
}

function ViewTrackingDetail(ObjectID,ObjectType,ViewType)
{
    Telligent_Modal.Configure('/utility/loading.html',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100);
    Telligent_Modal.Open('/Items/Graphs/ItemViewTracking.aspx?ObjectID=' + ObjectID + '&ObjectType=' +  ObjectType + '&ViewType=' + ViewType,510,242,null)
    return false;
}
function ItemPriceTracking(ObjectID)
{
    Telligent_Modal.Configure('/utility/loading.html',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100);
    Telligent_Modal.Open('/Items/Graphs/ItemPriceTracking.aspx?ItemID=' + ObjectID,600,500,null)
    return false;
}
function SetMarketValue(marketValue)
{
    document.getElementById('<%= txtItemMarketValue.ClientID.ToString() %>').value =  marketValue;
    return false;
}
function RefreshPrice()
{
    __doPostBack('ctl00$MainBody$btnRefreshPrice','');
}
function ConfirmGlobalCollectionChange(ViewStatus)
{
    if(ViewStatus == 'Public')
        return true;
    return confirm('You have chosen to make this item public. Do you wish to continue?')
}

function mceAddControlDynamic(controlId)
{
    window.setTimeout("tinyMCE.mceAddControlDynamic('"+controlId+"', 'mceAdvanceEditor')", 100);
}

// Check for the minium value
function VerifyMinValue(newValueObject)
{
    if ( (document.getElementById(newValueObject).value - 0) == 0)
        return confirm('Are you sure you want to set $0.00 as the new value for this item?');
   else
        return true;
}

function FindOnAmazon(amsearch)
{
    Telligent_Modal.Configure('/utility/loading.html',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100);
    Telligent_Modal.Open('/Items/Wizard/AmazonFindAndView.aspx?amsearch='+amsearch ,600,500,null)
    return false;
}
   
