var intHide=new Array(25);
var intShow=new Array(25);
var intHide1;
var intShow1;
var	CurrentWindow=0;

var ElemntList=new Array("DiscountTable","QuoteLookup","ClientInfo");
var AccountInfoElemntList=new Array("ChangePasswordWindow","ChangeUserNameWindow");

var index=0;
var StdLeftHidden=-610;
var StdLeftShown=150;
var IsNetscape=false;
var speed=35;

if(!Array.indexOf)
{
	Array.prototype.indexOf = function(obj){
	    for(var i=0; i<this.length; i++){
	        if(this[i]==obj){
	            return i;
	        }
	    }
	    return -1;
	}
}

function ParseStringPhoneNumber(Input)
{
	try
	{
		var number=new String();
		number=Input;
		while (number.indexOf("(",0) > -1)
		{
			number=number.replace("(","");
		}
		while (number.indexOf(")",0) > -1)
		{
			number=number.replace(")","");
		}
		while (number.indexOf("-",0) > -1)
		{
			number=number.replace("-","");
		}
		while (number.indexOf(".",0) > -1)
		{
			number=number.replace(".","");
		}
		//debugger;
		if (isNaN(number,10))
			return Input;
		if (number.length==11)
		{
			var Part1=number.substr(0,1);
			var Part2=number.substr(1,3);
			var Part3=number.substr(4,3);
			var Part4=number.substr(7,4);
			return Part1+"-("+Part2+")-"+Part3+"-"+Part4;
		}
		else
		if (number.length==10)
		{
			var Part2=number.substr(0,3);
			var Part3=number.substr(3,3);
			var Part4=number.substr(6,4);
			return "("+Part2+")-"+Part3+"-"+Part4;
		}
		else
		if (number.length==7)
		{
			var Part3=number.substr(0,3);
			var Part4=number.substr(3,4);
			return Part3+"-"+Part4;
		}
		else
			return Input;
	}
	catch(e)
	{
		return Input;
	}
}

function ParsePhoneNumber(TextInput)
{
	var VariableIsAControl=true;
	try
	{
		if (TextInput.value!=null)
		{
			TextInput.value=ParseStringPhoneNumber(TextInput.value);
			return TextInput.value;
		}
		else
		{
			VariableIsAControl=false;
		}
	}
	catch(e)
	{
		VariableIsAControl=false;
	}
	if (VariableIsAControl==false)
	{
		return ParseStringPhoneNumber(TextInput);
	}
}


function Alert(message)
{
	alert(message);
}

function LinkButton_OnMouseOver(Element)
{
	Element.style.textDecoration="underline";

}

function LinkButton_OnMouseOut(Element)
{
	Element.style.textDecoration="none";

}

function OpenInNewWindow(URL)
{
	window.open(URL,"_blank");
}

function NewWindow(URL,width,height )
{
	window.open(URL,"_blank","height = "+height+", width = "+width);
}

function loadAction(loc)
{
	window.open (loc, "_blank", "height=480, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no");
}

function OpenNewWindow(loc)
{
	window.open (loc, "_blank", "height=480, width=800, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=no, status=yes");
}

function SelfDestruct(Element)
{
	if (Element.parentNode)
	{
		Element.parentNode.removeChild(Element);
	}
}

function SetFocusOnElement(Element)
{
	var Done=false;
	if (Element!=null)
	{
		try
		{
			if (Element.type=="hidden" ||
				(Element.tagName!="INPUT" &&
				Element.tagName!="SELECT"))
			{
			}
			else
			{
				Element.focus();
				if (Element.type!="button" &&
					Element.type!="submit")
					Element.select();
				Done=true;
			}
		}
		catch(e)
		{
			try
			{
			if (Element.type=="hidden" ||
				(Element.tagName!="INPUT" &&
				Element.tagName!="SELECT"))
				{
				}
				else
				{
					Element.focus();
					Done=true;
				}
			}
			catch(e2)
			{
				
			}
		}
	}
	return Done;
}

function FindNextFocusAbleElement(Element,thePast)
{
	var Done=false;
	if (Element==null)
	{
		return;
	}
	var start=0;
	for (var k=0;k < Element.childNodes.length;++k)
	{
		if (thePast==Element.childNodes[k])
			start=k;
	}
	for (var i=start;i < Element.childNodes.length;++i)
	{
		if (Done==false && thePast!=Element.childNodes[i])
		{
			if (SetFocusOnElement(Element.childNodes[i]))
			{
				Done=true;
				break;
			}
			else
			{	
				Done=FindNextFocusAbleElement(Element.childNodes[i],Element);
			}
		}
	}
	if (Done==false && thePast!=Element.parentNode)
		Done=FindNextFocusAbleElement(Element.parentNode,Element);
	return Done;
}


function FocusOnNextElement(PreviousElementName)
{
	
	var PreviousElement=document.getElementById(PreviousElementName.split("$").join("_"));
	if (PreviousElement==null)
		PreviousElement=document.getElementsByName(PreviousElementName.split("$").join(":"))[0];
	if (PreviousElement!=null)
	{
		if (PreviousElement.tagName=="SELECT")
		{
			PreviousElement.focus();
			return;
		}
		
		FindNextFocusAbleElement(PreviousElement,null);
	}
}


function IsInputKindOfControl(Element)
{
	if (Element!=null)
	{
		if (Element.type!="hidden" &&
			(Element.tagName=="INPUT" ||
			Element.tagName=="SELECT"))
			return true;
		else
			return false;
	}
	else
		return false;
}

function FindLastInputChild(Element)
{
	var LastChild=null;
	if (Element!=null)
	{
		for (var i=0;i < Element.childNodes.length;++i)
		{
			if (Element.childNodes[i].childNodes.length > 0 && Element.childNodes[i].tagName!="SELECT")
			{
				Result=FindLastInputChild(Element.childNodes[i]);
				if (Result!=null)
					LastChild=Result;
			}
			else
			{
				if (IsInputKindOfControl(Element.childNodes[i]))
					LastChild=Element.childNodes[i];
			}
		}
	}
	return LastChild;
}

function FindLastInputChildInElement(ElementName)
{
	var Element=document.getElementById(ElementName.split("$").join("_"));
	if (Element==null)
		Element=document.getElementsByName(ElementName.split("$").join(":"))[0];
	if (Element!=null)
	{
		//debugger;
		var temp=FindLastInputChild(Element);
		return temp;
	}
	else
		return null;
}

function GiveHex(Dec)
{
   if(Dec == 10)
      Value = "A";
   else
   if(Dec == 11)
      Value = "B";
   else
   if(Dec == 12)
      Value = "C";
   else
   if(Dec == 13)
      Value = "D";
   else
   if(Dec == 14)
      Value = "E";
   else
   if(Dec == 15)
      Value = "F";
   else
      Value = "" + Dec;

   return Value;
}

//this is primarily for checking whether or not a first and last name are present when saving a quote
function CheckClientNameValidator(FirstNameID,LastNameID,FirstNameValidatorID,LastNameValidatorID)
{
  var IsValid=false;
  var FirstNameValid=false;
  var LastNameValid=false;
  //debugger;
  ClientFirstName=new String(document.getElementById(FirstNameID).value);
  ClientLastName=new String(document.getElementById(LastNameID).value);
  if (ClientFirstName.length == 0)
  {
		document.getElementById(FirstNameValidatorID).innerHTML="*";
		FirstNameValid=false;
  }
  else
  {
		document.getElementById(FirstNameValidatorID).innerHTML=" ";
		FirstNameValid=true
  }
  if (ClientLastName.length == 0)
  {
		document.getElementById(LastNameValidatorID).innerHTML="*";
		LastNameValid=false;
  }
  else
  {
		document.getElementById(LastNameValidatorID).innerHTML=" ";
		LastNameValid=true
  }
  if (FirstNameValid && LastNameValid)
	IsValid=true;
  else
	IsValid=false;
  return IsValid;
}

//this is primarily for checking whether or not a first and last name are present when saving a quote
function CheckClientNameAndDBAValidator(FirstNameID,LastNameID,FirstNameValidatorID,LastNameValidatorID,DBAID,DBAValidatorID)
{
  var IsValid=false;
  var FirstNameValid=false;
  var LastNameValid=false;
  var DBAValid=false;
  //debugger;
  ClientFirstName=new String(document.getElementById(FirstNameID).value);
  ClientLastName=new String(document.getElementById(LastNameID).value);
  DBA=new String(document.getElementById(DBAID).value);
  if (ClientFirstName.length == 0)
  {
		
		FirstNameValid=false;
  }
  else
  {
		FirstNameValid=true
  }
  if (ClientLastName.length == 0)
  {
		
		LastNameValid=false;
  }
  else
  {
		LastNameValid=true
  }
  if (DBA.length == 0)
  {
		
		DBAValid=false;
  }
  else
  {
		DBAValid=true
  }

  if ((FirstNameValid && LastNameValid) ||
      DBAValid)
  {
	IsValid=true;
	document.getElementById(FirstNameValidatorID).innerHTML=" ";
	document.getElementById(LastNameValidatorID).innerHTML=" ";
	document.getElementById(DBAValidatorID).innerHTML=" ";
  }
  else
  {
	IsValid=false;
	if (!FirstNameValid)
		document.getElementById(FirstNameValidatorID).innerHTML="*";
	else	
		document.getElementById(FirstNameValidatorID).innerHTML=" ";
	if (!LastNameValid)
		document.getElementById(LastNameValidatorID).innerHTML="*";
	else
		document.getElementById(LastNameValidatorID).innerHTML=" ";
	if (!DBAValid)
		document.getElementById(DBAValidatorID).innerHTML="*";
	else
		document.getElementById(DBAValidatorID).innerHTML=" ";
  }
  return IsValid;
}

//this is primarily for checking whether or not a first and last name are present AND a physical address and CSZ are present when saving a quote
function CheckClientNameAndDBAAndPhysAndCSZValidator(FirstNameID,LastNameID,FirstNameValidatorID,LastNameValidatorID,DBAID,DBAValidatorID,PhysAddID,PhysAddValidatorID,CSZID,CSZValidatorID)
{
  var IsValid=false;
  var FirstNameValid=false;
  var LastNameValid=false;
  var DBAValid=false;
  var PhysAddValid=false;
  var CSZValid=false;
  //debugger;
  ClientFirstName=new String(document.getElementById(FirstNameID).value);
  ClientLastName=new String(document.getElementById(LastNameID).value);
  DBA=new String(document.getElementById(DBAID).value);
  PhysAdd=new String(document.getElementById(PhysAddID).value);
  CSZ=new String(document.getElementById(CSZID).value);
  if (ClientFirstName.length == 0)
  {
		
		FirstNameValid=false;
  }
  else
  {
		FirstNameValid=true
  }
  if (ClientLastName.length == 0)
  {
		
		LastNameValid=false;
  }
  else
  {
		LastNameValid=true
  }
  if (DBA.length == 0)
  {
		
		DBAValid=false;
  }
  else
  {
		DBAValid=true
  }
  if (PhysAdd.length == 0)
  {
		
		PhysAddValid=false;
  }
  else
  {
		PhysAddValid=true
  }
  if (CSZ.length == 0)
  {
		
		CSZValid=false;
  }
  else
  {
		CSZValid=true
  }



  if (((FirstNameValid && LastNameValid) ||
      DBAValid) &&
		PhysAddValid && CSZValid)
  {
	IsValid=true;
	document.getElementById(FirstNameValidatorID).innerHTML=" ";
	document.getElementById(LastNameValidatorID).innerHTML=" ";
	document.getElementById(DBAValidatorID).innerHTML=" ";
	document.getElementById(PhysAddValidatorID).innerHTML=" ";
	document.getElementById(CSZValidatorID).innerHTML=" ";
  }
  else
  {
	IsValid=false;
	if (!FirstNameValid)
		document.getElementById(FirstNameValidatorID).innerHTML="*";
	else	
		document.getElementById(FirstNameValidatorID).innerHTML=" ";
	if (!LastNameValid)
		document.getElementById(LastNameValidatorID).innerHTML="*";
	else
		document.getElementById(LastNameValidatorID).innerHTML=" ";
	if (!DBAValid)
		document.getElementById(DBAValidatorID).innerHTML="*";
	else
		document.getElementById(DBAValidatorID).innerHTML=" ";
	if (!PhysAddValid)
		document.getElementById(PhysAddValidatorID).innerHTML="*";
	else
		document.getElementById(PhysAddValidatorID).innerHTML=" ";
	if (!CSZValid)
		document.getElementById(CSZValidatorID).innerHTML="*";
	else
		document.getElementById(CSZValidatorID).innerHTML=" ";

  }
  return IsValid;
}


function EnforceWithinRange(Value,HighValue,LowValue)
{
	return EnforceLowRange(EnforceHighRange(Value,HighValue),LowValue);
}

function EnforceLowRange(Value,LowValue)
{
	var tempValue=ToDouble(Value);
	var tempLow=ToDouble(LowValue);
	if (tempValue < tempLow)
		return tempLow;
	return tempValue;
}

function EnforceHighRange(Value,HighValue)
{
	var tempValue=ToDouble(Value);
	var tempHigh=ToDouble(HighValue);
	if (tempValue > tempHigh)
		return tempHigh;
	return tempValue;
}

//this works.  It only strips out $ for now though
function ToDouble(StringNum)
{
	var Temp=String(StringNum);
	Temp=Temp.replace('$','');
	try
	{
		var Result=parseFloat(Temp);
		if (isNaN(Result))
			Result=0.0;
	}
	catch(error)
	{
		var Result=0.0;
	}
	return Result;
}


/*
function MakeTextBoxRequired(TextBox)
{
	var text=new String();
	var newid=new String();
	var newstyle=new String();
	newid=TextBox.id+"Validator";
	newstyle="Left: "+(TextBox.style.leftPos+TextBox.style.widthPos+10)+
			 "px; Top: "+TextBox.style.Top+
			 "; position:"+TextBox.style.position+
			 "; Z-INDEX: "+TextBox.style.zindex+
			 ";  COLOR: red";
	TextBox.onblur=checkRequired
}

function checkRequired(parentElement,Tag,id,style,attributes,inner)
{
	if (this.value.length==0)
	{
		if (!DoesNodeExist(this.parentElement,newid))
		{
			myCreateElement(this.parentElement,"DIV",newid,newstyle," ","* Required");
		}
	}
	else
	{
		if (DoesNodeExist(this.parentElement,newid))
		{
			myDeleteNode(this.parentElement,id);
		}
	}
};


function DoesNodeExist(ParentElement,id)
{
	if (ParentElement.document.getElementById(id))
		return true;
	else
		return false;
}

function myCreateElement(ParentElement,Tag,id,style,attributes,inner)
{
	debugger;
	var tagtext=new String();
	
	tagtext="<"+Tag+" id='"+id+"' style='"+style+"' "+attributes+" ";
	if (Tag.indexOf("INPUT",0))
		tagtext+="/>";
	else
		tagtext+=">"+inner+"</"+Tag+">";
	var node = document.createElement(Tag);
	ParentElement.appendChild(node);
	
}

function myDeleteNode(parentElement,id)
{
	var node=parentElement.document.getElementById(id);
	if (!node)
		return;
	parentElement.removeChild(node);
}
	

function CreateMyElement(Tag,id,style,attributes,inner)
{
	debugger;
	var tagtext=new String();
	
	tagtext="<"+Tag+" id='"+id+"' style='"+style+"' "+attributes+" ";
	if (Tag.indexOf("INPUT",0))
		tagtext+="/>";
	else
		tagtext+=">"+inner+"</"+Tag+">";
	var node = document.createElement(Tag);
	node.id=id;
//	node.
	return node;
	
}
*/
/*
function GetAbsoluteLeft(Element)
{
	var Left=Element.style.posLeft;
	var CurrElement=Element;
	while (CurrElement.parentElement)
	{
		CurrElement=CurrElement.parentElement;
		if (CurrElement.tagName!="TD")
		{
			Left+=CurrElement.offsetLeft;
		}
	
	}
	//debugger;
	return Left;
}

function GetAbsoluteTop(Element)
{
	var Top=Element.style.posTop;
	var CurrElement=Element;
	while (CurrElement.parentElement)
	{
		CurrElement=CurrElement.parentElement;
		if (CurrElement.tagName!="TD")
		{
			Top+=CurrElement.offsetTop;
		}

	}
	return Top;
}
*/

function GetAbsoluteLeft(Element)
{
	var Left=parseInt(Element.style.left);
	if (isNaN(Left))
		Left=0;
	var CurrElement=Element;
	//alert("Is Netscape = "+IsNetscape);
	while (CurrElement.parentNode)
	{
		CurrElement=CurrElement.parentNode;
		if (CurrElement.tagName!="TD")
		{
			if (IsNetscape)
			{
				if (CurrElement.style)
				{
					temp=parseInt(CurrElement.style.left);
					if (!isNaN(temp))
						Left+=temp;
				}
			}
			else
			{
				temp=parseInt(CurrElement.offsetLeft);
				if (isNaN(temp))
					temp=0;
				Left+=temp;
			}
		}
	}

	return Left;
}

function GetAbsoluteTop(Element)
{
	var Top=parseInt(Element.style.top);
	if (isNaN(Top))
		Top=0;

	var CurrElement=Element;
	while (CurrElement.parentNode)
	{
		CurrElement=CurrElement.parentNode;
//		Top+=CurrElement.offsetTop;
/*		if (CurrElement.style.posTop==0 && CurrElement.tagName=="TD")
		{
			Top+=CurrElement.offsetTop;
		}
		else
			Top+=CurrElement.style.posTop;
*/	

		if (CurrElement.tagName!="TD")
		{
			if (IsNetscape)
			{
				if (CurrElement.style)
				{
					temp=parseInt(CurrElement.style.top);
					if (!isNaN(temp))
						Top+=temp;
				}
			}
			else
			{
				temp=parseInt(CurrElement.offsetTop);
				if (isNaN(temp))
					temp=0;
				Top+=temp;
			}
		}

	}
	return Top;
}

function VerifyRangeInTextBox(Control,Lower,Upper,ShowError)
{
	var myValue=parseInt(Control.value,10);
	if (myValue < Lower)
		myValue=Lower;
	if (myValue > Upper)
		myValue=Upper;
	Control.value=myValue;
	Message="Number should be in the range of "+Lower+" - "+Upper;
	if (ShowError==true)
		alert(Message);

}
function SubmitApplication()
{
	var Result=window.confirm("Are you sure you are ready to submit the application?  (Click OK to submit application)");
	if (Result==true)
	{
		return true;
		//document.getElementById('SubmissionStatus').value="true";
		//document.getElementById('TestApp').click();
	}
	else
		return false;
}

function DisableElement(Element)
{
	Element.setAttribute("disabled","disabled");
}

function OnHighlight(Element)
{

	if (Element.mySelected==null)
		Element.style.backgroundColor="#bbb333";
	Element.style.textDecoration="none";
//	Element.style.borderLeftColor="silver";
//	Element.style.borderTopColor="silver";
}
function OnUnHighlight(Element)
{
	if (Element.mySelected==null)
		Element.style.backgroundColor="#ccc333";
	Element.style.textDecoration="none";
//	Element.style.borderLeftColor="black";
//	Element.style.borderTopColor="black";
}

function PostChangeScreens(Target,SourceElement)
{
	__doPostBack(SourceElement.id/*.replace("_","$")*/,Target);
}

function ChangeScreens(TargetElement,SourceElement)
{
	for (i=0;i < document.getElementById(TargetElement).parentElement.parentElement.children.length;++i)
	{
		document.getElementById(TargetElement).parentElement.parentElement.children[i].children[0].style.zIndex=100;
	}
	document.getElementById(TargetElement).style.zIndex=170;
	
	//debugger;
	if (SourceElement!=null)
	{
		for (y=0;y < SourceElement.parentElement.children.length;++y)
		{
			if (SourceElement.parentElement.children[y].mySelected!=null)
			{
				SourceElement.parentElement.children[y].mySelected=null;
				//debugger;
				//if (SourceElement.parentElement.children[y].style
				SourceElement.parentElement.children[y].style.backgroundColor="#ccc333";
				//SourceElement.parentElement.children[y].style.textDecoration="none";
				SourceElement.parentElement.children[y].style.borderLeftColor="black";
				SourceElement.parentElement.children[y].style.borderTopColor="black";
				//SourceElement.parentElement.children[y].style.borderRightColor="silver";
				//SourceElement.parentElement.children[y].style.color="black";
			}
		}

		if (SourceElement.document.getElementById("CurrentTab")!=null)
			SourceElement.document.getElementById("CurrentTab").value=SourceElement.id;
		SourceElement.style.backgroundColor="#999222";
	//	SourceElement.style.textDecoration="underline";
		SourceElement.style.borderLeftColor="silver";
		SourceElement.style.borderTopColor="silver";
		//SourceElement.style.borderRightColor="black";
		//SourceElement.style.color="yellow";
		SourceElement.mySelected="true";
	}	
}

//this doesn't work!
//
//	<DIV style="DISPLAY: block; Z-INDEX: 111; LEFT: 24px; WIDTH: 184px; POSITION: absolute; TOP: 520px; HEIGHT: 24px"
//		ms_positioning="GridLayout" onmouseover="javascript:SetupScroll(this);"><span style="Left:0px; position:relative">Test</span></DIV>

function SetupScroll(Element)
{
	SetInterval("ScrollThis("+Element+")",10);
}

function ScollThis(Element)
{
	//debugger;
	Element.children[0].style.posLeft += 10;
	//Element.scrollLeft=Element.scrollWidth;
	if (Element.children[0].style.posLeft >= Element.scrollWidth)
		 Element.children[0].style.posLeft=0;
}
/////////////

		
function TrapEnter(e)
{
	if(!e)
	 var e = window.event;

	var code;
	if (IsNetscape)
	{
		tname=e.target.tagName
		if (e.target.type!=null)
			tname=e.target.type;
		if(e.which)
			code = e.which;
	}
	else
	{
		tname=event.srcElement.tagName
		if (event.srcElement.type!=null)
			tname=event.srcElement.type;
		if(e.keyCode)
			code = e.keyCode;
	}

	if( code == 13 && tname!="submit" && tname!="button")
	 {
		code=9;
	}
	if (IsNetscape)
	{
		
		if(e.which)
			e.which = code;
			
	}
	else
	{
		if(e.keyCode && code!=e.keyCode)
			e.keyCode = code;
	}
	
}

function SetupHandlers()
{
	DetectNavigator();
	if (IsNetscape)
	{
		document.onkeydown = TrapEnter;	
	}
	else
	{
		document.onkeydown = TrapEnter;	
	}
}
		

		
function TrapEnterNetscape(e)
{

//	if (IsNetscape)//navigator.userAgent("Netscape")!=-1 || navigator.userAgent("Firefox")!=-1)
	{
		//var e = window.event;
		if (e) 
		{
			tname=e.target.tagName
			//opera.postError('OK 1'); // Debug message
			if (e.target.type!=null)
			{
				//opera.postError('OK 2'); // Debug message
				tname=e.target.type;
				//opera.postError('OK 3'); // Debug message
				
			}

			if (e.keyCode==13 && tname!="submit" && tname!="button")
			{
				try
				{
						//opera.postError('OK 4'); // Debug message
						e.keyCode=9;
				}
				catch (e2)
					{
						
						//alert ("Firefox sucks.(catch)")
						//opera.postError(e+'OK 5'); // Debug message
						return false;
					}
			}
		}
		else
		{
		//alert ("Firefox sucks.")
		}
		
	}
}

function TrapEnterIE()
{

	{
		tname=event.srcElement.tagName
		//opera.postError('OK 1'); // Debug message
		if (event.srcElement.type!=null)
		{
			//opera.postError('OK 2'); // Debug message
			tname=event.srcElement.type;
			//opera.postError('OK 3'); // Debug message
			
		}

		if (event.keyCode==13 && tname!="submit" && tname!="button")
		{
			try
			{
					//opera.postError('OK 4'); // Debug message
					event.keyCode=9;
			}
			catch (e)
				{
					//opera.postError(e+'OK 5'); // Debug message
					return false;
				}
		}

	}
}



function DetectNavigator()
{
bname=navigator.userAgent;
	//alert(bname);
	//bname=navigator.appName;
	if (bname.indexOf("Netscape")!=-1 || bname.indexOf("Firefox") != -1)
	{
	//alert(bname);
		IsNetscape=true;
//		if (bname.indexOf("Firefox") == -1)
			//window.location="NetscapeError.htm";
	}
	else
	{
	//alert(bname);
		IsNetscape=false;
	}

}		

function StoningtonLloydswn(elmnt)
{
	if (IsNetscape)
	{
		if (document.getElementById(elmnt).style.left >= "0px")
			return 1;
		else
			return 0;
	}
	else
	{
		if (document.getElementById(elmnt).style.posLeft >= 0)
			return 1;
		else
			return 0;
	}
}

function SetFocus(ID)
{
	document.getElementById(ID).focus();
}

function FlipMenus(elmnt,Left)
{
/*	if (IsNetscape)
	{
		for (index=0;index < ElemntList.length;++index)
		{
			if (StoningtonLloydswn(ElemntList[index]) && elmnt!=ElemntList[index])
			{
				document.getElementById(ElemntList[index]).style.left=StdLeftHidden+"px";
			}
		}
		showmenu(elmnt,Left);	
	}
	else
	{
		for (index=0;index < ElemntList.length;++index)
		{
			if (StoningtonLloydswn(ElemntList[index]) && elmnt!=ElemntList[index])
			{
				document.getElementById(ElemntList[index]).style.posLeft=StdLeftHidden;
			}
		}
		showmenu(elmnt,Left);	
	}
*/
}


function FlipMenusAccountPage(elmnt,Left)
{
	if (IsNetscape)
	{
		for (index=0;index < AccountInfoElemntList.length;++index)
		{
			if (StoningtonLloydswn(AccountInfoElemntList[index]) && elmnt!=AccountInfoElemntList[index])
			{
				document.getElementById(AccountInfoElemntList[index]).style.left=StdLeftHidden+"px";
			}
		}
		showmenu(elmnt,Left);	
	}
	else
	{
		for (index=0;index < AccountInfoElemntList.length;++index)
		{
			if (StoningtonLloydswn(AccountInfoElemntList[index]) && elmnt!=AccountInfoElemntList[index])
			{
				document.getElementById(AccountInfoElemntList[index]).style.posLeft=StdLeftHidden;
			}
		}
		showmenu(elmnt,Left);	
	}
}




function showmenu(elmnt,Left)
{
	if (IsNetscape)
	{
		document.getElementById(elmnt).style.left=Left+"px";
	
//		if (intShow[CurrentWindow]!=null)
//			CurrentWindow++;
//		intShow[CurrentWindow]=setInterval("show('"+elmnt+"',"+Left+")",10);
	}
	else
	{
		if (intShow[CurrentWindow]!=null)
			CurrentWindow++;
		intShow[CurrentWindow]=setInterval("show("+elmnt+","+Left+")",10);
	}
}

function hidemenu(elmnt,Left)
{
	if (IsNetscape)
	{
		document.getElementById(elmnt).style.left=Left+"px";
//		if (intHide[CurrentWindow]!=null)
//			CurrentWindow++;
//		intHide[CurrentWindow]=setInterval("hide('"+elmnt+"',"+Left+")",10);
	}
	else
	{
		if (intHide[CurrentWindow]!=null)
			CurrentWindow++;
		intHide[CurrentWindow]=setInterval("hide("+elmnt+","+Left+")",10);
	}
}

function show(elmnt,Left)
{
	if (IsNetscape)
	{
		if (document.getElementById(elmnt).style.left < Left)
		{
			document.getElementById(elmnt).style.left=document.getElementById(elmnt).style.left+speed;
		}
		else
		{
			document.getElementById(elmnt).style.left=Left;
			clearInterval(intShow[CurrentWindow]);
			CurrentWindow--;
		}
	}
	else
	{
		if (elmnt.style.posLeft < Left)
		{
			elmnt.style.posLeft=elmnt.style.posLeft+speed;
		}
		else
		{
			elmnt.style.posLeft=Left;
			clearInterval(intShow[CurrentWindow]);
			CurrentWindow--;
		}
	}
}

function hide(elmnt,Left)
{
	if (IsNetscape)
	{
		if (document.getElementById(elmnt).style.left > Left)
		{
			document.getElementById(elmnt).style.left=document.getElementById(elmnt).style.left-speed;
		}
		else
		{
			clearInterval(intHide[CurrentWindow]);
			CurrentWindow--;
		}
	}
	else
	{
		if (elmnt.style.posLeft > Left)
		{
			elmnt.style.posLeft-=speed;
		}
		else
		{
			clearInterval(intHide[CurrentWindow]);
			CurrentWindow--;
		}
	}
}		

mouseover=false;
function coordinates(elmnt)
{
	if (event.srcElement.id!=elmnt)
	{
		mouseover=false;
		return;
	}
	if (event.srcElement.id==elmnt)
	{
		mouseover=true;
		pleft=document.getElementById(elmnt).style.pixelLeft;
		ptop=document.getElementById(elmnt).style.pixelTop;
		xcoor=event.clientX;
		ycoor=event.clientY;
		//var temp=moveImage(elmnt)
		//document.onmouseover=temp;
		
//		document.getElementById(elmnt).onmousemove=moveImage(elmnt);
	}
}

function moveImage(elmnt)
{
	if (mouseover&&event.button==1)
	{
		document.getElementById(elmnt).style.pixelLeft=pleft+event.clientX-xcoor;
		document.getElementById(elmnt).style.pixelTop=ptop+event.clientY-ycoor;
		return false;
	}
}

function mouseup()
{
	mouseover=false;
}




function DragWindow(elmnt)
{
}

function ReleaseWindow(elmnt)
{
}


/////////////////////////
//Older Functions - Need to have dependability for these removed
/////////////////////////
function showmenu1(elmnt)
{
	if (IsNetscape)
	{
		document.getElementById(elmnt).style.left="150px";
//		clearInterval(intHide1);
//		intShow1=setInterval("show1('"+elmnt+"')",10);
	}
	else
	{
		clearInterval(intHide1);
		intShow1=setInterval("show1("+elmnt+")",10);
	}

}

function hidemenu1(elmnt)
{
	if (IsNetscape)
	{
		document.getElementById(elmnt).style.left="-610px";
		//clearInterval(intShow1);
		//intHide1=setInterval("hide1('"+elmnt+"')",10);
	}
	else
	{
		clearInterval(intShow1);
		intHide1=setInterval("hide1("+elmnt+")",10);
	}
}

function show1(elmnt)
{
	if (IsNetscape)
	{
		if (document.getElementById(elmnt).style.left < 150)
		{
			document.getElementById(elmnt).style.left=document.getElementById(elmnt).style.left+speed;
		}
		else
		{
			document.getElementById(elmnt).style.left=150;
			clearInterval(intShow1);
		}
	}
	else
	{
		if (elmnt.style.posLeft < 150)
		{
			elmnt.style.posLeft=elmnt.style.posLeft+speed;
		}
		else
		{
			elmnt.style.posLeft=150;
			clearInterval(intShow1);
		}
	}
}

function hide1(elmnt)
{
	if (IsNetscape)
	{
		if (document.getElementById(elmnt).style.left > -610)
		{
			document.getElementById(elmnt).style.left-=speed;
		}
		else
		{
			clearInterval(intHide1);
		}
	}
	else
	{
		if (elmnt.style.posLeft > -610)
		{
			elmnt.style.posLeft-=speed;
		}
		else
		{
			clearInterval(intHide1);
		}
	}
}		

function DisplayMenu(elmnt,Top,Left)
{

	if (IsNetscape)
	{
		elmnt.style.left=Left+"px";
		elmnt.style.top=Top+"px";
		//alert("DisplayMenu is running - IsNetscape=TRUE");
		
	}
	else
	{
		//alert("DisplayMenu is running - IsNetscape=FALSE");
		elmnt.style.posLeft=Left;
//		elmnt.style.posTop=Top-elmnt.style.posHeight;
		elmnt.style.posTop=Top;
	}
}

function PutAwayMenu(elmnt)
{
	//if (
	if (IsNetscape)
	{
		//alert("PutAwayMenu is running");
		elmnt.style.left="-610px"
	}
	else
	{
		elmnt.style.posLeft=-610;
	}
}

function OnRollover()
{
	if (this.event.toElement.tagName=="TD")
		this.event.toElement.style.backgroundColor="#81bfe7";
	else
		if (this.event.toElement.tagName=="A")
			this.event.toElement.parentElement.style.backgroundColor="#81bfe7";
}

function OnRollOut()
{

	if (this.event.fromElement.tagName=="TD")
		this.event.fromElement.style.backgroundColor="#70aed6";//"#ffffff";
	else
		if (this.event.fromElement.tagName=="A")
			this.event.fromElement.parentElement.style.backgroundColor="#70aed6";//"#ffffff";
}
