var popUp; 
//var whichButton;
var controlList='';
var whichButton='';
var theValidatorControl='';

/*------------------------------------------------------------------------------------*/
/*Function checkControls
/*Created by Mesmin Augustin					Date: 09/10/2003
/*handles the unnecessary server-side validation when the which button is clicked
/*------------------------------------------------------------------------------------*/
function checkALLControls( source, arguments)
{
	var local_arr;
	var i;
	//alert(theValidatorControl + '-' +  source.id);
	
	if (theValidatorControl != source.id)	// make sure it is the right control that was clicked
	{
		arguments.IsValid = true;
		return
	}
	if ( whichButton != '')
	{
		
		local_arr = controlList.split(",");		//list of fields
	
		for( i=0; i<local_arr.length; i++)		//make sure all past
		{
			if (document.forms[0].item( local_arr[i] ).value == "")
			{
				arguments.IsValid = false;
				return
			}
		}
		arguments.IsValid = true;				//not a one was entered
		whichButton = ''		
	}
	else
	{
		arguments.IsValid = true;
	}
}
/*------------------------------------------------------------------------------------*/
/*Function checkAtLeastOne
/*Created by Mesmin Augustin					Date: 09/10/2003
/*handles the unnecessary server-side validation when the which button is clicked
/*------------------------------------------------------------------------------------*/
function checkAtLeastOne( source, arguments)
{
	var local_arr;
	var i;
	
	if ( whichButton != '')
	{
		local_arr = controlList.split(",");		//list of fields
	
		for( i=0; i<local_arr.length; i++)		//make sure at least one passed
		{
			if (document.forms[0].item( local_arr[i] ).value != "")
			{
				arguments.IsValid = true;
				return
			}
		}
		arguments.IsValid = false;				//not a one was entered
		whichButton = ''		
	}
	else
	{
		arguments.IsValid = true;
	}
}


/*------------------------------------------------------------------------------------*/
/*Function checkExempt
/*Created by Mesmin Augustin					Date: 09/10/2003
/*handles the unnecessary server-side validation when the which button is clicked
/*------------------------------------------------------------------------------------*/
function checkExempt( source, arguments)
{
	//alert( whichButton );
	if ( whichButton == '')
	{
		arguments.IsValid = true;
	}
	else
	{
		arguments.IsValid = false;
	}
}
/*------------------------------------------------------------------------------------*/
/*Function SET_WHICH_BUTTON
/*Created by Mesmin Augustin					Date: 09/10/2003
/*sets up the object that should not be validated server-side
/*------------------------------------------------------------------------------------*/
function setControlsToCheck( buttonName, ctlValidator, arrObjList )
{
	
	if (buttonName != '')
	{
		//alert( buttonName + '-' + arrObjList );
		controlList = arrObjList;
		whichButton = buttonName;
		theValidatorControl = ctlValidator
	}
	else
	{
		controlList = '';
		whichButton = '';
	}
	//alert( whichButton );
}

/*------------------------------------------------------------------------------------*/
/*Function setValidALL
/*Created by Mesmin Augustin					Date: 09/10/2003
/*handles the unnecessary server-side validation when the which button is clicked
/*------------------------------------------------------------------------------------*/
/*function setValidALL( source, arguments)
{
	if ( whichButton == "butFileUpload" )			//incident search
	{
	
		//at least one item is required
		if ( document.forms[0].item("txtIncidentNumber").value == "" 
				&& document.forms[0].item("txtIncidentDate").value == ""
				&& document.forms[0].item("txtIncidentDateTo").value == ""
				&& document.forms[0].item("ddlAttackLevel").value == ""
				&& document.forms[0].item("ddlRegion").value == ""
				&& document.forms[0].item("ddlIncidentType").value == ""
				&& document.forms[0].item("ddlIncidentStatus").value == ""
			)	
		{
			arguments.IsValid = false;
		}
		else
		{
			arguments.IsValid = true;
		}
	}
	else if ( whichButton == "userSearchButton" )			//user search
	{
		
		//at least one item is required, when dc is selected
		if (	document.forms[0].item("txtUserID").value == ""
				&& document.forms[0].item("txtFirstName").value == ""
				&& document.forms[0].item("txtMI").value == ""
				&& document.forms[0].item("txtLastName").value == ""
				&& document.forms[0].item("radALLDC").checked == true
			)	
		{
			arguments.IsValid = false;
		}
		else
			arguments.IsValid = true;
	}
	else if ( whichButton == "userLookUp" )			//user search
	{
		//at least one item is required, when dc is selected
		if (	document.forms[0].item("txtUserID").value == ""
				&& document.forms[0].item("txtFirstName").value == ""
				&& document.forms[0].item("txtMI").value == ""
				&& document.forms[0].item("txtLastName").value == ""
			)	
		{
			arguments.IsValid = false;
		}
		else
			arguments.IsValid = true;
	}
	else
	{
		arguments.IsValid = true;
	}
}
*/
/****************************************************************************************/
/* SET_WHICH_BUTTON
/****************************************************************************************/
function setWhichButton( name )
{
	whichButton=name;
}
/****************************************************************************************/
/* SET_VALID_COMP_TYPE
/****************************************************************************************/
function setValidALL( source, arguments)
{

	if ( whichButton == "subscribeButton" )	
	{
		//subscription email
		if ( document.forms[0].item("txtSubscribeEmail").value == "" )	
		{
			arguments.IsValid = false;
		}
		else
			arguments.IsValid = true;
	}
	/*if ( whichButton == "userSearchButton" )			//user search
	{
		
		//at least one item is required, when dc is selected
		if (	document.forms[0].item("txtUserID").value == ""
				&& document.forms[0].item("txtFirstName").value == ""
				&& document.forms[0].item("txtMI").value == ""
				&& document.forms[0].item("txtLastName").value == ""
				&& document.forms[0].item("radALLDC").checked == true
			)	
		{
			arguments.IsValid = false;
		}
		else
			arguments.IsValid = true;
	}*/
	else
	{
		arguments.IsValid = true;
	}
}
//------------------------------------------------------------------------------------
//------------------- bookmark and favorites script ----------------------------------

/* ----------------------------- SET HOMEPAGE --------------------------------------*/
function setHomepage()
{
	// If it's Internet Explorer, use automatic link
	if (document.all)
	{
		//document.write('<A HREF="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.Mezanmi.com\');">');
		//document.write('<font size="5" color=6699FF face=arial><B>Make Mezanmi.com Your Homepage</B></font></a>');
		//window.frmEmailList.style.behavior='url(#default#homepage)';window.frmEmailList.setHomePage('http://www.mezanmi.com');
		window.Form1.style.behavior='url(#default#homepage)';window.Form1.setHomePage('http://www.mezanmi.com');
	}
	// If it's Netscape 6, tell user to drag link onto Home button
	else if (document.getElementById)
	{
		document.write('<a href="http://www.Mezanmi.com">Drag this link onto your Home button to make this your Home Page.</a><br><br><a HREF="http://www.mezanmi.com">BACK</a>');
	}
	// If it's Netscape 4 or lower, give instructions to set Home Page
	else if (document.layers)
	{
		document.write('<b>Make this site your home page:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.<br><br><a HREF="http://www.mezanmi.com">BACK</a>');
	}
	// If it's any other browser, for which I don't know the specifications of home paging, display instructions
	else 
	{
		document.write('<b>Make this site your home page:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.<br><br><a HREF="http://www.mezanmi.com">BACK</a>');
	}
}

/*------------------------------ ADD TO FAVORITE -----------------------------------*/	
function addToFavorites()
{
		bookmarkurl="http://www.mezanmi.com/";
		bookmarktitle="Mezanmi.com";
		if (document.all)
			window.external.AddFavorite(bookmarkurl,bookmarktitle);
		else
			alert("Click on Add to Favorites in your browser menu, then Add");
	
}

/****************************************************************************************/
function StartStopSound()
{
	if ( window.mySound.src == "/songs/haiti.mid" )
	{
		window.mySound.src = "nofile.wav";
	}
	else
		window.mySound.src = "/songs/haiti.mid";
			
}
/****************************************************************************************/
function StopSound()
{
	window.mySound.src = "nofile.wav";
			
}
/********************************** OPEN_GAMES_WINDOW *********************************************/
function OpenGamesWindow(winURL, gID, gTypeID, gWidth, gHeight)
{
	
	var h, w;		//height, weight
	
	h = gHeight;
	w = gWidth;
	
	var intRand = Math.floor(1000*Math.random()+1);
	var strURL = winURL + "?itemID=" + gID + "&gameTypeID" + gTypeID + "&c=" + intRand;
	var features = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,width=" + w + ",height=" + h;	var myNewWindow = window.open(strURL, "GamesWindow", features);
	myNewWindow.resizeTo(w, h)

}	
/********************************** OPEN_GAMES_WINDOW *********************************************/
function OpenSameWindow(winURL, winName)
{
	
	var myNewWindow = window.open(winURL, winName);
}
		
