// JavaScript Document
function showtime(){
	today=new Date();
	thu=today.getDay();
	var thuten=""
	switch (thu)
	{
	case 0:
	thuten="Sunday";
	break;
	case 1:
	thuten="Monday";
	break;
	case 2:
	thuten="Tuesday";
	break;
	case 3:
	thuten="Wednesday";
	break;
	case 4:
	thuten="Thursday";
	break;
	case 5:
	thuten="Friday";
	break;
	default:
	thuten="Satuday";
	break;
	}
	ngay=today.getDate();
	thang=today.getMonth();
	thang=thang+1;
	switch (thang)
	{
	case 1:
	thang="January";
	break;
	case 2:
	thang="February";
	break;
	case 3:
	thang="March";
	break;
	case 4:
	thang="April";
	break;
	case 5:
	thang="May";
	break;
	case 6:
	thang="June";
	break;
	case 7:
	thang="July";
	break;
	case 8:
	thang="August";
	break;
	case 9:
	thang="September";
	break;
	case 10:
	thang="October";
	break;
	case 11:
	thang="November";
	break;
	case 12:
	thang="December";
	break;
	default:
	thang="January";
	break;
	}
	nam=today.getFullYear();
	//inra=thu+','+ngay+' '+thang+','+nam;
	document.write(thuten+',&nbsp;'+thang+'&nbsp;'+ngay+',&nbsp;'+nam);	
}
function ShowForexRate(){
	//vForexs.length - 1
	var sHTML = '';
	sHTML = sHTML.concat('<table border="0px" cellpadding="2px" cellspacing="1px" class="tbl-weather"  width="214" >');
	for(var i=0;i< 6;i++){
		sHTML = sHTML.concat('	<tr>');
		sHTML = sHTML.concat('		<td class="td-weather-title">').concat(vForexs[i]).concat('</td>');
		sHTML = sHTML.concat('		<td class="td-weather-data">').concat(vCosts[i]).concat('</td>');
		sHTML = sHTML.concat('	</tr>');
	}
	sHTML = sHTML.concat('</table>');
	document.write(sHTML);

}
function ShowGoldPrice(){
	var sHTML = '';
	sHTML = sHTML.concat('<div style="text-align:right;color:#8A0000;font:bold 10px arial;">&#272;VT: tr.&#273;/l&#432;&#7907;ng</div>');
	if(vGoldSbjBuy=='{0}' || vGoldSbjSell=='{1}' || vGoldSjcBuy =='{2}' || vGoldSjcSell=='{3}'){
		sHTML = sHTML.concat('<table border="0px" cellpadding="2px" cellspacing="1px" class="tbl-goldprice">');
		sHTML = sHTML.concat('	<tr>');	
		sHTML = sHTML.concat('		<td class="td-weather-title" style="text-align:center;font-size:10px;width:35%;font-weight:bold">D&#7919; li&#7879;u &#273;ang &#273;&#432;&#7907;c c&#7853;p nh&#7853;t</td>');	
		sHTML = sHTML.concat('	</tr>');
		sHTML = sHTML.concat('</table>');
	}
	else{	
		sHTML = sHTML.concat('<table border="0px" cellpadding="2px" cellspacing="1px" class="tbl-goldprice">');
		sHTML = sHTML.concat('	<tr>');
		sHTML = sHTML.concat('		<td class="td-weather-title" style="font-size:10px;width:30%;">Lo&#7841;i</td>');
		sHTML = sHTML.concat('		<td class="td-weather-title" style="text-align:center;font-size:10px;width:35%;">Mua</td>');
		sHTML = sHTML.concat('		<td class="td-weather-title" style="text-align:center;font-size:10px;width:35%;">B&#225;n</td>');
		sHTML = sHTML.concat('	</tr>');
		sHTML = sHTML.concat('	<tr>');
		sHTML = sHTML.concat('		<td class="td-weather-title">SBJ</td>');
		sHTML = sHTML.concat('		<td class="td-weather-data txtr">').concat(vGoldSbjBuy).concat('</td>');
		sHTML = sHTML.concat('		<td class="td-weather-data txtr">').concat(vGoldSbjSell).concat('</td>');
		sHTML = sHTML.concat('	</tr>');
		sHTML = sHTML.concat('	<tr>');
		sHTML = sHTML.concat('		<td class="td-weather-title">SJC</td>');
		sHTML = sHTML.concat('		<td class="td-weather-data txtr">').concat(vGoldSjcBuy).concat('</td>');
		sHTML = sHTML.concat('		<td class="td-weather-data txtr">').concat(vGoldSjcSell).concat('</td>');
		sHTML = sHTML.concat('	</tr>');
		sHTML = sHTML.concat('</table>');	
	}
	document.write(sHTML);
}


function ValidateData() {
	if ($("#txtGivename").val() == "") {
		alert("Please enter your Passenger Name");
		$("#txtGivename").focus();
		return false;
	}
	
	if ($("#txtEmailAddress").val()=="") {
		alert("Please enter email address");
		document.frmStep5.txtEmailAddress.focus();
		return false;
	}

	if (!isEmailAddr($("#txtEmailAddress").val())) {
		alert("Please enter a valid email address");
		$("#txtEmailAddress").focus();
		return false;
	}

	if ($("#txthomeAddress").val() == "") {
		alert("Please enter the address");
		$("#txthomeAddress").focus();
		return false;
	}

	if ($("#txtTelephone").val() == "") {
		alert("Please enter your Telephone Number");
		$("#txtTelephone").focus();
		return false;
	}
	if ($("#txtFlightNo").val() == "") {
		alert("Please enter your Flight Number");
		$("#txtFlightNo").focus();
		return false;
	}


	var rad_val = "";
	for (var i = 0; i < document.frmStep5.chkPayMethod.length; i++) {
		if (document.frmStep5.chkPayMethod[i].checked) {
		rad_val = document.frmStep5.chkPayMethod[i].value;
	}
	}
	
	if (rad_val == "") {
		alert("Please choose your payment method")
		return false;
	}
	if ($("#security_code").val() == "") {
			alert("Please enter your security code");
			$("#security_code").focus();
			return false;
		}
	return true
}

function isEmailAddr(txtEmail) {
	var result = false
	var theStr = new String(txtEmail)
	var index = theStr.indexOf("@");
	if (index > 0) {
		var pindex = theStr.indexOf(".", index);
	 	if ((pindex > index + 1) && (theStr.length > pindex + 1))
			result = "1";
		}
	 return result;
}

 function resizeIFrameToItsContent(obj)
        {          
          var the_height=obj.contentWindow.document.body.scrollHeight;
          obj.height=the_height;
        }
	$(document).ready(function(){
		$('#langen').click(function(){
			 changerLang(2);
			 document.frmlang.submit();
		})
		$('#langvi').click(function(){
			 changerLang(1);
			 document.frmlang.submit();
		})
		function changerLang(id){
			
			$('#langID').val(id);
		}
		
		 	$('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
			 $("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
		 $("#example-one").organicTabs();
		})
	function viewvideo2(id){
		window.location.href = "videoShow2.php?videoID=" + id;
	}
	function postnew(){
		window.location.href = "Post.html";
	}
function changtab(id,count,clear){
	for(i=1;i<=count;i++){
		document.getElementById('tab_'+i).className='tab_t_nomal';
	}
	document.getElementById('tab_'+id).className='tab_t_select';
	//document.getElementById('tab_content').innerHTML = document.getElementById('content_'+id).innerHTML;
	if(clear==1) clearInterval(showtime);
}
function tabdetail(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('detail_'+i).className='tab_nomal';
			document.getElementById('description_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('detail_'+id).className='tab_select';
	document.getElementById('description_'+id).style.display='block';
}

	function doUploadPic2(url){
	uploader = window.open(url,"upload","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 0,top = 0");
}

function submitform(){
						
							if(IsEmpty(document.getElementById("fullname").value) == false){
								document.getElementById("fullname").focus();
								alert("Please enter your Full Name!");
								return false;
							}
							/*if(isValidRadio(document.getElementById("gender")) == false){
								document.getElementById("gender").focus();
								alert("Please enter Choice gender!");
								return false;
							}*/
							if(IsEmpty(document.getElementById("City").value) == false){
								document.getElementById("City").focus();
								alert("Please enter your City!");
								return false;
							}
							 if(IsEmpty(document.getElementById("phone").value) == false){
								document.getElementById("phone").focus();
								alert("Please enter your phone number!");
								return false;
							}
							 if(IsNumeric(document.getElementById("phone").value) == false){
								document.getElementById("phone").focus();
								alert("Please enter your phone number !");
								return false;
							}
							if(IsEmpty(document.getElementById("email").value) == false){
								document.getElementById("email").focus();
								alert("Please enter your email!");
								return false;
							}
							if (String(document.getElementById("email").value).search(/^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/)==-1){
								alert("E-mail address is not correct!");
								document.getElementById("email").focus();
								return false;
							} 
					
							
							if(document.getElementById("numberadults").value == 0){
								document.getElementById("numberadults").focus();
								alert("Please enter the number of adults");
								return false;
							}
						
						if(document.getElementById("isAirport").checked == true){
							document.getElementById("isAirport").value = 1;
						}
						if(document.getElementById("isHotel").checked == true){
							document.getElementById("isHotel").value = 1;
						}	
						
							if(IsEmpty(document.getElementById("departuredate").value) == false){
								document.getElementById("departuredate").focus();
								alert("Please enter your departure date!");
								return false;
							}
							
							
							if(IsEmpty(document.getElementById("security_code").value) == false){
								document.getElementById("security_code").focus();
								alert("Please enter your security code !");
								return false;
							}
							if(document.getElementById("chkAgree").checked == false){
							alert("Please enter Choice Terms & Condition!");
							return false;
						}
							else{
								
								document.inquiryform.submit();
								return true;
							}
						}
						function isValidRadio(radio) {
							var valid = false;
							for (var i = 0; i < radio.length; i++) {
								if (radio[i].checked) {
									return true;
								}
							}
							 return false;
						}
						function IsNumeric(sText)

						{
						   var ValidChars = "0123456789.";
						   var IsNumber=true;
						   var Char;
						
						 
						   for (i = 0; i < sText.length && IsNumber == true; i++) 
							  { 
							  Char = sText.charAt(i); 
							  if (ValidChars.indexOf(Char) == -1) 
								 {
								 IsNumber = false;
								 }
							  }
						   return IsNumber;
						   
						   }

						function IsEmpty(val){
							if(val == "") return false
							else return true
						}
