
if(!window.clipboardData)
{
    window.clipboardData =
	{
	    setData : function(mode,content)
	    {
			var clipboard = document.body;
			var flashclipboard = clipboard.flashclipboard;
			if(flashclipboard == null)
			{
			    flashclipboard = document.createElement('div');
			    clipboard.flashclipboard = flashclipboard;
			    clipboard.appendChild(flashclipboard);
			}
			flashclipboard.innerHTML = '<embed src="/flash/clipboard.swf" FlashVars="clipboard='+encodeURIComponent(content)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	    }
	}
}

function convert()
{
    var masterpass = document.getElementById('convert_masterpass').value;
	var domain = document.getElementById('convert_domain').value.toLowerCase();

    var res = hex_md5(masterpass+domain).substr(3, 10);
    document.getElementById('pwh').value = res;
    document.getElementById('conv_result').style.display = 'block';
    window.clipboardData.setData('Text', res);
}

function swap_bttn()
{
    if (document.getElementById('pwh').style.display == 'inline')
    {
		document.getElementById('pwh').style.display = 'none';
		document.getElementById('bttn_display').value = 'Afficher';
    }
    else
    {
		document.getElementById('pwh').style.display = 'inline';
		document.getElementById('bttn_display').value = 'Masquer';
    }
}
