/**
 * Customizes the bugs@piclens.com mailto link with some platform information
 * Usage:
 * <a href="#" id="bugsLink">bugs@piclens.com</a>
 * customizeMailtoLinkWithPlatformInfo(document.getElementById('bugsLink'), 'bugs@piclens.com');
 */
function customizeMailtoLinkWithPlatformInfo(linkElement, emailAddress) {
    var plVersion = 'Cooliris not found in this browser',graphicsMode='';
    if (!window.piclensBridge) {
        // if not, try to define it here...
        var context = null;
        if (typeof PicLensContext != 'undefined') { // Firefox ONLY
            context = new PicLensContext();
        } else {                                    // IE ONLY
            try {
                context = new ActiveXObject("PicLens.Context");
            } catch (e) {
                // Safari
                if (navigator.mimeTypes['application/x-cooliris']) {
                    // Safari
                    context = document.createElement('object');
                    context.style.height="0px";
                    context.style.width="0px";
                    context.type = 'application/x-cooliris';
                    document.documentElement.appendChild(context);
                }
            }
        }
        
        window.piclensBridge = context;
    }
    
    if (window.piclensBridge) {
        plVersion = window.piclensBridge.version;
        try {
            graphicsMode = piclensBridge.getConfigProperty('com.cooliris.gfx.effects');
        } catch (e) {}
    }
    
    var mailto = "mailto:" + emailAddress +"?body=Thank you so much for emailing us, please provide us with this information: (We have pre-filled as much as possible)%0A%0A"+
    "%0A1. Operating System and Version (e.g., Windows XP, Mac OSX, etc):  "+ (navigator.oscpu ? navigator.oscpu : BrowserDetect.OS) + 
    "%0A2. Browser and Version (e.g., Mozilla Firefox 3.0.1, Internet Explorer 7): "+ BrowserDetect.browser + " " + BrowserDetect.version +
    "%0A3. Exact Cooliris Version (e.g., 1.8.1.3899, 1.8.1.3900, etc): " + plVersion + 
    "%0A4. Cooliris Graphics mode (don't worry if you don't know this): " + graphicsMode + 
    "%0A5. A Clear Description of Your Issue: " + 
    "%0A%0A%0A%0A%0A%0AWe will get back to you as soon as we can!";
    var origText = linkElement.innerHTML;
    linkElement.setAttribute('href', mailto);
    linkElement.innerHTML = origText;
}
