function ubah(gambar,file)
{
document[gambar].src=file;
eval(gambar + ".style.cursor='hand';")
}
function chcPro(theForm)
{
   	if (frm.optTP1(0).checked == true)
	{
	    frm.optTP2 = false;
		frm.optTP3 = false;
		frm.chkCheapest.disabled = false;
		//frm.chkCheapest.style.backgroundColor='#FFFFFF';
		frm.optHR.disabled = true;
		frm.optHR.style.backgroundColor='#DBE8FB';
		frm.txtRoom.disabled = true;
		frm.txtRoom.style.backgroundColor='#DBE8FB';
		frm.optBC.disabled = false;
		frm.optBC.style.backgroundColor='#FFFFFF';
		frm.txtAdt.disabled = false;
		frm.txtAdt.style.backgroundColor='#FFFFFF';
		frm.txtChd.disabled = false;
		frm.txtChd.style.backgroundColor='#FFFFFF';
		frm.txtInf.disabled = false;
		frm.txtInf.style.backgroundColor='#FFFFFF';
		frm.depDate.style.backgroundColor='#FFFFFF';
		frm.arrDate.style.backgroundColor='#FFFFFF';
		frm.depDate.disabled=true;
		frm.arrDate.disabled=true;
		frm.depDate.value="";
		frm.arrDate.value="";
		frm.txtRoom.value="";
	}
  	if (frm.optTP2(1).checked == true)
  	{
	    frm.optTP1 = false;
		frm.optTP3 = false;
		
		frm.chkCheapest.disabled = false;
		//frm.chkCheapest.style.backgroundColor='#FFFFFF';
		frm.optHR.disabled = false;
		frm.optHR.style.backgroundColor='#FFFFFF';
		frm.txtRoom.disabled = false;
		frm.txtRoom.style.backgroundColor='#FFFFFF';
		frm.optBC.disabled = true;
		frm.optBC.style.backgroundColor='#DBE8FB';
		frm.txtAdt.disabled = true;
		frm.txtAdt.style.backgroundColor='#DBE8FB';
		frm.txtChd.disabled = true;
		frm.txtChd.style.backgroundColor='#DBE8FB';
		frm.txtInf.disabled = true;
		frm.txtInf.style.backgroundColor='#DBE8FB';
		frm.depDate.style.backgroundColor='#FFFFFF';
		frm.arrDate.style.backgroundColor='#FFFFFF';
		frm.depDate.disabled=true;
		frm.arrDate.disabled=true;
		frm.depDate.value="";
		frm.arrDate.value="";
		frm.txtAdt.value="";
		frm.txtChd.value="";
		frm.txtInf.value="";
		
				
	}
	 if (frm.optTP3(2).checked == true)
	{
	
	    frm.optTP2 = false;
		frm.optTP1 = false;

frm.chkCheapest.disabled = true;
		frm.chkCheapest.style.backgroundColor='#DBE8FB';
		frm.optHR.disabled = false;
		frm.optHR.style.backgroundColor='#FFFFFF';
		frm.txtRoom.disabled = false;
		frm.txtRoom.style.backgroundColor='#FFFFFF';
		frm.optBC.disabled = false;
		frm.optBC.style.backgroundColor='#FFFFFF';
		frm.txtAdt.disabled = false;
		frm.txtAdt.style.backgroundColor='#FFFFFF';
		frm.txtChd.disabled = false;
		frm.txtChd.style.backgroundColor='#FFFFFF';
		frm.txtInf.disabled = false;
		frm.txtInf.style.backgroundColor='#FFFFFF';
		frm.depDate.style.backgroundColor='#FFFFFF';
		frm.arrDate.style.backgroundColor='#FFFFFF';
		frm.depDate.disabled=true;
		frm.arrDate.disabled=true;
		frm.depDate.value="";
		frm.arrDate.value="";
		frm.txtAdt.value="";
		frm.txtChd.value="";
		frm.txtInf.value="";
		frm.txtRoom.value="";
		
	}
  }
function frmValidator(frm)
  {
  	if (frm.txtDestination.value == "")
  	{
    		alert("Please specify your Destination.");
    		frm.txtDestination.focus();
    		frm.txtDestination.style.backgroundColor='#FFFFCC';
		return (false);
  	}
  		var txtCity = frm.txtDestination.value;
	//alert(txtCity.length);
  	if (txtCity.length < 4)
  	{
    		alert("Destination cannot be less than 04 characters.");
    		frm.txtDestination.focus();
    		frm.txtDestination.style.backgroundColor='#FFFFCC';
		return (false);
  	}
  	
  	if (frm.depDate.value == "")
  	{
    		alert("Please specify Departure Date.");
    		//frm.depDate.focus();
    		frm.depDate.style.backgroundColor='#FFFFCC';
    		return (false);
  	}
  	if (frm.arrDate.value == "")
  	{
    		alert("Please specify Return Date.");
    		//frm.arrDate.focus();
    		frm.arrDate.style.backgroundColor='#FFFFCC';
    		return (false);
  	}

   	tgl=frm.depDate.value;
	
  	tgl=tgl.split("/")
  	tglin= tgl[2] + tgl[1] + tgl[0] + " ";
   	tgl=frm.arrDate.value;
	
  	tgl=tgl.split("/")
  	  	tglout= tgl[2] + tgl[1] + tgl[0] + " ";

  	//alert (tglin);
  	//alert (tglout);
  	if (tglin >= tglout)
		{
			alert("Departure date cannot be equal or later than Return date !");
			frm.arrDate.focus();
			frm.arrDate.style.backgroundColor='#FFFFCC';
			return (false);
		}
  	if (frm.optTP(0).checked == true || frm.optTP(2).checked== true)
  	
	{
		 if (frm.txtAdt.value == "" && frm.txtChd.value == "" && frm.txtInf.value == "")
		  {
		    alert("Please enter at least a value of Total Passanger.");
		    frm.txtAdt.focus();
		    frm.txtAdt.style.backgroundColor='#FFFFCC';
		    frm.txtChd.style.backgroundColor='#FFFFCC';
		    frm.txtInf.style.backgroundColor='#FFFFCC';
		    return (false);
		  }
		  
		var checkOK = "0123456789";
		var checkStr = frm.txtAdt.value;
		var decPoints = 0;
		//var allNum = "";

		allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			{
				if (ch == checkOK.charAt(j))
					break;
			}
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
			//if (ch != ",")
			//allNum += ch;
		}
		if (!allValid)
		{
		alert("Please digit characters.");
		frm.txtAdt.focus();
		frm.txtAdt.value="";
		frm.txtAdt.style.backgroundColor='#FFFFCC';
		return (false);
		}
		var checkOK = "0123456789";
		var checkStr = frm.txtChd.value;
		var decPoints = 0;
		//var allNum = "";

		allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			{
				if (ch == checkOK.charAt(j))
					break;
			}
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
			//if (ch != ",")
			//allNum += ch;
		}
		if (!allValid)
		{
		alert("Please digit characters.");
		frm.txtChd.focus();
		frm.txtChd.value="";
		frm.txtChd.style.backgroundColor='#FFFFCC';
		return (false);
		}
		var checkOK = "0123456789";
		var checkStr = frm.txtInf.value;
		var decPoints = 0;
		//var allNum = "";

		allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			{
				if (ch == checkOK.charAt(j))
					break;
			}
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
			//if (ch != ",")
			//allNum += ch;
		}
		if (!allValid)
		{
		alert("Please digit characters.");
		frm.txtInf.focus();
		frm.txtInf.value="";
		frm.txtInf.style.backgroundColor='#FFFFCC';
		return (false);
		}
	}
  	 if (frm.optTP(1).checked == true || frm.optTP(2).checked== true)
  	
	{
		 if (frm.txtRoom.value == "")
		  {
		    alert("Please enter at Total Rooms needed.");
		    frm.txtRoom.focus();
		    frm.txtRoom.style.backgroundColor='#FFFFCC';
		    return (false);
		  }
		  
		var checkOK = "0123456789";
		var checkStr = frm.txtRoom.value;
		var decPoints = 0;
		//var allNum = "";

		allValid = true;
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			{
				if (ch == checkOK.charAt(j))
					break;
			}
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
			//if (ch != ",")
			//allNum += ch;
		}
		if (!allValid)
		{
		alert("Please digit characters.");
		frm.txtRoom.focus();
		frm.txtRoom.style.backgroundColor='#FFFFCC';
		frm.txtRoom.value="";
		return (false);
		}
	} 	 	 
  return(true);
  }