//---------------------------------------------
// PARAMETRİK SABİTLER
//---------------------------------------------

var defaultEmptyOK = false

//---------------------------------------------
// GENEL SABİTLER
//---------------------------------------------

// tatil gunleri

var holidayArr = new Array(
new Array("01011998","Yeni Yıl Tatili"),
new Array("02011998","Yeni Yıl Tatili"),
new Array("29011998","Ramazan Bayramı"),
new Array("30011998","Ramazan Bayramı"),
new Array("06041998","Kurban Bayramı"),
new Array("07041998","Kurban Bayramı"),
new Array("08041998","Kurban Bayramı"),
new Array("09041998","Kurban Bayramı"),
new Array("10041998","Kurban Bayramı"),
new Array("23041998","23 Nisan Bayramı"),
new Array("19051998","19 Mayıs Bayramı"),
new Array("29101998","Cumhuriyet Bayramı"),
new Array("30101998","Cumhuriyet Bayramı"),
new Array("01011999","Yeni Yıl Tatili"),
new Array("18011999","Ramazan Bayramı"),
new Array("19011999","Ramazan Bayramı"),
new Array("20011999","Ramazan Bayramı"),
new Array("21011999","Ramazan Bayramı"),
new Array("22011999","Ramazan Bayramı"),
new Array("29031999","Kurban Bayramı"),
new Array("30031999","Kurban Bayramı"),
new Array("31031999","Kurban Bayramı"),
new Array("01041999","Kurban Bayramı"),
new Array("02041999","Kurban Bayramı"),
new Array("23041999","23 Nisan Bayramı"),
new Array("19051999","19 Mayıs Bayramı"),
new Array("17081999","Körfez Depremi"),
new Array("18081999","Körfez Depremi"),
new Array("19081999","Körfez Depremi"),
new Array("20081999","Körfez Depremi"),
new Array("23081999","Körfez Depremi"),
new Array("24081999","Körfez Depremi"),
new Array("25081999","Körfez Depremi"),
new Array("29101999","Cumhuriyet Bayramı"),
new Array("29121999","Y2K Tatili"),
new Array("30121999","Y2K Tatili"),
new Array("31121999","Y2K Tatili"),
new Array("03012000","Y2K Tatili"),
new Array("10012000","Ramazan Bayramı"),
new Array("13032000","Kurban Bayramı"),
new Array("14032000","Kurban Bayramı"),
new Array("15032000","Kurban Bayramı"),
new Array("16032000","Kurban Bayramı"),
new Array("17032000","Kurban Bayramı"),
new Array("19052000","Gençlik ve Spor Bayramı"),
new Array("30082000","Zafer Bayramı"),
new Array("25122000","Ramazan Bayramı(İdari Tatil)"),
new Array("26122000","Ramazan Bayramı Arife"),
new Array("27122000","Ramazan Bayramı"),
new Array("28122000","Ramazan Bayramı"),
new Array("29122000","Ramazan Bayramı"),
new Array("01011997","Yeni Yıl Tatili"),
new Array("10021997","Ramazan Bayramı"),
new Array("11021997","Ramazan Bayramı"),
new Array("03031997","[NULL]"),
new Array("03041997","[NULL]"),
new Array("18041997","Kurban Bayramı"),
new Array("21041997","Kurban Bayramı"),
new Array("22041997","Kurban Bayramı"),
new Array("23041997","23 Nisan Bayramı"),
new Array("19051997","19 Mayıs Bayramı"),
new Array("03061997","[NULL]"),
new Array("03071997","[NULL]"),
new Array("29101997","Cumhuriyet Bayramı"),
new Array("30121996","Yeni Yıl Tatili"),
new Array("31121996","Yeni Yıl Tatili"),
new Array("30081999","Zafer Bayramı"),
new Array("01021995","[NULL]"),
new Array("01012001","Yılbaşı"),
new Array("05032001","Kurban Bayramı"),
new Array("06032001","Kurban Bayramı"),
new Array("07032001","Kurban Bayramı"),
new Array("08032001","Kurban Bayramı"),
new Array("09032001","Kurban Bayramı (İdari Tatil)"),
new Array("23042001","Ulusal Egemenlik Bayramı"),
new Array("30082001","Zafer Bayramı"),
new Array("29102001","Cumhuriyet Bayramı")
)

//---------------------------------------------
// Hata mesajları sabitleri
//---------------------------------------------



// i is an abbreviation for "invalid"

var iChoice = "$1 alanı için bir seçeneği seçmelisiniz.  Lütfen yeniden giriniz."
var iSelect = "$1 alanı için en az bir seçeneği seçmelisiniz.  Lütfen yeniden giriniz."
var iCheck = "$1 alanı için en az bir seçeneği seçmelisiniz.  Lütfen yeniden giriniz."

var iMinChar = "$1 alanı için en az $2 karakter girebilirsiniz.  Lütfen yeniden giriniz."
var iMaxChar = "$1 alanı için en fazla $2 karakter girebilirsiniz.  Lütfen yeniden giriniz."
var iRangeChar = "$1 alanı için $2 ile $3 arasında karakter uzunluğuna sahip bir kelime girebilirsiniz.  Lütfen yeniden giriniz."
var iFixRangeChar = "$1 alanı için $2 karakter uzunluğunda bir kelime girebilirsiniz.  Lütfen yeniden giriniz."

var iNumeric = "$1 alanı geçerli bir sayısal değer olmalıdır.  Lütfen yeniden giriniz."
var iMinNumeric = "$1 alanı için en az $2 uzunluğunda bir sayısal değer girebilirsiniz.  Lütfen yeniden giriniz."
var iMaxNumeric = "$1 alanı için en fazla $2 uzunluğunda bir sayısal değer girebilirsiniz.  Lütfen yeniden giriniz."
var iRangeNumeric = "$1 alanı için $2 ile $3 arasında karakter uzunluğuna sahip bir sayısal değer girebilirsiniz.  Lütfen yeniden giriniz."
var iFixRangeNumeric = "$1 alanı için $2 karakter uzunluğunda bir sayısal değer girebilirsiniz.  Lütfen yeniden giriniz."

var iInteger = "$1 alanı geçerli bir tamsayı olmalıdır.  Lütfen yeniden giriniz."
var iMinInteger = "$1 alanı için en az $2 değerini girebilirsiniz.  Lütfen yeniden giriniz."
var iMaxInteger = "$1 alanı için en fazla $2 değerini girebilirsiniz.  Lütfen yeniden giriniz."
var iRangeInteger = "$1 alanı için $2 ile $3 arasında bir tamsayı girebilirsiniz.  Lütfen yeniden giriniz."

var iDecimal = "$1 alanı geçerli bir küsüratlı sayı olmalıdır.  Lütfen yeniden giriniz."
var iMinDecimal = "$1 alanı için en az $2 değerini girebilirsiniz.  Lütfen yeniden giriniz."
var iMaxDecimal = "$1 alanı için en fazla $2 değerini girebilirsiniz.  Lütfen yeniden giriniz."
var iRangeDecimal = "$1 alanı için $2 ile $3 arasında bir küsüratlı sayı girebilirsiniz.  Lütfen yeniden giriniz."

var iDate = "$1 alanı geçerli bir tarih olmalıdır.  Lütfen yeniden giriniz."
var iMinDate = "$1 alanı için en az $2 tarihini girebilirsiniz.  Lütfen yeniden giriniz."
var iMaxDate = "$1 alanı için en fazla $2 tarihini girebilirsiniz.  Lütfen yeniden giriniz."
var iRangeDate = "$1 alanı için $2 ile $3 arasında bir tarih girebilirsiniz.  Lütfen yeniden giriniz."
var iHolidayDate = "$1 alanı için girdiğiniz tarih $2.  Lütfen yeniden giriniz."

// m is an abbreviation for "missing"

var m = "$1 alanı için bir değer girmediniz. Bu alanın doldurulması zorunludur, lütfen bir değer giriniz."



//---------------------------------------------
// ÖZEL MESAJ FONKSİYONLARI
//---------------------------------------------

// Notify user that required field theField is empty.
// String s describes expected contents of theField.value.
// Put focus in theField and return false.

function warnEmpty (theField){
	theField.focus();
    alert(getError(1, arguments));
    return false;
}
// Notify user that contents of field theField are invalid.
// String s describes expected contents of theField.value.
// Put select theField, pu focus in it, and return false.

function warnInvalid (theField)
{   
	theField.focus()
    theField.select()
    alert(getError(1, arguments));
    return false
}

// Notify user that contents for s are invalid.
// String s describes expected contents of theField.value.
// return false.
function warnInvalidAlert ()
{   
    alert(getError(0, arguments));
    return false
}

// Notify user that required field theField is empty.
// String s describes expected contents of theField.value.
// return false.

function warnEmptyAlert ()
{   
    alert(getError(0, arguments));
    return false
}

//---------------------------------------------
// ÖZEL VALIDATION FONKSİYONLARI
//---------------------------------------------

// Returns true if string s is empty or 
// whitespace characters only.

function isWhitespace (s) {
	// Check whether string s is empty.
	function isEmpty(s)
	{   
		return ((s == null) || (s.length == 0))
	}
	var reWhitespace = /^\s+$/
    return (isEmpty(s) || reWhitespace.test(s));
}
function isInteger (s){   
	var reInteger = /^\d+$/
    return reInteger.test(s)
}

function isIntegerInRange (s, a, b){
    if (!isInteger(s)) 
    	return false;
    var num = parseInt (s,10);
    if ((a != null) && (b != null)) 
    	return ((num >= a) && (num <= b));
    if ((a == null) && (b == null))
    	return true;
    if (a == null)
    	return (num <= b);
    if (b == null)
    	return (num >= a);
	return false;
}

function isDecimal (s){   
	var reInteger = /^\d+((,\d+)|())$/
    return reInteger.test(s)
}
function strToDecimal (s){   
	var re = new RegExp(",");
	var temp = s.replace(re,".");	
  return parseFloat(temp);
}
function isDecimalInRange (s, strA, strB){
    if (!isDecimal(s)) 
    	return false;
    var num = strToDecimal(s);
	  var a = (strA == null)?null:strToDecimal(strA);
	  var b = (strB == null)?null:strToDecimal(strB);

    if ((a != null) && (b != null)) 
    	return ((num >= a) && (num <= b));
    if ((a == null) && (b == null))
    	return true;
    if (a == null)
    	return (num <= b);
    if (b == null)
    	return (num >= a);
	return false;
}
function dateObject(inStrDate) {
    if (inStrDate == null) {
		var tempDate = new Date();
		this.year = tempDate.getYear();
		this.month = tempDate.getMonth() + 1 ;
		this.day = tempDate.getDate();
	} else {
		if (inStrDate.length == 8) {
			this.year = inStrDate.substr(4,4);
			this.month = inStrDate.substr(2,2);
			this.day = inStrDate.substr(0,2);
		} else {
			this.year = inStrDate.substr(6,4);
			this.month = inStrDate.substr(3,2);
			this.day = inStrDate.substr(0,2);
		}
	}
	this.valueOf = _getDateValue;
	this.format = _formatDate;
}
function _getDateValue() {
    var temp = this.day*1 + (this.month*100) + (this.year*10000);
	return temp;
}
function _formatDate()
{   
	var gDateSeperator = "."
	var temp = this.day + gDateSeperator + this.month + gDateSeperator + this.year ;
	return temp;
}

function isDate (year, month, day){   
	function isYear (s){   
	    if (!isInteger(s)) return false;
	    return ((s*1 > 1800) && (s.length == 4));
	}
	function isMonth (s){
		return isIntegerInRange (s, 1, 12);
	}
	function isDay (s){
	    return isIntegerInRange (s, 1, 31);
	}
	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
	}
	var daysInMonth = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
	// catch invalid years (not 2- or 4-digit) and invalid months and days.	
    if (! (isYear(year) && isMonth(month) && isDay(day))) return false;
    // Explicitly change type to integer to make code work in both
    // JavaScript 1.1 and JavaScript 1.2.
    var intYear = parseInt(year);
    var intMonth = parseInt(month);
    var intDay = parseInt(day);
    // catch invalid days, except for February

    if (intDay > daysInMonth[intMonth - 1]) return false; 
    if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;

    return true;
}

function isDateInRange (s, a, b){
    if ((a != null) && (b != null))
    	return ((s.valueOf() >= a.valueOf()) && (s.valueOf() <= b.valueOf()));
    if ((a == null) && (b == null))
    	return true;
    if (a == null) 
    	return (s.valueOf() <= b.valueOf());
    if (b == null) 
    	return (s.valueOf() >= a.valueOf());
    return false;
}

function isChoiceSelected(theRadioField)
{   
	if (theRadioField == null)
		return true; 
	if (theRadioField.length == null)
		return theRadioField.checked; 
	for(var i =0; i < theRadioField.length; i++) {
		if (theRadioField[i].checked==true) {
			return true;
		}
	}
    return false;
}

function isSelectSelected(theSelectField)
{   
	if (theSelectField.selectedIndex == -1 || theSelectField.options[theSelectField.selectedIndex].value =="") {
			return false;
	}
    return true;
}

function isCheckChecked(theCheckField)
{   
	if (theCheckField == null)
		return true; 
	if (theCheckField.length == null)
		return theCheckField.checked;
	for(var i =0; i < theCheckField.length; i++) {
		if (theCheckField[i].checked==true) {
			return true;
		}
	}
    return false;
}

function getError(startPosition, argumentsArray) {
	function getParametricString(str, arr) {
		var len = arr.length;
		var temp = str;
		for (var i=0; i<len; i++) {
			var re = new RegExp("\\$" + (i+1));
			temp = temp.replace(re,arr[i]);	
		}
		return temp; 
	}


	var arr = new Array();
	var str = argumentsArray[startPosition];
	for (var i = startPosition+1; i < argumentsArray.length; i++) {
	   arr[i-(startPosition+1)] = argumentsArray[i];
	}
	var msg = getParametricString(str, arr);
	return msg;
}

function isHoliday(intDay, intMonth, intYear, s, holidayArr, ret) {
	intDay = intDay*1;
	intMonth = intMonth*1;
	intYear = intYear*1;
	var tempDate = new Date(intYear, intMonth -1, intDay);
	var weekOfDay = tempDate.getDay();
	var strDate = ((intDay<10)?("0"+intDay):(""+intDay)) + ((intMonth<10)?("0"+intMonth):(""+intMonth)) + intYear + "";

	if ((weekOfDay == 0) || (weekOfDay == 6)) { 
		ret.msg = "haftasonu tatili";
		return true;
	}
	var len = (holidayArr == null)? 0 : holidayArr.length;
	for (var i=0;i<len;i++) {
		if (holidayArr[i][0] == strDate) {
			ret.msg = holidayArr[i][1];
			return true;
		}
	}
	return false;	
}

//---------------------------------------------
// GENEL VALIDATION FONKSİYONLARI
//---------------------------------------------

//---------------------------------------------
// STRING FUNCTIONS
//---------------------------------------------


/*
* Purpose: 	"theField" için değer girilip girilmediğini ve girilen değerin uzunluğunun
* 			"max" dan büyük olup olmadığını kontrol eder, uyarı mesajı verir ve
*			focusu "theField" a kaydırır.
*			
* Assumptions: 
* Effects: 
* Inputs: 	theField: kontrol edilecek form field i
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	max: girilebilecek maximum karakter adedi
*				Eğer null verilirse boy kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/
function checkString (theField, s, min, max, isEmptyOK)
{        
	function isStringInRange (s, a, b){
	    var len = s.value.length;
	    if ((a != null) && (b != null)) 
	    	return ((len >= a) && (len <= b));
	    if ((a == null) && (b == null))
	    	return true;
	    if (a == null)
	    	return (len <= b);
	    if (b == null)
	    	return (len >= a);
		return false;
	}
	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theField.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmpty(theField, m, s);
		}
	}
    if (!isStringInRange(theField, min, max)) {
	    if ((min != null) && (max != null)) {
		    if (min == max)
			    return warnInvalid (theField, iFixRangeChar, s, min);
		    else
			    return warnInvalid (theField, iRangeChar, s, min, max);
		}
	    if (min == null)
		    return warnInvalid (theField, iMaxChar, s, max);
	    if (max == null)
		    return warnInvalid (theField, iMinChar, s, min);
	} else 
    	return true;
    return false;
}



//---------------------------------------------
// NUMERIC FUNCTIONS
//---------------------------------------------


/*
* Purpose: 	"theField" için değer girilip girilmediğini ve girilen değerin uzunluğunun
* 			"max" dan büyük olup olmadığını kontrol eder, uyarı mesajı verir ve
*			focusu "theField" a kaydırır.
*			
* Assumptions: 
* Effects: 
* Inputs: 	theField: kontrol edilecek form field i
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	max: girilebilecek maximum karakter adedi
*				Eğer null verilirse boy kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/
function checkNumeric (theField, s, min, max, isEmptyOK)
{        

	function isNumericInRange (s, a, b){
	    if (!isInteger(s)) 
	    	return false;
	    var len = s.length;
	    if ((a != null) && (b != null)) 
	    	return ((len >= a) && (len <= b));
	    if ((a == null) && (b == null))
	    	return true;
	    if (a == null)
	    	return (len <= b);
	    if (b == null)
	    	return (len >= a);
		return false;
	}

	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theField.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmpty(theField, m, s);
		}
	}
    if (!isNumericInRange(theField.value, min, max)) {
	    if ((min != null) && (max != null)) {
		    if (min == max)
			    return warnInvalid (theField, iFixRangeNumeric, s, min);
		    else
			    return warnInvalid (theField, iRangeNumeric, s, min, max);
		}
	    if ((min == null) && (max == null))
		    return warnInvalid (theField, iNumeric, s);
	    if (min == null)
		    return warnInvalid (theField, iMaxNumeric, s, max);
	    if (max == null)
		    return warnInvalid (theField, iMinNumeric, s, min);
	} else 
    	return true;
    return false;
}



//---------------------------------------------
// INTEGER FUNCTIONS
//---------------------------------------------


/*
* Purpose: 	"theField" için integer bir değer girilip girilmediğini ve girilen değerin 
* 			"a" ve "b" -dahil- arasında  olup olmadığını kontrol eder, uyarı mesajı verir ve
*			focusu "theField" a kaydırır.
*			
* Assumptions: 
* Effects: 
* Inputs: 	theField: kontrol edilecek form field i
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	a: girilebilecek integer için minimum değer
*				Eğer null verilirse minimum kontrolü yapılmaz 
*         	b: girilebilecek integer için maximum değer
*				Eğer null verilirse maximum kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/

function checkInteger (theField, s, a, b, isEmptyOK)
{   
	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theField.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmpty(theField, m, s);
		}
	}
    if (!isIntegerInRange(theField.value, a, b)) {
	    if ((a != null) && (b != null))
		    return warnInvalid (theField, iRangeInteger, s, a, b);
	    if ((a == null) && (b == null))
		    return warnInvalid (theField, iInteger, s);
	    if (a == null)
		    return warnInvalid (theField, iMaxInteger, s, b);
	    if (b == null)
		    return warnInvalid (theField, iMinInteger, s, a);
	} else 
    	return true;
    return false;
}

//---------------------------------------------
//  FUNCTIONS
//---------------------------------------------


/*
* Purpose: 	"theField" için integer bir değer girilip girilmediğini ve girilen değerin 
* 			"a" ve "b" -dahil- arasında  olup olmadığını kontrol eder, uyarı mesajı verir ve
*			focusu "theField" a kaydırır.
*			
* Assumptions: 
* Effects: 
* Inputs: 	theField: kontrol edilecek form field i
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	a: girilebilecek integer için minimum değer
*				Eğer null verilirse minimum kontrolü yapılmaz 
*         	b: girilebilecek integer için maximum değer
*				Eğer null verilirse maximum kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/

function checkDecimal (theField, s, strA, strB, isEmptyOK)
{   
	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theField.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmpty(theField, m, s);
		}
	}
  var a = (strA == null)?null:strToDecimal(strA);
  var b = (strB == null)?null:strToDecimal(strB);
  if (!isDecimalInRange(theField.value, strA, strB)) {
    if ((a != null) && (b != null))
	    return warnInvalid (theField, iRangeDecimal, s, strA, strB);
    if ((a == null) && (b == null))
	    return warnInvalid (theField, iDecimal, s);
    if (a == null)
	    return warnInvalid (theField, iMaxDecimal, s, strB);
    if (b == null)
	    return warnInvalid (theField, iMinDecimal, s, strA);
	} else 
    	return true;
    return false;
}

//---------------------------------------------
// DATE FUNCTIONS
//---------------------------------------------

/*
* Purpose: 	"theFieldDay", "theFieldMonth" ve "theFieldYear" için girilen değerlerin
* 			geçerli bir tarih olup olmadığını ve "a" ile "b" tarihleri arasında olup olmadığını
*			kontrol eder, uyarı mesajı verir
*			
* Assumptions: 
* Effects: 
* Inputs: 	theFieldDay: kontrol edilecek tarihin gün kısmı
* 		 	theFieldMonth: kontrol edilecek tarihin ay kısmı
* 		 	theFieldYear: kontrol edilecek tarihin yıl kısmı
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	a: girilebilecek tarih için minimum değer
*				Eğer null verilirse minimum kontrolü yapılmaz 
*         	b: girilebilecek integer için maximum değer
*				Eğer null verilirse maximum kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/


function checkDateForHoliday (theFieldDay, theFieldMonth, theFieldYear, s, a, b, isEmptyOK) {
	if (checkDate (theFieldDay, theFieldMonth, theFieldYear, s, a, b, isEmptyOK)) {
		var ret = new Object();
		ret.msg = "";
		if (isHoliday(theFieldDay.value, theFieldMonth.value, theFieldYear.value, s, holidayArr, ret))
			return warnInvalidAlert (iHolidayDate, s, ret.msg);	
	} else {
		return false;
	}	
}


function checkDate (theFieldDay, theFieldMonth, theFieldYear, s, a, b, isEmptyOK)
{   
	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theFieldDay.value) && isWhitespace(theFieldMonth.value) && isWhitespace(theFieldYear.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmptyAlert(m, s);
		}
	}
    if (!isDate(theFieldYear.value, theFieldMonth.value, theFieldDay.value)) 
		return warnInvalidAlert (iDate, s);
    var d = new dateObject(theFieldDay.value + theFieldMonth.value + theFieldYear.value);
    if (!isDateInRange(d, a, b)) {
	    if ((a != null) && (b != null))
		    return warnInvalidAlert (iRangeDate, s, a.format(), b.format() );
	    if ((a == null) && (b == null))
		    return warnInvalidAlert (iDate, s);
	    if (a == null)
		    return warnInvalidAlert (iMaxDate, s, b.format() );
	    if (b == null)
		    return warnInvalidAlert (iMinDate, s, a.format() );
	}
    else 
    	return true;
	return false;
}


/*
* Purpose: 	"theField" için için girilen değerin
* 			geçerli bir tarih olup olmadığını ve "a" ile "b" tarihleri arasında olup olmadığını
*			kontrol eder, uyarı mesajı verir
*			focusu "theField" a kaydırır.
*			
* Assumptions: 
* Effects: 
* Inputs: 	theField: kontrol edilecek tarihtir, formatı "DD*MM*YYYY" şeklindedir (* karekteri herhangi bir ayıraç
*				kullanılabileceği anlamına gelmektedir. )
*         	s: uyari mesajında gösterilmek üzere field in label i
*         	a: girilebilecek tarih için minimum değer
*				Eğer null verilirse minimum kontrolü yapılmaz 
*         	b: girilebilecek integer için maximum değer
*				Eğer null verilirse maximum kontrolü yapılmaz 
*			isEmptyOK: Eğer true ise field için birşey girilmesede fonksiyon true döndürür
*				Eğer false ise field için bir değer girilmesi zorunludur.
*				Eğer bu parametre boş geçilirse global gisEmptyOK parametresi kullanılır.
* Returns: 	True/False
* Issues:  	
*---------------------------------------------------
*Date        Developer           Comments
*04/05/2001  Huseyin Savas       Initial creation
*
*---------------------------------------------------
*/

function checkFullDateForHoliday (theField, s, a, b, isEmptyOK) {
	if (checkFullDate (theField, s, a, b, isEmptyOK)) {
		var strDate = theField.value;
		var ret = new Object();
		ret.msg = "";
		if (isHoliday(strDate.substr(0,2), strDate.substr(3,2), strDate.substr(6,4), s, holidayArr, ret))
			return warnInvalid (theField, iHolidayDate, s, ret.msg);	
	} else {
		return false;
	}	
}

function checkFullDate (theField, s, a, b, isEmptyOK)
{   
	isEmptyOK = (isEmptyOK == null) ? defaultEmptyOK : isEmptyOK;
	if (isWhitespace(theField.value)) {
		if (isEmptyOK) {
			return true;
		} 
		else {
	       return warnEmpty(theField, m, s);
		}
	}

	var inStrDate = theField.value;
    if (!isDate(inStrDate.substr(6,4),inStrDate.substr(3,2), inStrDate.substr(0,2))) 
       return warnInvalid (theField, iDate, s);
    var d = new dateObject(inStrDate);

    if (!isDateInRange(d, a, b)) {
	    if ((a != null) && (b != null))
		    return warnInvalid (theField, iRangeDate, s, a.format(), b.format() );
	    if ((a == null) && (b == null))
		    return warnInvalid (theField, iDate, s);
	    if (a == null)
		    return warnInvalid (theField, iMaxDate, s, b.format() );
	    if (b == null)
		    return warnInvalid (theField, iMinDate, s, a.format() );
	}
    else 
    	return true;
	return false;
}

//---------------------------------------------
// CHOICE FUNCTIONS
//---------------------------------------------

function checkChoice(theRadioField, s)
{   
    if (!isChoiceSelected(theRadioField)) 
       return warnInvalidAlert (iChoice, s)
    else return true;
}

//---------------------------------------------
// SELECT FUNCTIONS
//---------------------------------------------

function checkSelect(theSelectField, s)
{   
    if (!isSelectSelected(theSelectField)) 
       return warnInvalidAlert (iSelect, s)
    else return true;

}

//---------------------------------------------
// CHECK FUNCTIONS
//---------------------------------------------

function checkCheckBox(theCheckField, s)
{   
    if (!isCheckChecked(theCheckField)) 
       return warnInvalidAlert (iCheck, s)
    else return true;
}



