function checkReqFields(){
	if(trimAll(document.forms[0].textTitle.value).length==0)
	{
		eval('textTitleHead').style.color='red';
		document.forms[0].textTitle.focus();
	}
	else
		eval('textTitleHead').style.color='#000080';	
		
	var dt=document.forms[0].textPostedOn
	if (isDate(dt.value)==false){
	    var i=0;
		eval('textPostedOnHead').style.color='red';	
		dt.focus()
	}
	else
	{
		i=1;
		eval('textPostedOnHead').style.color='#000080';
	}
	if(trimAll(document.forms[0].textDescription.value).length==0)
	{
		eval('textDescriptionHead').style.color='red';
		document.forms[0].textDescription.focus();
	}
	else
		eval('textDescriptionHead').style.color='#000080';	

	if(trimAll(document.forms[0].textContactName.value).length==0)
	{
		eval('textContactNameHead').style.color='red';
		document.forms[0].textContactName.focus();
	}
	else
		eval('textContactNameHead').style.color='#000080';	

	if(trimAll(document.forms[0].textContactPhone.value).length==0)
	{
		eval('textContactPhoneHead').style.color='red';	
		document.forms[0].textContactPhone.focus();
	}
	else
		eval('textContactPhoneHead').style.color='#000080';

	if ((trimAll(document.forms[0].textTitle.value).length!=0) && (trimAll(document.forms[0].textDescription.value).length!=0)&&(trimAll(document.forms[0].textContactName.value).length!=0) &&(trimAll(document.forms[0].textContactPhone.value).length!=0)&&(trimAll(document.forms[0].textPostedOn.value).length!=0)&&i==1)
	{
		hide('warntext1');
  		document.forms[0].submit();
  	}
  	else
		show('warntext1');
}

function checkAdminFields(chk){
	if(trimAll(document.forms[0].textTitle.value).length==0)
	{
		eval('textTitleHead').style.color='red';
		document.forms[0].textTitle.focus();
	}
	else
		eval('textTitleHead').style.color='#000080';
	
if (chk==1)
{
	if(document.forms[0].townId.value==0)
	{
		eval('townIdHead').style.color='red';
		document.forms[0].townId.focus();
	}
	else
		eval('townIdHead').style.color='#000080';
}
		
	var dt=document.forms[0].textPostedOn
	if (isDate(dt.value)==false){
	    var i=0;
		eval('textPostedOnHead').style.color='red';	
		dt.focus()
	}
	else
	{
		i=1;
		eval('textPostedOnHead').style.color='#000080';		
	}
		
	if(trimAll(document.forms[0].textDescription.value).length==0)
	{
		eval('textDescriptionHead').style.color='red';
		document.forms[0].textDescription.focus();
	}
	else
		eval('textDescriptionHead').style.color='#000080';	

	if(trimAll(document.forms[0].textContactName.value).length==0)
	{
		eval('textContactNameHead').style.color='red';
		document.forms[0].textContactName.focus();
	}
	else
		eval('textContactNameHead').style.color='#000080';	

	if(trimAll(document.forms[0].textContactPhone.value).length==0)
	{
		eval('textContactPhoneHead').style.color='red';	
		document.forms[0].textContactPhone.focus();
	}
	else
		eval('textContactPhoneHead').style.color='#000080';
		
		if(chk==1)
		{
			if ((document.forms[0].townId.value!=0)&&(trimAll(document.forms[0].textTitle.value).length!=0) && (trimAll(document.forms[0].textDescription.value).length!=0)&&(trimAll(document.forms[0].textContactName.value).length!=0) &&(trimAll(document.forms[0].textContactPhone.value).length!=0)&&(trimAll(document.forms[0].textPostedOn.value).length!=0)&&i==1)
			{
				hide('warntext2');
		  		document.forms[0].submit();
		  	}
		  	else
				show('warntext2');
		}
		else
		{
			if ((trimAll(document.forms[0].textTitle.value).length!=0) && (trimAll(document.forms[0].textDescription.value).length!=0)&&(trimAll(document.forms[0].textContactName.value).length!=0) &&(trimAll(document.forms[0].textContactPhone.value).length!=0)&&(trimAll(document.forms[0].textPostedOn.value).length!=0)&&i==1)
			{
				hide('warntext2');
		  		document.forms[0].submit();
		  	}
		  	else
				show('warntext2');
		}
}
/********* Check Blank Fields  ***********/
function trimAll(sString) 
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}


/******************** Check Date  Format ***********/
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

function ValidateForm(){
	var dt=document.forms[0].textPostedOn
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }

/***********************************/



function eLearningO(tid)
  {
    eval(tid).style.color="orange";
  }
function eLearningR(tid)
  {
    eval(tid).style.color="#000000";
  }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function breadLinkOver(id)
   {
    document.getElementById(id).style.color="orange";     
   }
function breadLinkOut(id)
   {
    document.getElementById(id).style.color="#000000";     
   }
function membershipLinkColor1(tid)
    {
     eval(tid).style.color="orange";
    }
    
function membershipLinkColor2(tid)
    {
     eval(tid).style.color="#000080";
    }    
function checkLoginid(chk)
	{
		if(document.forms[0].txtloginid.value=="")
			 alert('Please Select LoginID First');
		else
		 {
		   if(chk==1)
		   	location.href="Profile.asp?chkID="+document.forms[0].loginid.value;
		   else if(chk==2)
		   	location.href="adminUpdatePassword.asp?id="+document.forms[0].loginid.value;
		   else if(chk==3)	
		   	location.href="adminUpdateDuesStatus.asp?id="+document.forms[0].loginid.value;
		   else if(chk==4)	
		   	location.href="adminUpdateDuesAmount.asp?id="+document.forms[0].loginid.value;
		   	else if(chk==5)
			   	popup("notes.asp?id="+document.forms[0].loginid.value);
		 }	 
	}
	


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////




function numberInput(objTR)
{
		var txtval=objTR.value;		
		
		var key = event.keyCode;
		if((key < 48||key > 57)&&key != 46)
		{		
			event.keyCode = 0;
		}
		else {
			if(key == 46)
			{
				if(txtval.indexOf(".") != -1)// || txtval.length == 0)
					event.keyCode = 0;
			}
		}
}

     function change1(id)
    {
		eval(id).style.color="#f3a40b";
    }
	function change2(id)
    {
		eval(id).style.color="#000080";     
    }    
    
    function changetd1(tid)
	{
 	    eval(tid).style.background="#66551f";
	}
		
	function change(tid)
	{
	    eval(tid).style.background="#4CC7DD";  	 
	}

	function changetdcolor(id)
    {
		eval(id).style.color="#000080";
    }    

    function guide1(tid)
    {
     eval(tid).style.color="orange";
    }
    
    function guide2(tid)
    {
     eval(tid).style.color="#000080";
    }



    function linkunder(tid)
    {
     eval(tid).style.textDecoration="underline";
    }
	
    function linknone(tid)
    {
     eval(tid).style.textDecoration="none";
    }

	
	
function doProfile(){
	window.location="Profile.asp";
}
	
function doStatus(){
	window.location="MembershipStatus.asp";
}

function doSurvey() {
    window.location="CommunityProfile.asp";
}
	
function doTraining() {
	window.location="Registration.asp";
}

function doDirectory() {
	window.location ="Directory.asp";
}

function doServices(){
	window.location ="MemberServices.asp";
}




function color1(id){
   eval(id).style.background="#ffffff";
}

function color2(id){
   eval(id).style.background="transparent";
}

function arr1(id){
   eval(id).style.background="Brown";
   eval(id).style.color="#a0dff1";
}

function arr2(id){
   eval(id).style.background="#a0dff1";
   eval(id).style.color="#a0dff1";
}

function move_status(){
    window.location="admin.asp";
}

function settext(id)
{
	if(document.forms[0].proid.value==8)
	 show(id); 
	else
	{
	 document.forms[0].profession.value="";
	 hide(id);	 
	}
}
	

function show(id)
{
	document.getElementById(id).style.visibility='visible';
}

function hide(id)
{
	document.getElementById(id).style.visibility='hidden';
}

function membercheckbox(f)
{
  		  aoi="";
  		  for(var i=0;i<f.checkbox1.length;i++)
  		  {
  		     if(f.checkbox1[i].checked==true)
  		     {
  		            if(aoi=="")
				       	aoi=f.checkbox1[i].value;
				    else
					    aoi=aoi + "," + f.checkbox1[i].value;
  		     }
  		  }
  		  f.interestarea.value=aoi;
}

function checkboxstatus(f)
{

	str1=document.forms[0].interestarea.value;
	if(document.forms[0].interestarea.value!="")
	{
		l=str1.length;
		strt=0;
		for(var j=strt;j<l-1;j++)
		{
			if(str1.substring(j,j+1)==",")
			{
				k=str1.substring(strt,j)-1;
				f.checkbox1[k].checked=1;
				strt=j+1;
			}
		}
		k=str1.substring(strt)-1;
		f.checkbox1[k].checked=1;
	}
	
	if(document.forms[0].profession.value!="")
		show('profession');
	else
		hide('profession');								   
}


function checktowntext()
{
	var em=document.forms[0].email.value;
	var ph=document.forms[0].phone.value;
	var ea=document.forms[0].eaid.value;  		
	i=0;
	if (!(em))
	{
		i=1;		 
		document.getElementById('email').style.color ="red";  
	}
	else
		document.getElementById('email').style.color ="#000080";  		 
		 	
	if (!(ph))
	{
		i=1;
		document.getElementById('phone').style.color ="red";  
	}
	else	
		document.getElementById('phone').style.color ="#000080";  		 	

	if (!(ea))
	{
	 	i=1;
	 	document.getElementById('eaid').style.color ="red";  
	}
	else		 	
	 	document.getElementById('eaid').style.color ="#000080";  		 			 	
		 	
	if(i==1)
		show('warntext');
	else 
		hide('warntext');
		 
	if ((ea)!=""  && (em)!="" && (ph)!="")
		document.mainForm.submit();
}

function checkothertext()
{
	var em=document.forms[0].email.value;
	var ph=document.forms[0].phone.value;
  		
	i=0;
		
	if (!(em))
	{
	 	i=1;
	 	document.getElementById('email').style.color ="red";  
	}
	else
	 	document.getElementById('email').style.color ="#000080";  		 
		 	
	if (!(ph))
	{
		i=1;
		document.getElementById('phone').style.color ="red";  
	}
	else	
	 	document.getElementById('phone').style.color ="#000080";  		 	
	
	if(i==1)
		show('warntext');
	else 
		hide('warntext');		 	

	if ((em)!="" && (ph)!="")
		document.mainForm.submit();
}


function checkmembertext()
{
	j=0;
    n=checkmembertext.arguments.length;
    for(i=0;i<n;i++)
    {
    	k=0;
        id=checkmembertext.arguments[i];
        idVal=document.getElementById(id+"1").value;
//        alert(id);
//        alert(idVal);

       	if(id=="stateid" || id=="zip" || id=="city")
       	{
       		idVal1=document.getElementById("city1").value;
       		idVal2=document.getElementById("stateid1").value;
       		idVal3=document.getElementById("zip1").value;
       		if(idVal1=="" || idVal2=="" || idVal3=="")k=1;
       		id="city";
       	}
        if(idVal == "")
        {
        	j=1;
	        document.getElementById(id).style.color ="red";
	    }
	    else
			if(k==0)
		        document.getElementById(id).style.color ="#000080";
    }
	if(j==1)
	 	show('warntext');
	else
	 	hide('warntext');
	return j;
}

/*
function checkmembertext(fname,lname,pos,em)
{
		i=0,j=0;

		if (!(fname))
		{
		 	i=1;
		 	document.getElementById('firstName').style.color ="red";  
		}
		else
		 	document.getElementById('firstName').style.color ="#000080";  		 
		 	
		if (!(lname))
		{
		 	i=1;
		 	document.getElementById('lastName').style.color ="red";  
		}
		else	
		 	document.getElementById('lastName').style.color ="#000080";  		 	

		if (!(pos))
		{
		 	i=1;
		 	document.getElementById('positionid').style.color ="red";  
		}
		else		 	
		 	document.getElementById('positionid').style.color ="#000080";  	

	 	if (!(em))
		{
			i=1;
		 	document.getElementById('homeEmail').style.color ="red";  
		}
		else	
		 	document.getElementById('homeEmail').style.color ="#000080";  
		 	
		if((i==1) &&(j==1))
		{
			show('warnemail');
			show('warntext');
		}

		if(i==1)
		 	show('warntext');
		else  
		 	hide('warntext');

//		if(j==1)
//			 show('warnemail');
//		else
//			 hide('warnemail');

}
/***********************************************************************************************/

var newwindow;
function popup(url)
{
 newwindow=window.open(url,'name','height=354,width=441,screenx=650,screeny=420,left=300,top=220');
 if(window.focus)newwindow.focus();
}

var newlocation;
function location1(url)
{
 newlocation=window.open(url,'name','height=130,width=500,screeny=570,top=420');
 if(window.focus)newlocation.focus();
}