// 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();
		})
			$('.slideshow').cycle({
		 fx:     'fade', 
		speed:   1200, 
		timeout: 4000, 
		next:   '.slideshow', 
		pause:   1 
	});
		function changerLang(id){
			
			$('#langID').val(id);
		}
		
		
	})
	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");
}


