/* code for top-menu-dropdown-starts-here */

function showNav(objId, st){
	obj = document.getElementById(objId);
	if(document.getElementById(objId+"Sub")!=null)
	objSubNav = document.getElementById(objId+"Sub");

	
		if(st==1){
			if(obj.id != pgId)
			obj.className = "navAct";
			if(document.getElementById(objId+"Sub")!=null)
			objSubNav.style.visibility = "visible";
		} else {
			if(obj.id != pgId)
			obj.className = "nav";
			if(document.getElementById(objId+"Sub")!=null)
			objSubNav.style.visibility = "hidden";
		}
	
}

function showCurg(objPg){
	obj = document.getElementById(objPg);
	obj.className = 'navAct';
	
}

function showCurg1(objPg){
	obj = document.getElementById(objPg);
	obj.className = 'leftnavonpage';
}

function changeClass(obj1,st){
	if(st==1){
		obj1.className = "subnavo";
	} else {
		obj1.className = "subnav";
	}
}
/* code for top-menu-dropdown-ends-here */
/* code for left-nav-tree-menu-starts-here*/

var maxBlks;

// Check Monitor Resolution
function addPadding(){
	var objBody = document.getElementById("bodyObj");
	if ((screen.width<=800) && (screen.height<=600)){
		objBody.style.marginTop  = "0";
	} else {
		objBody.style.marginTop = "10";
	}
}

//Function to show/hide the block when one clicks on the heading
function showTable(objNo){
	objDiv = document.getElementById("divBlock"+objNo);
	objImg = document.getElementById("img"+objNo);
	if(objDiv.style.visibility == "hidden"){
		objDiv.style.position = "relative";
		objDiv.style.visibility = "visible";
		objImg.src = "images/nof_icon_title.gif"; 
	} else {
		objDiv.style.position = "absolute";
		objDiv.style.visibility = "hidden";
		objImg.src = "images/nof_icon_title_open.gif"; 
	}
	/*if(openBlks == maxBlks){
		document.getElementById("allEle").innerHTML = '<a href="#" onClick="showAll(0)"><img src="images/nof_button_collapse_all.gif" alt="Collapse All" width="89" height="20" border="0" hspace="2" /></a>';
		document.getElementById("allEle1").innerHTML = '<a href="#" onClick="showAll(0)"><img src="images/nof_button_collapse_all.gif" alt="Collapse All" width="89" height="20" border="0" hspace="2"  /></a>';
	} else {
		document.getElementById("allEle").innerHTML = '<a href="#" onClick="showAll(1)"><img src="images/nof_button_expantall.gif" alt="Expand All" width="77" height="20" hspace="2" border="0" hspace="2" /></a>';
		document.getElementById("allEle1").innerHTML = '<a href="#" onClick="showAll(1)"><img src="images/nof_button_expantall.gif" alt="Expand All" width="77" height="20" hspace="2" border="0" hspace="2" /></a>';
	}*/
}

//function to show/hide all the blocks
function showAll(no){
	divList = document.getElementsByTagName("div");
	j = 1;
	if(no==1){
			document.getElementById("allEle").innerHTML = '<a href="#" onClick="showAll(0)"><img src="images/nof_button_collapse_all.gif" alt="Collapse All" width="89" height="20" border="0" hspace="2" /></a>';
			document.getElementById("allEle1").innerHTML = '<a href="#" onClick="showAll(0)"><img src="images/nof_button_collapse_all.gif" alt="Collapse All" width="89" height="20" border="0" hspace="2" /></a>';
			for (i = 0; i < divList.length; i++){
				if(divList[i].id.substring(0,5) == "divBl"){
					document.getElementById("img"+j).src = "images/nof_icon_title.gif";
					divList[i].style.position = "relative";
					divList[i].style.visibility = "visible";
					j++;
				}
			}
		openBlks = maxBlks;
	} else {
			document.getElementById("allEle").innerHTML = '<a href="#" onClick="showAll(1)"><img src="images/nof_button_expantall.gif" alt="Expand All" width="77" height="20" hspace="2" border="0" /></a>';
			document.getElementById("allEle1").innerHTML = '<a href="#" onClick="showAll(1)"><img src="images/nof_button_expantall.gif" alt="Expand All" width="77" height="20" hspace="2" border="0" /></a>';
			for (i = 0; i < divList.length; i++){
				if(divList[i].id.substring(0,5) == "divBl"){
					document.getElementById("img"+j).src = "images/nof_icon_title_open.gif";
					divList[i].style.position = "absolute";
					divList[i].style.visibility = "hidden";
					j++;
				}
			}
		openBlks = 0;
	}
}


// function to count the no of blocks present in the window
function countblks(){
	divList = document.getElementsByTagName("div");
	count=0;
	for (i = 0; i < divList.length; i++){
		if(divList[i].id.substring(0,5) == "divBl"){
			count++;
		}
	}
	maxBlks = count;
}

/* Auto center window script */

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=n0'
win = window.open(mypage,myname,settings);

	//var sendText = args;
	//window.document.testmovie.SetVariable("videoName", sendText);
}
