function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
	var theCells = null;
    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '') || typeof(theRow.style) == 'undefined') 
	{
        return false;
    }
    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') 
	{
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') 
	{
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined' && typeof(theCells[0].getAttribute) == 'object') 
	{
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3
	// 4. Defines the new color
    // 4.1 Current color is the default one
   // alert(currentColor);
	if (currentColor == '' || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) 
	{
        if (theAction == 'over' && thePointerColor != '') 
		{
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') 
		{
            newColor = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) 
	{
        if (theAction == 'out') 
		{
            newColor = '';
        }
        else if (theAction == 'click' && theMarkColor != '') 
		{
            newColor = theMarkColor;
        }
    }
	//alert(currentColor);
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) 
	{
        if (theAction == 'click') 
		{
            newColor = (thePointerColor != '') ? thePointerColor : theDefaultColor;
        }
    } // end 4
    // 5. Sets the new color...
  //  if (newColor) 
	//{
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) 
		{
            for (c = 0; c < rowCellsCnt; c++) 
			{
                theCells[c].setAttribute('bgcolor', newColor, 0);
                //theCells[c].setAttribute('bordercolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else 
		{
            for (c = 0; c < rowCellsCnt; c++) 
			{
                theCells[c].style.backgroundColor = newColor;
                //theCells[c].style.borderColor = newColor;
            }
        }
 //   } // end 5

    return true;
} // end of the 'setPointer()' function
function initLocalitati(param)
{
    var index = 0;    
    selectLocalitati = document.forms[0].Localitate;
	selectLocalitati.length = 0;
    selectLocalitati[0] = new Option ("Alle", 0);
    var arrayLocalitati = localitati.split(',');
    //if(document.all.Tip_Id.value==1) tipid=1; else tipid=2;
    if(document.forms[0].Tip_Id.value==1) tipid=1; else tipid=2;
	for (i=0,j=0;i<arrayLocalitati.length;i++)
    {
		var temp = arrayLocalitati[i].split('#');
		
		if(tipid == temp[2]) 
			selectLocalitati.options[++j] = new Option (temp[1],temp[0]);
		if (param == temp[0]) index = selectLocalitati.length-1;
    }
    selectLocalitati.selectedIndex = index;
}
function initIncadrari(param)
{
	//alert(param);
    var index = 0;    
    selectIncadrari = document.forms[0].Incadrare;
	selectIncadrari.length = 0;
    selectIncadrari[0] = new Option ("Alle", 0);
    var arrayIncadrari = incadrari.split(',');
	for (i=0,j=0;i<arrayIncadrari.length;i++)
    {
		var temp = arrayIncadrari[i].split('#');
		if(document.forms[0].Tip_Id.value == temp[1]) 
			selectIncadrari.options[++j] = new Option (temp[2],temp[0]);
		if (param == temp[0]) index = selectIncadrari.length-1;
    }
    selectIncadrari.selectedIndex = index;
}
function initHoteluri(param)
{
    var index = 0;    
    Incadrare = document.forms[0].Incadrare.value;
    Localitate = document.forms[0].Localitate.value;
    selectHoteluri = document.forms[0].Hotel;
	selectHoteluri.length = 0;
	selectHoteluri.options[selectHoteluri.length] = new Option ("Alle",0);
    if(Localitate!=0)
	  if(Incadrare!=0)
	    var arrayHoteluri = hoteluriLI[Localitate][Incadrare].split(',');
	  else
	    var arrayHoteluri = hoteluriL[Localitate].split(',');
	else
	  if(Incadrare!=0)
	    var arrayHoteluri = hoteluriI[Incadrare].split(',');
	  else
	    var arrayHoteluri = hoteluri.split(',');
	for (i=0,j=0;i<arrayHoteluri.length;i++)
	{
	  var temp = arrayHoteluri[i].split('#');
	  if(arrayHoteluri!='')
 			if(document.forms[0].Tip_Id.value == temp[2]) 
				selectHoteluri.options[++j] = new Option (temp[1],temp[0]);
	  if (param == temp[0]) index = selectHoteluri.length-1;
	}
    selectHoteluri.selectedIndex = index;
}
function hilite(evt)
{
  evt = (evt) ? evt : (window.event) ? window.event : "";
  if (evt) 
  {
	if(navigator.appName=="Microsoft Internet Explorer")
	  window.event.srcElement.style.cursor="hand";
	else  
	  evt.target.style.cursor="pointer";
  }
}
function ClearData(obj)
{
	if(obj.value=='ZZ-LL-AAAA')
		obj.value='';
}
function WriteData(obj)
{
	if(obj.value==0)
		obj.value='ZZ-LL-AAAA';
	else
	{
		var expr1 = /[0-9]{2}\-[0-9]{2}\-[0-9]{4}/;
		var expr2 = /[0-9]{2}\.[0-9]{2}\.[0-9]{4}/;
		var expr3 = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}/;
		var expr4 = /[0-9]{2}\\[0-9]{2}\\[0-9]{4}/;
		temp = new Array();
		var i,isDate=true,char=false;
		var num = obj.value;
		if(!expr1.exec(obj.value))
			if(!expr2.exec(obj.value))
				if(!expr3.exec(obj.value))
					if(!expr4.exec(obj.value))
						isDate=false
					else
						temp = obj.value.split("\\");
				else
					temp = obj.value.split("/");
			else
				temp = obj.value.split(".");
		else
			temp = obj.value.split("-");
		if(!isDate)
			obj.value='ZZ-LL-AAAA';	
		else
		{
			var date = new Date(temp[2],temp[1]-1,temp[0]);
			var Zi = date.getDate();
			Zi = (""+Zi);
			if(Zi.length==1)
				Zi = "0"+Zi;
			var Luna = date.getMonth()+1;
			Luna = (""+Luna);
			if(Luna.length==1)
				Luna = "0"+Luna;
			var An = date.getFullYear();
			obj.value = Zi+'-'+Luna+'-'+An;
		}
	}
}
function CheckData()
{
	if(document.forms[0].DataSosire.value!='ZZ-LL-AAAA' && document.forms[0].DataPlecare.value!='ZZ-LL-AAAA')
	{
		var temp = document.forms[0].DataSosire.value.split("-");
		var Sosire = new Date(temp[2],temp[1]-1,temp[0]);
		var temp = document.forms[0].DataPlecare.value.split("-");
		var Plecare = new Date(temp[2],temp[1]-1,temp[0]);
		var Now = new Date();
		var Next_month = new Date(Now.getFullYear(),Now.getMonth()+2,Now.getDate());
		var Sosire_month =  new Date(Sosire.getFullYear(),Sosire.getMonth()+1,Sosire.getDate());
		if(Sosire.getTime()>Plecare.getTime() || Sosire.getTime()==Plecare.getTime() ||
			Plecare.getTime()>Sosire_month.getTime() || Sosire.getTime()>Next_month.getTime())
		{
			var Plecare_temp = new Date(Sosire.getFullYear(),Sosire.getMonth(),Sosire.getDate()+1);  	
			var zi = Plecare_temp.getDate();
			var luna = Plecare_temp.getMonth()+1;
			if(luna<10)
			  luna = '0'+luna;
			var an = Plecare_temp.getFullYear();
			document.forms[0].DataPlecare.value = zi+'-'+luna+'-'+an;
		}
	}
}
