var popUpWin=0;

function showWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width='+width+', height='+height+', left='+left+', top='+top+', screenX='+left+', screenY='+top+'');

}

function verificaFormular(obj)
{
	var luna1, luna2;

	var tmp,varz,varg;
	varz='';
	varg='';
	tmp=obj.request.value;
	varz = tmp.match(/[0-9\.\s]{10,14}/g);
	varg = tmp.match(/[a-zA-Z0-9\.\_\-]{1,}[\@][a-zA-Z0-9]\./g);
	if (varz==null) varz='';
	if (varg==null) varg='';

	if (varz.length>0 || varg.length>0)
	{
	    alert("Nu folositi date de contact in cerinte!");
	    return false;
	}

    if (obj["data_sos"].value.length < 1)
    {
    	alert ("Va rugam alegeti o data de sosire");
    	return false;
    }
    if (obj["data_plc"].value.length < 1)
    {
    	alert ("Va rugam alegeti o data de plecare");
    	return false;
    }

}

function datame(item)
{
	obj = document.cautare[item];
	len = document.cautare["data_sos"].value.length;
	if ( obj.name == 'data_plc')
	{
		if ( len<1 )
		{
			alert ("Alegeti o data de sosire mai intai !");
			show_calendar('cautare.data_sos');
		}
		else
		{
			show_calendar('cautare.data_plc');
        }
	}
    if ( obj.name == 'data_sos')
    {
		show_calendar('cautare.data_sos');
    }
}
