	var oldContent = new Array();
	var secondaryContent = new Array();
	var readyToShow = new Array();
	var headings = new Array();
			
	$(document).ready(function(){
		addProjectsHover();
		$('.tg-tab-td-strp').css({"opacity":"0.8"}).hover(
													function(){
														$(this).css({"opacity":"1.0"});
													},
													function(){
														$(this).css({"opacity":"0.7"});
													});
		$('body').css("opacity","0.5");
	});
	
	$(window).load(function(){
		oldContent['tg-together'] = $('#tg-m-content-tg-together').html();
		oldContent['tg-countries'] = $('#tg-m-content-tg-countries').html();
		oldContent['tg-projects'] = $('#tg-m-content-tg-projects').html();
		oldContent['tg-projects-scroll'] = $('#tg-m-content-tg-projects-scroll').html();
		headings['tg-together'] = $('#tg-together-heading').html();
		headings['tg-countries'] = $('#tg-countries-heading').html();
		headings['tg-projects'] = $('#tg-projects-heading').html();
		secondaryContent['tg-together'] = false;
		secondaryContent['tg-countries'] = false
		secondaryContent['tg-projects'] = false;
		readyToShow['tg-together'] = true;
		readyToShow['tg-countries'] = true;
		readyToShow['tg-projects'] = true;
		$('body').fadeTo(800,1.0);
		$('#tg-projects').css({'right':'0px'});
	});
	
	function button(which,action){
		var link1 = 'b-l-' + which;
		var link2 = 'b-r-' + which;
		if(action == 'on'){
			document.getElementById(link1).className = "button-l-on";
			document.getElementById(link2).className = "button-r-on";
		}else if(action == 'out'){
			document.getElementById(link1).className = "button-l";
			document.getElementById(link2).className = "button-r";
		}
	}
	function imgPreload(){
		var images = new Array('simg/r-button-l.gif','simg/r-button-r.gif','simg/country-hover.png');
		var preloaded = new Array();
		for(i=0;i<images.length;i++){
			preloaded[i] = new Image();
			preloaded[i].src = images[i];
		}
	}
	function timeToBeReady(what){
		readyToShow[what] = true;
	}
	
	function anim(what,direction){
	if(readyToShow[what]){
		readyToShow[what] = false;
		setTimeout('timeToBeReady("'+what+'")',2000);
		if(!secondaryContent[what]){
			if(direction == 'right'){
				$('#'+what).animate({
					left: "500px",
					opacity: "0.0"
				},1000,function(){
					$('#tg-m-content-'+what).html($('#'+what+'-secondaryData').html());
					$('#'+what+'-heading').html($('#'+what+'-secondaryHeading').html());
					$('#'+what).animate({
						left: "0px",
						opacity: "1.0"
					},1000);
				});
			}else{
				$('#'+what).animate({
					right: "500px",
					opacity: "0.0"
				},1000,function(){
					$('#tg-m-content-'+what).html($('#'+what+'-secondaryData').html());
					if(what == 'tg-projects'){
						$('#tg-m-content-tg-projects-scroll').html($('#'+what+'-secondaryData-scroll').html());
					}
					$('#'+what+'-heading').html($('#'+what+'-secondaryHeading').html());
					$('#'+what).animate({
						right: "0px",
						opacity: "1.0"
					},1000,function(){
						//initiate downloads scroll
						TINY.scroller.init('tg-m-content-tg-projects-in2','scrollcontentProjects2','scrollbarr2','scroller2','buttonclick2');
					});
					addProjectsHover();
				});
			}
			secondaryContent[what] = true;
		}else{
			if(direction == 'right'){
				$('#'+what).animate({
					left: "500px",
					opacity: "0.0"
				},1000,function(){
					$('#tg-m-content-'+what).html(oldContent[what]);
					$('#'+what+'-heading').html(headings[what]);
					$('#'+what).animate({
						left: "0px",
						opacity: "1.0"
					},1000);
				});
			}else{
				$('#'+what).animate({
					right: "500px",
					opacity: "0.0"
				},1000,function(){
					$('#tg-m-content-'+what).html(oldContent[what]);
					if(what == 'tg-projects'){
						$('#tg-m-content-tg-projects-scroll').html(oldContent[what+'-scroll']);
					}
					$('#'+what+'-heading').html(headings[what]);
					$('#'+what).animate({
						right: "0px",
						opacity: "1.0"
					},1000,function(){
						//initiate projects scroll
						TINY.scroller.init('tg-m-content-tg-projects-in','scrollcontentProjects','scrollbarr','scroller','buttonclick');
					});
					addProjectsHover();
				});
			}
			secondaryContent[what] = false;
		}
	}
	}
	var ct = 0;
	function changeCountry(country){
		$('#selectedCountry').remove();
		var cntry = $('#countryInfo-'+country).html();
		$('#countryMain').append('<div id="selectedCountry">'+cntry+'</div>');
	}
	
	function changeColor(){
		var val = $('#colorSelector').val();
		$('body').css({ "backgroundImage" : 'url("'+val+'")' });
	}
	
	function addProjectsHover(){
		$('.projectsItem').hover(
			function(){
				$(this).fadeTo(200,0.3);
				$(this).fadeTo(200,1.0);
			}
		);
	}