<?php
	if ($_SESSION["userid"]=="") {
		ob_clean();
		header("Location: index.php");
		exit;
	}
?>

<html>

<head>

<Script language="JavaScript">

window.onbeforeunload = myconfirm;
window.onunload = myclose;
document.oncontextmenu=mymenu;
timeid=window.setTimeout("mytimer()",3000);
starttime=0;
contacttime=0;
bQuit=0;

function myclose()
{
	window.clearTimeout(timeid);
	if (bQuit<1) {
		bQuit=1;
		document.form2.submit();
		alert("Thanks!");
	}
}

function mysubmit()
{
	window.clearTimeout(timeid);
	bQuit=1;
}

function mytimer()
{
	var d=new Date();
	tmptime=Math.round(d.getTime()/1000);
	showtime(tmptime-starttime);
	if (tmptime-contacttime>=20) {
		contacttime=tmptime;
		mycontact(tmptime);
	}
	timeid=window.setTimeout("mytimer()",3000);
}

function myload()
{
	var d=new Date();
	contacttime=Math.round(d.getTime()/1000);
	starttime=contacttime;
	showtime(0);
	mycontact(starttime);
	bQuit=0;
}

function showtime(times)
{
	var d=1,h=1,m=1,s=1;
	d=Math.floor(times/(24*3600));
	s=times-d*24*3600;
	h=Math.floor(s/3600);
	s=s-h*3600;
	m=Math.floor(s/60);
	s=s-m*60;
	var str="";
	if (d>0) str=str+d+" days, ";
	if (h>0) str=str+h+" hours, ";
	if (m>0) str=str+m+" minutes, ";
	str=str+s+" seconds";
	document.all.timetext.innerText=str;
}

function mymenu()
{
	window.event.returnValue=false;
}

function mycontact(currenttime)
{
	strurl="contact.php?serial="+currenttime.toString();
	parent.sip_myright.location.href=strurl;
}

function myconfirm()
{
	if (bQuit>0) return;
	else return "\r\n\r\n\r\n\r\n\r\nAlert: If you close or leave this page,you can't continue to be online!Please open a new explorer window to browse!\r\n\r\n\r\n\r\n\r\n";
}

</Script>

<title>Welcome</title>
</head>

<body background="../bkg.bmp" onLoad="javascript:myload();">

<p align="center"><font size="5"><b>Welcome</b></font></p>
<hr color="#999966">
<div align="center">
  <center>
  <table border="0" width="478">
    <tr>
      <td align="center" width="175">
        <table border="0" cellpadding="0" cellspacing="0" width="441">
		<tr><td width="180">
		Customer Service
		</td><td width="257">
		</td></tr>
		<tr><td width="180">
        &nbsp;&nbsp;
		</td><td width="257">
		</td></tr>
		<tr><td width="180"><a href=pass.html target=_blank>Change Password</a></td></tr>  
		<tr><td width="180"><a href=query1.php target=_blank>List Bill</a></td></tr>
		<tr><td width="180">
        &nbsp;&nbsp;
		</td><td width="257">
		</td></tr>
		<tr><td width="180">
		<form name=form2 method="POST" action="logout_result.php">
			<input type="submit" value="Logout" name="quit" onclick="javascript:mysubmit();">
			<input name=quittype type=hidden value=normal>
		</form>
		</td><td width="257" align="left">
		<b><span id="timetext"></span></b>
		</td></tr>
        </table>
        
      </td>
    </tr>
  </table>
  </center>
</div>
<hr>
<p align="center">SIPMonitor System</p> 

</body>

</html>
