﻿var Section="";
var Dropped="";
var Rolled="";

var Nav=navigator.appName.toLowerCase().indexOf("netscape")>-1;

function el(id){
	return document.getElementById(id);
}

function els(id){
	return document.getElementById(id).style;
}

function RollMe(id){
	if(id){
		el(id).src=el(id).src.replace("_n","_o");
		Rolled=id;
	}else{
		el(Rolled).src=el(Rolled).src.replace("_o","_n");
	}
}

if(Nav)onload=addEventListener('load',ShowSection,false);
else onload=ShowSection;
function ShowSection(){
	url=unescape(location.href.toLowerCase());
	if(url.indexOf("welcome")>-1){
		Section="Welcome";
	}else if(url.indexOf("digital br")>-1){
		Section="Digital";
	}else if(url.indexOf("website g")>-1){
		Section="Website";
	}else if(url.indexOf("wap")>-1){
		Section="WAP";
	}
	if(!el("m"+Section))return
	el("m"+Section).className=el("m"+Section).className+"Current";
	if(url.indexOf("introduction")==-1&&Section!="Welcome")el("Cookies").innerHTML=TitleCase(url);
}

function TitleCase(txt){
	txt=txt.substr(txt.indexOf(Section.toLowerCase()+" "));
	txt=txt.replace(".htm","");
	
	var arrWords=txt.split(" ");
	for(var i=0;i<arrWords.length;i++){
		arrWords[i]=arrWords[i].substr(0,1).toUpperCase()+arrWords[i].substr(1);
		arrWords[i]=CheckCase(arrWords[i]);
	}
	arrWords=String(arrWords).replace(/,/g," ").split("/");
	for(var i=0;i<arrWords.length;i++){
		arrWords[i]=arrWords[i].substr(0,1).toUpperCase()+arrWords[i].substr(1)
		arrWords[i]=CheckCase(arrWords[i]);
	}
	arrWords[0]='<a href="../Introduction.htm">'+arrWords[0]+'</a>';
	return String(arrWords).replace(/,/g," / ");
}

function CheckCase(txt){
	if(txt.length<=3&&txt!="Mtn"&&txt!="Html")return txt.toLowerCase()
	if(txt.indexOf("Mtnl")>-1){
		return txt.replace("Mtnl","MTNL");
	}else if(txt.indexOf("Mtn")>-1){
		return txt.replace("Mtn","MTN");
	}else if(txt.indexOf("Html")>-1){
		return txt.replace("Html","HTML");
	}else if(txt.indexOf("Wap")>-1){
		return txt.replace("Wap","WAP");
	}else if(txt.indexOf("Template")>-1){
		return(txt.substr(0,9)+txt.substr(9).toUpperCase());
	}else{
		return txt;
	}
}

var tPickup;
function Drop(id){
	if(Dropped!=id)Pickup();
	if(!id)id=Dropped;
	if(tPickup)clearTimeout(tPickup);
	if(Section!=id&&el(id).className.indexOf("Current")==-1)el(id).className+="Current";
	Dropped=id;
	
	tmpid = id.replace("aTop","");
	if(el(tmpid+"divSubMenu")){
		el(tmpid+"divSubMenu").style.display='block';
	}
}

function ReadyPickup(){
	tPickup=setTimeout(Pickup,500);
}

function Pickup(){
	if(Dropped=="")return;
	tmpid = Dropped.replace("aTop","");
	if(el(tmpid+"divSubMenu"))el(tmpid+"divSubMenu").style.display='none';
	if(Dropped!=Section)el(Dropped).className=el(Dropped).className.replace("Current","");
}



function change(id){ 

	 tmpid = id.replace("imgPlus","");

     ID = document.getElementById(tmpid+"trType2_2"); 
     imgID = document.getElementById(id);
     linkID = document.getElementById(tmpid+"aMenuType2"); 
     
     if(ID.style.display == "inline"){ 
          imgID.src='../images/global/plus.gif';
          ID.style.display = "none"; 
          linkID.style.color = ""; 

          }
     else if(ID.style.display == "none") {
          imgID.src='../images/global/minus.gif' ; 
          ID.style.display = "inline"; 
          linkID.style.color = "#909090"; 

          }
}

function change2(id){ 
     ID = document.getElementById(id); 
     imgID = document.getElementById("img"+id);
     
     if(ID.style.display == "inline"){ 
          imgID.src='../images/global/plus.gif';
          ID.style.display = "none"; 
          }
     else if(ID.style.display == "none") {
          imgID.src='../images/global/minus.gif' ; 
          ID.style.display = "inline"; 
          }
      }

/*  POPUP FUNCTION */
