var isOpen = 0;
var pop_window;

////////////////////////////////////////////////////////////////////////////////////////////////
// ALL SHOW Functions
////////////////////////////////////////////////////////////////////////////////////////////////
function closeIFrame()
{
	var ef = parent.document.all.descframe;

	if(ef.style.visibility =="visible")
		ef.style.visibility = "hidden";
}

function CloseDlg()
{
	window.close();
}

function onMOrMsg(msg)
{
	window.status = msg;
	return true;
}

function showHome()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=HOME&purl=viewhome.asp";
}

function showFileSearch()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=FILESEARCH&purl=viewfilesearch.asp";
}

function showClients()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=CLIENTS&purl=viewclients.asp";
}

function showContacts()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=CONTACTS&purl=viewcontacts.asp";
}

function showBoxes()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=BOXES&purl=viewboxes.asp";
}

function showFiles()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=FILES&purl=viewfiles.asp";
}

function showReqs()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=REQUESTS&purl=viewreqs.asp";
}

function showActs()
{
	top.frames["bodyFrame"].location.href = "mainframe.asp?pname=ACTIVITIES&purl=viewacts.asp";
}

function doLogoff()
{
	if(confirm("Are you sure, you want to logoff?"))
	{
		window.location.href = "../jumper.asp?an=SIMONELOGOFF";
	}
}

function showVenus()
{
	window.location.href = "../jumper.asp?an=VSIMONE";
}

function showBoxBulk(name, w, h)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewbulkboxdestroy.asp";
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientInfo(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewclientinfo.asp?cid=" + cid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientContacts(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewclientcontacts.asp?cid=" + cid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientBoxes(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewclientboxes.asp?whichpage=1&cid=" + cid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientBoxes2(name, w, h, cid)
{
	var link = "viewclientboxes2.asp?whichpage=1&cid=" + cid;
	document.location.href = link;
}

function showClientReqs(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewclientreqs.asp?cid=" + cid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientStoReqs(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewclientstoreqs.asp?cid=" + cid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showClientInvoices(cid)
{
	var sel_txt = "inv_month_year" + cid;
	var sel = eval(document.all[sel_txt]);
	var dateVal = sel.options[sel.selectedIndex].value;
	if(dateVal == 0)
	{
		alert("Please select Month-Year for generating invoice");
		sel.focus();
	}
	else
	{
		var link = "viewclientinvoices.asp?cid=" + cid +"&my="+ dateVal;
		document.location.href = link;
	}
}

function showClientInvoicesManage(cid)
{
	var sel_txt = "inv_month_year" + cid;
	var sel = eval(document.all[sel_txt]);
	var dateVal = sel.options[sel.selectedIndex].value;
	if(dateVal == 0)
	{
		alert("Please select Month-Year for generating invoice");
		sel.focus();
	}
	else
	{
		var link = "manageclientinvoices.asp?cid=" + cid +"&my="+ dateVal;
		document.location.href = link;
	}
}

function showBoxFiles(name, w, h, bid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewboxfiles.asp?bid=" + bid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showReqActs(name, w, h, rid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewreqacts.asp?rid=" + rid;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

////////////////////////////////////////////////////////////////////////////////////////////////
// End of ALL SHOW Functions 
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////
// ALL NEW Functions
////////////////////////////////////////////////////////////////////////////////////////////////
function showNewClient(name, w, h)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewclient.asp";
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewContact(name, w, h, cid, from)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewcontact.asp?cid=" + cid +"&from="+ from;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewBox(name, w, h)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewbox.asp";
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}
function showNewBoxEx(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewboxex.asp?cid="+ cid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewFile(name, w, h, bid, from)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewfile.asp?bid="+ bid +"&from="+ from;
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewRequest(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewreq.asp?cid="+ cid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewStoRequest(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewreqsto.asp?cid="+ cid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewReqAct(name, w, h, rid, from)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewnewreqact.asp?rid="+ rid +"&from="+ from;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

////////////////////////////////////////////////////////////////////////////////////////////////
// End of ALL NEW Functions
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////
// ALL EDIT Functions
////////////////////////////////////////////////////////////////////////////////////////////////
function showEditClient(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtclient.asp?cid=" + cid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showEditContact(name, w, h, cid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtcontact.asp?cid=" + cid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showEditBox(name, w, h, bid, from)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtbox.asp?bid=" + bid +"&from="+ from;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showEditFile(name, w, h, fid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtfile.asp?fid=" + fid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showEditReq(name, w, h, rid, from)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtreq.asp?rid=" + rid +"&from="+ from;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showEditAct(name, w, h, aid)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	if (pop_window)
	{
		if (pop_window.closed == false)
		{
			pop_window.focus();
		}
	}
	var link = "viewedtreqact.asp?aid=" + aid;
	//alert(link);
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

////////////////////////////////////////////////////////////////////////////////////////////////
// End of ALL EDIT Functions
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////
// ALL DELETE Functions
////////////////////////////////////////////////////////////////////////////////////////////////
function showDeleteClient(cid, from)
{
	if(confirm("Are you sure you want to delete this client?"))
	{
		document.location.href = "dodelclient.asp?cid="+ cid + "&from="+ from;
	}
}

function showDeleteContact(cid, cliid)
{
	if(confirm("Are you sure you want to delete this contact?"))
	{
		document.location.href = "dodelcontact.asp?contact_id="+ cid +"&client_id="+ cliid;
	}
}

function showDeleteBox(bid, from)
{
	if(confirm("Are you sure you want to delete this box?"))
	{
		document.location.href = "dodelbox.asp?bid="+ bid + "&from="+ from;
	}
}

function showDeleteFile(fid, from)
{
	if(confirm("Are you sure you want to delete this file?"))
	{
		document.location.href = "dodelfile.asp?fid="+ fid +"&from="+ from;
	}
}

function showDeleteReq(rid, from)
{
	if(confirm("Are you sure you want to delete this request?"))
	{
		document.location.href = "dodelreq.asp?rid="+ rid + "&from="+ from;
	}
}

function showDeleteAct(aid, from)
{
	if(confirm("Are you sure you want to delete this activity?"))
	{
		document.location.href = "dodelreqact.asp?aid="+ aid + "&from="+ from;
	}
}

function DeleteInvoiceItem(ty, id)
{
	if(ty == "ACT")
	{
		if(confirm("Are you sure you want to delete this item?"))
		{
			alert("Item deleted");
			document.location.href = document.location.href;
		}
	}
	else if(ty == "STO")
	{
		if(confirm("Are you sure you want to delete this storage item?"))
		{
			alert("Storage item deleted");
			document.location.href = document.location.href;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////
// End of ALL DELETE Functions
////////////////////////////////////////////////////////////////////////////////////////////////