 /*
 **  Developer: Anthony James
 **      Email: webdevelopernyc@gmail.com
 **     Client: Jeff Greenspan ~ http://www.jeffgreenspan.com (Programmed specifically for this site)
 **   Synopsis: Javascript implementation to facilitate hyperlink navigation between
 **             project-nodes as situated within corresponding project-category
 **       Date: May 2010 
 ** 
 */
 
 

galleryNav = function(gallery) {

  var listElement = null;

  listElement = document.getElementById(gallery).getElementsByTagName("LI");

  var project_link = null;
  
  var wrapper = "<div id='projects_wrapper'>";

  var x = null;

  var id = null;

  var num_iters = 9;

  var len = listElement.length;

  if(len == 0){
	 
      project_link = "<div id='project_enum'>There are no projects for this category.";

    }else if(len == 1){

      project_link = "<div id='project_enum'>"; 

    }else{

      project_link = "<div id='project_enum'>";

  }	

  for(x = 0; x < len; x++){		 

    id = String(listElement[x]['id']);

      if (x == num_iters){ 

	    url_prefix = "</div><div id='project_enum_next' style='left: -5;'><div style='float: left; margin: 1px; position: relative;'><a href=\"#\" style='padding-left: 3px;' class='hide' onclick='gallerynav("+x+", "+id+"); return false' onmouseover='this.style.color: #ff9933;' >";
	  
        project_link = project_link+url_prefix+(x+1)+"</a></div>";	 
//alert('num_iters... '+x); 	 
	  } else if(x === 0){

		//first project -- only one project
//alert('first project...'+x);		
		if(len == 1){

        project_link = "<div id='project_enum' style='padding-bottom: 0px;' >"; 
		
		} else {
		
		//first project -- more than one project	
		
	    url_prefix = "<div style='float: left; margin: 1px; position: relative;'><a href=\"#\" style='padding-left: 3xp;' class='chosen' onclick='gallerynav("+x+", "+id+"); return false' onmouseover='this.style.color: #ff9933;'>";  
   
        project_link = project_link+url_prefix+(x+1)+"</a></div>";
		
		}
		  
     } else {
//alert('subsequent projects... '+x);		  
        //subsequent projects
			
	    url_prefix = "<div style='float: left; margin: 1px; position: relative;'><a href=\"#\" style='padding-left: 3px;' class='hide' onclick='gallerynav("+x+", "+id+"); return false' onmouseover='this.style.color: #ff9933;'>";
		
		project_link = project_link+url_prefix+(x+1)+"</a></div>";

      }  

} 

project_link = project_link+"</div>";
//alert('project_link'+project_link);
 document.getElementById(id).innerHTML = project_link;

}