/*******************************************************************
Globlal Variables and Constants Declarations
*******************************************************************/



var strSitePath = "http://appserver/Fatwa/";

/*****************************************************************
To Add the site to favorites
*****************************************************************/
function AddToFavorites(){
	window.external.AddFavorite( "http://www.Eskadenia.com","ESKADENIA Software Solutions")
}


/*******************************************************************
Returns a String containing a copy of a specified string without leading spaces. 

Parameters:
String - The required string argument is any valid 
         string expression. If string contains null, 
         false is returned.
Returns: String.
*******************************************************************/
function LTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return (false);

	for (i = 0; i < String.length; i++)
	{
		if (String.substr(i, 1) != ' ' && String.substr(i, 1) != '\t')
			break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

/*******************************************************************
Returns a String containing a copy of a specified string without trailing spaces. 

Parameters:
String - The required string argument is any valid 
         string expression. If string contains null, 
         false is returned.
Returns: String.
*******************************************************************/
function RTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return (false);

	for(j = String.length - 1; j >= 0; j--)
	{
		if (String.substr(j, 1) != ' ' && String.substr(j, 1) != '\t')
			break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

/*******************************************************************
Returns a String containing a copy of a specified string without 
both leading and trailing spaces .

Parameters:
String - The required string argument is any valid 
         string expression. If string contains null, 
        false is returned.
Returns: String.
*******************************************************************/
function Trim(String)
{
	if (String == null)
		return (false);
	return RTrim(LTrim(String));
}

/**************************************************************
 Mid: Returns a String containing a specified number of 
      characters from a string

 Parameters:
      String = String expression from which characters are 
               returned. If string contains null, false is 
               returned.
      Start  = Number. Character position in string at which 
               the part to be taken begins. If Start is 
               greater than the number of characters in 
               string, Mid returns a zero-length string ("").
      Length = Number of characters to return. If omitted 
               false is returned. 

 Returns: String
***************************************************************/
function Mid(String, Start, Length)
{
	if (String == null)
		return (false);

	if (Start > String.length)
		return '';

	if (Length == null || Length.length == 0)
		return (false);

	return String.substr((Start - 1), Length);
}

/**************************************************************
 Len: Returns a Long containing the number of characters in a 
      string or the number of bytes required to store a 
      variable.

 Parameters:
      string = Any valid string expression. If string contains 
               null, false is returned.

 Returns: Long
***************************************************************/
function Len(string)
{
	if (string == null)
		return (false);

	return String(string).length;
}

/*******************************************************************
Return boolen value if the passed value is valid number or not.

Parameters:
strValue - string value that will be checked if its number.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsNumber(strValue,strAlert)
{
	strval=Trim(strValue)
	test=true;

	number=isNaN(strval);
	if (number == true)
	{
		test=false;
		alert(strAlert);
	}
	return(test);	
}	

/*******************************************************************
Return boolen value if the passed value is nigative number or not.

Parameters:
strValue - string value that will be checked if its nigative number.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsNegative(strValue,strAlert)
{
	test=true;
	if ((strValue < 0 ) == true)
	{
		test=false;
		alert(strAlert);
	}
	return(test);	
}	

/*******************************************************************
Return boolen value if the passed value is empty or null string.

Parameters:
strValue - string value that will be checked if its empty string or not.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsEmpty(strValue,strAlert)
{
	test = true;
	valtrimed = Trim(strValue);
	testlen = valtrimed.length;

	if (testlen == 0) 
	{
		test = false;
		alert(strAlert);
	}
	return(test);	
}	

/*******************************************************************
Return boolen value if the passed value is Alphabet entries or not.

Parameters:
intFlag  - indicates the state of alphabet. 1-Arabic(Both). 2-English.
strValue - string value that will be checked if its Alphabet entries.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/


function IsAlpha(intFlag,strValue,strAlert)
{
	var r;
	var x;
	
	test=true;
	if (Trim(strValue) != "")
	{
		if (intFlag == 1)
			x="[A-Za-zÃÅÉÆÄÇ-í]+[ ÉÅÃÄÆÇ-íA-Za-z./&,_Á -]*[a-zÃÅÉÄÁÆÅáÇ-íA-Z.]*";
		else if (intFlag == 2)
			x="[A-Za-z]+[A-Za-z.&/,_ -]*[A-Za-z.]*";
					
		r=strValue.match(x);
		if (r!=strValue)
		{
			test=false;
			alert(strAlert);
		}
	}
	return(test);	
}	

/*******************************************************************
Return boolen value if the passed value is Alphanumeric data.

Parameters:
intFlag  - indicates the state of alphabet. 1-Arabic(Both). 2-English.
strValue - string value that will be checked if its Alphanumeric data.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsAlphaNum(intFlag,strValue,strAlert)
{
	var r;
	var x;
	
	test=true;
	if (Trim(strValue) != "" )
	{
		if (intFlag == 1)
			x="[0-9A-Za-zÃÅÉÆÄÇ-í]+[ÉÅÃÄÆÇ-íA-Za-z0-9.&/,_Á -]*[a-zÃÅÉÄÁÆÅáÇ-íA-Z0-9.]*";
		else
			x="[0-9A-Za-z]+[A-Za-z0-9.&/,_ -]*[a-zA-Z0-9.]*";
		
		r=strValue.match(x);
		if (r!=strValue) 
		{
			test=false;
			alert(strAlert);
		}
	}
	return(test);	
}	

/*******************************************************************
Return boolen value if the passed value is valid email format or not.

Parameters:
strValue - string value that will be checked if its valid email format.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsEmail(strValue,strAlert)
{
	var r;
	var x;
	
	test=true;
	if (Trim(strValue) != "")
	{
		x="[A-Za-z_]+[A-Za-z0-9_-]*[.]?[A-Za-z0-9_-]+[@][A-Za-z0-_-]+[.][A-Za-z0-9_]+[.]?[A-Za-z0-9_]+" ;
		r=strValue.match(x);
		if (r!=strValue)
		{
			test=false;
			alert(strAlert);
		}
	}
	return(test);	
}	

/*******************************************************************
 Return boolen value if the passed string had length more than certain
 characters.

Parameters:
strValue - string value that will be checked. 
intLen   - the max no. of characters allowed.
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function checkPasswordLength(strValue,intLen,strAlert)
{
	test=true;
	valtrimed=Trim(strValue)
	testlen=valtrimed.length;
	if ( testlen < intLen )
	{
		test=false;
		alert(strAlert);
	}
	return(test)
} 

/*******************************************************************
Return boolen value if the passed value is valid phone format.

Parameters:
strValue - string value that will be checked. 
strAlert - string value to be message alert.
Returns: Boolean.
*******************************************************************/
function IsTelephone(strValue,strAlert)
{
	var x,r
	test=true
	if (Trim(strValue) != "" )
	{
		x="[+]?[0-9]+[0-9-]*"
		r=strValue.match(x)
		if (r!=strValue) 
		{
			test=false;
			alert(strAlert);
		}
	}
	return(test);	
}

/*******************************************************************
Add a new item to a SELECT HTML object at runtime.

Parameters:
Object - SELECT Object ID.
Value  - Value of the String ... <option VALUE="?????">....</option>.
String - String to add.
Returns: None.
*******************************************************************/
function ComboAdd(Object, Value, String)
{
	Value = Trim(Value)
	String = Trim(String)

	if (Value.length < 1 || String.length < 1)
		return false

	Object[Object.length] = new Option(String, Value);
	Object.selectedIndex = Object.length; 
}



/*******************************************************************
Add a new item to a SELECT HTML object at runtime.

Parameters:
Object - SELECT Object ID.
Value  - Value of the String ... <option VALUE="?????">....</option>.
String - String to add.
Returns: None.
*******************************************************************/
function MultipleListAdd(Source,Distination) 
{
	var  oOption ;
	var c = Source.length;
	var flag;
	
	for(i=0; i<c; i++)
	{
		oOption = new Option();
		if (Source[i].selected) 
		{   
		    Source[i].selected=false;
			oOption.value= Source.options[i].value;
			oOption.text=Source.options[i].text;
			
			if (Distination.length==0)
			{
				Distination.options[Distination.length]=oOption;
				oOption=null;
			}
			
			if (oOption != null){
				flag=0;
				for(i=0; i<Distination.length; i++)
				{
					if (Distination.options[i].value==oOption.value){
						flag=1;
						oOption=null;
						break
					}
				}
			}

			if (flag==0){
				Distination.options[Distination.length]=oOption;
				oOption=null;
			}
		}
	}
	
}
	

/*******************************************************************
Delete the current/selected item from a SELECT HTML object at runtime.

Parameters:
Object - SELECT Object ID.
Returns: None.
*******************************************************************/
function ComboDel(Object)
{
	var selected_index = Object.selectedIndex
	
	if (selected_index >= 0)
	{
		Length = Object.length
		for (i= Length-1;i >= 0;i--){
		if (Object.options[i].selected)
		{
			Object.options[i] = null;
		}
		
		}
//		if (selected_index >= 0)
//			Object.selectedIndex = selected_index
//		else
//			Object.selectedIndex = 0;
	}
}

/*******************************************************************
Returns a Long specifying the position of the first 
occurrence of one string within another. Is String1
or String2 are null, false is returned.

Parameters:
String1 - String expression being searched.
String2 - String expression sought.
Returns: Integer.
*******************************************************************/
function InStr(String1, String2)
{
	var a = 0;

	if (String1 == null || String2 == null)
		return (false);

	String1 = String1.toLowerCase();
	String2 = String2.toLowerCase();

	a = String1.indexOf(String2);
	if (a == -1)
		return 0;
	else
		return a + 1;
}

/**************************************************************
Returns a Boolean value indicating whether an 
expression contains symbols such as
@#$%^&|\_+-*="!?,/.:;'(){}<>[].

Parameters:
String1 - the string being searched.
String2 - Variant containing a numeric expression or 
		  string expression.
Returns: Boolean.
***************************************************************/
function IsSpecialChars(String1, String2)
{
	if (String1 != "")
	{
		Expression = String1.toLowerCase();
		if(String2 !="" || String2 == false)
			RefString  = String2;
		else
			RefString ="\"\'";

		if (Expression.length < 1) 
			return (false);

		for (var i = 0; i < Expression.length; i++) 
		{
			var ch = Expression.substr(i, 1)
			var a = RefString.indexOf(ch, 0)
			if (a != -1)
			{
				alert("The following characters are not allowed " + RefString +" .");
				return (false);
			}
		}
	}
	return(true);
}

/*******************************************************************
Returns if a specific string reaches the min. size.

Parameters:
String1 - the string you want to check.
Length  - the min. lenght you want.
String2 - the error message.
Returns: Boolean
*******************************************************************/
function IsMinSize(String1,Lenght,String2)
{
	var StringVal = Trim(String1);
	var StringLength = StringVal.length ;

	if (StringVal != "")
	{
		if ( parseInt(StringLength) < parseInt(Lenght) )
		{
			alert(String2);
			return false;
		}
	}
	return true;
}

/*******************************************************************
Returns if a specific string reaches the max. size.

Parameters:
String1 - the string you want to check.
Length  - the min. lenght you want.
String2 - the error message.
Returns: Boolean
*******************************************************************/
function IsMaxSize(String1,Lenght,String2)
{
	var StringVal = Trim(String1);
	var StringLength = StringVal.length ;
	if (StringVal != "")
	{
		if ( parseInt(StringLength) > parseInt(Lenght) )
		{
			alert(String2);
			return false;
		}
	}
	return true;
}

/*******************************************************************
Returns a referance to a spcified form .

Parameters:
String1 - The name of the form. 
Returns: form object.
*******************************************************************/
function GetForm(String1)
{
	
	if (String1 == null)
		return null;
	else
		return eval("document.forms." + String1);
}

/*******************************************************************
submits a form. 

Parameters:
formName - form name string.
Returns: none.
*******************************************************************/
function SubmitForm(formName)
{
	var obj_form= GetForm(formName);
	if(obj_form)
	{
		obj_form.submit();
	}
}

/*******************************************************************
resets a form. 

Parameters:
formName - form name string.
Returns: none.
*******************************************************************/
function ResetForm(formName)
{
	var obj_form= GetForm(formName);
	if(obj_form)
	{
		obj_form.reset();
	}
}

/*******************************************************************
Gets an element refernce.  

Parameters:
FormElement - element name you want to get.	
Form		- form object.
Returns: object. 
*******************************************************************/
function GetElement(FormElement,Form)
{
	var form_length = Form.elements.length;
	var myform = Form;
	var Element = null;
	for (var i = 0; i < form_length; i++)
	{
		if(myform.elements[i].name == FormElement)
		{
			Element=myform.elements[i];
			return 	Element;
		}
	}
	alert("Element not found "+ FormElement);
}

/*******************************************************************
Returns the element value.

Parameters:
CheckedElement = element object you want to return it's value.
Returns: String. 
*******************************************************************/
function GetElementValue(CheckedElement)
{
	var ElementValue ="";
	if (CheckedElement == null)
	{
		alert("Null element");
		return false;
	}
				
	var ElementType = CheckedElement.type ;
	ElementType = ElementType.toLowerCase();
	if (
		ElementType == 'text' || ElementType == 'hidden' || 
		ElementType == 'password' || ElementType == 'textarea' || 
		ElementType == 'select-one' || ElementType == 'checkbox' || 
		ElementType == 'radio' || ElementType == 'select-multiple'
		)
		{
					
		if (
			ElementType == 'text' || ElementType == 'hidden' ||
			ElementType == 'password' || ElementType == 'textarea'
			)
			ElementValue = Trim(CheckedElement.value);
					
		else if (ElementType == 'select-one' || ElementType == 'select-multiple')
			ElementValue =  Trim(CheckedElement[CheckedElement.selectedIndex].value);
		}
	return ElementValue;
}

/*******************************************************************
select and focus of an element. 

Parameters:
CheckedElement - element object you want to select.
Returns: none.
*******************************************************************/
function selectElement(CheckedElement)
{
	var ElementType = CheckedElement.type ;
	ElementType = ElementType.toLowerCase();
			
	if (ElementType == 'text'  || ElementType == 'password'  || ElementType == 'textarea')
	{
		CheckedElement.select();
		CheckedElement.focus();
	}
					
	else if (ElementType == 'checkbox' || ElementType == 'radio' || 
			 ElementType == 'select-one' || ElementType == 'select-multiple')
		CheckedElement.focus();
		CheckedElement.selectedIndex=0;
}

/*******************************************************************
checks an element for the various validation conditions. 

Parameters:
FormElement  - form element's name.
Form		 - the form object.
Empty		 - to check if the field is empty.
Alpha		 - to check if the field is alpha.
Number		 - to check if the field is numeric.
Negative	 - to check if the field is negative.
AlphaNum	 - to check if the field is alphanumeric.
Email		 - to check if the field is formatted as an email.
Telephone	 - to check if the field is formatted is a phone.
MinSize		 - to determine the minimum size of the field.
MaxSize		 - to determine the maximum size of the field.
SpecialChars - to check if the element contains a special characters.

Notes:-
The other parameters can be either false(is the validation condition is not required)
or an error message(string) if the validation condition is required.
	   
note :1- The last two parameters maxsize and minsize of char's in a field, in case 
it's required the number of char's should be contcatenated with a $ and with 
also with the error message.
			
2- When its needed to check for spcial characters the SpecialChars variable
should equal a string that contains the spcial characters
			
	   
Ex. you need to make shur the minimum of char's in a password field is 6.
The function should be called as follows
CheckElement(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,
"6$"+ ErrorMessage,MaxSize,SpecialChars)
Where ErrorMessage is a string that contains the actual error message.
	   
Ex.
CheckElement(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,
MinSize,MaxSize,"[]{}+-\\*\'=\"")

Returns: none
*******************************************************************/
function CheckElement(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,MinSize,MaxSize,SpecialChars)
{
	var CheckedElement=GetElement(FormElement,Form);
	var ElementValue="";
	var status;
	
	if(CheckedElement==null)
	{
		alert(messageArrayE[10]+ ' '+ FormElement);
		return false;
	}
	else
	{
		ElementValue = GetElementValue(CheckedElement);
		if (Empty!=false)
		{
			if (IsEmpty(ElementValue,Empty)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Alpha!=false)
		{
			if (IsAlpha(2,ElementValue,Alpha)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Number!=false)
		{
			if (IsNumber(ElementValue,Number)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
	
		if (Negative!=false)
		{
			if (IsNegative(ElementValue,Negative)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Alphanum!=false)
		{
			if (IsAlphaNum(2,ElementValue,Alphanum)==false)
			{
				selectElement(CheckedElement);
				return false;	
			}
		}
		
		if (Email!=false)
		{
			if (IsEmail(ElementValue,Email)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Telephone!=false)
		{
			if (IsTelephone(ElementValue,Telephone)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (MinSize!=false)
		{
			var Message =MinSize.substr(MinSize.indexOf("$")+1);
			MinSize=MinSize.substr(0,MinSize.indexOf("$"));
				
			if (IsMinSize(ElementValue,MinSize,Message +" "+MinSize+".")==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (MaxSize!=false)
		{
			var Message =MaxSize.substr(MaxSize.indexOf("$")+1);
			MaxSize=MaxSize.substr(0,MaxSize.indexOf("$"));
				
			if (IsMaxSize(ElementValue,MaxSize,Message +" "+MaxSize+"." )==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}

		if (SpecialChars!=false)
		{
			if (IsSpecialChars(ElementValue,SpecialChars)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
				
		return true;
	}
}




/*******************************************************************
checks an element for the various validation conditions. 

Parameters:
FormElement  - form element's name.
Form		 - the form object.
Empty		 - to check if the field is empty.
Alpha		 - to check if the field is alpha.
Number		 - to check if the field is numeric.
Negative	 - to check if the field is negative.
AlphaNum	 - to check if the field is alphanumeric.
Email		 - to check if the field is formatted as an email.
Telephone	 - to check if the field is formatted is a phone.
MinSize		 - to determine the minimum size of the field.
MaxSize		 - to determine the maximum size of the field.
SpecialChars - to check if the element contains a special characters.

Notes:-
The other parameters can be either false(is the validation condition is not required)
or an error message(string) if the validation condition is required.
	   
note :1- The last two parameters maxsize and minsize of char's in a field, in case 
it's required the number of char's should be contcatenated with a $ and with 
also with the error message.
			
2- When its needed to check for spcial characters the SpecialChars variable
should equal a string that contains the spcial characters
			
	   
Ex. you need to make shur the minimum of char's in a password field is 6.
The function should be called as follows
CheckElement(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,
"6$"+ ErrorMessage,MaxSize,SpecialChars)
Where ErrorMessage is a string that contains the actual error message.
	   
Ex.
CheckElement(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,
MinSize,MaxSize,"[]{}+-\\*\'=\"")

Returns: none
*******************************************************************/
function CheckElementA(FormElement,Form,Empty,Alpha,Number,Negative,Alphanum,Email,Telephone,MinSize,MaxSize,SpecialChars)
{
	var CheckedElement=GetElement(FormElement,Form);
	var ElementValue="";
	var status;
	
	if(CheckedElement==null)
	{
		alert(messageArrayA[10]+ ' '+ FormElement);
		return false;
	}
	else
	{
		ElementValue = GetElementValue(CheckedElement);
		if (Empty!=false)
		{
			if (IsEmpty(ElementValue,Empty)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Alpha!=false)
		{
			if (IsAlpha(1,ElementValue,Alpha)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Number!=false)
		{
			if (IsNumber(ElementValue,Number)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
	
		if (Negative!=false)
		{
			if (IsNegative(ElementValue,Negative)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Alphanum!=false)
		{
			if (IsAlphaNum(1,ElementValue,Alphanum)==false)
			{
				selectElement(CheckedElement);
				return false;	
			}
		}
		
		if (Email!=false)
		{
			if (IsEmail(ElementValue,Email)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (Telephone!=false)
		{
			if (IsTelephone(ElementValue,Telephone)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (MinSize!=false)
		{
			var Message =MinSize.substr(MinSize.indexOf("$")+1);
			MinSize=MinSize.substr(0,MinSize.indexOf("$"));
				
			if (IsMinSize(ElementValue,MinSize,Message +" "+MinSize+".")==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
		
		if (MaxSize!=false)
		{
			var Message =MaxSize.substr(MaxSize.indexOf("$")+1);
			MaxSize=MaxSize.substr(0,MaxSize.indexOf("$"));
				
			if (IsMaxSize(ElementValue,MaxSize,Message +" "+MaxSize+"." )==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}

		if (SpecialChars!=false)
		{
			if (IsSpecialChars(ElementValue,SpecialChars)==false)
			{
				selectElement(CheckedElement);
				return false;
			}
		}
				
		return true;
	}
}

/*******************************************************************
compare the value of two elemets in the form.

Parameters:
String1 - compared Element name.
String2 - comparable Element name.
String3 - show Error Message. 
Object  - Form Object.           
Returns: Boolean
*******************************************************************/
function CheckPasswordsMatch(String1,String2,String3,Object)
{
	if(GetElementValue(GetElement(String1,Object))!=GetElementValue(GetElement(String2,Object)))
	{
		alert(String3);
		selectElement(GetElement(String1,Object));
		return false;
	}
	else
		return true;
}

/*******************************************************************
checks if the first option is selected in a DDL. 

Parameters:
String1 - Element name.
String2 - index value.
String3 - Error Message.
Object  - Form Object.
Returns: Boolean.
*******************************************************************/
function SelectedIndex(String1,String2,String3,Object)
{
	var SelectElement= GetElement(String1,Object);
	if( SelectElement.selectedIndex <=0  )
	{
		alert(String3);
		selectElement(SelectElement);
		return false;
	}
	else
		return true;
}

/*******************************************************************
checks if the options are selected in a DDL, and the first option
is not 0. 

Parameters:
String1 - Element name.
String2 - index value.
String3 - Error Message.
Object  - Form Object.
Returns: Boolean.
*******************************************************************/
function SelectedMultipleWithoutZero(String1,String2,String3,Object)
{
	var SelectElement= GetElement(String1,Object);
	
	if(SelectElement.length > 1)
	for(i=1;i<SelectElement.length;i++)
	{
		if(SelectElement.options[i].selected == true)
		{
			return true;		
		}
	}	
	alert(String3);
	return false;
}

/*******************************************************************
checks if the options are selected in a DDL, and the first option
is 0. 

Parameters:
String1 - Element name.
String2 - index value.
String3 - Error Message.
Object  - Form Object.
Returns: Boolean.
*******************************************************************/
function SelectedMultipleWithZero(String1,String2,String3,Object)
{
	var SelectElement= GetElement(String1,Object);
	
	if(SelectElement.length > 0)
	for(i=0;i<SelectElement.length;i++)
	{
		if(SelectElement.options[i].selected == true)
		{
			return true;		
		}
	}	
	alert(String3);
	return false;
}

/*******************************************************************
allow you to select in the multi select options up to certain no. 

Parameters:
String1		- Element name.
MaxNumber	- the determined no. (do not exceed).
strAlert	- Error Message.
Object		- Form Object.
Returns: Boolean.
*******************************************************************/
function MaxMultipleSelection(String1,MaxNumber,str_Alert,Object)
{
	var SelectElement= GetElement(String1,Object);
	var int_Counter = 0;
	if(SelectElement.length > 0)
	for(i=1;i<SelectElement.length;i++)
	{
		if(SelectElement.options[i].selected == true)
		{
			int_Counter++;
			if (int_Counter > MaxNumber)				
			{
				alert("The Maximum number of selections is " + MaxNumber + " in the "+str_Alert+".");
				for(i=1;i<SelectElement.length;i++)
				{
					if(SelectElement.options[i].selected == true)
						SelectElement.options[i].selected = false ;
					return false;	
				}	
				return false;
			}
		}
	}	
	return true;
}

/*******************************************************************
checks the lenght of a DDL. 

Parameters:
String1		- Element name.
Number1		- length value.
String3		- Error Message.
Object		- Form Object.
Returns: Boolean.
*******************************************************************/
function SelectedLength(String1,Number1,String3,Object)
{
	var SelectElement= GetElement(String1,Object);
	if (SelectElement.length < parseInt(Number1))
	{
		alert(String3);
		selectElement(SelectElement);
		return false;
	}
	else
	{
		return true;
	}
}

/*******************************************************************
checks if the first option is selected in a DDL. 

Parameters:
strSelectName	- Select object Name.
objForm			- the From object.
strAlert		- string to appear in the alert error message.
intCheckFor		- integer value to check the value of selected index equal it.
Returns: Boolean.
*******************************************************************/
function CheckDropDown(strSelectName,objForm,strAlert,intCheckFor)
{
	if (GetElementValue(GetElement(strSelectName,objForm)) == intCheckFor)
	{		
		alert(strAlert);
		selectElement(GetElement(strSelectName,objForm));
		return false;
	}
	return true;
}

/*******************************************************************
return the month number.

Parameters:
strMonthName - Month Name.
Returns: Integer.
*******************************************************************/
function GetMonthNumber(strMonthName)
{
	var intNumber = 0;
	
	switch (strMonthName)
	{
		case "January":
			intNumber = 1;
			break;
		case "February":
			intNumber = 2;
			break;
		case "March":
			intNumber = 3;
			break;
		case "April":
			intNumber = 4;
			break;
		case "May":
			intNumber = 5;
			break;
		case "June":
			intNumber = 6;
			break;
		case "July":
			intNumber = 7;
			break;
		case "August":
			intNumber = 8;
			break;
		case "September":
			intNumber = 9;
			break;	
		case "October":
			intNumber = 10;
			break;
		case "November":
			intNumber = 11;
			break;
		case "December":
			intNumber = 12;
			break;
	}
	return intNumber;
}

/*******************************************************************
adds the Other... word and it's index to a combobox.

Parameters:
SourceElement - the combo element.
SpecificWord  - the word you want to add.
Index		  - the index of this word.	
*******************************************************************/
function AddOther(SourceElement,SpecificWord,Index)
{
	ComboAdd(SourceElement,Index,SpecificWord);

	if (sourceElement.length == 2) 
		SourceElement[1].selected=true;
	else	
		SourceElement[0].selected=true;
}

/*******************************************************************
to select multiple elements in DDL.

Parameters:
SelectElement - the element you want to select from.
StringText    - the elements you want to select(seperated by ;).
strFormName	  - the form name.
*******************************************************************/
function SelectMultipeOptions(SelectElement,StringText,strFormName)
{
	var Form = "";
	Form = GetForm(str_FormName);
	if (Form == null || Form == "" || Form == "undefined")
		return false;

	var StringTex = StringText;
	var temp="";
	var SelectEle = GetElement(SelectElement,Form);

	while(StringTex.indexOf(";") >0)
	{
		temp=StringTex.substr(0,StringTex.indexOf(";"))
		StringTex=StringTex.substr(StringTex.indexOf(";")+1)	
	
		for(i=0;i<SelectEle.length;i++)
		{
			if(Trim(SelectEle[i].value)==Trim(temp))
			{
				SelectEle[i].selected=true;
			}	
		}
	}
	SelectEle[0].selected=false;
}

/*******************************************************************
to select a certain value from DDL.

Parameters:
SelectElement - the element you want to select from.
StringText    - the string you want to select.
strFormName	  - the form name.
*******************************************************************/
function SelectMonth(SelectElement,StringText,strFormName)
{
	var Form = "";
	Form = GetForm(strFormName);
	if (Form == null || Form == "" || Form == "undefined")
		return false;

	var StringTex = StringText;
	var temp="";
	var SelectEle = GetElement(SelectElement,Form);
	
	temp=StringTex	
	for(i=0;i<SelectEle.length;i++)
	{
		if(Trim(SelectEle[i].value)==Trim(temp))
		{
			SelectEle[i].selected=true;
		}	
	}
}

/*******************************************************************
used with another ASP code to calculate days from seperated DDL's.

Parameters:
String - the element name.
Form   - the form name.
*******************************************************************/
function CalculateDays(String,FORM) {	
			
	var intMonth = GetElement(String + 'Months',FORM);
	var intYear = GetElement(String + 'Years',FORM);
	var intDays = GetElement(String + 'Days',FORM);
	var oldSelectedIndex= intDays.selectedIndex;
	var intMaxDay = 31;
	var intDay = 1;

	if (intMonth.value != 0 && intYear.value != 0) 
	{			
		switch (intMonth.value) 
		{ 
			case "1":
			case "3":
			case "5":
			case "7":
			case "8":
			case "10":
			case "12": 
			{
				intMaxDay = 31;
			}
			break; 
     		case "4":
    		case "6":
    		case "9":
    		case "11": 
			{
				intMaxDay = 30; 
			}
			break; 				
			case "2": 
			{
				if (intYear.value % 4 == 0 && (intYear.value % 1000 == 0 || intYear.value % 100 != 0)) 
				{
					intMaxDay = 29;
				}
				else 
				{
					intMaxDay = 28;
				}
			}
			break; 
			default: 
			{
				intMaxDay = 31;
			}
		}


		while (intDays.length > 1) 
		{
			intDays.options[intDays.length-1] = null;
		}
	
		for (intDay=1; intDay<=intMaxDay; intDay++) 
		{
			var Eintrag = new Option(intDay);
			intDays.options[intDays.length] = Eintrag;
			intDays.selectedIndex = intDay;
			intDays.options[intDays.selectedIndex].value = intDay;	
		}
		if(intMaxDay >=oldSelectedIndex + 1 )
			intDays.selectedIndex = oldSelectedIndex;
		else
			intDays.selectedIndex = intDays.length-1;
	}
}

/*******************************************************************
to construct a hidden field from combo.

Parameters:
Combo	- the combo element.
Hidden	- the hidden control name.
Form	- the form name.
Char	- the seperator character between the elements.
/*******************************************************************
function constructHidden(Combo,Hidden,Form,Char)
{
	var ComboElement = GetElement(Combo,Form);
	var HiddenElement = GetElement(Hidden,Form);
	var text = "";
	
	if(ComboElement.length >= 2)
	{
		for(i=1;i<ComboElement.length;i++)
			text = text + ComboElement[i].value+Char;

		HiddenElement.value = text.substr(0,text.length-1);
	}
	return false;	
}

/*******************************************************************
to check if you use I.E. or Netscape browser.
*******************************************************************/
function CheckBrowser() 
{
	var Name = navigator.appName
	
	if (Name=="Netscape") 
		this.Name = "ns"
	else 
		if (Name=="Microsoft Internet Explorer") this.Name = "ie"
		else
			this.Name = null
	
	this.v = parseInt(navigator.appVersion)
		
	this.ns = (this.Name=="ns" && this.v>=4)
	
	this.ns4 = (this.Name=="ns" && this.v==4)
	
	this.ns5 = (this.Name=="ns" && this.v==5)
	
	this.ie = (this.Name=="ie" && this.v>=4)
		
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	
	if (this.ie5)
	{
		this.v = 5
	}	 
	this.mv =parseFloat(navigator.appVersion)
}

/*******************************************************************
returns a specific cookie.

Parameters:
name	- the name of the cookie.
*******************************************************************/
function Get_Cookie(name) 
{
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	
	if (start == -1) return null;

	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	return document.cookie.substring(len,end);
}

/*******************************************************************
checks the length of a DDL.

Parameters:
select		 - the DDL name.
Length		 - do not exceed this length.
ErrorMessage - when error show this message.
*******************************************************************/
function checkLength(select,Length,ErrorMessage)
{
	var selectedElements = 0;

	for(var i=0;i < select.length ;i++)
	{
		if(select[i].selected)
			++selectedElements;
	}

	if (selectedElements > parseInt(Length))
	{
		alert(ErrorMessage);
		for(var i=0;i <select.length ;i++)
		{
			if(select[i].selected)
			{
				select[i].selected=false;
				return false;
			}
		}
	}
}

/*******************************************************************
Move From Source list To Distination one.

Parameters:
Source			 - the source list.
Destination		 - the destination list.
*******************************************************************/
function MoveFromListToList(Source,Distination) 
{
	var  oOption ;
	var c = Source.length;
	var my_array = new Array();
	
	k=0;
 
	for(i=0; i<c; i++)
	{
		oOption = new Option();
		if (Source[i].selected) 
		{
			Source[i].selected=false;
			oOption.value= Source.options[i].value;
			oOption.text=Source.options[i].text;
			Distination.options[Distination.length]=oOption;
			oOption=null;
			my_array[k]=i;
			k=k+1;
		}
	}
	for(i=0; i<k; i++) 
	{
		Source.options[my_array[i]-i]=null;		
	}
}
	
/*******************************************************************
Return Selected Values from list1 to list2.
*******************************************************************/
function ReturnSelectedValues (Source,Distination,StrSelectedValues) 
{
	var St = new String();
	var arr
		 
	St=StrSelectedValues;
	if (St.length==0)
		return;
		   
	St= StrSelectedValues;
	arr=St.split(",");
		 
	var  oOption ;
	var c = Source.length;
	var my_array = new Array();
	var t1,t2
	k=0;
 
	for(i=0; i<c; i++)
	{
		oOption = new Option();
		for (j= 0;j<=arr.length-1;j++)
		{
			t1=TrimString(Source[i].value);
			t2=TrimString(arr[j])
			if( t1 == t2) 
			{
				oOption.value= Source.options[i].value;
				oOption.text=Source.options[i].text;
				Distination.options[Distination.length]=oOption;
				oOption=null;
				my_array[k]=i;
				k=k+1;
			}
		}		
		
	}
	for(i=0; i<k; i++) 
	{
		Source.options[my_array[i]-i]=null;		
	}
	
}
	
/*******************************************************************
to Get the contents of a List in a comma delimeted string.
*******************************************************************/
function GetListContents(List,txtListContents)
{
	var St=new String();
	var c = List.length;
	k=0;
 
	for(i=0; i<c; i++)
	{	        
		St = St + List.options[i].value + ",";
		//if (i != c-1) 
		//	St =St + ","; 
	}
	txtListContents.value = St;
}
/*******************************************************************
to Get the contents of a List Text in a comma delimeted string.
*******************************************************************/
function GetListTextContents(List,txtListContents)
{
	var St=new String();
	var c = List.length;
	k=0;
 
	for(i=0; i<c; i++)
	{	        
		St = St + List.options[i].text + ",";
		//if (i != c-1) 
		//	St =St + ","; 
	}
	txtListContents.value = St;
}
/*********************************************************************
*********************************************************************/
function ChangeLang(Lang){
	var test = document.all["UserControl1"];
	test.ChangeLayout(Lang);
}
/**********************************************************************/
function AddTextToSelect(strForm,strTextBoxName,strSelectName,strAlert,intValidationNo){
	var objForm = GetForm(strForm);		
	var objSelect  = GetElement(strSelectName,objForm);
	var objTextBox = GetElement(strTextBoxName,objForm);
	var TextValue  = GetElementValue(objTextBox);
	
	switch (intValidationNo) {
		case 2:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],messageArrayA[2],false,false,false,false,false,false,false,false))
				return false;
				break;
		case 3:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],false,messageArrayA[3],false,false,false,false,false,false,false))
				return false;
				break;
		case 4:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],false,false,messageArrayA[4],false,false,false,false,false,false))
				return false;
				break;
		case 5:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],false,false,false,messageArrayA[5],false,false,false,false,false))
				return false;
				break;
		case 6:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],false,false,false,false,messageArrayA[6],false,false,false,false))
				return false;
				break;
		case 7:
			if(!CheckElementA(strTextBoxName,objForm,messageArrayA[1],false,false,false,false,false,messageArrayA[7],false,false,false))
				return false;
				break;
	}
		
	if (!searchtext(objSelect,TextValue,""))
		{
			ComboAdd(objSelect,TextValue,TextValue);
			objSelect.selectedIndex = 0;
			objTextBox.value = "";
			objTextBox.focus();
		}
	else
		{
			alert(strAlert);
			objTextBox.value= "";
			objTextBox.focus();
			return false;
		}	
}
////////////////////////////////////////////////
function searchtext(Object1,String1,Char)
{
	for (i=0; i<Object1.length;i++){
		if( Char!="" ){	
			if(Trim(Object1[i].value.toString().substr(0,Object1[i].value.toString().indexOf(Char)))== Trim(String1)){
				Object1.selectedIndex = i;
				return true
				}
			}
		else
			{
			if(Trim(Object1[i].text)== Trim(String1)){
				Object1.selectedIndex = i;
				return true
				}
			}		
	}
			
	return false;			
}
/////////////////////////////////////////////////////
function search(Object1,String1,Char){	
	for (i=0; i<Object1.length;i++){
		
		if( Char!="" )	
			{
			if(Trim(Object1[i].value.toString().substr(0,Object1[i].value.toString().indexOf(Char)))== Trim(String1)){
				Object1.selectedIndex = i;
				return true
				}
			}
		else
			{
			if(Trim(Object1[i].value)== Trim(String1)){
				Object1.selectedIndex = i;
				return true
				}
			}		
	}
			
	return false;			
}
/***********************************************************************/
function CollectFromSel(sel,txt){
	var Sel1 = "";
	if (sel.length != 0){
		for (i=0;i<sel.length;i++){
			Sel1 = Sel1 + sel.options[i].value + ",";
		}
		
		txt.value = Sel1

	}
}

/***********************************************************************/
function CollectFromSelVer2(sel,txt){
	var Sel1 = "";
	if (sel.length != 0){
		for (i=0;i<sel.length;i++){
			Sel1 = Sel1 + sel.options[i].value +'-'+i+",";
		}
		
		txt.value = Sel1

	}
}
/*******************************************************************************/
function AddSelSelSelTo(sel1,sel1Msg,sel2,sel2Msg,sel3,sel3Msg,destination){
	
	if (sel1Msg != ""){
		if (eval(sel1+'.options['+sel1+'.selectedIndex].value') == -1){
			alert(sel1Msg)
			eval(sel1+'.focus()')
			return false;
		}
	}
	if (sel2Msg != ""){

		if (eval(sel2+'.options['+sel2+'.selectedIndex].value') == -1){
			alert(sel2Msg)
			eval(sel2+'.focus()')
			return false;
		}
	}
	if (sel3Msg != ""){
		if (eval(sel3+'.options['+sel3+'.selectedIndex].value') == -1){
			alert(sel3Msg)
			eval(sel3+'.focus()')
			return false;
		}
	}
			
	Val1	= eval(sel1+'.options['+sel1+'.selectedIndex].value')
	selTxt1	= eval(sel1+'.options['+sel1+'.selectedIndex].text')
	
	Val2	= eval(sel2+'.options['+sel2+'.selectedIndex].value')
	selTxt2	= eval(sel2+'.options['+sel2+'.selectedIndex].text')
	
	Val3	= '-'+eval(sel3+'.options['+sel3+'.selectedIndex].value')
	selTxt3	= ' - '+eval(sel3+'.options['+sel3+'.selectedIndex].text')
	
	if (eval(sel3+'.options['+sel3+'.selectedIndex].value') == -1){
		
		Val3	= '-'+null
		selTxt3	= ''
	}
	
	MyValue = Val1+'-'+Val2+Val3
	
	for (i=0;i<destination.length;i++){
		if (destination.options[i].value == MyValue){
			return false;
		}
	}

	ComboAdd(destination,MyValue , selTxt1+' - '+selTxt2+selTxt3)
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
function AddSelTo(sel1,sel1Msg,destination){
	if (sel1Msg != ""){
		if (eval(sel1+'.options['+sel1+'.selectedIndex].value') == -1){
			alert(sel1Msg)
			eval(sel1+'.focus()')
			return false;
		}
	}
			
	Val1	= eval(sel1+'.options['+sel1+'.selectedIndex].value')
	Txt1	= eval(sel1+'.options['+sel1+'.selectedIndex].text')

	MyValue = Val1
	for (i=0;i<destination.length;i++){
		if (destination.options[i].value == MyValue){
			return false;
		}
	}
	ComboAdd(destination,Val1,Txt1)
}
//////////////////////////////////////////////////////////////////////////////////////////////
function AddSelSelTo(sel1,sel1Msg,sel2,sel2Msg,destination){
	if (sel1Msg != ""){
		if (eval(sel1+'.options['+sel1+'.selectedIndex].value') == -1){
			alert(sel1Msg)
			eval(sel1+'.focus()')
			return false;
		}
	}
	if (sel2Msg != ""){
		if (eval(sel2+'.options['+sel2+'.selectedIndex].value') == -1){
			alert(sel2Msg)
			eval(sel2+'.focus()')
			return false;
		}
	}
			
	Val1	= eval(sel1+'.options['+sel1+'.selectedIndex].value')
	Txt1	= eval(sel1+'.options['+sel1+'.selectedIndex].text')
	Val2	= eval(sel2+'.options['+sel2+'.selectedIndex].value')
	Txt2	= eval(sel2+'.options['+sel2+'.selectedIndex].text')

	MyValue = Val1+'-'+Val2
	for (i=0;i<destination.length;i++){
		if (destination.options[i].value == MyValue){
			return false;
		}
	}
	ComboAdd(destination,MyValue,Txt1 + ' - ' +Txt2)
}
//////////////////////////////////////////////////////////////////////////////////////////////
function AddSelSelToVer2(sel1,sel1Msg,sel2,sel2Msg,destination){
	if (sel1Msg != ""){
		if (eval(sel1+'.options['+sel1+'.selectedIndex].value') == -1){
			alert(sel1Msg)
			eval(sel1+'.focus()')
			return false;
		}
	}
	if (sel2Msg != ""){
		if (eval(sel2+'.options['+sel2+'.selectedIndex].value') == -1){
			alert(sel2Msg)
			eval(sel2+'.focus()')
			return false;
		}
	}
			
	Val1	= eval(sel1+'.options['+sel1+'.selectedIndex].value')
	Txt1	= eval(sel1+'.options['+sel1+'.selectedIndex].text')
	Val2	= eval(sel2+'.options['+sel2+'.selectedIndex].value')
	Txt2	= eval(sel2+'.options['+sel2+'.selectedIndex].text')

	MyValue = Val1+'-'+Val2
	for (i=0;i<destination.length;i++){
		if (destination.options[i].value == MyValue){
			return false;
		}
	}
	
	ComboAdd(destination,MyValue,Txt2)
}
/**************************************************

Author: Bilal S. Bader
Date  : Nov 15,2001
Purpose : This is specifice function when we have tow 
		DDL for date and we need to Concatenate the day, Month,Year
		toguther and put it in hidden input
Parameters :
			strStartDateName,strEndDateName
			those two parameters use to pass the name passed in 
			OutPutDate function in ASP
			objForm, the form object name
			strhdnStartDate, the name of hidden field that will hold the start date
			strhdnEndDate , the name of hidden field that will hold the end date
***************************************************/
function CheckDateConcatenate(strStartDateName,strEndDateName,objForm,strhdnStartDate,strhdnEndDate){
		var objStartDay = "";
		var objStartMonth = "";
		var objStartYear = "";
		var objEndDay = "";
		var objEndMonth = "";
		var objEndYear = "";
				
		var strStartDay = "";
		var strStartMonth = "";
		var strStartYear = "";
		var strEndDay = "";
		var strEndMonth = "";
		var strEndYear = "";
				
		var objhdnStartDate = "";
		var objhdnEndDate = "";
				
		var strStartDate = "";
		var strEndDate = "";
				
		
		objEndDay = GetElement("sel_"+ strEndDateName  +"Days",objForm);
		objEndMonth = GetElement("sel_"+ strEndDateName  +"Months",objForm);
		objEndYear = GetElement("sel_"+ strEndDateName +"Years",objForm);
		
		objStartDay = GetElement("sel_"+ strStartDateName +"Days",objForm);
		objStartMonth = GetElement("sel_"+ strStartDateName +"Months",objForm);
		objStartYear = GetElement("sel_"+ strStartDateName +"Years",objForm);
		
		objhdnEndDate = GetElement("hdnEndDate",objForm);
		objhdnStartDate = GetElement("hdnStartDate",objForm);
		
		strEndDay = GetElementValue(objEndDay);
		strEndMonth = GetElementValue(objEndMonth);
		strEndYear = GetElementValue(objEndYear);
		strStartDay = GetElementValue(objStartDay);
		strStartMonth = GetElementValue(objStartMonth);
		strStartYear = GetElementValue(objStartYear);
				
		if (strStartDay !=0 && (strStartMonth == 0 || strStartYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartDay);
				return false;
			}
				
		if (strStartMonth !=0 && (strStartDay == 0 || strStartYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartMonth);
				return false;
			}
		if (strStartYear !=0 && (strStartMonth == 0 || strStartDay == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartYear);
				return false;
			}
				
		if (strEndDay != 0 && (strEndMonth == 0 || strEndYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndDay);
				return false;
			}
				
		if (strEndMonth != 0 && (strEndDay == 0 || strEndYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndMonth);
				return false;
			}
					
		if (strEndYear != 0 && (strEndMonth == 0 || strEndDay == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndYear);
				return false;
			}
		if (strStartDay != 0 && strStartMonth != 0 && strStartYear != 0){
			strStartDate = strStartMonth + '/' + strStartDay + '/' + strStartYear;
			objhdnStartDate.value = strStartDate;
			}
		else
			objhdnStartDate.value = "";
				
		if (strEndDay != 0 && strEndMonth != 0 && strEndYear != 0 ){
			strEndDate = strEndMonth + '/' + strEndDay + '/' + strEndYear;
			objhdnEndDate.value = strEndDate 
			}
		else
			objhdnEndDate.value = "";
									
		if (strEndDate != "" && strStartDate != ""){
			var sDate = new Date(strStartDate);
			var eDate = new Date(strEndDate);	
			if (sDate > eDate){
				alert("íÌÈ Çä íßæä ÇáÊÇÑíÎ ÇáÅÈÊÏÇÆí ÇÞá ãä ÇáäåÇÆí");
				return false;
			}
		}
	return true
}
/**************************************************

Author: Bilal S. Bader
Date  : Nov 15,2001
Purpose : This is specifice function when we have tow 
		DDL for date and we need to Concatenate the day, Month,Year
		toguther and put it in hidden input
Parameters :
			strStartDateName,strEndDateName
			those two parameters use to pass the name passed in 
			OutPutDate function in ASP
			objForm, the form object name
			strhdnStartDate, the name of hidden field that will hold the start date
			strhdnEndDate , the name of hidden field that will hold the end date
***************************************************/
function CheckHijriDateConcatenate(strStartDateName,strEndDateName,objForm,strhdnStartDate,strhdnEndDate){
		var objStartDay = "";
		var objStartMonth = "";
		var objStartYear = "";
		var objEndDay = "";
		var objEndMonth = "";
		var objEndYear = "";
				
		var strStartDay = "";
		var strStartMonth = "";
		var strStartYear = "";
		var strEndDay = "";
		var strEndMonth = "";
		var strEndYear = "";
				
		var objhdnStartDate = "";
		var objhdnEndDate = "";
				
		var strStartDate = "";
		var strEndDate = "";
				
				
		objEndDay = GetElement("sel"+ strEndDateName  +"Days",objForm);
		objEndMonth = GetElement("sel"+ strEndDateName  +"Months",objForm);
		objEndYear = GetElement("sel"+ strEndDateName +"Years",objForm);
				
		objStartDay = GetElement("sel"+ strStartDateName +"Days",objForm);
		objStartMonth = GetElement("sel"+ strStartDateName +"Months",objForm);
		objStartYear = GetElement("sel"+ strStartDateName +"Years",objForm);
				
		objhdnEndDate = GetElement("hdnEndDate",objForm);
		objhdnStartDate = GetElement("hdnStartDate",objForm);
				
		strEndDay = GetElementValue(objEndDay);
		strEndMonth = GetElementValue(objEndMonth);
		strEndYear = GetElementValue(objEndYear);
		strStartDay = GetElementValue(objStartDay);
		strStartMonth = GetElementValue(objStartMonth);
		strStartYear = GetElementValue(objStartYear);
				
		if (strStartDay !=0 && (strStartMonth == 0 || strStartYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartDay);
				return false;
			}
				
		if (strStartMonth !=0 && (strStartDay == 0 || strStartYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartMonth);
				return false;
			}
		if (strStartYear !=0 && (strStartMonth == 0 || strStartDay == 0)){
				alert(messageArrayA[62]);
				selectElement(objStartYear);
				return false;
			}
				
		if (strEndDay != 0 && (strEndMonth == 0 || strEndYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndDay);
				return false;
			}
				
		if (strEndMonth != 0 && (strEndDay == 0 || strEndYear == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndMonth);
				return false;
			}
					
		if (strEndYear != 0 && (strEndMonth == 0 || strEndDay == 0)){
				alert(messageArrayA[62]);
				selectElement(objEndYear);
				return false;
			}
		if (strStartDay != 0 && strStartMonth != 0 && strStartYear != 0){
			strStartDate = strStartDay + '/' + strStartMonth + '/' + strStartYear;
			objhdnStartDate.value = strStartDate;
			}
		else
			objhdnStartDate.value = "";
				
		if (strEndDay != 0 && strEndMonth != 0 && strEndYear != 0 ){
			strEndDate =  strEndDay + '/' + strEndMonth + '/' + strEndYear;
			objhdnEndDate.value = strEndDate 
			}
		else
			objhdnEndDate.value = "";
									
		if (strEndDate != "" && strStartDate != ""){
			var sDate = new Date(strStartDate);
			var eDate = new Date(strEndDate);	
			if (sDate > eDate){
				alert("íÌÈ Çä íßæä ÇáÊÇÑíÎ ÇáÅÈÊÏÇÆí ÇÞá ãä ÇáäåÇÆí");
				return false
			}
		}
		return true
}

