<!--//--><![CDATA[//><!-- 
//### GENERAL ////////////////////////////////////////////////////////////////////
//IE JavaScript fix for the CSS dropdowns
	var sfEls;
	sfHover = function() {
		
		try{
			
			sfEls = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					for( i = 0; i < sfEls.length; i++ ){
						sfEls[i].className = sfEls[i].className.replace( " sfhover", "" );
					}
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					
					for( i = 0; i < sfEls.length; i++ ){
						sfEls[i].className = sfEls[i].className.replace( " sfhover", "" );
					}
					//this.className = this.className.replace( " sfhover", "" );
				}
			}
			
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}
	
	if (window.attachEvent){
		window.attachEvent("onload", sfHover);
		//document.onmouseover = sfHover;
	}

	function ieNavFix( oSender ){
		alert( oSender.tagName );
		oSender.className = oSender.className.replace( " sfhover", "");
	}

//### ARTICLE ////////////////////////////////////////////////////////////////////
//email validation for CONTACT mailto in article manager
	function checkMail( sEmail ){
		
		try{
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if( filter.test( sEmail ) ){ 
				return true; 
			}else{ 
				alert( "The email address entered was not formatted correctly.\nPlease reenter the address." );
				document.form1['contactaddress'].select();
				return false; 
			}
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
	
	}

//days of thoughtfully engaged form validation
	function doValidate(){
		
		try{
			
			for( i = 0; i < document.form2.length ; i++){
			
				if( ( document.form2[i].type == "text" || document.form2[i].type == "textarea" ) && 
					( document.form2[i].value == "" || document.form2[i].value == "\t" ) ){
						
					if( document.form2[i].name == "ByLine" || document.form2[i].name == "Summary" ){ continue; }
					else{
						
						alert( "Fields cannot be left blank.\n\nPlease fill out the form completely befor submitting." );
		
						document.form2[i].value="\t";
						document.form2[i].focus();
						document.form2[i].select();
						return false;
					
					}
					
				}
				if( document.form2[i].type == "select-one" && document.form2[i].options.value == "0" ){ 
				
					alert( "Please select an item from the pulldown menus before submitting." );
	
					document.form2[i].focus();
					return false;
				
				}
				
			}		
		
			return true;
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }

	}
	
//function for VIEW/SAVE menu items
//changes the ACTION property of the form, modifies the hidden element for SAVE or VIEW, submits the form
	function menuAction( page, action, ArtID, isPostBack ){

		try{

			switch( action.toLowerCase() ){
				
				case "view": //##an article was selected to VIEW
						window.location= page+'?form_action='+action+'&ArtID='+ArtID;
					break;
					
				case "save": //##an article was selected to SAVE
						
						if( isPostBack ){
							//alert( "preview" );
							window.location= page+'?form_action='+action+'&post_back='+isPostBack;
						}else{
							//alert( "edit" );
							document.form2.form_action.value = "edit";
							document.form2.action += '?form_action='+action+'&post_back='+isPostBack;
							document.form2.submit();
						}
						
					break;
					
				case "saveas": //##an article was selected to UPDATE
				
						if( isPostBack ){
							//alert( "preview" );
							window.location= page+'?form_action='+action+'&ArtID='+ArtID+'&post_back='+isPostBack;
						}else{
							//alert( "edit" );
							document.form2.form_action.value = "edit";
							document.form2.action += '?form_action='+action+'&ArtID='+ArtID+'&post_back='+isPostBack;
							document.form2.submit();
						}
						
					break;
				
			}
			
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
 
	}


//### GRAPHS ////////////////////////////////////////////////////////////////////
//relocate
	function goThere(lPath){
		try{
			
			window.location=lPath;
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
	}
	
//change colors
	function colorChange( oSender, oPreview, oForm ){
		
		try{
			
			document.getElementById( oPreview ).style.backgroundColor = oSender.options.value;
			document.getElementById( oForm ).value = oSender.options.value;
			
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}

//show/hide graph
	function toggleGraph( oSenterIndex ){
		
		try{
			
			switch(oSenterIndex){
				case 1: document.getElementById('hidechart').style.display = 'block';
						document.getElementById('chart').style.display = 'block';
						document.getElementById('showchart').style.display = 'none';
					break;
				case 2: document.getElementById('hidechart').style.display = 'none';
						document.getElementById('chart').style.display = 'none';
						document.getElementById('showchart').style.display = 'block';
					break;
					
				case 3: //#show Article Editor 
						document.getElementById('edit_article').style.display = 'none';
						document.getElementById('preview_article').style.display = 'block';
						
						document.form2.form_action.value = 'preview';
						document.form2.submit(); 	
						
					break;
				case 4: //#show Article Prieview 
						document.getElementById('edit_article').style.display = 'block';
						document.getElementById('preview_article').style.display = 'none';
						
						document.form2.submit(); 
						
					break;
			}
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}
	
	
//### MISC PROCESSING FUNCTIONS ###########################################
//TRIM FRONT AND BACK
	function Trim( sString ){
		
		try{
			
			if( sString.length > 0 ){
	
				sString = LeftTrim( sString );
				sString = RightTrim( sString );
			
			}
			
			return sString;
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}

//trim spaces: Front
	function LeftTrim( sString ){
		
		try{
			
			if( sString.length > 0 ){
				
				var i = 0;
				var char = sString.charAt(0);
	
				while ( char == ' ' || char == "\t" ){ //first, strip any SPACES
					i++;	
					char = sString.charAt(i);
				}
				
				sString = sString.substring( i, sString.length );
			}
			
			return sString;
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}
	
//trim spaces: BACK
	function RightTrim( sString ){
		
		try{
			
			if( sString.length > 0 ){
				
				var i = 0;
				var char = sString.charAt( sString.length + i -1);
	
				while ( char == ' ' || char == "\t" ){ //first, strip any SPACES
					i--;	
					char = sString.charAt( sString.length + i -1 );
				}
				
				sString = sString.substring( 0, sString.length + i );
				
			}
			
			return sString;
		
		}catch(e){ alert( e.constructor+':\n\n'+e.name+'\n\n'+e.message ); }
		
	}

//--><!]]>