ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 250 //550
ypSlideOutMenu.hideDelay = 10 //50
ypSlideOutMenu.minCPUResolution = 10
ypSlideOutMenu.styleMod = '';
var stUserID = '';
var stDeptCode = '';
	
function ypSlideOutMenu(id, dir, left, top, width, height, parentid, degrade, debug)
{
	this.ie = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	if (this.ie || this.ns4 || this.dom) {
		this.degrade = degrade;
		this.debug = debug;
		this.sliding = false;
		this.id = id
		this.parentid = parentid
		this.dir = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType = dir == "right" || dir == "down" ? "-" : "+"
		this.dim = this.orientation == "h" ? width : height
		this.hideTimer = false
		this.aniTimer = false
		this.open = false
		this.over = false
		this.startTime = 0
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")
		ypSlideOutMenu.Registry[id] = this
		//ed - these 5 lines were in aveda but arent being used anymore.. i hope
		//this.initleft = left
		//this.inittop = top
		//this.initwidth = width
		//this.initheight = height
		//this.showcount = 0;
var d = document
var strCSS = '<style type="text/css">';
strCSS += '#' + this.id + 'Container { visibility:hidden; '

if(browser.indexOf('safari') != -1 && menu_current_url.toLowerCase().indexOf('/community/') == 0 && browser.indexOf('chrome') == -1 )
{
	strCSS += 'margin-left:' + left + 'px; '
}
else if(browser.indexOf('chrome') != -1 && menu_current_url.toLowerCase().indexOf('/community/') == -1)
{
	//chrome for sharepoint
	strCSS += 'margin-left:' + left + 'px; '
}
else if(browser.indexOf('chrome') != -1 && menu_current_url.toLowerCase().indexOf('/community/') == 0)
{
	//chrome for community
	strCSS += 'margin-left: 0px; '
}
else
{
	strCSS += 'left:' + left + 'px; '
}
strCSS += 'top:' + top + 'px; '
strCSS += 'overflow:hidden; z-index:9999; }'
strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
strCSS += 'width:' + width + 'px; '
strCSS += 'height:' + height + 'px; '
strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
strCSS += '}'
strCSS += '</style>'
d.write(strCSS)
this.load()
// The following code originally invoked "document.write" but it caused
// a crash in IE (but not NS) when there were
// more than 31 menus total.  What crashed is that the styles that were
// declared in the css disappeared with 31 menus, where 32 menus caused
// the d.write call to fail entirely.  When I changed
// it so that the style changes were accumulated into one string
// (then at the end that string was written into the document,
// so that document.write was only called once) this solved the problem.
		ypSlideOutMenu.styleMod += '#' + this.id + 'Container { visibility:hidden; ';
		ypSlideOutMenu.styleMod += 'left:' + left + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:9999; ';
		ypSlideOutMenu.styleMod += 'top:' + top + 'px; ';
		ypSlideOutMenu.styleMod += 'overflow:hidden; }';
		ypSlideOutMenu.styleMod += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ';
		ypSlideOutMenu.styleMod += 'height:' + height + 'px; ';
		ypSlideOutMenu.styleMod += 'width:' + width + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:50; ';
		ypSlideOutMenu.styleMod += 'clip:rect(0 ' + width + ' ' + height + ' 0); ';
		ypSlideOutMenu.styleMod += '}  ';
		this.load()
	}
}
ypSlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	if (!obj1 || !obj2) {
		window.setTimeout(this.gRef + ".load()", 1000);
	} else {
		this.container = obj1
		this.menu = obj2
		this.style = this.ns4 ? this.menu : this.menu.style
		// SEE NOTE ABOVE.  The following function call for the 31 menus bug.
		//this.setStyle()
		this.homePos = eval("0" + this.dirType + this.dim)
		this.outPos = 0
		this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
		this.endSlide()
	}
}
ypSlideOutMenu.showMenu = function(id, e)
{
	//highlight the top nav
	var topnav_item = document.getElementById('top_'+id);
	topnav_item.className='topnav_on';
	
	var reg = ypSlideOutMenu.Registry
	var obj = ypSlideOutMenu.Registry[id]

	if (obj.container) {
//		if (obj.ie) alert('showing: ' + id);
		obj.over = true
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
		obj.showcount++;
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOVER);
}

ypSlideOutMenu.hideMenu = function(id, e)
{

	//not highlight the top nav
	//highlight the top nav
	var topnav_item = document.getElementById('top_'+id);
	topnav_item.className='';
	
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
//		if (obj.ie) alert('hiding: ' + id);
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.showcount--;
		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOUT);
}
ypSlideOutMenu.hideAll = function()
{
var reg = ypSlideOutMenu.Registry
for (menu in reg) {
ypSlideOutMenu.hide(menu);
if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
}
}
ypSlideOutMenu.hide = function(id) {
	var obj = ypSlideOutMenu.Registry[id]
	var reg = ypSlideOutMenu.Registry
	obj.over = false
	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	obj.hideTimer = 0
	var close = true;
	for (menu in reg) {
		// for each child, if either
		//  1. the child is open or
		//  2. the child is closing (but hasn't closed yet)
		// then we don't close this menu.
		var pid = ypSlideOutMenu.Registry[menu].parentid
		if (pid == id) {
			if (ypSlideOutMenu.Registry[menu].open) close = false;
			if (!ypSlideOutMenu.Registry[menu].open && ypSlideOutMenu.Registry[menu].sliding) close = false;
		}
	}
	if (obj.open && !obj.aniTimer && close && !obj.showcount) obj.startSlide(false);
}
ypSlideOutMenu.prototype.startSlide = function(open) {
//ed - had to add this line below to make centering work
this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime() 
	this.sliding = true;
	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}
ypSlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-") d = -d
		else if (this.open && this.dirType == "+") d = -d
		else if (!this.open && this.dirType == "-") d = -this.dim + d
		else d = this.dim + d
		this.moveTo(d)
	}
}
ypSlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	this.sliding = false;
	if (((this.open && !this.over) || (!this.open && this.over)) && (!this.parent || this.parent.open)) {
		this.startSlide(this.over)
	} else {
		var overchild = false;
		var reg = ypSlideOutMenu.Registry
		for (menu in reg) {
			var pid = ypSlideOutMenu.Registry[menu].parentid
			if (pid == this.id) overchild = ypSlideOutMenu.Registry[menu].over ? true : overchild		
		}
//		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hideMenu(this.parentid);
		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hide(this.parentid);
	}
}
ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}
ypSlideOutMenu.prototype.moveTo = function(p) { 
// ed - without   = this.ns4 ? p : p + "px"   it gave me problems in netscape.. it wouldnt slide.
this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
ypSlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}
//ed - had to add these 2 lines below to make centering work
ypSlideOutMenu.prototype.onactivate = function() { }
ypSlideOutMenu.prototype.ondeactivate = function() { }

function hidediv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('menu5Container').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'hidden';
}
else { // IE 4
document.all.hideshow.style.visibility = 'hidden';
}
}
}

function showdiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('menu5Container').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = 'visible';
}
else { // IE 4
document.all.hideshow.style.visibility = 'visible';
}
}
}

function callMe()

			{
				
			if (document.frmLogin.stLogin.value=='')
			{
			alert('Enter the User Name');
			document.frmLogin.stLogin.focus();
			return (false);
			}
			if (document.frmLogin.stPassword.value=='')
			{
			alert('Enter the Password');
			document.frmLogin.stPassword.focus();
			return (false);
			 }
			var stTempLogin = document.frmLogin.stLogin.value;
			var stTempPass = document.frmLogin.stPassword.value;

			var str = isAllreadyLogin(stTempLogin,stTempPass);
			var arr = new Array();
			var arr = str.split(',');

			stUserID=arr[0];
			stTempDeptCode=arr[1];
			
			check();
	        }
	        function keyPressEvent(event)
				{
				doClick('go',event);
				}

				function doClick(buttonName,e)
				{
				var key;
				if(window.event)
				{
				key = window.event.keyCode;
					}
				else
				{
				key = e.which;
				}
				if (key == 13)
				{
				var btn = document.getElementById('go');
				if (btn != null)
				{
				btn.click();

				}
				}
	}
	function check()
	{
	//alert(stTempDeptCode);
	
if(stTempDeptCode=='AllReadyLoggedIn')
{
//var stAllReadyPage='<table width=\"100%\" border=\"0\" height=\"141\" cellspacing=\"0\" background=\"http://www.taxshax.com/image/login_back2.jpg\" cellpadding=\"2\"><tr><td width=\"55%\" height=\"25\" align=\"center\" valign=\"middle\"><b style=\"font-size:13px; color:#333333;\">Already logged IN</b></td>    </tr>  <tr><td width=\"350\" align=\"center\"><input type=\"button\" name=\"btnOk\" id=\"btnOk\" style=\"background:url(http://www.taxshax.com/prod/Portal/HAATHIPUNE/Objects/image/OK.gif);width:36;height:20;\" title=\"Ok\" onclick=\"return checkLogin();\">&nbsp;<input type=\"button\" name=\"btnCancel\" style=\"background:url(http://www.taxshax.com/prod/Portal/HAATHIPUNE/Objects/image/CANCEL.gif);width:60;height:20;\" title=\"Cancel\" onclick=\"return checkCancel();\"></td></tr>                </table>';
var stAllReadyPage='<table width=\"100%\" border=\"0\" height=\"141\" cellspacing=\"0\" background=\"image/login_back2.jpg\" cellpadding=\"2\">                                <tr>                                    <td width=\"70%\" height=\"25\" align=\"right\" valign=\"middle\"><b style=\"font-size:13px; color:#333333;\">Already Logged In</b></td>                                <td width=\"22%\" height=\"25\" align=\"right\" valign=\"middle\"><a onclick=\"javascript:hidediv()\" style=\"cursor:pointer\"><img src=\"image/exit_icon.jpg\" alt=\"Close\" title=\"Close\" /></a></td>                                    <td width=\"8%\" height=\"25\" align=\"right\" valign=\"middle\"></td>                                </tr>                                <tr>                                	<td colspan=\"3\" height=\"15\" align=\"center\" valign=\"top\" style=\"color:#FF0000\">You have already logged into the system. <br>Re-Logging will result in loss of any <br />unsaved information.<br />Do you want to continue?</td>                                </tr>                                <tr>                                    <td colspan=\"3\" height=\"20\" align=\"center\" valign=\"middle\">                                        <div style=\"float:left; padding:0 0 8px 70px\"><a href=\"#\"><img src=\"image/but_ok.jpg\" alt=\"Ok\" title=\"Ok\" onclick=\"return checkLogin();\" /></a></div>                                         <div style=\"float:left; padding:0px 0 0 5px;\"><a href=\"#\"><img src=\"image/but_cancel.jpg\" alt=\"Cancel\" title=\"Cancel\" onclick=\"return checkCancel();\" /></a></div>                                    </td>                            	</tr>                            </table>';
document.getElementById('adminbar').innerHTML=stAllReadyPage;
}
else if(stTempDeptCode=='Password')
{
var stInvalidPassword='<table width=\"100%\" border=\"0\" height=\"141\" cellspacing=\"0\" background=\"http://www.taxshax.com/image/login_back2.jpg\" cellpadding=\"2\"><tr><td width=\"91%\" height=\"25\" align=\"left\" valign=\"middle\" style=\"color:#FF0000; padding:0 0 0 20px;\">Invalid Password. Please try again.</td><td width=\"9%\" height=\"25\" align=\"left\" valign=\"middle\"><a onclick=\"javascript:hidediv()\" style=\"cursor:pointer\"><img src=\"http://www.taxshax.com/image/exit_icon.jpg\" alt=\"Close\" title=\"Close\" /></a></td><td width=\"8%\" height=\"25\" align=\"right\" valign=\"middle\"></td></tr><tr><td colspan=\"3\" height=\"25\" align=\"center\" valign=\"middle\"><div style=\"height:28px;\"><label class=\"login\" id=\"userlogin_label\"><span style=\"color:#c2c2c2\">Username</span><input class=\"adminbar-input\" type=\"text\" name=\"stLogin\" id=\"stLogin\" value=\"\" tabindex=\"1\" /></label></div></td></tr><tr><td colspan=\"3\" height=\"25\" align=\"center\" valign=\"middle\"><div style=\"height:28px;\"><label class=\"login\" id=\"password_label\"><span style=\"color:#c2c2c2\">Password</span><input class=\"adminbar-input\" type=\"password\" name=\"stPassword\" id=\"stPassword\" value=\"\" tabindex=\"2\" onKeyPress=\"return submitenter(this,event)\"/></label></div></td></tr><tr><td colspan=\"3\" height=\"20\" align=\"left\" valign=\"middle\"><div style=\"float:left; 3px 0 0 18px;\"> <div style=\"float:left; padding:3px 0 0 18px;\"><a class=\"fogotpassword\" style=\"cursor:pointer\" onClick=\"openForgotPassWindow();\">Forgot Password</a></div><div style=\"float:left; padding:0 0 8px 40px\"><img src=\"image/but_proceed.jpg\" alt="Proceed" title=\"Proceed\" onClick=\"return callMe();\" tabindex=\"3\" style=\"cursor:pointer\"></div></td></tr></table>';
document.getElementById('adminbar').innerHTML=stInvalidPassword;
document.frmLogin.stLogin.focus();
document.getElementById('stLogin').focus();
jQuery(document).ready(function(){

			// init fields
			if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();

			if(jQuery('#stPassword').val() !=  '')
				jQuery('#password_label span').hide();

			// on focus
			jQuery('#userlogin_label input').focus(function() {
				jQuery('#userlogin_label span').fadeTo(100, 0);

				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();

				if(jQuery('#stPassword').val() !=  '')
				jQuery('#password_label span').hide();

			});

			jQuery('#password_label input').focus(function() {
				jQuery('#password_label span').fadeTo(100, 0);

				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});

			//on keydown
			jQuery('#userlogin_label input').keydown(function() {
    				if(jQuery('#userlogin_label span').is(':visible') )
    				jQuery('#userlogin_label span').hide();
   			});

			jQuery('#password_label input').keydown(function() {
				if(jQuery('#password_label span').is(':visible') )
				jQuery('#password_label span').hide();
			});

			//on click
			jQuery('#password_label').click(function() {
				jQuery('#stPassword').trigger('focus');
				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});
			jQuery('#userlogin_label').click(function() {
				jQuery('#stLogin').trigger('focus');
				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();
			});

			//on blur
			jQuery('#stLogin').blur(function() {
				if( jQuery('#stLogin').val() ==  '') {
					jQuery('#userlogin_label span').show();
					jQuery('#userlogin_label span').fadeTo(100, 1);
				}
				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();
			});
			jQuery('#stPassword').blur(function() {
				if( jQuery('#stPassword').val() ==  '') {
					jQuery('#password_label span').show();
					jQuery('#password_label span').fadeTo(100, 1);
				}
				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});

		});

}
else if(stTempDeptCode=='Login')
{
var stInvalidLogin='<table width=\"100%\" border=\"0\" height=\"141\" cellspacing=\"0\" background=\"http://www.taxshax.com/image/login_back2.jpg\" cellpadding=\"2\"><tr><td width=\"91%\" height=\"25\" align=\"left\" valign=\"middle\" style=\"color:#FF0000; padding:0 0 0 20px;\">Invalid Login. Please try again.</td><td width=\"9%\" height=\"25\" align=\"left\" valign=\"middle\"><a onclick=\"javascript:hidediv()\" style=\"cursor:pointer\"><img src=\"http://www.taxshax.com/image/exit_icon.jpg\" alt=\"Close\" title=\"Close\" /></a></td><td width=\"8%\" height=\"25\" align=\"right\" valign=\"middle\"></td></tr><tr><td colspan=\"3\" height=\"25\" align=\"center\" valign=\"middle\"><div style=\"height:28px;\"><label class=\"login\" id=\"userlogin_label\"><span style=\"color:#c2c2c2\">Username</span><input class=\"adminbar-input\" type=\"text\" name=\"stLogin\" id=\"stLogin\" value=\"\" tabindex=\"1\" /></label></div></td></tr><tr><td colspan=\"3\" height=\"25\" align=\"center\" valign=\"middle\"><div style=\"height:28px;\"><label class=\"login\" id=\"password_label\"><span style=\"color:#c2c2c2\">Password</span><input class=\"adminbar-input\" type=\"password\" name=\"stPassword\" id=\"stPassword\" value=\"\" tabindex=\"2\" onKeyPress=\"return submitenter(this,event)\"/></label></div></td></tr><tr><td colspan=\"3\" height=\"20\" align=\"left\" valign=\"middle\"><div style=\"float:left; 3px 0 0 18px;\"> <div style=\"float:left; padding:3px 0 0 18px;\"><a class=\"fogotpassword\" style=\"cursor:pointer\" onClick=\"openForgotPassWindow();\">Forgot Password</a></div><div style=\"float:left; padding:0 0 8px 40px\"><img src=\"image/but_proceed.jpg\" alt="Proceed" title=\"Proceed\" onClick=\"return callMe();\" tabindex=\"3\" style=\"cursor:pointer\"></div></td></tr></table>';



document.getElementById('adminbar').innerHTML=stInvalidLogin;
document.frmLogin.stLogin.focus();
document.getElementById('stLogin').focus();
jQuery(document).ready(function(){
			if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();

			if(jQuery('#stPassword').val() !=  '')
				jQuery('#password_label span').hide();
			jQuery('#userlogin_label input').focus(function() {
				jQuery('#userlogin_label span').fadeTo(100, 0);
				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();
				if(jQuery('#stPassword').val() !=  '')
				jQuery('#password_label span').hide();
			});

			jQuery('#password_label input').focus(function() {
				jQuery('#password_label span').fadeTo(100, 0);

				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});

			//on keydown
			jQuery('#userlogin_label input').keydown(function() {
    				if(jQuery('#userlogin_label span').is(':visible') )
    				jQuery('#userlogin_label span').hide();
   			});

			jQuery('#password_label input').keydown(function() {
				if(jQuery('#password_label span').is(':visible') )
				jQuery('#password_label span').hide();
			});

			//on click
			jQuery('#password_label').click(function() {
				jQuery('#stPassword').trigger('focus');
				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});
			jQuery('#userlogin_label').click(function() {
				jQuery('#stLogin').trigger('focus');
				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();
			});

			//on blur
			jQuery('#stLogin').blur(function() {
				if( jQuery('#stLogin').val() ==  '') {
					jQuery('#userlogin_label span').show();
					jQuery('#userlogin_label span').fadeTo(100, 1);
				}
				if(jQuery('#stLogin').val() !== '')
				jQuery('#userlogin_label span').hide();
			});
			jQuery('#stPassword').blur(function() {
				if( jQuery('#stPassword').val() ==  '') {
					jQuery('#password_label span').show();
					jQuery('#password_label span').fadeTo(100, 1);
				}
				if(jQuery('#stPassword').val() !==  '')
				jQuery('#password_label span').hide();
			});

		});


}

else
{


		var stServletPath = 'http://www.taxshax.com/prod/';
		document.frmLogin.action =stServletPath+'SlShowPortalPage?stCompany=HAATHI';
		document.frmLogin.submit();
  }


	}
	function checkLogin()
		{
		var strandom=Math.random();
		var toPath='http://www.taxshax.com/prod/SlProtectedPage?stAction=SignOthersOut&stLogin='+stUserID+'&stCompany=HAATHI&stLocation=PUNE&stRnd='+strandom;
		window.open(toPath,'_self');
		}

		function checkCancel()
		{
		var toPath='http://www.taxshax.com/index.html';
		window.open(toPath,'_self');
	}
	
	
		window.name='display';
	
		function changePassword()
			{
			var stAppletPath = 'http://www.taxshax.com/';
			getUserID();
			var toPath=stAppletPath+'taxshax-ChangePwd.html?'+stUserID;
			window.open(toPath,'_blank','toolbar=no, scrollbars=no, status=no, resizable=no, alwaysRaised=yes, width=440, height=280, left=400, top=280 ');
			}
	
			var stCall = 'Dashboard';
	
	    /*function callPage(str)
			{
			 stCall=str;
			 check();
			}
	
	   function check()
			{
			getUserID();
			var stServletPath = 'http://www.taxshax.com/prod/';
			if(stCall=='Logout')
			 {
			  frmLogin.action =stServletPath+'SlProtectedPage?&stAction=createLogoutTemp';
			  }
			else
			 {
			 var toPath=stServletPath+'SlShowPortalPage?stAction='+stUserID+'&stDeptCode='+stDeptCode+'&stCompany=HAATHI&stLocation=PUNE';
			 document.frmLogin.action =toPath;
			 }
			document.frmLogin.submit();
		}*/
		
		function callPage1(str)
					{
					 stCall=str;
					 check1();
					}
			
			   function check1()
					{
					getUserID();
					var stServletPath = 'http://www.taxshax.com/prod/';
					if(stCall=='Logout')
					 {
					  parent.document.frmLogin.action =stServletPath+'SlProtectedPage?&stAction=createLogoutTemp';
					  }
					else
					 {
					 var toPath=stServletPath+'SlShowPortalPage?stAction='+stUserID+'&stDeptCode='+stDeptCode+'&stCompany=HAATHI&stLocation=PUNE';
					 parent.document.frmLogin.action =toPath;
					 }
					parent.document.frmLogin.submit();
		}
	
	
		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);}
		}
	
	
		function printUserId()
		{
	
		getUserID();
	
			document.getElementById('LoginDiv1').innerHTML="<b>"+stUserID+"</b>";
	}
	
	function printUserId1()
		{
	
		getUserID();
		
		
		
		
	if(!((stUserID=='GUEST'||stUserID=='') && (stDeptCode=='Not Found'||stDeptCode=='')))
{
			document.getElementById('LoginDiv1').innerHTML="<b><a onClick='return callPage1(\"Dashboard\");' style='cursor:pointer; color:#005aa0;'>My Taxshax</a> &nbsp; | &nbsp; "+stUserID+"</b>";
			}
			else
			{
			document.getElementById('LoginDiv1').innerHTML="<b>"+stUserID+"</b>";
			}
	}
	
	function printUserDetails()
	{
	getUserID();
	document.getElementById('userDetails').innerHTML='<ul> <li style="width:270px"><b>Name:</b> Tausif Patel</li>                           <li style="width:220px"><b>PAN:</b> PP666GH8</li>                           <li style="width:200px"><b>Email ID:</b> '+stUserID+'</li>                        </ul>';
}


function isAllreadyLogin(stLogin,stTempPass)
{
	try
	{
		var stServletPath = 'http://www.taxshax.com/prod/';
		/*Atul dont handle chars one by one
		stTempPass = replaceChar(stTempPass,'#','%23');
		stTempPass = replaceChar(stTempPass,'&','%26');
		//atul handle % in the password field
		stTempPass = replaceChar(stTempPass,'%','%25');		
		*/
		//Atul handle all chars
		stTempPass = replaceHTMLChars_1(stTempPass);
		
		var url = stServletPath+'SlShowPortalPage?stAction=start&stLogin='+stLogin+'&stPassword='+stTempPass+'&stCompany=HAATHI&stLocation=PUNE&stCheckLoggedIn=Y&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);
		}
		return stUserID+','+stDeptCode;
	}
	catch(e)
	{
		alert('Execption while making the page(Code AJAX01) : Exception ='+e);
	}
}

function replaceChar(stValue,stOld,stNew)
{
	var stRet='';
	for(var i=0;i<stValue.length;i++)
	{
		if(stValue.charAt(i)==stOld)
		{
			stRet = stRet + stNew;
		}
		else
		{
			stRet = stRet + stValue.charAt(i);
		}
	}
	return stRet;
}


function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;


if (keycode == 13)
   {
   callMe();
   }

else
   return true;
}


function openForgotPassWindow()
	{
	var stServletPath = 'http://www.taxshax.com/prod/';
	 if (document.frmLogin.stLogin.value=='')
	  {
	    alert('Enter the Email Id');
 	    document.frmLogin.stLogin.focus();
	    return (false);
	   }
	var strandom=Math.random();
	var stEmail = document.frmLogin.stLogin.value;
	var toPath= stServletPath+'SlLogin?hdn_form_name=ForgotPassword&stCompany=HAATHI&stLocation=PUNE&stCallFromPortal=N&stLogin=USER_NOT_PASSED&stEmail='+stEmail+'&stRnd='+strandom;
	dv = document.createElement('div');
	document.getElementById('adminbar').appendChild(dv);
	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>';
	}
	
	
	function openProtectedPage(stPageName,stPageCode)
	{
		var strandom=Math.random();
		
		var totpath='http://www.taxshax.com/prod/SlProtectedPage?stAction=OpenPage&stRnd='+strandom+'&stPageCode='+stPageCode+'&stPageName='+stPageName+'&stCompany=HAATHI&stLocation=PUNE&stMsg=^Login@&stAppletpath=';
	        var oo = open(totpath,'_top');
        }
        
        function openPublicDomainForm(stCode, stProtected)
			{
			
				var totpath='http://www.taxshax.com/prod/SlDocPublicDomainForm?stCompany=HAATHI&stLocation=PUNE';
				totpath = totpath+'&stDocCode='+stCode+'&stProtected='+stProtected;
				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');
				else 		var oo = open(totpath,stCode+'URL','width=680,height=530,left=310,top=120,resizable=yes,scrollbars = yes,toolbar = no,location = no,directories = no,status = no,maximize=no,menubar = no');
}

var stURL = parent.document.URL;
stURL = stURL.substring(0,5);

if(stURL=='https')
{
	stURL='https://www.taxshax.com/'
}
else
{
	stURL='http://www.taxshax.com/'
}

//Atul function copied from comfunctForProcEnable.js and added for plus
function replaceHTMLChars_1(str)
{
	str = replaceAll(str,"%","%25");
	str = replaceAll(str,"&","%26");
	str = replaceAll(str,"'","%27");
	str = replaceAll(str,'"',"%22");
	str = replaceAll(str,"#","%23");
	str = replaceAll(str,">","%3E");
	str = replaceAll(str,"<","%3C");
	str = replaceAll(str,"+","%2B");
	return str;
}
//Atul function copied from comfunctForProcEnable.js
function replaceAll(str1,str2,str3)
{
	str1 = ''+str1;
	var stReturn = str1;
	var idx = str1.indexOf(str2);
	if(idx>-1)
	{
		var stThis = str1.substring(0,str1.indexOf(str2))
		var stRemaining = str1.substring(str1.indexOf(str2)+str2.length);
		stReturn = stThis+str3+replaceAll(stRemaining,str2,str3)
	}
	return stReturn;
}
