/*document.onkeydown = function() {
	if( event.keyCode == 13 )
		return false;
}*/

/*
** Function Name : GetElement
** Description	 : take the ID and return to you the Element Object
** Return		 : return value is Element Object
** Author		 : elhussein
*/
function GetElement(elementID)
{
	return document.all[elementID];
}

/*
** Function Name : ShowElement
** Description	 : show an element in the page
** Author		 : elhussein
*/
function ShowElement(elementID)
{
	var element = GetElement(elementID);
	element.style.display = "inline";
}

/*
** Function Name : HideElement
** Description	 : Hide an element in the page
** Author		 : elhussein
*/
function HideElement(elementID)
{
	var element = GetElement(elementID);
	element.style.display = "none";
}

/*
** Function Name : ToggleView
** Description	 : show or hide an element in the page
** Author		 : elhussein
*/
function ToggleView(elementID)
{
	var element = GetElement(elementID);
	element.style.display = ( !IsVisibleElement(elementID) )? "inline" : "none";
}

/*
** Function Name : IsVisibleElement
** Description	 : detect is the element is visible or Not
** Return		 : return true or false
** Author		 : elhussein
*/
function IsVisibleElement(elementID)
{
	var element = GetElement(elementID);
	return (element.style.display == "none")? false : true;
}

/*
** Function Name : ShowColorDialog
** Parameters	 : 
**				   bool RightToLeft : Optional argument [ the default value is true ]
** Description	 : Dispaly Color Dialog Picker
** Return		 : return null value if the user cancel to choose colors
**				   or return the color Name
** Author		 : elhussein
*/
function ShowColorDialog(RightToLeft)
{

	var RightToLeft = ( RightToLeft == null )? true : false;
	var folderPath = "Js/ColorPicker/";
	var pageName = ( RightToLeft )? "ColorDialog_ar.htm" : "ColorDialog_en.htm" ;

	var dialogWidth  = ( RightToLeft )? 28 : 26;
	var dialogHeight = ( RightToLeft )? 35 : 29;

	var colorValue = window.showModalDialog( folderPath + pageName
		,window
		,"dialogWidth=" + dialogWidth + ";dialogHeight=" + dialogHeight + ";help=0;status=0;resizable=yes;");

	return ( typeof colorValue == "undefined" )? null : colorValue;
}

/*
** Function Name   : openCalendar
** Description	   : take the ID and return to you the Element Object
** Return		   : return value is Element Object
** Author		   : Mohamed
** Changes History : 
**					Change Date		Author		Description
**					14/4/2004		Elhussein	Set the Popup Window to
**												be Relocated at center
*/
function openCalendar(ControlID)
{
	var windowWidth  = 380;
	var windowHeight = 350;
	var windowLeft	 = ( window.screen.width  - windowWidth  )/2 ;
	var windowTop	 = ( window.screen.height - windowHeight )/2;

	window.open( "calendar.aspx?id=" + ControlID + "&dateValue=" + document.all[ControlID].value
				, null
				,'height=' + windowHeight + 
				 ',width=' + windowWidth +
				 ',left='  + windowLeft +
				 ',top='   + windowTop +
				 ',status=no,toolbar=no,menubar=no,location=no');
}

function OpenWindow(url, width, height)
{
	var windowWidth  = width;
	var windowHeight = height;
	var windowLeft	 = ( window.screen.width  - windowWidth  )/2 ;
	var windowTop	 = ( window.screen.height - windowHeight )/2;

	window.open( url 
				, null
				,'height=' + windowHeight + 
				 ',width=' + windowWidth +
				 ',left='  + windowLeft +
				 ',top='   + windowTop +
				 ',status=no,toolbar=no,menubar=no,location=no');
}

function hidestatus(statusmsg)
{
	window.status=statusmsg;
	return true;
}

function setFocus(elementID)
{
	var element = GetElement(elementID);
	element.focus();
}

/*
** Function Name   : AddToFavorite
** Description	   : add the site to the Browser Favorite
** Parameters	   : 
**						url -- the path of url to be added in the favorite
**						favoriteSiteName -- the name of the site in the favorite
** Return		   : Null
** Author		   : Elhussein
*/
function AddToFavorite( url, favoriteSiteName)
{
	if( document.all )
		window.external.AddFavorite(url, favoriteSiteName);
}