var stUserID = '';
var stDeptCode = '';
function getUserID()
{
	try
	{
		var stURL = parent.document.URL;
		stURL = stURL.substring(0,5);
		var stServletPath = 'http://www.taxshax.com/prod/';
		if(stURL=='https')
		{
			stServletPath = 'https://www.taxshax.com/prod/';
		}
		var url = stServletPath+'SlShowPortalPage?stAction=GETUSER&stCompany=HAATHI&rand='+Math.random();
		var http_request;

		//Native XMLHttpRequest
		if (window.XMLHttpRequest)
		{
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/xml');
			}
		}
		else if (window.ActiveXObject) // IE/Windows ActiveX
		{
			try
			{
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch(e)
			{
				try 
				{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch (e)
				{
				}
			}
		}
		if (!http_request) 
		{
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}
		try 
		{
			//http_request.onreadystatechange = function() { getUserDetails(http_request); };
			http_request.open("GET", url, false);
			http_request.send(null);
			getUserDetails(http_request);
		}
		catch(e)
		{
			alert('Execption while making the page(Code AJAX02) : Exception ='+e);
		}
	}
	catch(e)
	{
		alert('Execption while making the page(Code AJAX01) : Exception ='+e);
	}
}

function getUserDetails(http_request)
{
	try
	{
		if (http_request.readyState == 4)
		{
			if (http_request.status == 200)
			{
				response = http_request.responseXML.documentElement;
				recs = response.getElementsByTagName('rec');
				var currentValue='';
				try
				{
					rec1=recs[0];
					stUserID = rec1.getElementsByTagName('rec1')[0].firstChild.data;
					stDeptCode = rec1.getElementsByTagName('rec2')[0].firstChild.data;
				}catch(e)
				{
					stUserID='';
					stDeptCode='';
				}
			}
			else
			{
				alert("There was a problem retrieving the data:" + http_request.statusText);
			}
		}

	} catch (e) {alert('Execption while making the page(Code AJAX05) : Exception ='+e);}
}

getUserID();

if((stUserID=='GUEST'||stUserID=='') && (stDeptCode=='Not Found'||stDeptCode==''))
{
	document.write("<HTML>");
	document.write("<HEAD>");
	document.write("<style type='text/css' title='IE stylesheet'>");
	document.write("<!--");
	document.write(".btbold {font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal; color: #444444;}");
	document.write(".st {font-family: Verdana; font-size: 8pt; font-style: bold; font-weight: normal; color: #444444;}");
	document.write(".heading1{font-size:14px;font-weight:bold;color:#7C8CC2;}");
	document.write(".heading2{font-size:15px;font-weight:bold;color:#666666;}");
	document.write(".logintxt{font-size:12px;text-decoration:none;color:#333399;}");
        document.write("-->");

	document.write("</style>");

	document.write("</HEAD>");
	document.write("<BODY class='BD' leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 onLoad='document.frmLogin.stLogin.focus()'>");
	document.write("<script language=\"JavaScript\" src=\"https://www.taxshax.com/js/taxshax_dynamic.js\"></script>");

	document.write("<script>");
	document.write(" var stUserID='' ;");
	document.write(" var stTempDeptCode='';");

	document.write("window.name='display';");
	
	document.write("function openPublicDomainForm(stCode, stProtected)");
	document.write("{");
	document.write("	var totpath='https://www.taxshax.com/prod/SlDocPublicDomainForm?stCompany=HAATHI&stLocation=PUNE';");
	document.write("	totpath = totpath+'&stDocCode='+stCode+'&stProtected='+stProtected;");
	document.write("	if(stProtected='Y')		var oo = open(totpath,stCode+'URL','height=200,width=350,left=400,top=300,resizable=yes,scrollbars = yes,toolbar = no,location = no,directories = no,status = no,maximize=no,menubar = no');");
	document.write("	else 		var oo = open(totpath,stCode+'URL','width=500,height=530,left=310,top=120,resizable=yes,scrollbars = yes,toolbar = no,location = no,directories = no,status = no,maximize=no,menubar = no');");
	document.write("}");
	
	document.write(" function callMe()");
	document.write("{");
	document.write("   if (document.frmLogin.stLogin.value=='')");
	document.write("   {");
	document.write("      alert('Enter the User Name');");
	document.write("      document.frmLogin.stLogin.focus();");
	document.write("      return (false);");
	document.write("   }");
	document.write("   if (document.frmLogin.stPassword.value=='')");
	document.write("   {");
	document.write("      alert('Enter the Password');");
	document.write("      document.frmLogin.stPassword.focus();");
	document.write("      return (false);");
	document.write("   }");
	document.write("   	var stTempLogin = document.frmLogin.stLogin.value;");
	document.write("   	var stTempPass = document.frmLogin.stPassword.value;");

	document.write(" 	var str = isAllreadyLogin(stTempLogin,stTempPass);");
	document.write(" 	var arr = new Array();");
	document.write(" 	var arr = str.split(',');");

	document.write(" 	stUserID=arr[0];");
	document.write(" 	stTempDeptCode=arr[1];");
	document.write(" 	check();");
	document.write("}");
	
	document.write("function keyPressEvent(event)");
	document.write("{");
	document.write("   doClick('go',event);");
	document.write("}");
	
	document.write("function doClick(buttonName,e)");
	document.write("{");
	document.write("	var key;");
	document.write("	if(window.event)");
	document.write("	{");
	document.write("		key = window.event.keyCode;");
	document.write("	}");
	document.write("	else");
	document.write("	{");
	document.write("		key = e.which;");
	document.write("	}");
	document.write("	if (key == 13)");
	document.write("	{");
	document.write("		var btn = document.getElementById('go');");
	document.write("		if (btn != null)");
	document.write("		{ ");
	document.write("		  btn.click();");
	//document.write("		  event.keyCode = 0");
	document.write("		}");
	document.write("	}");
	document.write("}");
	
	document.write("function check()");
	document.write("{");
	
	document.write(" 	if(stTempDeptCode=='AllReadyLoggedIn')");
	document.write("	{");
	document.write("		var stAllReadyPage ='<form  method=\"POST\" name=\"frmLogin\" target=\"display\">'\n+");
	document.write("  		'<table style=\"background-color:#ffffff;align=left width=350 height=100 border=0 cellSpacing=0 cellPadding=0 leftMargin=0 topMargin=1 marginheight=1 marginwidth=1><tr> <td width=\"350\" align=\"left\" scope=\"col\"><span style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight:bold;color:#666666;\">You have already logged into the system.<br>Re-Logging will result in loss of any unsaved information.Do you want to continue?</span></td></tr><tr><td width=\"350\" align=\"center\"><input type=\"button\" name=\"btnOk\" id=\"btnOk\" style=\"background:url(https://www.taxshax.com/Objects/image/OK.gif);width:36;height:20;\" title=\"Ok\" onclick=\"return checkLogin();\">&nbsp;<input type=\"button\" name=\"btnCancel\" style=\"background:url(https://www.taxshax.com/Objects/image/CANCEL.gif);width:60;height:20;\" title=\"Cancel\" onclick=\"return checkCancel();\"></td></tr></table>';");
	document.write("		'</form>';");
	document.write("  		document.getElementById('taxshax_login_new').innerHTML=stAllReadyPage; \n");
	document.write("                document.frmLogin.btnOk.focus();");
	document.write("	}");
	document.write(" 	else if(stTempDeptCode=='Password')");
	document.write("	{");
	document.write("		var stPassword ='<form  method=\"POST\" name=\"frmLogin\" target=\"display\">'\n+");
	document.write("		'<input type=hidden name=\"stCompany\" value = \"HAATHI\">'\n+");
	document.write("		'<input type=hidden name=\"stLocation\" value = \"pune\">'\n+");
	document.write("		'<table style=\"background-color:#ffffff;\" align=left width=350 height=100 border=0 cellSpacing=0 cellPadding=0 leftMargin=0 topMargin=1 marginheight=1 marginwidth=1>'\n+");
	document.write("		    '<tr>'+");
	document.write("		    '<td colspan=\"3\" align=\"left\" scope=\"col\"><span style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight:bold;color:#666666;\">Invalid Password.Please try again.</span></td>'\n+");
	document.write("		    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("		    '<td align=\"left\"  style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;\" scope=\"col\">Email ID</td>'\n+");
	document.write("	   	    '<td align=\"left\"  style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;\" scope=\"col\">Password </td>'\n+");
	document.write("	   	    '<td  scope=\"col\">&nbsp;</td>'+");
	document.write("		    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("	      	    '<td ><input type=\"text\" style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;width:200;height:20;\" name=\"stLogin\" onkeypress=\"keyPressEvent(event);\"></td>'+");
	document.write("	   	    '<td><input type=\"password\" style=\";width:116;height:20;\" name=\"stPassword\" onkeypress=\"keyPressEvent(event);\"></td>'+");
	document.write("	   	    '<td scope=\"col\"><input type=\"button\" style=\"border:none;background:url(https://www.taxshax.com/Objects/image/go.png);width:72px;height:21px;\" title=\"Submit\" name=\"go\" id=\"go\" onclick=\"return callMe();\"></td>'+");
	document.write("	   	    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("	   	    '<td colspan=\"3\" align=\"left\" ><span style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;\"><a name=\"forgot\" href=\"#\" onClick=\"openForgotPassWindow();\">Forgot  password?</a>'\n+");
	document.write("	   	    '&nbsp;&nbsp;&nbsp;New Member?&nbsp;<a style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;\" target=\"\" href=\"https://www.taxshax.com/index_newreg.html\"><b>Enroll Now</b></a></span></td>'\n+");
	document.write("	   	    '</tr>'\n+");
	document.write("	   	  '</table>'\n+");
	document.write("		'</form>';");
	document.write("  		document.getElementById('taxshax_login_new').innerHTML=stPassword; \n");
	document.write("                document.frmLogin.stLogin.focus();");
	document.write("	}");
	document.write(" 	else if(stTempDeptCode=='Login')");
	document.write("	{");
	document.write("		var stLogin ='<form  method=\"POST\" name=\"frmLogin\" target=\"display\">'\n+");
	document.write("		'<input type=hidden name=\"stCompany\" value = \"HAATHI\">'\n+");
	document.write("		'<input type=hidden name=\"stLocation\" value = \"pune\">'\n+");
	document.write("		'<table style=\"background-color:#ffffff;\" align=left width=350 height=100 border=0 cellSpacing=0 cellPadding=0 leftMargin=0 topMargin=1 marginheight=1 marginwidth=1>'\n+");
	document.write("		    '<tr>'+");
	document.write("		    '<td colspan=\"3\" align=\"left\" scope=\"col\"><span style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight:bold;color:#666666;\">Invalid Login. Please try again.</span></td>'\n+");
	document.write("		    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("		    '<td align=\"left\"  style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;\" scope=\"col\">Email ID</td>'\n+");
	document.write("	   	    '<td align=\"left\"  style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;\" scope=\"col\">Password</td>'\n+");
	document.write("	   	    '<td  scope=\"col\">&nbsp;</td>'+");
	document.write("		    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("	      	    '<td ><input type=\"text\" style=\"font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;width:200;height:20;\" name=\"stLogin\" onkeypress=\"keyPressEvent(event);\"></td>'+");
	document.write("	   	    '<td><input type=\"password\" style=\";width:116;height:20;\" name=\"stPassword\" onkeypress=\"keyPressEvent(event);\"></td>'+");
	document.write("	   	    '<td scope=\"col\"><input type=\"button\" style=\"border:none;background:url(https://www.taxshax.com/Objects/image/go.png);width:72px;height:21px;\" title=\"Submit\" name=\"go\" id=\"go\" onclick=\"return callMe();\"></td>'+");
	document.write("	   	    '</tr>'+");
	document.write("		    '<tr>'+");
	document.write("	   	    '<td colspan=\"3\" align=\"left\" ><span style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;\"><a name=\"forgot\" href=\"#\" onClick=\"openForgotPassWindow();\">Forgot  password?</a>'\n+");
	document.write("	   	    '&nbsp;&nbsp;&nbsp;New Member?&nbsp;<a style=\"font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;\" target=\"\" href=\"https://www.taxshax.com/index_newreg.html\"><b>Enroll Now</b></a></span></td>'\n+");
	document.write("	   	    '</tr>'\n+");
	document.write("	   	  '</table>'\n+");
	document.write("		'</form>';");
	document.write("  		document.getElementById('taxshax_login_new').innerHTML=stLogin; \n");
	document.write("                document.frmLogin.stLogin.focus();");
	document.write("	}");
	document.write(" 	else ");
	document.write("	{");
	document.write("   		var stServletPath = 'https://www.taxshax.com/prod/';\n");
	document.write("   		document.frmLogin.action =stServletPath+'SlShowPortalPage?stCompany=HAATHI';\n");
	document.write("   		document.frmLogin.submit();\n");
	document.write("	}");
	document.write("}");
	
	document.write("	function checkLogin()");
	document.write("	{");
	document.write("		var strandom=Math.random();");
	document.write("		var toPath='https://www.taxshax.com/prod/SlProtectedPage?stAction=SignOthersOut&stLogin='+stUserID+'&stCompany=HAATHI&stLocation=PUNE&stRnd='+strandom;");
	document.write("		window.open(toPath,'_self')");
	document.write("	}");

	document.write("	function checkCancel()");
	document.write("	{");
	document.write("		var toPath='https://www.taxshax.com/index.html';");
	document.write("		window.open(toPath,'_self')");
	document.write("	}");
	
	document.write("function openForgotPassWindow()");
	document.write("{");
	document.write("   var stServletPath = 'https://www.taxshax.com/prod/';");
	document.write("   if (document.frmLogin.stLogin.value=='')");
	document.write("   {");
	document.write("      alert('Enter the Email Id');");
	document.write("      document.frmLogin.stLogin.focus();");
	document.write("      return (false);");
	document.write("   }");
	document.write("   var strandom=Math.random();");
	document.write("   var stEmail = document.frmLogin.stLogin.value; ");
	document.write("   var toPath= stServletPath+'SlLogin?hdn_form_name=ForgotPassword&stCompany=HAATHI&stLocation=PUNE&stCallFromPortal=N&stLogin=USER_NOT_PASSED&stEmail='+stEmail+'&stRnd='+strandom;");
	document.write("   dv = document.createElement('div');");
	document.write("   document.getElementById('taxshax_login_new').appendChild(dv);");
	document.write("   dv.innerHTML='<IFRAME frameborder=0 style=\"z-index:0;overflow:auto;VERTICAL-ALIGN: top; left:0px ; top:0px;width:0px;height:0px\" src='+toPath+'></IFRAME>';");
	document.write("}");
	
	document.write("function keyPressEvent(event)");
	document.write("{");
	document.write("   doClick('go',event);");
	document.write("}");
	
	document.write("function doClick(buttonName,e)");
	document.write("{");
	document.write("	var key;");
	document.write("	if(window.event)");
	document.write("	{");
	document.write("		key = window.event.keyCode;");
	document.write("	}");
	document.write("	else");
	document.write("	{");
	document.write("		key = e.which;");
	document.write("	}");
	document.write("	if (key == 13)");
	document.write("	{");
	document.write("		var btn = document.getElementById('go');");
	document.write("		if (btn != null)");
	document.write("		{ ");
	document.write("		  btn.click();");
	//document.write("		  event.keyCode = 0");
	document.write("		}");
	document.write("	}");
	document.write("}");
	
	document.write("</script>");

	document.write("<form  method='POST' name='frmLogin' target='display'>");
	document.write("   <input type=hidden name='stCompany' value = 'haathi'>");
	document.write("   <input type=hidden name='stLocation' value = 'pune'>");
	document.write("<table style='background-color:#ffffff';align=left height=100 border=0 cellSpacing=0 cellPadding=0 leftMargin=0 topMargin=1 marginheight=1 marginwidth=1>");

	document.write("   <tr>");
	document.write("   <td width='200' align='left' scope='col'><span style='font-family: Verdana; font-size: 10pt; font-style: normal; font-weight:bold;color:#666666;'>Existing User? Login Now</span></td>");
	document.write("   <td width='88'   class='heading1' scope='col'>&nbsp;</td>");
	document.write("   <td scope='col'>&nbsp;</td>");
	document.write("   </tr>");

	document.write("   <tr>");
	document.write("   <td align='left'  style='font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;' scope='col'><font color='gray'>Email ID </font></td>");
	document.write("   <td align='left'  style='font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;' scope='col'><font color='gray'>Password </font></td>");
	document.write("   <td  scope='col'>&nbsp;</td>");
	document.write("   </tr>");

	document.write("   <tr>");
	document.write("   <td ><input type='text' style='font-family: Verdana; font-size: 10pt; font-style: normal; font-weight: normal;width:200;height:20;'name='stLogin' onkeypress=\'keyPressEvent(event);\' /></td>");
	document.write("   <td><input type='password' style=';width:116;height:20;' name='stPassword' onkeypress=\'keyPressEvent(event);\' /></td>");
	document.write("   <td   scope='col'><input type='button' style='border:none;background:url(https://www.taxshax.com/Objects/image/go.png);width:72px;height:21px;' title='Submit' name='go' id ='go' onclick=\'return callMe();\'></td>");
	document.write("   </tr>");

	document.write("   <tr>");
	document.write("   <td colspan='3' align='left' ><span style='font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;'><a name='forgot' href='#' onClick=\'openForgotPassWindow();\'>Forgot  password?</a>");
	document.write("   &nbsp;&nbsp;&nbsp;<font color='gray'>New Member?</font>&nbsp;<a style='font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;' target=\"\" href=\"https://www.taxshax.com/index_newreg.html\"><b>Enroll Now</b></a></span></td>");
	document.write("   </tr>");
	document.write("</table>");	
	document.write("</form>");

	document.write("<script>");
	document.write("   document.frmLogin.stLogin.focus();");
	document.write("</script>");

	document.write("</BODY>");
	document.write("</HTML>");
}
else
{
	document.write("<HTML>");
	document.write("<HEAD>");
	document.write("<style type='text/css' title='IE stylesheet'>");
	document.write("<!--");
	document.write(".btbold {font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal; color: #444444;}");
	document.write(".st {font-family: Verdana; font-size: 8pt; font-style: bold; font-weight: normal; color: #444444;}");
	document.write(".heading1{font-size:14px;font-weight:bold;color:#7C8CC2;}");
	document.write(".heading2{font-size:15px;font-weight:bold;color:#666666;}");
	document.write(".logintxt{font-size:12px;text-decoration:none;color:#333399;}");
        document.write("-->");

	document.write("</style>");

	document.write("</HEAD>");
	document.write("<BODY class='BD' leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 >");
	
	document.write("<script>");
	document.write("window.name='display';");

	document.write("function changePassword()");
	document.write("{");
	document.write("   var stAppletPath = 'https://www.taxshax.com/';");
	document.write("    var toPath=stAppletPath+'taxshax-ChangePwd.html?'+stUserID;");
	document.write("    window.open(toPath,'_blank','toolbar=no, scrollbars=no, status=no, resizable=no, alwaysRaised=yes, width=375, height=180, left=470, top=250 \') ");
	document.write("}");

	document.write(" var stCall = 'Dashboard';");

	document.write("function callPage(str)");
	document.write("{");
	document.write("stCall=str;");
	document.write("check();");
	document.write("}");
	
	document.write("function check()");
	document.write("{");
	document.write(" 	var stServletPath = 'https://www.taxshax.com/prod/';");
	document.write("	if(stCall=='Logout')"); 
	document.write("	{");
	document.write("	   document.frmLogin.action =stServletPath+'SlProtectedPage?&stAction=createLogoutTemp';");
	document.write("	}");
	document.write("	else "); 
	document.write("	{");
	document.write("	   var toPath=stServletPath+'SlShowPortalPage?stAction='+stUserID+'&stDeptCode='+stDeptCode+'&stCompany=HAATHI&stLocation=PUNE';");
	document.write("	   document.frmLogin.action =toPath;");
	document.write("	}");
	document.write("   	document.frmLogin.submit();\n");
	document.write("}");
	document.write("</script>");

	document.write("<form  method='POST' name='frmLogin' target='display' onsubmit=\'return check();\'>");
	document.write("<table style='background-color:#ffffff';align=left height=100 width=350 border=0 cellSpacing=0 cellPadding=0 leftMargin=0 topMargin=1 marginheight=1 marginwidth=1>");
	
	document.write("<tr align=center>");
	document.write("<td align=right><span style='font-family: Verdana; font-size: 10pt; font-style: normal; font-weight:bold;color:#666666;'>"+stUserID+"</span></td>");
	document.write("</tr>");	
	
	document.write("   <tr>");
	document.write("	<td align=right scope='col'><span style='font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;'><a name='logout' href='#' onClick=\'return callPage(\"Logout\");\'>Logout</a></td>");
	document.write("   </tr>");
	if(stDeptCode=='ASSESSEE'||stDeptCode=='TAXPREPARER'||stDeptCode=='CLIENT' ||stDeptCode=='CORPORATE' ||stDeptCode=='TPCLIENT')	
	{
		document.write("   <tr>");
		document.write("	<td align=right scope='col'><span style='font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;'><a name='dashboard' href='#' onClick=\'return callPage(\"Dashboard\");\'>My Taxshax</a></td>");
		document.write("   </tr>");
	}	
	document.write("   <tr>");
	document.write("	<td align=right scope='col'><span style='font-family: Verdana; font-size: 8pt; font-style: normal; font-weight: normal;'><a name='change_pass' href='#' onClick=\'changePassword();\'>Change Password?</a></td>");
	document.write("   </tr>");

	document.write("</table>");
	document.write("</BODY>");
	document.write("</HTML>");
}

