// JScript source code
function doCopy(i)
{
	var elem = document.getElementById(i);
	if(elem!=null)
	{
	    if(document.body.createTextRange)
	    {
	        var r = document.body.createTextRange();
	        if(r!=null)
	        {
	            r.moveToElementText(elem);
	            r.select();
    	        document.execCommand("Copy");
    	    }
	    }
   	    else
	    {
            alert("Your browser does not support this function.\r\n" + 
            "We recommend using MS Internet Explorer.\r\n" + 
            "The link you need to copy is:\r\n" + elem.innerHTML);    	
            return;
	    }
    }
    elem = document.getElementById("f"+i);
	if(elem!=null)
	{
	    var r = document.body.createTextRange();
	    if(r!=null)
	    {
	        r.moveToElementText(elem);
    	}
	}
	alert('The filename has been copied to the clipboard.\r\nYou many now paste it as a link into any field.');
}
/************************************************************/
function doOK()
{
    var nf = document.getElementById("fileName");
    var nh = document.getElementById("fileUploaded");
    var n1 = document.getElementById("alignLeft");
    var n2 = document.getElementById("alignRight");
    var na = "none";
    var nfval = nf.value.trim();
    var nhval = nh.innerHTML.trim();
    if(nfval=="")
    {
        var index = nhval.lastIndexOf("\\");
        if(index<0)
            index = nhval.lastIndexOf("/");
        if(index>0)
            nfval = nhval.substring(index+1);
        else
            nfval=nhval;
    }
    if(n1.checked)
        na="left";
    else if(n2.checked)
        na="right";
    window.returnValue=nhval + '|' + nfval + '|' + na;
    window.close()    
}
/**************************************************/
String.prototype.trim = function () 
{
    return this.replace(/^\s*/, "").replace(/[\s\\\/]*$/, "");
}
