function showbox(i){
	imgtop = getposOffset(document.getElementById("iconimage"),"top");
	imgleft = getposOffset(document.getElementById("iconimage"),"left");
	document.getElementById("iconbox").style.top = (imgtop - 128) +"px";
	document.getElementById("iconbox").style.left = (imgleft + (i>=6 ? 423 : (i-1)*85))+"px";
	if(i == 1){
		document.getElementById("iconbox").innerHTML = "<h5>FAIR TRADE</h5>Providing poor communities with a fair and reliable income and a workplace that is democratic, safe, and healthy; Maintaining trusting, supportive, long-term relationships...";
	}
	else if(i == 2){
		document.getElementById("iconbox").innerHTML = "<h5>ECO-CONSCIOUS</h5>Creating sustainable alternatives to exploitative and environmentally destructive means of production and taking great effort to minimize our environmental footprint...";
	}
	else if(i == 3){
		document.getElementById("iconbox").innerHTML = "<h5>HANDCRAFTED</h5>Preserving traditional techniques and designs while creating items of beauty and use in our modern lifestyles...";
	}
	else if(i == 4){
		document.getElementById("iconbox").innerHTML = "<h5>CREATING SUSTAINABLE LIVELIHOODS</h5>Building reliable access to markets to create economic opportunity for the most marginalized communities around the world; Encouraging economic development through self-sufficiency...";
	}
	else if(i == 5){
		document.getElementById("iconbox").innerHTML = "<h5>BUILDING COMMUNITY</h5>Supporting participatory and community-led development that engages women and youth; Bridging communities globally; Working in solidarity with Global South partners...";
	}
	else if(i == 6){
		document.getElementById("iconbox").innerHTML = "<h5>PROMOTING HUMAN RIGHTS</h5>Promoting dignity, security, and equality as enshrined in the Universal Declaration of Human Rights; Advocating for democratic governance and leadership from the ground up...";
	}
	else if(i == 7){
		document.getElementById("iconbox").innerHTML = "<h5>ADVANCING GLOBAL HEALTH</h5>Ensuring access to health care and education, including preventative care, treatment, and HIV/AIDS care and support; Generating an income for people living with HIV and AIDS...";
	}
	else if(i == 8){
		document.getElementById("iconbox").innerHTML = "<h5>SUPPORTING ACCESS TO EDUCATION</h5>Focusing on equal access to education for women and girls including literacy and numeracy for adults, business training for women, and both primary and secondary schooling for all children...";
	}
	document.getElementById("iconbox").style.display="block";
}
function hidebox(i){
	document.getElementById("iconbox").style.display="none";
}
function schoolbox(){
	document.getElementById("overlay").style.display="block";
	document.getElementById("schoolpopup").style.display="block";
}
function closeschoolbox(){
	document.getElementById("overlay").style.display="none";
	document.getElementById("schoolpopup").style.display="none";
}
function selectschool(contactid){
	document.getElementById("overlay").style.display="none";
	document.getElementById("schoolpopup").style.display="none";
	$.getJSON("../template/ggpdata.cfm?r="+Math.random()+"&mode=schoolcode&contact_id="+contactid,
        function(data){
        	if(data.data.organization != ""){
        		document.getElementById("fundraisingBox").innerHTML = "You are now shopping for <strong>" + data.data.organization + "</strong>. (Click <span onclick=\"schoolbox();\" class=\"strong\">HERE</span> to change your selection.)";
        		document.getElementById("shopping_for_header").innerHTML = "SHOPPING FOR " + data.data.organization;
        	}
        	else if(data.data.contact_id == 0) {
        		document.getElementById("fundraisingBox").innerHTML = "If shopping for a school or nonprofit, click <span onclick=\"schoolbox();\" class=\"strong\">HERE</span> to make your selection.";
        		document.getElementById("shopping_for_header").innerHTML = "";
        	}
        });
}
//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//
function addLoadEvent(func){
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}
}
function addUnLoadEvent(func){
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function'){
    	window.onunload = func;
	} else {
		window.onunload = function(){
		oldonunload();
		func();
		}
	}
}
function collapse(cnt,path){
	for(i=0;i<=cnt;i++){
		if(document.getElementById("blockcat"+i)){
			div = document.getElementById('blockcat'+i);
			img = document.getElementById('imgcat'+i);
			if(!path){
				path = "..";
			}
			div.style.display = "none";
			img.src = path + "/images/rightarrowred.gif";
		}
	}
}

