var isOpen = 0;
var pop_window;

/*
// For Production
var h_s_ad = "https://secure.talk011.com/";
var h_ad = "http://www.talk011.com/";
*/

// For Systest
var h_s_ad = "https://4.61.143.162/r/";
var h_ad = "http://4.61.143.162/r/";

function showHome()
{
	window.location.href = "default.asp";
}

function doLogoff()
{
	if(confirm("Are you sure, you want to logoff?"))
	{
		window.location.href = "jumper.asp?an=VENUSLOGOFF";
	}
}
function showTsk2U()
{
	window.location.href = "welcome.asp";
}

function showU2Tsk()
{
	window.location.href = "u2tsks.asp";
}

function showVenusMsg()
{
	window.location.href = "viewmsgs.asp";
}

function showUserMsgDetails(mid)
{
	var ef = top.document.frames[1].frames[1];
	var urlloc = "showmsgbody.asp?mid="+ mid;
	ef.location.href = urlloc;
}

function showGaneshSales()
{
	window.location.href = "jumper.asp?an=GANESHSALES";
}

function showGanesh()
{
	window.location.href = "jumper.asp?an=GANESH";
}

function showGaneshMCS()
{
	window.location.href = "jumper.asp?an=GANESHMCS";
}

function showGaneshMDM()
{
	window.location.href = "jumper.asp?an=GANESHMDM";
}

function showGmmm()
{
	// window.location.href = "jumper.asp?an=GMMM";
	window.open("jumper.asp?an=GMMM");
}

function showGaneshCON()
{
	window.location.href = "jumper.asp?an=GANESHCON";
}

function showMamsInvoice()
{
	var ef = top.document.frames[1];
	var urlloc = "http://mercury.mindsgate.com/Apps/mams_systemtest/viewjlkcustinvoicesall_venus.asp";
	//var urlloc = "http://ads.mindsgate.com/viewjlkcustinvoicesall_venus.asp";
	ef.location.href = urlloc;
}

function showRsmdTrans()
{
	window.location.href = "jumper.asp?an=RSMDTRANS";
}

function showSimone()
{
	window.location.href = "jumper.asp?an=SIMONE";
}

function showSybil()
{
	window.location.href = "jumper.asp?an=SYBIL";
}

function showTalkAdmin()
{
	window.location.href = "jumper.asp?an=TALKADMIN";
}

function showAllReport()
{
	window.location.href = "viewallreports.asp";
}

function showActs()
{
	window.open("/acts/");
}

function showClockReports()
{
	window.location.href = "viewclockreports.asp";
}

function showAllCBItems()
{
	window.location.href = "viewallcbitems.asp";
}

function showFramePage(page)
{
	document.all["detframe"].src = page;
}

function showTskDesc(tid)
{
	var ef = top.document.all.descframe;
	var urlloc = "showtskdesc.asp?tid="+ tid;
	ef.src = urlloc;
	var lt = screen.availWidth/2-250;
	var tp = screen.availHeight/2-200;
	ef.style.left = lt;
	ef.style.top = tp;
	ef.style.visibility = "visible";
	// top.document.body.filters.item(0).opacity = 25;
	// alert(ef.filters.item(0).opacity); // = 100;
}

function showAssByInfo(aid)
{
	var ef = top.document.all.descframe;
	var urlloc = "showassinfo.asp?aid="+ aid;
	ef.src = urlloc;
	var lt = screen.availWidth/2-250;
	var tp = screen.availHeight/2-200;
	ef.style.left = lt;
	ef.style.top = tp;
	ef.style.visibility = "visible";
	// top.document.body.filters.item(0).opacity = 25;
	// alert(ef.filters.item(0).opacity); // = 100;
}

function showAdminNew()
{
}

function closeIFrame()
{
	var ef = top.document.all.descframe;
	var nf = top.document.all.adminnew;

	if(ef.style.visibility =="visible")
		ef.style.visibility = "hidden";
}

function showDelTsk(name,tid,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 = "viewdeltsk.asp?tid=" + tid;
	//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 showEdtTsk(name,tid,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 = "viewedttsk.asp?tid=" + tid;
	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 showEdtTsk2(name,tid,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 = "viewedttsk2.asp?tid=" + tid;
	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 showEdtTsk3(name,tid,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 = "viewedttsk3.asp?tid=" + tid;
	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 showNewTsk(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 = "viewnewtsk.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 showNewTskSelf(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 = "viewnewtskself.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 showNewRSMDTrans(name,uid,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 = "https://secure.mindsgate.com/venus_rsmd/viewnewrsmdtrans.asp?uid=" + uid;
	var settings = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,width='+ w +',height='+ h  +',top='+ TopPosition +',left='+ LeftPosition +',resizable=0';
	pop_window = window.open(link,name,settings);
}

function showNewCBItem(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 = "viewnewcbitem.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 showEdtCBItem(name,cbid,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 = "viewedtcbitem.asp?cbid="+ cbid;
	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 showDelCBItem(cbid)
{
	if(confirm("Are you sure, you want to delete this item?"))
	{
		top.location.href = "dodelcbitem.asp?cbid="+ cbid;
	}
}

function showDMail()
{
	window.open("http://www.domain-mail.com","_blank");	
}

function showCBook()
{
	top.location.href = "viewcashbook.asp";
}

function showExecView()
{
	document.all["detframe"].src = "viewexeccashbook.asp";
}

function showAnnualView()
{
	document.all["detframe"].src = "viewcashbook_annual.asp";
}

function showTMEntry()
{
	document.all["detframe"].src = "viewnewtmentry.asp";
}

function showUsrInfo(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 = "viewusrinfo.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 showUsrPass(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 = "viewusrpass.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 showNteTsk(name,tid,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 = "viewntetsk.asp?tid=" + tid;
	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 showTmTsk(name,tid,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 = "viewtmtsk.asp?tid=" + tid;
	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 showLegend(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 = "viewlegend.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 OnClickDateImgs(src,dt)
{
	if(src == 31)
	{
		var strloc = "calmon.asp?" + dt;
		window.location = strloc;
	}
}

function ShowLog(theday)
{
	var str = "ad_dcrpt.asp?tid=";
	str += theday;

	top.window.location.href = str;
	//alert(str);
}

function ShowMLog(themon)
{
	var str = "ad_mcrpt.asp?tid=";
	str += themon;

	top.window.location.href = str;
	//alert(str);
}

function ShowWLog(wsd, wed)
{
	var str = "ad_wcrpt.asp?wsd=";
	str += wsd;
	str += "&wed=" + wed;

	top.window.location.href = str;
	//alert(str);
}

function MarkAsCompleted(tid)
{
	if( confirm("Are you sure you want to mark this task as completed?") )
		document.location.href = "domarktskcomp.asp?tid="+ tid;

	return;
}

function GaneshMarkAsCompleted(tid, gid)
{
	if( confirm("Are you sure you want to mark this task as completed?") )
		document.location.href = "../domarkganeshtskcomp.asp?tid="+ tid +"&gid="+ gid;

	return;
}

function RecordClock(cid)
{
	var msg = "";
	var temp = new Date();
	var evt_d = temp.getFullYear() + "-" + parseInt(temp.getMonth()+1) + "-" + temp.getDate();
	var t_dt = evt_d + " " + temp.getHours() + ":" + temp.getMinutes() + ":" + temp.getSeconds();

	if(cid == 1)
	{
		msg = "Are you sure you want to Clock-IN?";
	}
	else if(cid == 2)
	{
		msg = "Are you sure you want to Clock-OUT?";
	}

	if( confirm(msg) )
	{
		var pageurl = "domarkclock.asp?t_dt="+ t_dt +"&cid="+ cid;
		document.location.href = pageurl;
	}

	return;
}

function showDailyClockReports()
{
	var f = document.subform1;
	var uid = f["userLst"].options[f["userLst"].selectedIndex].value;
	var today = f["log_date"].value;
	var pageurl = "showclockreports.asp?uid="+ uid +"&t_dt="+ today;
	document.all["detframe"].src = pageurl;
}

function showWeeklyClockReports()
{
	var f = document.subform1;
	var uid = f["userLst"].options[f["userLst"].selectedIndex].value;
	var today = f["log_date"].value;
	if(uid > 0)
	{
		var pageurl = "showclockreports_weekly.asp?uid="+ uid +"&t_dt="+ today;
		document.all["detframe"].src = pageurl;
	}
	else
	{
		alert("Please select atleast one User.");
		f["userLst"].focus();
	}
}

function showWeeklyClockReportsAll()
{
	var f = document.subform1;
	var uid = f["userLst"].options[f["userLst"].selectedIndex].value;
	var today = f["log_date"].value;

	var pageurl = "showclockreports_weeklyall.asp?uid="+ uid +"&t_dt="+ today;
	document.all["detframe"].src = pageurl;
}

function showMonthlyClockReportsAll()
{
	var f = document.subform1;
	var monName = f["monNameLst"].options[f["monNameLst"].selectedIndex].value;
	var yrName = f["yrLst"].options[f["yrLst"].selectedIndex].value;

	var pageurl = "showclockreports_monthlyall.asp?monNm="+ monName +"&yrNm="+ yrName;
	document.all["detframe"].src = pageurl;
}

function showMonthlyClockReportsAllTotals()
{
	var f = document.subform1;
	var monName = f["monNameLst"].options[f["monNameLst"].selectedIndex].value;
	var yrName = f["yrLst"].options[f["yrLst"].selectedIndex].value;

	var pageurl = "showclockreports_monthlyall_totals.asp?monNm="+ monName +"&yrNm="+ yrName;
	document.all["detframe"].src = pageurl;
}

function showQuaterlyClockReportsAllTotals()
{
	var f = document.subform1;
	var qtrNm = f["qtrNameLst"].options[f["qtrNameLst"].selectedIndex].value;
	var qtrYrNm = f["qtrYrLst"].options[f["qtrYrLst"].selectedIndex].value;

	var pageurl = "showclockreports_qtrall_totals.asp?qtrNm="+ qtrNm +"&qtrYrNm="+ qtrYrNm;
	document.all["detframe"].src = pageurl;
}

function showDRangeClockReportsAll()
{
	var f = document.subform1;
	var uid = f["userLst"].options[f["userLst"].selectedIndex].value;
	var fromDate = f["log_from_date"].value;
	var toDate = f["log_to_date"].value;

	if(Date(toDate) < Date(fromDate))
	{
		alert("ToDate must be greater than FromDate")
		return;
	}
	else
	{
		var pageurl = "showclockreports_drangeall.asp?uid="+ uid +"&f_dt="+ fromDate +"&t_dt="+ toDate;
		document.all["detframe"].src = pageurl;
	}
}

function showUsrTimeSheet()
{
		document.location.href = "viewclockforuser.asp";
}
