// Remove default string input field or select existing text.

function removeDefault(field, defaultString) {
    if (field.value == defaultString) {
        field.value = "";
        field.className = '';
    }
    field.focus();
    field.select();

}

// Replace blank input field with default string.

function restoreDefault(field, defaultString) {
    if (field.value == "") {
        field.value = defaultString;
        field.className = 'default-value';
    }


}
//trims the string
function trim(value) { return value.replace(/^\s*([\S\s]*?)\s*$/, '$1'); }

//function for conposing the player embed code
function ComposeEmbedCode(videoId, widgetId, embedCodeURL, singleEmbedPlayerHeight, singleEmbedPlayerWidth, freeWheelId, siteSection)
{
    embedCodeURL += "?WID=" + widgetId + "&VID=" + videoId;
    if (freeWheelId && $.trim(freeWheelId) != '' && $.trim(freeWheelId) != '0')
    {
        embedCodeURL += "&freewheel=" + $.trim(freeWheelId);
        if (siteSection && $.trim(siteSection) != '')
        {
            embedCodeURL += "&sitesection=" + $.trim(siteSection);
        }
    }
    var embedCode = "<iframe src=" + "\"" + $.trim(embedCodeURL) + "\"" + " height=" + singleEmbedPlayerHeight + " width=" + singleEmbedPlayerWidth +
                " frameborder=no scrolling=no noresize marginwidth=0px marginheight=0px></iframe>";
    return embedCode;
}

if (!Array.indexOf)
{
    Array.prototype.indexOf = function(v)
    {
        for (var i = 0; i < this.length; i++)
        {
            if (this[i] == v)
            {
                return i;
            }
        }
        return -1;
    }
}