var TheURL = window.location.href;
/*var currentURL = TheURL.split('/');
currentURL = currentURL[currentURL.length - 3];
alert(currentURL);*/

var cit = new Array();
 cit[0] = document.getElementById('idhome');
 cit[1] = document.getElementById('it1');
 cit[2] = document.getElementById("it2");
 cit[3] = document.getElementById("it3");
 cit[4] = document.getElementById("it4");
 cit[5] = document.getElementById("it5");
 cit[6] = document.getElementById("it6");
 cit[7] = document.getElementById("it7");
 cit[8] = document.getElementById("it8");
 cit[9] = document.getElementById('idcontact');

var cimet = new Array();
 cimet[1] = document.getElementById("item1");
 cimet[2] = document.getElementById("item2");
 cimet[3] = document.getElementById("item3");
 cimet[4] = document.getElementById("item4");
 cimet[5] = document.getElementById("item5");
 cimet[6] = document.getElementById("item6");
 cimet[7] = document.getElementById("item7");
 cimet[8] = document.getElementById("item8");

function initial(s) {
	
   for (var i=1; i<9; i++) {
	   cimet[i].style.color = "#ffffff";
	   }
	   if (s>0) cimet[s].style.color = "#72523b";
}






//alert("it is 11_10");

/* ------------------- */
var cssFix = function(){

  var u = navigator.userAgent.toLowerCase(),

  addClass = function(el,val){

    if(!el.className) {

      el.className = val;

    } else {

      var newCl = el.className;

      newCl+=(" "+val);

      el.className = newCl;

    }

  },

  is = function(t){return (u.indexOf(t)!=-1)};

  addClass(document.getElementsByTagName('html')[0],[

    (!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)

      
	   
      :is('firefox/2')?'gecko ff2'

      :is('firefox/3')?'gecko ff3'

      :is('gecko/')?'gecko'

      :is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1

      :is('konqueror')?'konqueror'

      :is('applewebkit/')?'webkit safari'

      :is('mozilla/')?'gecko':'',

    (is('x11')||is('linux'))?' linux'

      :is('mac')?' mac'

      :is('win')?' win':''

  ].join(" "));

}();
/*---------------------*/




function chleft(a) {
	
	currentElement=document.getElementById('idhome');
	
	if (a==1) currentElement.style.backgroundImage = 'url(/images/blocks/home.gif)';
	   else currentElement.style.backgroundImage = 'url(/images/blocks/ghome.gif)';
	   
	/*currentElement=document.getElementById('item1');
	currentElement.style.paddingBottom = 0.4 + 'em';
	currentElement=document.getElementById('item8');
	currentElement.style.paddingBottom = 0.4 + 'em';*/
	
}






function chright(a) {
	
	currentElement=document.getElementById('idcontact');
	
	if (a==1) currentElement.style.backgroundImage = 'url(/images/blocks/contact.gif)';
	   else currentElement.style.backgroundImage = 'url(/images/blocks/gcontact.gif)';
}

/*
switch(currentURL) {
	   case 'www.kindgreenplanet.org': 
	       initial(1); chleft(1); cit[1].style.backgroundColor = '#fed805';
		   break;
	   case 'about':
	      initial(2); cit[2].style.backgroundColor = '#fed805';
		  break;
	   case 'current': case 'archive':
	      initial(3); cit[3].style.backgroundColor = '#fed805';
		  break;
	   case 'glasswalls': case 'archive':
	      initial(4); cit[4].style.backgroundColor = '#fed805';
		  break;
}
*/
function startcolor()
{
if (TheURL.indexOf('index') != -1) { initial(1); chleft(1); cit[1].style.backgroundColor = '#fed805'; }
if (TheURL.indexOf('/about/') != -1) {initial(2); cit[2].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/action/') != -1) {initial(3); cit[3].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/programs/') != -1) {initial(4); cit[4].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/media/') != -1) {initial(5); cit[5].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/resource/') != -1) {initial(6); cit[6].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/help/') != -1) {initial(7); cit[7].style.backgroundColor = '#fed805';}
if (TheURL.indexOf('/contact/') != -1) {initial(8); chright(1); cit[8].style.backgroundColor = '#fed805';}

}

function ini() {
	for (var i=1; i<9; i++) {
	   cit[i].style.backgroundColor = "#62ad34";
	   }
	    chleft(0);
	    chright(0);
}
startcolor();

if (navigator.userAgent.indexOf("Apple")!=-1) {
	
	currentElement=document.getElementById('nav');	
	currentElement.style.lineHeight = 19 +'px';
	
	currentElement=document.getElementById('item8');	
	currentElement.style.paddingRight = 1.8 +'em';
	
	currentElement=document.getElementById('tiptop-text');
	currentElement.style.lineHeight = 130 +'%';
	
	currentElement=document.getElementById('spp');
	currentElement.style.height = 0 +'px';
	
	startcolor();
}
      
	   
	  

