// JavaScript Document
/*function Category( ID , parent , name , description ){
	this.ID = ID;
	this.parent = parent;
	this.name = name;
	this.description = description;
	this.Subs = [];
}
var Categories = [];
var xmlHttp = null;
var hover = -1;
var ContentDivs = [ "About_div" , "Donate_div" , "Contact_div" , "Sign_div" , "Search_div" , "highlights_div" ];
var ContentText = [ "About" , "Donate" , "Contact" , "Sign in" , "Search" , "Highlights" ];
var Current_div;
var CurrentContentDiv = -1;
var interval = null; //Contains interval function
var cantOut = null;

function GetXmlHttpObject()
{
	//var xmlHttp=null;
	try
	 {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	//return xmlHttp;
}
function loadXML( url ){
	GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  confirm ("Your browser does not support AJAX!");
	  return;
	} 
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged() { 
	if (xmlHttp.readyState==4)
	{ 
		var DATA = xmlHttp.responseXML.documentElement;
		readXML( DATA );
	}
}
function readXML( DATA ){
		var ID , parent , N, failCode = "", failLine;
		var IDs = DATA.getElementsByTagName( "CategoryID" );
		var Parents = DATA.getElementsByTagName( "ParentID" );
		var Names = DATA.getElementsByTagName( "Title" );
		var ie = ( navigator.appName == "Microsoft Internet Explorer" );
		for(var i=0; i < DATA.childNodes.length; i++){
			try{
				if( IDs[ i ].textContent != 1276 && 1026 != IDs[ i ].textContent ){
			failLine = 0;
			if( !ie ){
				ID = IDs[ i ].textContent;
				failLine = 1;
				parent = Parents[ i ].textContent;
				failLine = 2;
				N = Names[ i ].textContent;
				failLine = 3;
			}
			else{
				ID = IDs[ i ].text;
				failLine = 1;
				parent = Parents[ i ].text;
				failLine = 2;
				N = Names[ i ].text;
				failLine = 3;
			}
			//alert(N.textContent);
			//break;
			//document.write( "<br />Node: " );
			//document.close();CategoriesXML[i].nodeName == "DecendantCategories" && 
			//if( parent.textContent == '0'){
			Categories[ Categories.length ] = new Category( ID , parent , N , '' );
			//Categories = addCategory( ID , parent , N , Categories , 0 );
			failLine = 4;
			}
			}catch( err ){
			//Categories[ Categories.length ] = new Category( ID , parent , N , '' );
			}
			//}
		}
		alert( 1 );
		//document.getElementById( "MenuDiv" ).innerHTML = 
		//alert( document.getElementById( "MenuDiv" ).innerHTML );
		document.getElementById( "code" ).value = writeMenu( 0 , true) ;
}
function addCategory( ID , parent , title , C , P ){
	if( parent == P ){ 
		C[ C.length ] = new Category( ID , parent , title , '' );
	}
	else{ for( var i = 0; i < C.length; i++ ){
		C[ i ].Subs = addCategory(ID , parent , title , C[ i ].Subs , C[ i ].id );
	}
	}
	return C;
}
function writeMenu( P , top ){
	var Code = "" , Single = "", count = -1 , last , Y , first = true;
	if( !top ){ Code += "<div class='subholder'>";}
	for( var i = 0; i < Categories.length; i++ ){		
		try{ 
		if( Categories[ i ].parent == P ){ 
			count ++;
			Y = 0;//1.25 * count;
			//if( C[ i ].parent == 1358 && P == 1358 ){ document.getElementById("data").innerHTML += C[ i ].name + "<br />"; }
			Single = "<div id='Cat_" + Categories[ i ].ID + "-" + Categories[ i ].parent + "' class='";
			if( top ){
				Single += "mainLink_div";
				//Y = 1.25 * count;//1.25
				//Y += count * .0625;
			}
			else{ Single += "link_div"; }
			if( first && count == 0 ){
				Single += " topLink_div";
				first = false;
			}
			last = true;
			for( var j = i + 1; j < Categories.length; j++ ){
				if( Categories[ j ].parent == P ){ 
					last = false;
				}
			}
			if( last && !top){
				Single += " bottomLink_div";
			}
			else if( last && top){
				Single += " MainBottomLink_div";
			}
			//Single += "' style='top:" + Y + "em;' onmouseover='MOver(" + Categories[ i ].ID + " , " + Categories[ i ].parent + ")' onmouseout='MOut(" + Categories[ i ].ID + " , " + Categories[ i ].parent + ")'><a href='category2.aspx?catid=" + Categories[ i ].ID + "' class='";
			Single += "'><a href='category2.aspx?catid=" + Categories[ i ].ID + "' class='";
			if( top ){ Single += "MainMenuLink' >" + Categories[ i ].name + "</a>"; }
			else{ Single += "subMenuLink' >" + Categories[ i ].name + "</a>"; }
			Single += writeMenu( Categories[ i ].ID , false );
			Single += "</div>";
			Code += Single;
		}
		}catch( err ){return Code;}
	}
	if( count == -1 ){ return ""; }
	if( !top ){ Code += "</div>";}
	return Code;
}
function findParent( ID ){
	for( var i = 0; i < Categories.length; i++ ){	
		if( ID == Categories[ i ].ID.textContent ){ return Categories[ i ].parent.textContent; }
	}
	return -1;
}
function isChild( ID , parent ){
	var good = 0, bad = 0;
	for( var i = 0; i < Categories.length; i++ ){	
		try{
			if( Categories[ i ] == null || Categories[ i ].ID == null || 
													  Categories[ i ].parent == null || Categories[ i ].name == null){ 	
				bad++;
			} else { good++; }
			
			if( ID == Categories[ i ].ID.textContent && parent == Categories[ i ].parent.textContent){ return true; }
		} catch ( err ) { }
	}
	return false;
}
	
function MOver( ID , parent ){
	document.getElementById( "C" + ID + "-" + parent ).style.overflow = "visible";
}
function MOut( ID , parent ){
	document.getElementById( "C" + ID + "-" + parent ).style.overflow = "hidden";
}
function toggleVisibility( layerName ){
	if( layerName == CurrentContentDiv ){ MM_effectShake('Location_div'); return; }
	document.getElementById( "Location_div" ).innerHTML = '';
	if( Current_div != null ){
		MM_effectAppearFade( ContentDivs[ CurrentContentDiv ] , 1000, 100, 0, false);
		interval = window.setTimeout( "document.getElementById('" + ContentDivs[ CurrentContentDiv ] + "').style.visibility = 'hidden';" , 1000 );
		//Current_div = document.getElementById( ContentDivs[ CurrentContentDiv ] );
		//interval = window.setTimeout( "slideUp()" , 20 );
	}
	CurrentContentDiv = layerName;
	Current_div = document.getElementById( ContentDivs[ CurrentContentDiv ] );
	MM_effectAppearFade( ContentDivs[ CurrentContentDiv ] , 1000, 0, 100, false);
	interval = window.setTimeout( 'Current_div.style.visibility = "visible";' , 50 );
	document.getElementById( "Location_div" ).innerHTML = ContentText[ CurrentContentDiv ];
}
function slideDown(){
	//var layer = document.getElementById( ContentDivs[ CurrentContentDiv ] );
	var top = Current_div.style.top.substring( 0 , Current_div.style.top.indexOf( 'px' ) );
	top -= -15;
	//alert( top );
	if( top > 200 ){
		Current_div.style.top = '215px';
		interval = null;
		document.getElementById( "Location_div" ).innerHTML = ContentText[ CurrentContentDiv ];
	}
	else { 
		Current_div.style.top = top + 'px'; 
		interval = window.setTimeout( "slideDown()" , 20 );
	}
}
function slideUp(){
	//var layer = document.getElementById( ContentDivs[ CurrentContentDiv ] );
	var top = Current_div.style.top.substring( 0 , Current_div.style.top.indexOf( 'px' ) );
	top -= 15;
	//alert( top );
	if( top < -380 ){
		Current_div.style.top = '-400px';
		Current_div.style.visibility = "hidden";
		Current_div = document.getElementById( ContentDivs[ CurrentContentDiv ] );
		Current_div.style.top = '-400px';
		Current_div.style.visibility = "visible";
		interval = window.setTimeout( "slideDown()" , 20 );
	}
	else { 
		Current_div.style.top = top + 'px'; 
		interval = window.setTimeout( "slideUp()" , 20 );
	}
}*/
var menu_outs = [];
var MenuTimer = window.setInterval( function(){
	for( var i = 0; i < menu_outs.length; i++ ){
		menu_outs[ i ].style.overflow = 'hidden';		
	}
	menu_outs = [];
} , 15 );
var menu_links = [];
function applyMouseEvents(){
	/*try{var elements = document.getElementsByTagName( "DIV" );
	//var isPrograms = ( location.pathname.indexOf( "programs" ) != -1 );
	for( var i = 0; i < elements.length; i++ ){
		try{
		if( elements[ i ].id.substring( 0 , 4 ) == "cat_" ){
			elements[ i ].onmouseover = function(){ this.style.overflow = "visible"; }
			elements[ i ].onmouseout = function(){ this.style.overflow = "hidden"; }
			if( elements[ i ].childNodes.length > 1 && elements[ i ].className.indexOf( "topLevel" ) == -1 ){ 
				elements[ i ].appendChild( getMarkerDiv() );
			}
			for( var j = 0; j < elements[ i ].childNodes.length; j++ ){
				if( elements[ i ].childNodes[ j ].tagName == "A" ){
					//elements[ i ].childNodes[ j ].href = elements[ i ].childNodes[ j ].href.replace( "category" , "programs" );
					elements[ i ].childNodes[ j ].innerHTML = constrain( elements[ i ].childNodes[ j ].innerHTML , 25);
				}
			}
		}}catch(e){}
	}
	 var menu = document.getElementById( "Menu_cover" );
	 //if( menu == null ){ return; }
	 return;	
	 menu.doFade = doFade;
	 menu.fadeIn = fadeIn;
	 menu.fadeOut = fadeOut;
	 menu.fading = false;
	 menu.style.opacity = .8;
	 menu.style.filter = "alpha(opacity=" + 80 + ")";
	 document.getElementById( "Menu_div" ).onmouseover = function(){ document.getElementById( "Menu_cover" ).fadeIn(); };
	 document.getElementById( "Menu_div" ).onmouseout = function(){ document.getElementById( "Menu_cover" ).fadeOut();  }; }catch(e){alert(e);}*/
	 /*var top = $(".topLevel");
	 top.mouseover(function(){this.style.overflow = "visible"; return false;});
	 top.mouseout(function(){this.style.overflow = "hidden"; return false;});
	
	 var subLevel = $(".subLevel");
	 subLevel.mouseover(function(){this.style.overflow = "visible";});
	 subLevel.mouseout(function(){this.style.overflow = "hidden"; });
	 subLevel.filter( function(){ return this.childNodes.length > 1; } ).append( getMarkerDiv() );*/
	 var top = $(".topLevel");
	 top.mouseover(function(){
		this.style.overflow = "visible";
		for( var i = 0; i < menu_outs.length; i++ ){
			if( menu_outs[ i ].id == this.id ){
				menu_outs.splice( i , 1 );
				//i--;
			}
		} 
		return false;
	 });
	 top.mouseout(function(){ menu_outs.push( this ); return false;});
	
	 top.bind('click', function () {
		urchinTracker('/leftnav/' + getCatName( this ).replace(/&/gi, "and")  );
	 });
	 
	 var subLevel = $(".subLevel");
	 subLevel.mouseover(function(){
		this.style.overflow = "visible";
		for( var i = 0; i < menu_outs.length; i++ ){
			if( menu_outs[ i ].id == this.id ){
				menu_outs.splice( i , 1 );
				//i--;
			}
		}
	 });
	 subLevel.mouseout(function(){ menu_outs.push( this ); });
	 subLevel.filter( function(){ 
		var title = this.childNodes[ 0 ];
		if( this.getAttribute( "hft" ) == "True" ){//Hide from top if we need it
			this.style.visibility = "hidden";
			this.style.position = "absolute";
		}
		//if( title.href.indexOf( "jccmanhattan.org" ) == -1 && ( title.href.indexOf( "http://" ) != -1 || title.href.indexOf( "https://" ) != -1 ) ){
		if( title.href.indexOf( "category.aspx" ) == -1 ){
			menu_links.push( title.href );
			//title.href = "javascript:var nw = window.open( menu_links[" + ( menu_links.length - 1 ) + "] )";
			title.target = "_new";
		}
		title = title.innerHTML;
		if( title.length > 20 ){
			for( var i = 20; i > 10; i-- ){
				if( title.charCodeAt( i ) == 32 ){
					this.childNodes[ 0 ].innerHTML = title.substring( 0 , i ) + "<br />" + title.substring( i + 1 , title.length );
					break;
				}
			}
		}
		//return this.childNodes.length > 1;
		return hasKids( this );
	} ).append( getMarkerDiv() );
	
		
	 subLevel.bind('click', function () {
		urchinTracker('/leftnav/' + getCatName( this.parentNode.parentNode ).replace(/&/gi, "and")  + '/' + getCatName( this ).replace(/&/gi, "and")  );
	 });

	var bcs = document.getElementById( "BreadCrumb_div" );
	if( bcs == null ){ return; }
	else{
		bcs = bcs.getElementsByTagName( "A" );
		for( var i = 0; i< bcs.length; i++ ){
			bcs[i].href = "category.aspx?catid=" + getCatidFromUrl( bcs[i].href );
		}
	}
}
function getMarkerDiv(){
	var div = document.createElement("DIV");
	div.className = "marker_div";
	return div;
}
function hasKids( div ){
	if( div.childNodes.length < 2 ){ return false; }
	div = div.childNodes[ 1 ];
	if( div.className != "subholder" ){ return false; }
	for( var i = 0; i < div.childNodes.length; i++ ){
		if( div.childNodes[ i ].getAttribute( "hft" ) == "False" ){ return true; }
	}
	div.parentNode.removeChild( div );
	return false;
}
function fadeIn(){
	this.alphas = [ 0, .1 , .15 , .2 , .25 , .3 , .35 , .4 , .45 , .5 , .55 , .6  ];
	if( navigator.appName == "Microsoft Internet Explorer" ){
		this.alphas = [ 0 ];
	}
	while( this.alphas[ this.alphas.length - 1 ] >= this.style.opacity ){
		//alert( this.alphas[ this.alphas.length - 1 ] + " >= " + this.style.opacity );
		this.alphas.pop( );
	}
	this.doFade();
}
function fadeOut(){	
	this.alphas = [ .6  , .55 , .5 , .45 , .4 , .35 , .3 , .25 , .2 , .1 ];
	if( navigator.appName == "Microsoft Internet Explorer" ){ 
		this.alphas = [ .8 ];
	}
	while( this.alphas[ this.alphas.length - 1 ] < this.style.opacity ){
		this.alphas.pop( );
	}
	this.style.zIndex = 16; 
	this.style.visibility = "visible";
	this.doFade();
}
function doFade(){
	if( !( this.alphas.length > 0 ) ){ return; }
	var alpha = this.alphas.pop();
	this.style.opacity = alpha;
	if( alpha == 0 ){ this.style.visibility = "hidden"; this.style.zIndex = 13; return; }
	else if( alpha == 1 ){  }
	this.style.filter = "alpha(opacity=" + Math.floor( alpha * 100 ) + ")";
	if( this.alphas.length > 0 ){
		var self = this;
		this.int = setTimeout( function(){ self.doFade(); } , 30 );
	} else { this.alphas = []; }
}

/******************RIGHT NAV******************************/
function findCurrentMenuItem(){
	//var divs = document.getElementsByTagName( "DIV" );
	var loc = location.search.toLowerCase();
	var current_cat = loc.substring( loc.indexOf( 'catid' ) + 6 , loc.indexOf( 'catid' ) + 10 );
	/*for( var i = 0; i < divs.length; i++ ){
		if( divs[ i ].id.indexOf( "cat_" ) != -1 && divs[ i ].id.indexOf( current_cat ) != -1 ){
			return divs[ i ];
		}
	}*/
	return findMenuItem( current_cat );
}
function findMenuItem( ID ){
	var divs = document.getElementsByTagName( "DIV" );
	var possible = [], choose = null;
	for( var i = 0; i < divs.length; i++ ){
		if( divs[ i ].id.indexOf( "cat_" ) != -1 && divs[ i ].id.indexOf( ID ) != -1 ){
			possible.push( divs[ i ] );
			//return divs[ i ];
		}
	}	
	if( possible.length == 0 ){ return null; }
	else{
		choose = possible[ 0 ];
		for( var i = 0; i<possible.length; i++ ){
			if( getLevel( possible[ i ] ) < getLevel( choose ) ){
				choose = possible[ i ];
			}
		}
	}
	return choose;
}
var mainParent_tries = 0;
function mainParentOf( obj ){
	try{
		var BCs = document.getElementById( "BreadCrumbNav_2_01" );
		if( BCs == null ){ BCs = document.getElementById( "BreadCrumbNav" ); }
	BCs = BCs.getElementsByTagName("A");
	if( BCs.length > 0 ){ 
		var main = BCs[ 0 ].href;
		if( main == "javascript:void(0)" ){
			main = BCs[ 0 ].res;
		}
	}else{ 
		var main = location.href;
	}
	main = main.substring( main.indexOf( "catid=" ) + 6 , main.indexOf( "catid=" ) + 10 );
	var menu = document.getElementById( "Menu_div" );
	var menu_divs = menu.getElementsByTagName( "DIV" );
	for( var i = 0; i < menu_divs.length; i++ ){
		if( menu_divs[ i ].id.indexOf( main ) != -1 ){
			return menu_divs[ i ];
		}
	}
	if( mainParent_tries < 10 ){
		mainParent_tries++;
		window.setTimeout( buildRightNav , 300 );
	}
	//alert( main + " not found" );
	}catch(e){ 
		if( mainParent_tries < 10 ){
			mainParent_tries++;
			window.setTimeout( buildRightNav , 300 );
		}
	}
}
function getLevel( obj ){
	var level = -1;
	if( obj == null || obj.id == null ){ return level; }
	for( var i = 0; i < obj.id.length; i++ ){
		if( obj.id.charAt( i ) == '_' ){
			level++;
		}
	}
	//alert( level );
	return level; //return document.getElementById( "BreadCrumbNav_2_01" ).childNodes.length - 1;
}
function parentOf( ID ){
	var divs = document.getElementsByTagName( "DIV" ), thisDiv;
	for( var i = 0; i < divs.length; i++ ){
		if( divs[ i ].id.indexOf( "cat_" ) != -1 && divs[ i ].id.indexOf( ID ) != -1 ){
			thisDiv = divs[ i ];
			break;
		}
	}
	if( getLevel( thisDiv ) == 1 ){ return 0; }
	else{
		return getCatID( (thisDiv != null) ? thisDiv.parentNode.parentNode : null );	
	}
}
function hasSubs( div ){
	return childByClass( div , "subholder" ) != null;
}
function getCatName( div ){
	if( div == null ){ return ""; }
	for( var i = 0; i < div.childNodes.length; i++ ){
		if( div.childNodes[ i ].tagName == "A" ){
			return div.childNodes[ i ].innerHTML;
		}
	}
}
function getNameFromId( ID ){
	var divs = document.getElementsByTagName( "DIV" );
	for( var i = 0; i < divs.length; i++ ){
		if( divs[ i ].id.indexOf( "cat_" ) != -1 && divs[ i ].id.indexOf( ID ) != -1 ){
			return getCatName( divs[ i ] );
		}
	}
}
function getCatID( div ){
	if( div == null ){ return -1; }
	for( var i = 0; i < div.childNodes.length; i++ ){
		if( div.childNodes[ i ].tagName == "A" ){
			return div.childNodes[ i ].href.substring( div.childNodes[ i ].href.length - 4 , div.childNodes[ i ].href.length );
		}
	}
}
function getCatHREF( div ){
	for( var i = 0; i < div.childNodes.length; i++ ){
		if( div.childNodes[ i ].tagName == "A" ){
			return div.childNodes[ i ].href;
		}
	}
}
var mainID, currentCat, currentLvl;
function buildRightNav(){
	currentCat = findCurrentMenuItem();
	var main = mainParentOf( currentCat );
	mainID = getCatID( main );
	var code = "<table style='position:relative;'><tr><td style='width: 200px; height: auto; border: 1px #000000;'></td><td style='width: 300px; height: auto; border: 1px #000000;'></td><td><div class='jGM_box' id='jGlide_001'>";
	//print the main category menu that starts as the display
	code += printCodeFor( main , "at the jcc in manhattan" , "001" );
	var subs = childrenByTag( childByClass( main , "subholder" ) , "div" );
	var subSubs;
	for( var i = 0; i < subs.length; i++ ){
		if( hasSubs( subs[ i ] ) ){
			code += printCodeFor( subs[ i ] , getCatName( main ) );
			document.getElementById( "right_nav" ).innerHTML = code;
		}
	}
	code += "</div></td></tr></table>";
	try{document.getElementById( "right_nav" ).innerHTML = code;}catch(e){}

	
		$('#jGlide_001').jGlideMenu( { tileSource      : '.jGlide_001_tiles' , demoMode        : false } ).show();
	

                        // Connect "Toggle" Link        
                        $('#switch').click(function(){  $(this).jGlideMenuToggle();});
                        $('li').click(function(){  $(this).jGlideMenuToggle();});
						var int = window.setTimeout( function(){
							currentLvl = getLevel( currentCat );//document.getElementById( "BreadCrumbNav_2_01" ).childNodes.length;
							deepLinkBreadCrumbs();
							InitialSlide();
						}, 2000 );
						//}catch(e){alert(e + " in buildRightNav");}
}
function InitialSlide(){
	if( currentLvl > 1 ){
			//try{alert( currentCat.id + " , " + currentCat.parentNode + " , " + document.getElementById( currentCat.id ).parentNode.parentNode );}catch(e){alert(e);}
			currentCat = document.getElementById( currentCat.id );
		while( currentLvl > 2 || currentCat.childNodes.length < 2 ){
			currentCat = currentCat.parentNode.parentNode; 
			currentLvl--;
		}
		jQuery.jGlideMenu.loadTile("tile_" + getCatID( currentCat ),jQuery.jGlideMenu.URLParams);//this line creates IE7 left nav error
		jQuery.jGlideMenu.scrollToTile(currentLvl,jQuery.jGlideMenu.defaultScrollSpeed);
	}
}
function printCodeFor( div , parentName , title ){
	var catName = ( title != null ) ? title : getCatID( div );
	catName = catName.replace( ' ' , '_' );
	var code = '<ul id="tile_' + catName +'" class="jGlide_001_tiles" title="' + stripTags( getCatName( div ) ) + '" alt="' + parentName + '">';
	var subs = childrenByTag( childByClass( div , "subholder" ) , "div" );
	for( var i = 0; i < subs.length; i++ ){
		code += "<li";
		if( title != null && childByClass( subs[ i ] , "subholder" ) != null ){
			code += " rel='tile_" + getCatID( subs[ i ] ) + "'>";
			code += stripTags( getCatName( subs[ i ] ) );
		} else {
			code += "><a href='" + getCatHREF( subs[ i ] ) + "' >";
			code += stripTags( getCatName( subs[ i ] ) );
			code += "</a>";
		}		
		code += "</li>";
	}
	code += "</ul>";
	/*start do subs
	var subs = childrenByTag( childByClass( main , "subholder" ) , "div" );
	var subSubs;
	for( var i = 0; i < subs.length; i++ ){
		if( hasSubs( subs[ i ] ) ){
			code += printCodeFor( subs[ i ] , getCatName( main ) );
			document.getElementById( "right_nav" ).innerHTML = code;
		}
	}
	end*/
	return code;
}
function deepLinkBreadCrumbs(){
	var BC = document.getElementById( 'BreadCrumb_div' ).getElementsByTagName( 'a' ); 
	for( var i = 0; i < BC.length; i++ ){
		BC[ i ].onclick = function(){
			SWFAddress.setValue(this.rel);
			return false;
		}
		BC[ i ].rel = ( i == 0 ) ? "tile_001" : "tile_" + getCatidFromUrl( BC[ i ].href );
		BC[ i ].res = BC[ i ].href;
		BC[ i ].href = "javascript:void(0)";
	}
}
/*ALERTS*/
var xmlAlerts;
function loadAlerts( ){
	GetAlertXML();
	if (xmlAlerts==null)
	{
	  confirm ("Your browser does not support AJAX!");
	  return;
	}
	xmlAlerts.onreadystatechange = makeAlerts;
	xmlAlerts.open("GET","Alerts.xml",true);
	xmlAlerts.send(null);
}

function GetAlertXML()
{
	xmlAlerts=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlAlerts=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlAlerts=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlAlerts=new ActiveXObject("Microsoft.XMLHTTP");
    }
  } 
return xmlAlerts;
}
function makeAlerts(){
	if( xmlAlerts.readyState == 4 ){
		var alerts = xmlAlerts.responseXML.documentElement.childNodes, code = "", alertBoxCode, hasHL;
		for( var i = 0; i < alerts.length; i++ ){
			hasHL = -1;
			alertBoxCode = "<a href='#' onclick='this.parentNode.parentNode.style.overflow = \"hidden\"' class='alert_close'>x</a>";
			for( var j = 0; j < alerts[ i ].childNodes.length; j++ ){
				if( alerts[ i ].childNodes[ j ] && hasHL != 1){
					hasHL = 0;
				}
				//if alert is new, set hasHL to 1
				//put a breaker if it's not the first
				if( j != 0 ){
					alertBoxCode += "<hr />";
				}
				alertBoxCode += ( alerts[ i ].childNodes[ j ].text != null ) ? alerts[ i ].childNodes[ j ].text : alerts[ i ].childNodes[ j ].textContent;
			}
			code += "<div class='alert_slot'>";
			if( hasHL == 0 ){
				code += "<img src='#' onclick='this.parentNode.style.overflow = \"visible\"'>";
				code += "<div class='alert_box'>";
				code += alertBoxCode;
				code += "</div>";
			}
			code += "</div>";
		}
		document.getElementById( "alerts_div" ).innerHTML = code;
	}
}
function putBackArrowIn( ID , name ){
	document.getElementById( ID ).innerHTML = '<img src="eddy/042709/jGlideMenu_0/img/arrow_bk2.gif" alt="<" border="0" /> ' + constrain( name , 23 );
}