
//var defaultImage ="images/Logo-plain_map.jpg";
var defaultImage ="images/MB00001.jpg";
function loadPage(url,name,spec,replace)
{

  var current;
  if (url==null || url == "")
  {
	  return false;
  }
  if (name==null || name == "")
  {
      name = "_self";
  }
  if (spec==null || spec== "")
  {
      spec = "location=yes";
  }
  if (replace==null)
  {
      replace = true;
  }
  current = window.open(url,name,spec,replace);
  current.focus();
}


function openNewWindow1(url,name,spec,replace)
{
  var currentWin;
//alert("Hi123....");

  if (url==null || url == "")
  {
	  return false;
  }
  if (name==null || name == "")
  {
      name = "DefaultWindow";
  }
  if (spec==null || spec== "")
  {
      spec = "height=400,width=600,resizable=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes";
  }
  if (replace==null)
  {
      replace = true;
  }
//alert("Hi....");
 var foobar = window.open(url,name,spec,replace);
//window.self.blur();
foobar.focus(); // focus the popup


}

function closeAllChildWindows()
{

 var parentWindow;
 

}

function closeWindow()
{
  var currentWin;

  if (currentWin != null && currentWin.open) 
     currentWin.close();
}

function openNewWindow2(url,name,spec,replace)
{

 var currentWin;
  if (url==null || url == "")
  {
	  return false;
  }
  if (name==null || name == "")
  {
      name = "DefaultWindow";
  }
  if (spec==null || spec== "")
  {
      spec = "height=700,width=700,resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no";
  }
  if (replace==null)
  {
      replace = true;
  }
//alert("Hi.... new4 " + url);

 var foobar = window.open(url,name,spec,replace);
  //document.currentWin.focus();
// check if we can focus it
//foobar.opener.blur();
//window.self.blur();
foobar.focus(); // focus the popup
/*
if (foobar && window.focus && foobar.focus)
{
window.focus(); // focus the opener
if (window.blur) // check if we can blur
window.blur(); // blur the opener explicitely
foobar.focus(); // focus the popup
}*/

}

function ExpandCollapseTree_new(CategoryArrayType,fnVariable/*,ExpandText,CollapseText*/)
{
 var SubCategoryArray;
 var subCategory;
 var TdElement;
 var ArraySize;
 var ArrayElement = "";
 var subId;

  ArraySize = CategoryArrayType.length;
 //Identify the Category that has been clicked
 for (i=0;i<ArraySize;i++)
 {
 
   if(fnVariable == CategoryArrayType[i][0])
	 {
		 SubCategoryArray = CategoryArrayType[i];
	 }
	 else
	 {
		  CollapseOne(CategoryArrayType[i]); 
	 }
 }//end of for
 //The array "SubCategoryArray" will contain a list of all the Sub-categories,
 //for the Catgory which was clicked

 //Check to ensure that the clicked Category has sub Categories under it
 if(null != SubCategoryArray)
 {
  ArraySize = SubCategoryArray.length;
	//Iterate through all the subcategories to expand/collapse them
	for (j=1;j<ArraySize;j++)
	{
		subCategory = SubCategoryArray[j];
		TdElement  = document.getElementById(subCategory);

		//Check if the Category is already expanded or not
		if (null != TdElement)
		{
		  if (TdElement.style.display == "")
		  {
				TdElement.style.display = "none";
				//Get the category font to change from Bold to Normal
				if(j==1)
				{
				  document.getElementById(SubCategoryArray[0]).style.fontWeight = '';
				  /*if(CollapseText!=null && CollapseText!="")
				  {
				   subId = fnVariable + '_symbol';
				   document.getElementById(subId).innerHTML = CollapseText;
				  }*/
				}
		  }
		  else
		  {
				TdElement.style.display = "";
				//Get the category font to change to Bold
				if(j==1)
				{
				  document.getElementById(SubCategoryArray[0]).style.fontWeight = 'bold';
				  /*subId = fnVariable + '_symbol';
				  if(ExpandText!=null && ExpandText!="")
				  {
				   document.getElementById(subId).innerHTML = ExpandText;
				  }*/

				}

			}
		}
	}//end of for
 }//end of if

}//end of function ExpandCollapseTree_new


function ExpandCollapseTree(fnVariable)
{
 var SubCategoryArray;
 var subCategory;
 var TdElement;
 var ArraySize;
 var ArrayElement = "";

  ArraySize = CategoryArray.length;
 //Identify the Category that has been clicked
 for (i=0;i<ArraySize;i++)
 {
   if(fnVariable == CategoryArray[i][0])
	 {
		 SubCategoryArray = CategoryArray[i];
	 }
	 else
	 {
		  CollapseOne(CategoryArray[i]); 
	 }
 }//end of for
 //The array "SubCategoryArray" will contain a list of all the Sub-categories,
 //for the Catgory which was clicked

 //Check to ensure that the clicked Category has sub Categories under it
 if(null != SubCategoryArray)
 {
  ArraySize = SubCategoryArray.length;
//alert ("found " + fnVariable );
//alert ("array - > " + SubCategoryArray.length );

	//Iterate through all the subcategories to expand/collapse them
	for (j=1;j<ArraySize;j++)
	{
		subCategory = SubCategoryArray[j];
		TdElement  = document.getElementById(subCategory);

		//Check if the Category is already expanded or not
		if (null != TdElement)
		{
		  if (TdElement.style.display == "")
		  {
				TdElement.style.display = "none";
				//Get the category font to change from Bold to Normal
				if(j==1)
				{
				  document.getElementById(SubCategoryArray[0]).style.fontWeight = '';
				}
		  }
			else
			{
				TdElement.style.display = "";
				//Get the category font to change to Bold
				if(j==1)
				{
				  document.getElementById(SubCategoryArray[0]).style.fontWeight = 'bold';
				}

			}
		}
	}//end of for
 }//end of if

}//end of function ExpandCollapseTree

//This function is used to collapse all the sub categories
function CollapseOne(SubCategoryArray)
{

 var SubCategoryArraySize;
 var j;
 var subCategory;

	 //Check to ensure that the clicked Category has sub Categories under it
	 if(null != SubCategoryArray)
     {
		SubCategoryArraySize = SubCategoryArray.length;
		for (j=0;j<SubCategoryArraySize;j++)
		{
			subCategory = SubCategoryArray[j];
			TdElement  = document.getElementById(subCategory);

			if (j==0)
			{
   			 TdElement.style.fontWeight = 'normal';
			}
			else
			{

			TdElement.style.display = "none";
			}
			
		}
	 }

}//end of Function CollapseOne


function CollapseAll(p_CategoryArrayType)
{

 var ArraySize;
 var SubCategoryArraySize;
 var i,j;
 var SubCategoryArray;
 var subCategory;
 var TdElement;

 var CategoryArrayType =p_CategoryArrayType;
 ArraySize = CategoryArrayType.length;
 //alert("1...");
 //Identify the Category that has been clicked
 for (i=0;i<ArraySize;i++)
 {
//alert("2...");
	 SubCategoryArray = CategoryArrayType[i];
	 //Check to ensure that the clicked Category has sub Categories under it
//alert("3...");
	 if(null != SubCategoryArray)
     {
//alert("4...");
		SubCategoryArraySize = SubCategoryArray.length;
		for (j=1;j<SubCategoryArraySize;j++)
		{
//alert("5...");
			subCategory = SubCategoryArray[j];
			TdElement  = document.getElementById(subCategory);
			TdElement.style.display = "none";
//alert("6...");
		}
	 }
	 SubCategoryArray = null;
 }//end of for

}//end of Function CollapseAll


function changeTextDisplay(Category)
{
  var TdElement1; 
alert(Category);
  TdElement1  = document.getElementById(Category);
alert(TdElement1.style.textdecoration);
  //TdElement.style.text-decoration  = "none";

}

function changeImage(imagePath,elementId,role)
{
	var TdElement;

//alert("inside changeImage " + imagePath);

	if(imagePath=="Default" && (role == null||role == ""))
	{
		 imagePath = defaultImage;
	}
	else
	if(imagePath=="Default" && (role == "Students"))
	{
       imagePath = "images/blank.jpg";
	}
	TdElement = document.getElementById(elementId);
	TdElement.innerHTML = "<img border='0' src='" + imagePath + "'>";	

}

	function blinkIt() 
	{
		if (!document.all) 
		return;
		else 
		{
			for(i=0;i<document.all.tags('blink').length;i++)
			{
			s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
			}
		}
	}