// JavaScript Document

			function myPopup() {
			window.open( "http://www.devotiondiet.com/images/GOAL_Description.png", "myWindow", "status = 0, width = 500, height = 250, resizeable = 0" )
			}
			
			function myPopup2() {
			window.open( "http://www.devotiondiet.com/images/monkey.jpg", "myWindow", "status = 0, width = 650, height = 650, resizeable = 0" )
			}
			
			function GoToUsername( ) {
			
				document.LoginForm.Username.focus( );
			}


			function MouseOver( obj ) {
			
				obj.className = "MenuColorOver";
			}

			function MouseOut( obj, color ) {
			
				obj.className = "MenuColor";
			}
			
			function ChangeSrc( obj, strFileName ) {
				
				obj.src = "/Images/" + strFileName;
			}
			
			function ChangeClass( obj, strClassName ) {
				
				obj.className = strClassName;
			}

			function ChangeClass2( obj, strClassName, sh ) {
				
				var tmp;
				
				tmp = document.getElementById( "Level2" );
				if ( sh == 1 )
					tmp.className = "jkShow";
				else
					tmp.className = "jkHide";
				obj.className = strClassName;
			}

			function echeck(str) {
			
				var at = "@"
				var dot = "."
				var lat = str.indexOf( at )
				var lstr = str.length
				var ldot = str.indexOf( dot )
			
				if ( str.indexOf( at ) == -1 ) {
				   alert( "Invalid E-mail ID" )
				   return false
				}
			
				if ( str.indexOf( at ) == -1 || str.indexOf( at ) == 0 || str.indexOf( at ) == lstr ) {
				   alert( "Invalid E-mail ID" )
				   return false
				}
			
				if ( str.indexOf( dot ) == -1 || str.indexOf( dot ) == 0 || str.indexOf( dot ) == lstr ) {
					alert( "Invalid E-mail ID" )
					return false
				}
			
				 if ( str.indexOf( at, ( lat + 1 ) ) != -1 ) {
					alert( "Invalid E-mail ID" )
					return false
				 }
			
				 if ( str.substring( lat-1, lat ) == dot || str.substring( lat+1, lat+2 ) == dot ) {
					alert( "Invalid E-mail ID" )
					return false
				 }
			
				 if ( str.indexOf( dot, ( lat+2 ) ) == -1  ){
					alert( "Invalid E-mail ID" )
					return false
				 }
					
				 if (str.indexOf(" ")!=-1){
					alert("Invalid E-mail ID")
					return false
				 }
			
				 return true					
			}

			function ValidateEmail( strEmail, page ) {

				var emailID, tmp
				
				if ( page = 1 ) {
					emailID = document.ContactUs.val9;
					tmp = document.getElementById( "ok9" );
				} else {
					emailID = document.SignUp.val3;
					tmp = document.getElementById( "ok3" );
				}

/*				if ( !emailID.value || emailID.value == "" ) {
					alert( "Please Enter your Email" );
					document.getElementById( "Email" ).src = "/Images/NoOK.png";
					tmp.className = "DDShow";
					emailID.focus( );
					return false;
				} */
				if ( echeck( emailID.value ) == false ) {
					emailID.focus( );
					document.getElementById( "Email" ).src = "/Images/NoOK.png";
					tmp.className = "DDShow";
					return false;
				}

				document.getElementById( "Email" ).src = "/Images/OK.png";
				tmp.className = "DDShow";
				return true
			}

			function LandOn( obj ) {
			
				var iCtr, strName, tmp

				document.getElementById( obj ).className = "ContactUsInRow";
				for ( iCtr = 1; iCtr <= 13; iCtr ++ ) {
					strName = "line" + iCtr.toString( );
					tmp = document.getElementById( strName );
					if ( !tmp )
						break;
					if ( strName != obj )
						document.getElementById( strName ).className = "ContactUsOutRow";
					if ( iCtr != 9 )
						if ( document.getElementById( "val" + iCtr ).value )
							document.getElementById( "ok" + iCtr ).className = "DDShow";
						else
							document.getElementById( "ok" + iCtr ).className = "DDHide";
				}
			}

			function SelectRightSide( ) {

				var obj = document.getElementById( "RightSide" );
				var ctr;

				for ( ctr = 0; ctr <= obj.options.length - 1; ctr ++ ) {
					obj.options[ ctr ].selected = true;
				}
			}

			function ChangeColor( row ) {

				var obj;

				if ( row == 1 ) {
					obj = document.getElementById( "row1" );
					alert( obj.name );
					obj.className = "ContactUsInRow";
					obj = document.getElementById( "row2" );
					obj.className = "ContactUsInRow";
				} else {
					obj = document.getElementById( "row1" );
					obj.className = "ContactUsOutRow";
					obj = document.getElementById( "row2" );
					obj.className = "ContactUsOutRow";
				}
			}
			
			function FoodChange( ) {

				var ctr, obj;
				var pick = document.FoodChoice.FoodCategory.selectedIndex;

				for ( ctr = 1; ctr <= document.FoodChoice.iCategorys.value; ctr ++ ) {
					obj = document.getElementById( "LeftSide" + ctr.toString( ) );
					if ( obj != null )
						obj.className = "ListInvisible";
				}
				obj = document.getElementById( "LeftSide" + document.FoodChoice.FoodCategory.options[ pick ].value.toString( ) );
				if ( obj != null )
					obj.className = "ListVisible"
			}
			
			function MoveRight( ) {
				
				var optn = document.createElement( "OPTION" );
				var obj = document.getElementById( "LeftSide" + document.FoodChoice.FoodCategory.value );
				var pick = obj.selectedIndex;
				
				if ( pick == -1 )
					alert( "You Must Select a Food" );
				else {
					optn.text = obj.options[ pick ].text;
					optn.value = obj.options[ pick ].value;
					document.FoodChoice.RightSide.options.add( optn );
					obj.remove( pick );
				}
			}
			
			function RemoveCountCheck( ) {
				
				if ( document.FoodChoice.RightSide.options.length < document.FoodChoice.iNbrtoRemove.value ) {
					alert( "You Must Remove at Least " + document.FoodChoice.iNbrtoRemove.value + " Items Please" );
					return false;
				}

				SelectRightSide( );

				return true;
			}
			
			function NarrowMoveRight( ) {
				
				var optn = document.createElement( "OPTION" );
				var obj = document.getElementById( "LeftSide" );
				var pick = obj.selectedIndex;
				
				if ( pick == -1 )
					alert( "You Must Select a Food" );
				else {
					optn.text = obj.options( pick ).text;
					optn.value = obj.options( pick ).value;
					document.FoodChoice.RightSide.options.add( optn );

					obj.remove( pick );
				}
			}
			
			function MoveAllRight( ) {
				
				var a = new Array( );
				var obj = document.getElementById( "LeftSide" + document.FoodChoice.FoodCategory.value );
				var ctr;

				for ( ctr = 0; ctr <= obj.options.length - 1; ctr ++ ) {
					a[ ctr ] = document.createElement( "OPTION" );
					a[ ctr ].text = obj[ ctr ].text;
					a[ ctr ].value = obj[ ctr ].value;
					document.FoodChoice.RightSide.options.add( a[ ctr ] );
				}
				obj.options.length = 0;
			}

			function MoveLeft( ) {
				
				var optn = document.createElement( "OPTION" );
				var obj;
				var pick = document.FoodChoice.RightSide.selectedIndex;
				
				if ( pick == -1 ) {
					alert( "You Must Select a Food" );
				} else {
					optn.text = document.FoodChoice.RightSide.options[ pick ].text;
					optn.value = document.FoodChoice.RightSide.options[ pick ].value;
					obj = document.getElementById( "LeftSide" + document.FoodChoice.RightSide.options[ pick ].value.substr( 0, document.FoodChoice.RightSide.options[ pick ].value.search( "-" ) ) );
					if ( obj != null )
						obj.options.add( optn );
					else
						alert( "Object Null" )

					document.FoodChoice.RightSide.remove( pick );
				}
			}

			function NarrowMoveLeft( ) {
				
				var optn = document.createElement( "OPTION" );
				var obj;
				var pick = document.FoodChoice.RightSide.selectedIndex;
				
				if ( pick == -1 ) {
					alert( "You Must Select a Food" );
				} else {
					optn.text = document.FoodChoice.RightSide.options( pick ).text;
					optn.value = document.FoodChoice.RightSide.options( pick ).value;
					obj = document.getElementById( "LeftSide" );
					if ( obj != null )
						obj.options.add( optn );
					else
						alert( "Object Null" )

					document.FoodChoice.RightSide.options.remove( pick );
				}
			}

			function MoveAllLeft( ) {
				
				var a = new Array( );
				var obj;
				var ctr;
				for ( ctr = 0; ctr <= document.FoodChoice.RightSide.length - 1; ctr ++ ) {
					a[ ctr ] = document.createElement( "OPTION" );
					a[ ctr ].text = document.FoodChoice.RightSide.options[ ctr ].text;
					a[ ctr ].value = document.FoodChoice.RightSide.options[ ctr ].value;
					obj = document.getElementById( "LeftSide" + document.FoodChoice.RightSide.options[ ctr ].value.substr( 0, document.FoodChoice.RightSide.options[ ctr ].value.search( "-" ) ) );
					
					obj.options.add( a[ ctr ] );
				}
				document.FoodChoice.RightSide.options.length = 0;
			}

			function OverCode( obj, cls ) {
			
				obj.className = cls;
			}

			function ChangeTo( strPanelName ) {

				if ( strPanelName != "" )
					FrmBody.location = "/ASP/NutritionNook" + strPanelName + ".asp";
				else
					FrmBody.location = "/ASP/BlankFrmBody.asp";
			}

			function ChangeToPDF( strFileName, strSubDir ) {

				if ( strFileName != "" )
					FrmBody.location = "/PDF/" + strSubDir + "/" + strFileName;
				else
					FrmBody.location = "/ASP/BlankFrmBody.asp";
			}
			
			var newwindow;
			
			function poptastic( url ) {

				newwindow = window.open( url, 'name' );
				if ( window.focus )
					newwindow.focus( )
			}

			function DisplayPDF( strFileName, strSubDir ) {

				poptastic( "/PDF/" + strSubDir + "/" + strFileName )
			}
			
			function CheckFields( ) {
				
				if ( document.SignUp.val1.value == "" ) {
					window.alert( "Your First Name Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val2.value == "" ) {
					window.alert( "Your Last Name Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val3.value == "" ) {
					window.alert( "Your Email Must Be Entered" );
					return false;
				}
				if ( !ValidateEmail( document.SignUp.val3.value, 2 ) ) {
					window.alert( "Invalid Email Entered Please Reenter" );
					return false;
				}
				if ( document.SignUp.val4.value == "" ) {
					window.alert( "The Password Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val5.value == "" ) {
					window.alert( "Please Reenter Your Password" );
					return false;
				}
				if ( document.SignUp.val4.value != document.SignUp.val5.value ) {
					window.alert( "Passwords Don't Match Please Reenter" );
					return false;
				}
				if ( document.SignUp.val6.value == "" ) {
					window.alert( "Your Height Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val6.value.length < 1 || document.SignUp.val6.value.length > 3  ) {
					window.alert( "Your Height Must Be In the Format x or x.x" );
					return false;
				}
				if ( document.SignUp.val7.value == "" ) {
					window.alert( "Your Weight Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val9.value == "" ) {
					window.alert( "Your Age Must Be Entered" );
					return false;
				}
				if ( document.SignUp.val10.value == "" ) {
					window.alert( "Your Goal Weight Must Be Entered" );
					return false;
				}
				
				return true;
			}
