/*function loadGoogleMap(){
  var  googleMapHtml = "<iframe width='390' height='390' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://maps.google.com.hk/maps/ms?msa=0&amp;msid=211473385490706124243.0004b41ce7a060d5aaafc&amp;brcurrent=3,0x3404007e811b3f95:0x47c863b8fcf83784,0,0x3403ff80eb6f67b1:0x46c3c89b39011247&amp;ie=UTF8&amp;t=m&amp;vpsrc=6&amp;ll=22.286525,114.150181&amp;spn=0.003872,0.004195&amp;z=17&amp;output=embed'></iframe>";
  var agent=navigator.userAgent.toLowerCase();
  var is_iphone = ((agent.indexOf('iphone') != -1));
  var is_ipad = ((agent.indexOf('ipad') != -1));
  if(is_iphone || is_ipad){
	// location.reload(true);
	$('#mapBox').html('<img src="images/gmap.gif" width="390" height="390" />');		 
  } else {     
	$('#mapBox').html(googleMapHtml);
  }; 	  
  $('#mapBox').html(googleMapHtml);
}*/
function startLoopBG(){
	currentBG=1;
	setTimeout("loopBG()",6000);
}

function loopBG(){
	loopStart=1;
	loopEnd=20;
	stayTime=6000;
	transTime=2000;
	if(currentBG<20){	
	  if(currentBG==1){
		$('#bg20').css({"display":'none'});
	  }
	  var theBgName='#bg'+currentBG;
	  $(theBgName).fadeOut(transTime,function(){
		setTimeout("loopBG()",stayTime);
	  });
	  currentBG+=1;
	  var nextBgName='#bg'+currentBG;
	  $(nextBgName).css({"display":'block'});	  
	}else{
	  $('#bg1').fadeIn(transTime,function(){
		$('#bg20').css({'display':'none'});
		setTimeout("loopBG()",stayTime);
	  });	  
	  currentBG=1;
	}
}

function resizeContactUs(){	
  widthRatio = $(window).width()/600;
  heightRatio = $(window).height()/383;	  
  if(widthRatio-heightRatio>=0){	
	$('.contactUsBGimg').css('width', $(window).width()+'px');
	$('.contactUsBGimg').css('height', 'auto');
	$('#bgDiv2').css('left', '0px');
	$('#bgDiv2').css('top', 0-(383*widthRatio-$(window).height())/2+'px');
  }else{		
	$('.contactUsBGimg').css('height', $(window).height()+'px');
	$('.contactUsBGimg').css('width', 'auto');		
	$('#bgDiv2').css('left', 0-(600*heightRatio-$(window).width())/2+'px');
	$('#bgDiv2').css('top', '0px');
  }
}
