// JavaScript Document
//var divCollectionDiveAdd= new Array("aLBDdivedetail","aLBDdivebuddies","aLBDcondition","aLBDdivefish","aLBDdivecoral","aLBDdiveplant","aLBDdivemammal","aLBDdivewreck","aLBDdivecomputer");
var divCollectionDiveAdd= new Array("aLBDdivedetail","aLBDdivebuddies","aLBDcondition","aLBDdivespecies","aLBDdivetourOperator","aLBDdivecomputer");

function ShowHideAddlogbook(div,logtype){
	var maxI=0;
	if(logtype==2){
		maxI=divCollectionDiveAdd.length;
	}else{
		maxI=divCollectionDiveAdd.length-1;
	}
	for(var i=0;i<maxI;i++){
		if(divCollectionDiveAdd[i]==div){
			document.getElementById(divCollectionDiveAdd[i]).style.display="";
			document.getElementById("td"+divCollectionDiveAdd[i]).style.background="#8AB064";
			document.getElementById("td"+divCollectionDiveAdd[i]).style.color='#ffffff';
		}else{			
			document.getElementById(divCollectionDiveAdd[i]).style.display="none";
			document.getElementById("td"+divCollectionDiveAdd[i]).style.background='#4669A4';
			document.getElementById("td"+divCollectionDiveAdd[i]).style.color='#94E100';			
		}
	}//end of for*/
}
function mynewwindow(urlAdd,winName,width,height,menubar,resizable,scrollbars){
	var winName= (winName==null)?"mywindow":winName;
	var width= (width==null)?"5000":width;
	var height= (height==null)?"300":height;
	var menubar= (menubar==null)?"1":menubar;
	var resizable= (resizable==null)?"1":resizable;
	var scrollbars= (scrollbars==null)?"1":scrollbars;
	window.open(urlAdd,winName,"menubar="+menubar+",resizable="+resizable+",width="+width+",height="+height+",scrollbars="+scrollbars);
}

function ShowHide2Div(div1,div2){	
	document.getElementById(div1).style.display="block";
	var arrdiv=div2.split(",");	
	for(var i=0;i<arrdiv.length;i++){
		document.getElementById(arrdiv[i]).style.display="none";
	}
}

function ShowHideTwoDiv(div1,div2){	
	document.getElementById(div1).style.display="block";
	document.getElementById(div2).style.display="none";
}

function ShowHide(div1)
{
	if(document.getElementById(div1).style.display=="none"){
		document.getElementById(div1).style.display="block";
	}else{
		document.getElementById(div1).style.display="none";
	}
}

function ShowHideWithNameReturn(div1, div2)
{
	if(document.getElementById(div1).style.display=="none"){
		document.getElementById(div1).style.display="block";
		document.getElementById(div2).value="  close  ";
	}else{
		document.getElementById(div1).style.display="none";
		document.getElementById(div2).value="post comment";
	}
}

function validateEmailregx(emailFiled)//here emailField is the id of the text field where email is entered.
{
var regEmail=/\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b/i;
objEmailField=document.getElementById(emailFiled);

	if (regEmail.test(objEmailField.value)) {
		return true;
	}else{
		alert("Please Enter A Valid Email");
		objEmailField.select();
		objEmailField.focus();
		return false;
	}
}

function showHideMainTabs(tabid)
  { 

	  if(tabid==0)
	   {}else
	   {
	 if(document.getElementById("mainMenu"+tabid))	   
	 document.getElementById("mainMenu"+tabid).style.display="";
	  document.getElementById("test"+tabid+"-header").style.background="#87AA5D";
	   }
	 for(i=1; i <=12 ; i++)
	    {
			if(i != tabid)
			  {
				      if(document.getElementById("mainMenu"+i))
					  document.getElementById("mainMenu"+i).style.display="none";
					  
                     
					  document.getElementById("test"+i+"-header").style.background="#4669A2";
				  
				  }
			
			}
	 
	  }
	  
function siteMap(count)
   {    var checkStatus=0;
     
		var c2=0;
	   for(i=0; i < count ; i++)
	      {
			 
			  if(document.getElementById('unapprovedSites'+i).checked ==true)
			      {
               
					  checkStatus=1;
					  }
	   
	    }
		
		if(checkStatus==0)
		   {
			   
			   alert("Please select a site");
			   return false;
			   
			   }
	   if(document.getElementById('selectName').selectedIndex < 0 )
	       {
			   alert("Please enter site to map to");
			   return false;
			   }
		 
	   
   }
function getPages(page,parameterId,containerId,clubId,type)
{
if(parameterId > 0 && type=="showDetailsAlso")
   {
document.getElementById('desc').style.display="";	   
	   }else if(type=="")
	   {
document.getElementById('desc').style.display="none";	   		   
		   }
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object.
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
       
		var file = 'ajaxPages/'+page+'?parameterId='+parameterId+'&containerId='+containerId+'&clubId='+clubId; //This is the path to the file we just finished making *
    //alert(file);
	xmlhttp.open('GET', file, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById(containerId).innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                     
					 
				}
        }
		else{
			document.getElementById(containerId).innerHTML = "<div style='width:100%' align='center'>loading...</div>";
			}
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}
