/*
CLCP v2.1 Clear Links to Current Page
Jonathan Snook
This code is offered unto the public domain
http://www.snook.ca/jonathan/
*/



function clearCurrentLink(){
	var a = document.getElementsByTagName("A");
	
    for(var i=0;i<a.length;i++){
        if(a[i].href == window.location.href.split("#")[0]){
        		
            removeNode(a[i]);
        }
    }
}

function removeNode(n){
    if(n.hasChildNodes()){
        for(var i=0;i<n.childNodes.length;i++){
            n.parentNode.insertBefore(n.childNodes[i].cloneNode(true),n);
        }
    }
    n.parentNode.removeChild(n);
    
}

/* Set class for current page links, etc */
function setClass() {
  var cssClass = "current"; 
  var aElem=document.getElementsByTagName("a");
  for (i=0; i<aElem.length; i++) { 
 
    if(aElem[i].href == window.location.href.split("#")[0] && aElem[i].parentNode.tagName == "LI")	{ 
	
	  
      	 aElem[i].parentNode.className = cssClass;
	   
	  
       clearCurrentLink();         
	}
  }
}

// gets a geocode for address
function getMap(location)   {	 
	var geocoder = new GClientGeocoder();
    	geocoder.getLatLng(location, mapit);  
}


//The geocoder calls this function with the point as the asynchronous response to the geocoder.getLatLng() call, also uses global
// variable zoom computed from surface area
function mapit(point) {	
    if (point == null)  {
   		point = new GLatLng(35, 105);
   	}
   	if (GBrowserIsCompatible()) {		
       	var map = new GMap2(document.getElementById("mapDiv"));
		map.setCenter(point, 15);
		var marker = new GMarker(point); 
		map.addOverlay(marker); 
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
    }
}
	
function checkBoxes()	{
   var check = document.getElementsByName("task[]");
   var flag = 0;
   for(i=0; i<check.length; i++){
	  if(check[i].checked){
		 flag = 1;
		 break;
	  }
	  else   {
		 flag = 0;
	  }	
   }
   if(flag == 0) {
	  alert("You did not select any volunteer options!");
	  return false;
   }
   else 	{
	  return true;
   }
}



