// JavaScript Document

var delay_hide=500;

function initStatLyr() {
	// args: id, left, top, w, h, duration of glide to location onscroll, acceleration factor
  // acceleration factor should be -1 to 1. -1 is full deceleration
	var statLyr = new Glider("glideDivz",600,150,363,900,660,-1);
	var statLyr = new Glider("LeftMenuz",-1,140,null,140,600,-1);
  statLyr.show();
}



function resetit(e){
delayhide=setTimeout("manageTopMenu(-1)",delay_hide);
}
function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function manageTopMenu(mnuname,action)
{

clear_delayhide();
if (mnuname != -1)
{

  	  MM_changeProp('submnuItemCompnay','','style.display','none','DIV');
	  MM_changeProp('submnuItemPractices','','style.display','none','DIV');
	  MM_changeProp('submnuItemServices','','style.display','none','DIV');
	  MM_changeProp('submnuItemOffshore','','style.display','none','DIV');
	  MM_changeProp('submnuItemIndustries','','style.display','none','DIV');
	  MM_changeProp('submnuItemClients','','style.display','none','DIV');
  	  MM_changeProp('submnuItemCareers','','style.display','none','DIV');

      MM_changeProp('topMenu','','style.backgroundImage','url(none)','DIV');

  MM_changeProp('topMenu','','style.backgroundImage','url(/images/topmenu/'+mnuname.id+'.gif)','DIV');
  MM_changeProp('sub'+ mnuname.id,'','style.display','block','DIV')
}
else
{
	  MM_changeProp('submnuItemCompnay','','style.display','none','DIV');
	  MM_changeProp('submnuItemPractices','','style.display','none','DIV');
	  MM_changeProp('submnuItemServices','','style.display','none','DIV');
	  MM_changeProp('submnuItemOffshore','','style.display','none','DIV');
	  MM_changeProp('submnuItemIndustries','','style.display','none','DIV');
	  MM_changeProp('submnuItemClients','','style.display','none','DIV');
  	  MM_changeProp('submnuItemCareers','','style.display','none','DIV');

      MM_changeProp('topMenu','','style.backgroundImage','url(none)','DIV');
}



}

function TimerFunction(functionname,objectref,timeline)
{
timerid = setTimeout(eval('"'+functionname+'(\'' +objectref.id+ '\',\'mout\')"'),timeline);
//document.form1.textfield.value = timerid;
}

function FunctionHideMenu(mnuname)
{
MM_changeProp('sub'+ mnuname,'','style.display','none','DIV')
MM_changeProp('topMenu','','style.backgroundImage','url(none)','DIV');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2002-4 by Sharon Paine
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function initGlideLayers() {
  var i, el;
  var glideLyrs = new Array();

  // Set up your layers here
  // arguments: id, amount to be visible (left), top, width, height
	// If you don't specify the top position (null), code calculates
	// based on height of previous layer, leaving a 2px gap
//  glideLyrs[0] = new dynObj('glideDivsearch', 536, 0, 200, 50);
  glideLyrs[0] = new dynObj('glideDiv1', 536, 180, 200, 151); 
  glideLyrs[1] = new dynObj('glideDiv2', 536, 360, 200, 151); 
  glideLyrs[2] = new dynObj('glideDiv3', 536, 540, 200, 151);
  glideLyrs[3] = new dynObj('glideDiv4', 536, 720, 200, 151);
  glideLyrs[4] = new dynObj('glideDiv5', 536, 900, 200, 151);
  glideLyrs[5] = new dynObj('glideDiv6', 536, 1100, 200, 151);
  glideLyrs[6] = new dynObj('glideDiv7', 536, 1280, 200, 151);





 // glideLyrs[2] = new dynObj('glideDiv2', 536, 200, 200, 151);




  for (i=0; glideLyrs[i]; i++) {
		// hold amount to be left visible
		glideLyrs[i].xOff = glideLyrs[i].x;
		if ( !glideLyrs[i].y ) // position based on previous glideLyrs height and position
			if ( glideLyrs[i-1] ) glideLyrs[i].y = glideLyrs[i-1].y + glideLyrs[i-1].h + 2;
		glideLyrs[i].shiftTo( -(glideLyrs[i].w - glideLyrs[i].xOff), glideLyrs[i].y );
		glideLyrs[i].show();
    el = dynObj.getElemRef( glideLyrs[i].id );
    if (el) {
      el.onmouseover = slideIntoView;
      el.onmouseout = slideOutOfView;
    }
  }

}

function slideIntoView() {

  var glideLyr = dynObj.getInstance(this.id);
  glideLyr.slideTo(170, null,250, -.48);

  MM_changeProp('glideDiv','','style.zIndex','300','DIV');
}

function slideOutOfView(e) {
  var glideLyr = dynObj.getInstance(this.id);
	e = e? e: window.event;
  var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
  if ( toEl != glideLyr.el && !contained(toEl, glideLyr.el) )
	  glideLyr.slideTo( -(glideLyr.w - glideLyr.xOff), null, 300, -.8);

	  MM_changeProp('glideDiv','','style.zIndex','6','DIV');
}

// returns true if oNode is contained by oCont (container)
function contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}

function LeftMenu(mnuId)
{
//this.smSyncml.style.display=='none' ? 'block':'none'
var obj = MM_findObj(mnuId);
var newprop=(obj.style.display =='none') ? 'block':'none';
MM_changeProp(mnuId,'','style.display',newprop,'DIV');
}

function TabMenu(mnuId)
{
//this.smSyncml.style.display=='none' ? 'block':'none'
var prefix="TabConent";
var dynaId,objdynaId;
	for(i=1;i<50;i++)
	{
		dynaId = prefix +i;
		MM_changeProp(dynaId,'','style.display','none','DIV');
	}
//var obj = MM_findObj(mnuId);
MM_changeProp(mnuId,'','style.display','block','DIV');
restoreTabs(mnuId.substr(9,2));
}
function Teaser(mnuId)
{
//this.smSyncml.style.display=='none' ? 'block':'none'
var prefix="Teaser";
var dynaId,objdynaId;
	for(i=1;i<50;i++)
	{
		dynaId = prefix +i;
		MM_changeProp(dynaId,'','style.display','none','DIV');
	}
//var obj = MM_findObj(mnuId);
MM_changeProp(mnuId,'','style.display','block','DIV');

}

function TabMenuNevigator(direction)
{
var prefix="TabConent",newTabId;
var dynaId,objdynaId;
	for(i=1;i<50;i++)
	{
		dynaId = prefix +i;
		var objdynaId = MM_findObj(dynaId);
		if (!objdynaId) ////Added to remove error from JavaScript. Dharmesh 12/March/07 if Tab does not exist.
		{
			return;
		}
		if(objdynaId.className == 'activediv')
		{
			MM_changeProp(dynaId,'','className','normdiv','DIV');
			objdynaId = null;
			break;
		}

	}
	curTabId =  i;


	if (direction=="next")
	{
	curTabId++;
	newTabId = prefix +curTabId;
	var objdynaId = MM_findObj(newTabId);
		if (objdynaId)
		{
		MM_changeProp(newTabId,'','className','activediv','DIV');
		}
		else
		{
			//Assuming was at last tab so moving to first tab now.
			curTabId--;
			newTabId = prefix +curTabId;
			MM_changeProp(newTabId,'','className','activediv','DIV');

		}

	}
	else if(direction=="prev")
	{
	curTabId--;
	if (curTabId <1){curTabId =1}
	newTabId = prefix +curTabId;
	MM_changeProp(newTabId,'','className','activediv','DIV');
	}
	else

	{
		curTabId = direction;
		if (curTabId >6){curTabId =6}
		newTabId = prefix +curTabId;
		MM_changeProp(newTabId,'','className','activediv','DIV');
	}
	
	resetTabs (direction,curTabId);
	restoreTabs	(curTabId);
}

function findTabs()
{

	for (i=1;i<50;i++)
	{
	var objtab = MM_findObj('TabConent'+i);
	//Create rutime object and count them
			if (!objtab)
			{
				//Check if object is found.
				i--;
				break;

			}

	}
return i; //returns total tabal
}
function restoreTabs(curTabId)
{
	/*
	for (i=1;i<5;i++)
	{
		//alert ("Function Count :" +i);
	var objthicktabs = MM_findObj('TabLink'+i);
	
		if(!hasInnerText){
			tabStatus = objthicktabs.textContent;
		} else{
		  tabStatus = objthicktabs.innerText;
		}
		//alert ("tabStatus :" + tabStatus + "ctab : " +curTabId);
		if (tabStatus == curTabId)
		{

			 objthicktabs.childNodes[0].style.borderBottomStyle='solid';
			 objthicktabs.childNodes[0].style.borderBottomWidth='2px';
			 objthicktabs.childNodes[0].style.borderBottomColor ='56AAEE';
			 objthicktabs.childNodes[0].style.backgroundColor='56AAEE';


		}
		else
		{
			 objthicktabs.childNodes[0].style.borderBottomStyle='solid';
			 objthicktabs.childNodes[0].style.borderBottomWidth='1px';
			 objthicktabs.childNodes[0].style.borderBottomColor ='ffffff';
			 objthicktabs.childNodes[0].style.backgroundColor='56AAEE';
		}		
	}
	
	var leftarrow = document.getElementById('leftmostitem');
	leftarrow.childNodes[0].style.borderBottomStyle='solid';
	leftarrow.childNodes[0].style.borderBottomWidth='1px';
	leftarrow.childNodes[0].style.borderBottomColor ='ffffff';
	leftarrow.childNodes[0].style.backgroundColor='56AAEE';
	
	var rightarrow= document.getElementById('rightmostitem');
	rightarrow.childNodes[0].style.borderBottomStyle='solid';
	rightarrow.childNodes[0].style.borderBottomWidth='1px';
	rightarrow.childNodes[0].style.borderBottomColor ='ffffff';
	rightarrow.childNodes[0].style.backgroundColor='56AAEE';
	*/
}

function resetTabs(direction,newTabIds)
{
var maxTabs =findTabs();
var prefix="TabConent",newTabId;
var newTabId = prefix +curTabId;
var tabStatus;
id ="TabLink1";
//alert (curTabId);





	for (i=1;i<6;i++)
	{
		//alert ("Function Count :" +i);
		var objthicktabs = MM_findObj('TabLink'+i);		
		
		if(objthicktabs)
		{		
			var oldHtml = objthicktabs.innerHTML;
		
			if(!hasInnerText){
				tabStatus = objthicktabs.textContent;
			} else {
			  tabStatus = objthicktabs.innerText;
			}
		
			//alert (tabStatus);
			if (direction == "next")
				{
					if (i ==1)
					{
		
						if (tabStatus <(maxTabs-3) )
						{tabStatus++; }
		
						else
						{//restoreTabs();
		
						return;	}
					}
					else
					{
						//alert ("here 1");
						tabStatus++;
					}
		
		
				/*
				tabStatus++;
					var objthicktabstmp = MM_findObj('TabConent'+tabStatus);
					//alert (objthicktabstmp.id);
					if (!objthicktabstmp)
					{
								tabStatus--;
								//var objthicktabs = MM_findObj('TabLink'+tabStatus);
					}
		
				*/
		
				}
				else
				{
					if (tabStatus <=1)
					{
						return;
						alert("here 2: " + tabStatus);
						tabStatus =tabStatus;
						}
						else
						{
							tabStatus--;
						}
		
				}
			objthicktabs.innerHTML = "<a  href='javascript:void(0);' onClick=TabMenu('TabConent" +tabStatus+"');>"+tabStatus+"</a>";
		}
	}


/*
if (oldHtml.search("2") > 1)
	{
		break;
	}
	}
	alert(i);


var objthicktabs = MM_findObj('TabLink1');
var oldHtml = objthicktabs.innerHTML;
alert(oldHtml.search("2"));


oldHtml = oldHtml.replace("1", "5");
oldHtml = oldHtml.replace("1", "5");
objthicktabs.innerHTML = oldHtml;
*/

}

function LeftMenutest(mnuId)
{
//this.smSyncml.style.display=='none' ? 'block':'none'

var obj = MM_findObj(mnuId);
var newprop=(obj.style.visibility =='visible') ? 'visible':'hidden';
//alert (newprop);
//MM_changeProp(mnuId,'','style.visibility',newprop,'DIV');

MM_showHideLayers(mnuId,'','hide');
}
function expandcollaps(obj)
{

var obj = MM_findObj(obj);
//alert (obj1.innerText);


//document.form1.textfield.value = obj.innerText;
	//MM_changeProp('smSyncml','','style.display','block','DIV');
	//MM_changeProp('smES','','style.display','block','DIV');
var mnuStatus ="";
	if(!hasInnerText){
    mnuStatus = obj.textContent;
} else{
  mnuStatus = obj.innerText;
}
mnuStatus = mnuStatus.substr(0,1);
//alert (mnuStatus);
if (mnuStatus == "+")
{

	MM_changeProp('smSyncml','','style.display','block','DIV');
	MM_changeProp('smES','','style.display','block','DIV');
	MM_changeProp(obj.id,'','innerHTML','<h1>-<img src="/images/tp.gif" width="5" border="0"><a href="javascript:void(0);" class="smalllink" >Services</a></h1>','DIV');
}
else
{
	MM_changeProp('smSyncml','','style.display','none','DIV');
	MM_changeProp('smES','','style.display','none','DIV');
	MM_changeProp(obj.id,'','innerHTML','<h1>+<img src="/images/tp.gif" width="5" border="0"><a href="javascript:void(0);" class="smalllink" >Services</a></h1>','DIV');
}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
