$(document).ready(function() { //begin jquery



//disable contact button script
function disablelink() {
var obj = document.getElementById("emailbutton");
obj.disabled = true;
obj.onclick = new Function("return false;");
parent.location='mailto:asg@methanetomarkets.org?subject=Methane to Markets';
} 


//Tab Switcher
	$("#org_tab").hide();
	$("#project_tab").hide();
	$("li.country").addClass("country_on");
	
	$("#storytabs .country").click(function(){
			$("#org_tab").hide();
			$("#project_tab").hide();
			$("#country_tab").show();
			$("li.country").addClass("country_on");
			$("li.org").removeClass("org_on");
			$("li.project").removeClass("project_on");
	});
	
	$("#storytabs .org").click(function(){
			$("#country_tab").hide();
			$("#project_tab").hide();
			$("#org_tab").show();
			$("li.org").addClass("org_on");
			$("li.country").removeClass("country_on");
			$("li.project").removeClass("project_on");
	});
			 
	$("#storytabs .project").click(function(){
			$("#country_tab").hide();
			$("#org_tab").hide();
			$("#project_tab").show();
			$("li.project").addClass("project_on");
			$("li.country").removeClass("country_on");
			$("li.org").removeClass("org_on");
	});
	
	
//Tab Switcher2
	$("#stories2 #project_tab").hide();
	$("#stories2 #org_tab").show();
	$("#stories2 li.org").addClass("org_on");
	
	$("#stories2 #storytabs .org").click(function(){
			$("#project_tab").hide();
			$("#org_tab").show();
			$("li.org").addClass("org_on");
			$("li.project").removeClass("project_on");
	});
			 
	$("#stories2 #storytabs .project").click(function(){
			$("#org_tab").hide();
			$("#project_tab").show();
			$("li.project").addClass("project_on");
			$("li.org").removeClass("org_on");
	});
	
	

//Accordion
	
	$(".accordion ul.acclist").hide();
		$(".accordion h3").click(function(){
				$(this).next("ul.acclist").slideDown("slow").siblings("ul.acclist:visible").slideUp("slow");
				$(this).addClass("active");
				$(this).siblings("h3").removeClass("active");
			});
		
	
	$(".accordion div").hide();
//	$(".accordion h3#reportsdiv").addClass("active");
//	$(".accordion h3#reportsdiv+div").slideDown("slow");
		$(".accordion h3").click(function(){
				$(this).next("div").slideDown("slow").siblings("div").slideUp("slow");
				$(this).addClass("active");
				$(this).siblings("h3").removeClass("active");
			});


//remove bottom border
$('#rightlist li:last').css("border-bottom", "0");
$('#sectorevents li:last').css("border-bottom", "0");


//zebra table
//$('.zebra tr:even').addClass('alt');
$("#projectstable2").tablesorter({ 
    widgets: ['zebra'] 
});


//Flash map
//$('#flashmap').flash({
//		swf: 'flash/map.swf',
//		width: 789,
//		height: 397,
//		params: {
//           wmode: 'transparent'
//        }
//
//	});

//$('#flashmap2').flash({
//		swf: '../flash/map.swf',
//		width: 789,
//		height: 397,
//		params: {
//           wmode: 'transparent'
//        }
//
//	});

// projects randomizer

var projects = new Array();
		projects[0] = "<h2>Brazilian Landfill to Generate Electricity and Earn Carbon Credits</h2><p>Belo Horizonte Landfill, a closed landfill in Municipality of Belo Horizonte, Brazil, expects to use landfill gas as an energy source very soon. An assessment report estimated that sufficient landfill gas could be recovered to generate 9 megawatts of power and reduce annual emissions by an average of 134,160 metric tons of carbon dioxide equivalent each year for ten years.</p><p class='moreinfo'><a href='../projects/projects_brazil1.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[1] = "<h2>Chinese Landfill to Sell Electricity to Grid and Gain Income from Carbon Credits</h2><p>The U.S. Environmental Protection Agency helped the Chengdu City Landfill complete an assessment of the landfill gas potential for energy use. The landfill is looking to supply electricity to the local grid as well as register the project and sell Certified Emission Reductions under the Kyoto Protocol's Clean Development Mechanism.</p><p class='moreinfo'><a href='../projects/projects_china1.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[2] = "<h2>Oxidizing Ventilation Air Methane to Increase Mine Safety, Reduce Emissions, and Make Hot Water for Miners</h2><p>A project at the Datong Mine, located in the Chongqing Municipality in Southwest China, will destroy ventilation air methane as well as produce hot water for coal mine workers.</p><p class='moreinfo'><a href='../projects/projects_china2.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[3] = "<h2>Liquefied Coal Mine Methane to be Hauled by Truck in China</h2><p>A project is underway to gather, purify, and liquefy as much as 130 million cubic meters annually of coal mine methane from Songzao, China's six operating coal mines in the Chongqing Municipality. The liquefied natural gas will be transported by truck for use locally and in other areas south and east of the municipality.</p><p class='moreinfo'><a href='../projects/projects_china3.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[4] = "<h2>Energy Independence, Environmental Benefits, and Financial Gain from Methane Capture on Brazilian Swine Farms</h2><p>Frigor&iacute;fico Mabella, a pork processing, swine production, and trading company in Brazil uses a biogas to supply electricity. The farm combines high technology with simple designing, which makes it financially attractive as well as benefiting the environment.</p><p class='moreinfo'><a href='../projects/projects_brazil2.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[5] = "<h2>Chinese Landfill Succeeds at Capturing and Using Landfill Gas</h2><p>More than half a million tons of carbon dioxide equivalent emissions will be reduced by 2022 at the Gaoantun Landfill in China by the capture and reuse of landfill gas. Energy from the landfill gas will be available to sell to potential end-users located near the landfill.</p><p class='moreinfo'><a href='../projects/projects_china4.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[6] = "<h2>First Indian Landfill Gas Project to Receive Carbon Credits</h2><p>As the first of its kind for India, the Gorai landfill is expected to reduce 2 million tons of carbon dioxide equivalent emissions over the lifetime of the project and has the potential to earn $5.2 million (USD) for carbon credits for captured gas.</p><p class='moreinfo'><a href='../projects/projects_india1.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[7] = "<h2>First Landfill Gas-to-Energy Project Online in Ukraine</h2><p>Ukraine's first landfill gas energy project in Khmelnitsky is using landfill gas to fuel four infrared heaters installed in the landfill's maintenance garage-a perfect application for this location.</p><p class='moreinfo'><a href='../projects/projects_ukraine1.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		projects[8] = "<h2>Chinese Landfill Uses Micro-Turbine to Produce Power for Onsite Use</h2><p>Reducing methane emissions through both capture and flaring at the Mentougou Landfill in China should eliminate up to 395,021 metric tons of carbon dioxide equivalent by 2028.</p><p class='moreinfo'><a href='../projects/projects_china5.aspx'>[More Info]</a></p><p id='allproj'><a href='../projects/projects_index.aspx'>View All Project Spotlights &gt;&gt;</a></p>";
		
	var randomproj = Math.floor(Math.random()*projects.length);	
	$('#sstitle').after(projects[randomproj]);
	$('#project_tab').append(projects[randomproj]);


}); //end jquery



// google translate
function doTranslate(lang_pair) {
        window.open('http://translate.google.com/translate_p?hl=en&langpair=' + lang_pair + '&u=' + location.href);
        }

function ShowDoc(url){
window.open(url,'guide','status=0,toolbar=1,menubar=1,resizable=1,location=50,scrollbars=1,width=800,height=500');
}


