// JavaScript Document
/**
 * 
 * @todo Migrate to new modular code format and dojo
 */
jsLib.addOnload(window,function(){
	//just for article stuff, here because admin does not allow JS
	var img=_('agua_salud_map');
	if(img){
		var im=img.getParent(); //get anchor
		if(!img.org_img) img.org_img=img.src;
		im.onclick=function(){
			if(img.src!=im.href){
				img.src=im.href;
			}else{
				img.src=img.org_img;
			}
			return false;
		}
	}
	var img2=_('watershed_zoom');
	if(img2){
		img2.owidth=img2.width;
		img2.oheight=img2.height;
		img2.onclick=function(){
			if(this.zoomed){
				this.setAttribute('width',this.owidth);
				this.setAttribute('height',this.oheight);
				this.zoomed=false;
			}else{
				this.setAttribute('width','');
				this.setAttribute('height','');
				this.zoomed=true;
			}
		}
	}
	//vid stuff
	
	window.hideVids=function(){
		var check=_('vid_viewer');
		if(check){
			var elems=check.getElementsByTagName('table');
			for(var i=0;i<elems.length;i++){
				_(elems[i]).hide();
			}
		}			
	}		
	window.showVid=function(id){
		var vid=_('v'+id);
		if(vid){
			hideVids();
			vid.show();
		}
	}
	hideVids();	
});


