function changecolor()
{
	//document.styleSheets[0].cssRules[8].cssText
	//for(var x=0;x<document.styleSheets[0].cssRules.length;x++){console.log(document.styleSheets[0].cssRules[x])}
	//for(var x=0;x<document.styleSheets[0].cssRules.length;x++){console.log(x+' '+document.styleSheets[0].cssRules[x].selectorText)}
	/*var x1=document.createElement('div')
	x1.setAttribute("class", "banner_container")
	x1.setAttribute("id", "gbcoloradjust")
	//x1.className='testme'
	x1.innerHTML='x'
	x1.className='banner_container'
	//x1.id='testme'
	
	document.body.insertBefore(x1,document.body.lastChild.nextSibling)
	gebid('gbcoloradjust').style.display='none'

	try {
	    // Change the id tag of elements altered by the .NET framework
	    document.getElementsByName('GlobalBarBGEALogoType')[0].id = "GlobalBarBGEALogoType"
	    document.getElementsByName('globalbardropdownimg')[0].id = "globalbardropdownimg"
	}
	catch (err) {
	}
	var gbca=getstyle('gbcoloradjust','background-color')
	var gbimg=getstyle('gbcoloradjust','background-image')
	
	gebid('GlobalBarBackground').style.backgroundColor=gbca
	gebid('GlobalBarBackground').style.backgroundImage=gbimg
	
	var imgpath=gbimg
	imgpath=imgpath.match(/\/[a-zA-Z0-9\/]+\//)
	//console.log(imgpath)
	
	//get the correct dropdown image path
	//id= globalbardropdownimg
	gebid('globalbardropdownimg').src=imgpath+'GlobalBarBGEADropDownOff.gif'
	*/
/*	if(imgpath!='/globalassets/images/globalbar/')
	{
		
	}*/

	//get the correct logo image path
	//id= GlobalBarBGEALogoType
	/*
	gebid('GlobalBarBGEALogoType').src=imgpath+'GlobalBarBGEALogoType.gif'

	gebid('GlobalBarDropDown').style.backgroundColor=gbca
	gebid('BGEAGlobalBarDropDownMenu').style.backgroundColor=gbca

	gebid('BGEAGlobalBarDropDownImage').onmouseover=function yay1(){globalopenID=setTimeout('openglobal(\''+imgpath+'\')',400)}
	gebid('BGEAGlobalBarDropDownImage').onmouseout=function yay2(){clearTimeout(globalopenID);swapsrc('globalbardropdownimg',imgpath+'GlobalBarBGEADropDownOff.gif');}
*/
//	gebid('GlobalBarDropDown').style.color='#ffffff'
//	gebid('GlobalBarBackground').style.color='#ffffff'
/*
	var blah=''
	
	var replacecolor='#ffffff'
	*/
		
	/*
		check to see if the gbca value is in rgb() or hex #xxxxxx notation
		if it's in rgb, convert to hex
		if the hex value is only 3 characters, convert it to the 6-character version
	*/
/*	
	var rgbstr=''
	if(gbca.indexOf('rgb')>=0)
	{
		//convert rbg() to hex values
		var rgbarr=gbca.match(/(\d+)/g)
		//alert(rgbarr[0])
		rgbstr='#'+d2h(parseInt(rgbarr[0]))+d2h(parseInt(rgbarr[1]))+d2h(parseInt(rgbarr[2]))
	}
	else
	{
		//already in hex values
		

		//gbca=gbca.toString()
		//gbca=gbca.toString()
		blah=gbca.toString()
		blah=blah.match(/([a-zA-z0-9]+)/g)
		//alert(blah+'\n'+blah.length)
		//alert(blah+'\n'+blah.toString().length)
		
		if(blah.toString().length==3)
		{
			//alert('here')
			//var rgbarr=rgbstr.split()
			//alert(rgbarr.length)
			//q=blah.toString()
			//alert(blah.toString().charAt(0))
			q=blah.toString()
			rgbstr='#'+q.charAt(0)+q.charAt(0)+q.charAt(1)+q.charAt(1)+q.charAt(2)+q.charAt(2)
		}
		else
		{
			rgbstr=gbca
		}
	}
	*/
	//alert(rgbstr)
	/*
	rgbstr=rgbstr.toUpperCase()
	
	if(rgbstr=='#B9141E') //#B9141E, rgb(185, 20, 30)
	{
		//red
		replacecolor='#D7797E'
	}
	else if(rgbstr=='#3399FF') //#3399FF, rgb(51, 153, 255)
	{
		//blue
		replacecolor='#AED6FF'
	}
	
	gebid('BGEAGlobalBarDropDownMenu').style.border='1px solid '+replacecolor+''
	blah=getCSSRule('.GlobalBarDropDownMenu a:link')
	blah.style.color=replacecolor //'#AED6FF'
	
	blah=getCSSRule('.GlobalBarDropDownMenu a:visited')
	blah.style.color=replacecolor //'#AED6FF'

	blah=getCSSRule('.GlobalBarDropDownMenu p')
	blah.style.borderBottom='1px solid '+replacecolor+'' //#AED6FF'
*/

/*	if(document.styleSheets[0].insertRule)
	{
		document.styleSheets[0].insertRule("p{font-size: 20px;}", 0)
	}
	gebid('BGEAGlobalBarDropDownMenu').style.backgroundColor=gbca*/
	
	//changedisplay('GlobalBarBackground','block')
	//document.body.removeChild(document.getElementById('gbcoloradjust'))
}

//decimal to hex
function d2h(d) {return d.toString(16);}
//hex to decimal
function h2d(h) {return parseInt(h,16);} 

function getCSSRule(ruleName, deleteFlag) {               // Return requested style obejct
   ruleName=ruleName.toLowerCase();                       // Convert test string to lower case.
   if (document.styleSheets) {                            // If browser can play with stylesheets
      for (var i=0; i<document.styleSheets.length; i++) { // For each stylesheet
         var styleSheet=document.styleSheets[i];          // Get the current Stylesheet
         var ii=0;                                        // Initialize subCounter.
         var cssRule=false;                               // Initialize cssRule. 
         do {                                             // For each rule in stylesheet
            if (styleSheet.cssRules) {                    // Browser uses cssRules?
               cssRule = styleSheet.cssRules[ii];         // Yes --Mozilla Style
            } else {                                      // Browser usses rules?
               cssRule = styleSheet.rules[ii];            // Yes IE style. 
            }                                             // End IE check.
            if (cssRule)  {                               // If we found a rule...
               if (cssRule.selectorText.toLowerCase()==ruleName) { //  match ruleName?
                  if (deleteFlag=='delete') {             // Yes.  Are we deleteing?
                     if (styleSheet.cssRules) {           // Yes, deleting...
                        styleSheet.deleteRule(ii);        // Delete rule, Moz Style
                     } else {                             // Still deleting.
                        styleSheet.removeRule(ii);        // Delete rule IE style.
                     }                                    // End IE check.
                     return true;                         // return true, class deleted.
                  } else {                                // found and not deleting.
                     return cssRule;                      // return the style object.
                  }                                       // End delete Check
               }                                          // End found rule name
            }                                             // end found cssRule
            ii++;                                         // Increment sub-counter
         } while (cssRule)                                // end While loop
      }                                                   // end For loop
   }                                                      // end styleSheet ability check
   return false;                                          // we found NOTHING!
}                                                         // end getCSSRule 

function killCSSRule(ruleName) {                          // Delete a CSS rule   
   return getCSSRule(ruleName,'delete');                  // just call getCSSRule w/delete flag.
}                                                         // end killCSSRule

function addCSSRule(ruleName) {                           // Create a new css rule
   if (document.styleSheets) {                            // Can browser do styleSheets?
      if (!getCSSRule(ruleName)) {                        // if rule doesn't exist...
         if (document.styleSheets[0].addRule) {           // Browser is IE?
            document.styleSheets[0].addRule(ruleName, null,0);      // Yes, add IE style
         } else {                                         // Browser is IE?
            document.styleSheets[0].insertRule(ruleName+' { }', 0); // Yes, add Moz style.
         }                                                // End browser check
      }                                                   // End already exist check.
   }                                                      // End browser ability check.
   return getCSSRule(ruleName);                           // return rule we just created.
} 

if (window.addEventListener)
{
	//alert('changing bg color')
	window.addEventListener("load", changecolor, false)
}

if (window.attachEvent)
{
	window.attachEvent("onload", changecolor)
}

