function UpdateRefresh(vLstRefreshCnt)
{
	if(vLstRefreshCnt==5)
	{
		window.top.frames[3].location.href = "ConrinueSession.aspx"
	}
}

function closeBtnClick()
{
	parent.document.all.outerFr.cols="30%,0%,*";
	window.parent.frames[2].setFormTitle();
	writeToViewMenu(window.parent.frames[2]);
}

function openWindow()
{
	parent.document.all.outerFr.cols="30%,*,0%";
	writeToViewMenu(window.parent.frames[1]);
}

function setFormName(fName)
{ 
	try
	{
		window.top.frames[0].SetFormName(fName)
		// this SetFormName(fName) called from ViewMenu.aspx
	}
	catch(Expception)
	{
	}
}

function ReplaceTextValue(txt)
{
	while(txt.value.indexOf('&')>-1)
	{ 
		txt.value = txt.value.replace('&','%26');
	}
	while(txt.value.indexOf('<')>-1)
	{ 
		txt.value = txt.value.replace('<','&lt;');
	}
	while(txt.value.indexOf('>')>-1)
	{ 
		txt.value = txt.value.replace('>','&gt;');
	}
	while(txt.value.indexOf('=')>-1)
	{ 
		txt.value = txt.value.replace('=','%3D');
	}
	while(txt.value.indexOf('?')>-1)
	{ 
		txt.value = txt.value.replace('?','%40');
	}
	while(txt.value.indexOf('javascript:')>-1)
	{ 
		txt.value = txt.value.replace('javascript:','javascriptColn');
	}
	
}

function RevartReplaceTextValue(txt)
{
	while(txt.value.indexOf('%26')>-1)
	{ 
		txt.value = txt.value.replace('%26','&');
	}
	while(txt.value.indexOf('&lt;')>-1)
	{ 
		txt.value = txt.value.replace('&lt;','<');
	}
	while(txt.value.indexOf('&gt;')>-1)
	{ 
		txt.value = txt.value.replace('&gt;','>');
	}
	while(txt.value.indexOf('%3D')>-1)
	{ 
		txt.value = txt.value.replace('%3D','=');
	}
}

var Production_Issue = 0;
var Test_Environment_Issue = 1;
var Review_Issues = 2;
var Issue_Remark = 3;
var Assign_Issue = 4;
var Mass_Status_Update =5;

function createIssueMenu(vIssueId)
{

	for (var i=0;i<vIssueId.length;i++)
	{
		if(vIssueId[i] == 1)
		{
			switch(i)
			{
				case Production_Issue: 
					document.write("<DIV class='menuItem' id='Post_Issue'>Production Issue</DIV>");
					break;
				case Test_Environment_Issue:
					document.write("<DIV class='menuItem' id='Multi_Post_Issue'>Test Environment Issue</DIV>");
					break;	
				case Review_Issues:
					document.write("<DIV class='menuItem' id='View_Def'>Review Issues</DIV>");
					break;
				case Issue_Remark:
					document.write("<DIV class='menuItem' id='IssRem'>Issue Remark</DIV>");
					break;
				case Assign_Issue:
					document.write("<DIV class='menuItem' id='AssignIssue'>Assign Issue</DIV>");
					break;	
				case Mass_Status_Update:
					document.write("<DIV class='menuItem' id='M_Status_Update'>Mass Status Update</DIV>");
					break;	
						
			}
		}	
	}
	document.write("<DIV class='menuItem' id='Report'>Report</DIV>");	
}

var Configurations = 0;
var Change_Password = 1;
var Developer_Hour = 2;
var Support_Process = 3;
var Alerts = 4;

function createGeneralMenu(vGeneralId)
{
	for (var i=0;i<vGeneralId.length;i++)
	{
		if(vGeneralId[i] == 1)
		{
			switch(i)
			{
				case Configurations :
					document.write("<DIV class='menuItem' id='User_Config'>Configurations</DIV>");
					break;			
				case Change_Password :
					document.write("<DIV class='menuItem' id='Change_Pass'>Change Password</DIV>");
					break;				
				case Developer_Hour :
					document.write("<DIV class='menuItem' id='dev_hrs'>Developer Hour</DIV>");
					document.write("<DIV class='menuItem' id='dev_hrs_upd'>Update Developer Hour</DIV>");
					break;			
				case Support_Process : 
					//document.write("<DIV class='menuItem' id='support'>Support Process</DIV>");
					break;						
				case Alerts:
					document.write("<DIV class='menuItem' id='Alerts'>Alerts</DIV>");
					break;									
			}					
		}
	}
}

function checkSpecUser(frm,vSpecVal)
{
	/*if(vSpecVal == 'T')
		frm.Post_Issue.style.display="none";*/
}

function checkErrorMessage(vErrorMsg,frm)
{
	if(vErrorMsg != '')
	{
		alert(vErrorMsg);
		frm.location.href = "Welcomepage.aspx"		
	}
}

function PhoneValidator()
{
	var v = String.fromCharCode(window.event.keyCode);
	var regEx = /^([\d\-\(\)\+]+)$/;
	if(!regEx.test(v))
		window.event.returnValue = false;
}
function notAllowableChar()
{
	if (window.event.keyCode == 94)
		window.event.returnValue=false;
}

function noInvertedComma()
{
	if ((window.event.keyCode == 39) | (window.event.keyCode == 34))
		window.event.returnValue=false;
}
function noUnderScore()
{
	if (window.event.keyCode == 95 )
		window.event.returnValue=false;
}

function numericCharacter() 
{
  if ((window.event.keyCode <48) | (window.event.keyCode >57)) 
		window.event.returnValue=false;
}

function CheckNumericCharacter(txt) 
{
	if(isNaN(txt.value))
		txt.value = ''
}


//Numeric Character With .(dot).
function numericPrecision(str) 
{
	if ((window.event.keyCode != 46) &&((window.event.keyCode <48) | (window.event.keyCode >57)))
		window.event.returnValue=false;
	else if(str.lastIndexOf(".") >=0)
	{
		if (window.event.keyCode==46)
		{
			window.event.returnValue=false;
		}
		else if(str.indexOf(".") > 2)
		{
			window.event.returnValue=false;
		}
		else if(str.length - str.lastIndexOf(".") > 2)
		{
			window.event.returnValue=false;
		}
		else 
		{
			window.event.returnValue=true
		}
	}
    else
    {
		if(str.lastIndexOf(".") != -1)
			window.event.returnValue=(str.length <5)
		else 
			if(window.event.keyCode == 46)
				window.event.returnValue=(str.length <3)
			else
				window.event.returnValue=(str.length <2)
    }
}

function chkValidNumPrecision(inpt)
{
	if(inpt.value.indexOf(".")>2)
	{
		inpt.value = inpt.value.substring(inpt.value.indexOf(".")-2)
	}
	if(inpt.value.lastIndexOf(".")>2)
	{
		inpt.value = inpt.value.substring(0,inpt.value.lastIndexOf(".")-2)
	}
}

function EmailValidator(vMailId)
{
	//var ex = /^([A-Za-z]+[\w]+@[\w]+\.[A-Za-z]+[A-Za-z.]*)$/;
	var ex = /^([a-zA-Z][\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	return ex.test(vMailId);
}

function RemoveNonAllowedChars()
{
	var v = String.fromCharCode(window.event.keyCode);
	//var regEx = /^({`|~|!|\^|-|_|\||;|:|"|'|<|>|\?|\/|\\}+)$/;
	var regEx = /^({`|~|!|\^|\||:|"|'|<|>|\\}+)$/;
	if(regEx.test(v) | window.event.keyCode == 96 | window.event.keyCode == 92)// | window.event.keyCode == 32)
		window.event.returnValue = false;
}

function LTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return (false);

	for (i = 0; i < String.length; i++)
	{
		if (String.substr(i, 1) != ' ' &&
			String.substr(i, 2) != '\t')
			break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

function RTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return (false);

	for(j = String.length - 1; j >= 0; j--)
	{
		if (String.substr(j, 1) != ' ' &&
			String.substr(j, 1) != '\t')
		break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

function Trim(String)
{
	if (String == null)
		return (false);

	return RTrim(LTrim(String));
}


