var	noteIdToBeCloned = 0,
	noteAttachments = "false",
	noteInotes = "false",
	noteToBeClonedTitle = null;

function assignDivId(noteid, attachments, inotes, noteTitle) {
	noteIdToBeCloned = noteid;
	noteAttachments = attachments;
	noteInotes = inotes;
	noteToBeClonedTitle = noteTitle;
	setInotesValue();
	var parOffset;
	var parScroll;
	if ($('clone').getStyle('position') == "absolute") {
		parOffset = $('clone').getOffsetParent().cumulativeOffset().top;
		parScroll = $('clone').getOffsetParent().cumulativeScrollOffset().top;
		$('clone').style.top = ((document.viewport.getHeight() -
				$('clone').getHeight())/ 2 + parScroll - parOffset) + "px";
	}

	if ($('wait').getStyle('position') == "absolute") {
		parOffset = $('wait').getOffsetParent().cumulativeOffset().top;
		$('wait').style.top = ((document.viewport.getHeight() - 
				$('wait').getHeight()) / 2 - parOffset) + "px";
	}

	$('atmCheckbox').checked = false;
	$('inoteCheckbox').checked = false;
	$('clone').show();
	$('clonesubmit').activate();
}

function setInotesValue() {

	$('cloneMessage').update(
			"<p>Do you want to clone the note '" + noteToBeClonedTitle + "'?</p>");

	if ((noteAttachments != "true") && (noteInotes != "true")) {
		$('checkBoxesForCloning').hide();
	} else {
		$('checkBoxesForCloning').show();
	}
	if (noteAttachments == "true") {
		$('atmItems').show();
	} else {
		$('atmItems').hide();
	}
	if (noteInotes == "true") {
		$('inoteItems').show();
	} else {
		$('inoteItems').hide();
	}
}

function chkiNotes(iName) {
	$('hiddeniNotes').value = iName.checked;
}

function chkAttachments(aName) {
	$('hiddenattachments').value = aName.checked;
}

function submitClone() {

	void ($('clone').hide());
	void ($('wait').show());
	$('hiddenNoteId').value = noteIdToBeCloned;
}


