/** Common js functions used by Tortoise Logic */
function TestModal(Url, RowId, ParentId, Width, Height)
	{
		/* Uncomment the following to view the source of the modal screen */
		/* strReturn=window.open('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  ); /*  'null', 'width=' + Width + ',height=' + Height + '); */
		window.open(Url + '?id=' + RowId + '&ParentId=' + ParentId ); 
		return true;
	}

function ShowModal(Url, RowId, ParentId, Width, Height)
	{
		var strReturn; 
		
		/* Uncomment the following to view the source of the modal screen */
		/* strReturn=window.open('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  ); /*  'null', 'width=' + Width + ',height=' + Height + '); */
		strReturn=window.showModalDialog('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  , 'null', 'status:no;dialogWidth:' + Width + ';dialogHeight:' + Height + ';dialogHide:true;help:no;scroll:yes'); 
		if (strReturn == '')
		{
			return null;
		}
		else if (strReturn != null) 
		{
			return strReturn;
		}
		else
			{
				/* __doPostBack("",""); */
				/* window.location.reload(true); */
				/* window.location = window.location; */
				
			}
	}
	
function SaveBeforePreview(Frame, Form, Control, Button, Url, RowId, ParentId, Width, Height)
	{
		var strReturn;
		var strCommand;
		alert(Control);
		alert(Button);
		strCommand='window.frames.' + Frame + '.document.' + Form + '.elements[\'' + Control + ':' + Button + '\'].click();'
		alert(strCommand);
		strReturn=strCommand;
		if (strReturn == '')
		{
			alert('null');
			return null;
		}
		else if (strReturn != null) 
		{
			alert('returned');
			return strReturn;
		}
		else
			{
				alert('fail');
				
			}
		/*alert(strReturn);
		return strReturn;*/
	}
	
function ShowNote(Url, RowId, ParentId, QuoteId, Width, Height)
	{
		var strReturn; 
		
		/* Uncomment the following to view the source of the modal screen */
		/* strReturn=window.open('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  ); /*  'null', 'width=' + Width + ',height=' + Height + '); */
		strReturn=window.showModalDialog('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId + '&QuoteId=' + QuoteId  , 'null', 'status:no;dialogWidth:' + Width + ';dialogHeight:' + Height + ';dialogHide:true;help:no;scroll:yes'); 
		
		if (strReturn == '')
		{
			return null;
		}
		else if (strReturn != null) 
		{
			return strReturn;
		}
		else
			{
				/* __doPostBack("",""); */
				/* window.location.reload(true); */
				/* window.location = window.location; */
				
			}
	}
	
function ShowImports(Url, RowId, ParentId, OrganisationId, SalesOrderId, Width, Height)
	{
		var strReturn; 
		/* Uncomment the following to view the source of the modal screen */
		/* strReturn=window.open('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  ); /*  'null', 'width=' + Width + ',height=' + Height + '); */
		strReturn=window.showModalDialog('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId + '&OrganisationId=' + OrganisationId + '&SalesOrderId=' + SalesOrderId  , 'null', 'status:no;dialogWidth:' + Width + ';dialogHeight:' + Height + ';dialogHide:true;help:no;scroll:yes');  
		
		if (strReturn == '')
		{
			return null;
		}
		else if (strReturn != null) 
		{
			return strReturn;
		}
		else
			{
				/* __doPostBack("",""); */
				/* window.location.reload(true); */
				/* window.location = window.location; */
				
			}
	}

function OpenCalendar(Url, RowId, ParentId, Width, Height)
	{
		var strReturn; 
		Width='155px'
		Height='200px'
		/* Uncomment the following to view the source of the modal screen */
		/* strReturn=window.open('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  ); /*  'null', 'width=' + Width + ',height=' + Height + '); */
		strReturn=window.showModalDialog('ModalPage.aspx?Url=' + Url + '&id=' + RowId + '&ParentId=' + ParentId  , 'null', 'status:no;dialogWidth:' + Width + ';dialogHeight:' + Height + ';dialogHide:true;help:no;scroll:no'); 
		if (strReturn == '')
			return null;
		else if (strReturn != null) 
			return strReturn;
		else
			window.location.reload();
	}


function DeleteRecord()
	{
		if (!window.confirm("Are you sure you want to delete this record?"))
		{
			return false;
		}
	}
	
function DeleteTerm()
{
	if (!window.confirm("Are you sure you want to delete this Term?"))
	{
		return false;
	}
}

function Close()
	{
		/*if (!window.confirm("Do you want to save your changes?"))
		{
			return false;
			window.close;
		}*/
		window.close();
	}
	
function startListReminder()
{
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("dmenuReminder");
		for (i=0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function startListFollowUp() 
{
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("dmenuFollowUp");
		for (i=0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
