
var tradeLabelId = 0;
var divCount = 0;
function setTradeLabel(tradeid)
{
	tradeLabelId = tradeid;
}

var isNav4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4)
var isNav4Min = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4)
var isIE4Min = (navigator.appName.indexOf("Microsoft") != -1 && parseInt(navigator.appVersion) >= 4)
function processTradeLabel() 
{
	var theString = "";
	//alert(navigator.appVersion);
    if (isNav4Min) {
		theString = document.getSelection().toString();
    } else if (isIE4Min) {
        if (document.selection) {
			theString = document.selection.createRange().text;
            event.cancelBubble = true
			document.selection.empty();
        }
    }
	else
	{
		alert("Browser not currently supported for fast labels.  To request browser support contact support@pathtags.com");
	}
	if(theString.length > 4)
	{
		divID = 'dyndiv'+divCount;
		divCount++;
		
		$('#divContainer').append("<div id=\""+divID+"\">Testing</div>");
		$('#'+divID).dialog({
			minHeigh: 300,
			width: 700,
			modal: true,
			title: "Create A Mailing Label For Trade " + tradeLabelId
		});
		$('#'+divID).html(
			"<div style='float: right;margin-left: 20px;'><B>Review/Edit the Label:</B><BR>" +
			"<form onsubmit=\"$('#"+divID+"').dialog('close');return getAJAX(this);\">" + 
			'						<input type="hidden" name="action" value="addLabel">' +
			'						<input type="hidden" name="tradeid" value="' + tradeLabelId + '">' +
			"<textarea name=\"labeltext\" cols=50 rows=5>" + theString + "</textarea><BR><input id=\"submit" + tradeLabelId + "\"type=submit value=Save></form></div>" +
			"<B>Remember:</B>  The system will automatically combine tags going to a single partner for you and the final labels will indicate which tags of yours to send.  You do not need to include that information in the label.  You may need to edit for format (your partner's address is all on one line, etc.)  "
			);
			
		$('#submit'+ tradeLabelId).focus();
	}
}
if (isNav4) 
{
    document.captureEvents(Event.MOUSEUP)
}
		
