
/*--------aaa--Zoom--------------*/
   $.fn.zoomtabs = function (zoomPercent, easing) {
        if (!zoomPercent) zoomPercent = 10;
        return this.each(function () {
            var $zoomtab = $(this);
            var $tabs = $zoomtab.find('.tabs');
            var height = $tabs.height();
            var panelIds = $tabs.find('a').map(function () {
                return this.hash;
            }).get().join(',');
            $zoomtab.find('> div').scrollTop(0);
            var $panels = $(panelIds);
            var images = [];
            $panels.each(function () {
                var $panel = $(this),
                    bg = ($panel.css('backgroundImage') || "").match(/url\s*\(["']*(.*?)['"]*\)/)
                    img = null;
                if (bg !== null && bg.length && bg.length > 0) {
                    bg = bg[1];
                    img = new Image();
                    $panel.find('*').wrap('<div style="position: relative; z-index: 1000;top:0px;left:0px" />');                    
               
                    $panel.css('backgroundImage', 'none');
                    $(img).load(function () {
                        var w = this.width;
                        var wIn = w / 100 * zoomPercent;
                        var h = this.height;
                        var hIn = h / 100 * zoomPercent;
                        var top = 0;
                        var fullView = {
                            height: (h - hIn) + 'px',
                            width: (w - wIn) + 'px',
                            top: top,
                            left: '+' + (wIn / 2) + 'px'	
                        };
                                                
                        var zoomView = {
                            height: h + 'px',
                            width: w + 'px',
                            top: top,
                            left: 0
                        };
                        $(this).data('fullView', fullView).data('zoomView', zoomView).css(zoomView);
                    }).prependTo($panel).css({'position' : 'absolute', 'top' : 0, 'left' : 0 ,'z-index':-1000}).attr('src', bg);
                    
                    images.push(img);
                }
            });
            function zoomImages(zoomType, speed) {
                $(images).each(function () {
                    var $image = $(this);
                    if ($image.is(':visible')) {
                        $image.stop().animate($image.data(zoomType), speed, easing);
                    } else {
                        $image.css($image.data(zoomType), speed);
                    }
                });
            }        
            $tabs.height(0).hide(); 
            var speed = 200;
            $zoomtab.hover(function () {
                zoomImages('fullView', speed);
                $tabs.stop().animate({ height : height }, speed, easing);
            }, function () {
                zoomImages('zoomView', speed);
                $tabs.stop().animate({ height : 0 }, speed, easing, function () {
                  $tabs.hide();
                });
            });
            var hoverIntent = null;
            $tabs.find('a').hover(function () {
                clearTimeout(hoverIntent);
                var el = this;
                hoverIntent = setTimeout(function () {
                    $panels.hide().filter(el.hash).show();
                }, 100);
            }, function () {
                clearTimeout(hoverIntent);
            }).click(function () {
               
            });
        });
    };

	/*------Find Location------*/
	var cityAr=new Array("Beijing","Guangzhou","Gurgaon","Hong Kong","Jakarta","Macau","Mumbai","Seoul","Shanghai","Shenzhen","Singapore","Sydney","Taipei","Tianjin","Tokyo");
var locationsAr=new Array(['Beijing - Beijing Yintai Centre','Beijing - China Resources Building','Beijing - Hyundai Motor Tower','Beijing - China World Office 1'],['Guangzhou - HNA Tower','Guangzhou - Taikoo Hui'],['Gurgaon - Gurgaon DLF Cyber City'],['Hong Kong - Cambridge House','Hong Kong - Three Pacific Place','Hong Kong - Wheelock House','Hong Kong - One Island East','Hong Kong - Nexxus Building','Hong Kong - Two Exchange Square'],['Jakarta - Sampoerna Strategic Square'],['Macau - AIA Tower'],['Mumbai - Kalpataru Synergy'],['Seoul - Gangnam Finance Center','Seoul - Seoul Finance Centre'],['Shanghai - Citic Square','Shanghai - Chong Hing Finance Center','Shanghai - The Center','Shanghai - Xintiandi','Shanghai - International Finance Centre'],['Shenzhen - Kerry Plaza Tower 2'],['Singapore - One Raffles Quay','Singapore - Prudential Tower','Singapore - Ocean Financial Centre'],['Sydney - RBS Tower','Sydney - Australia Square','Sydney - Northpoint Tower'],['Taipei - Taipei 101','Taipei - Far Eastern Plaza'],['Tianjin - The Exchange Tower 2','Tianjin - TEDA MSD','Tianjin - World Financial Centre'],['Tokyo - Cerulean Tower','Tokyo - Tokyo Bankers Club','Tokyo - Sanno Park Tower']);
var urlAr=new Array(['http://www.executivecentre.com/service-office-locations/virtual-office-beijing-yintai.html','http://www.executivecentre.com/service-office-locations/virtual-office-in-beijing-resources.html','http://www.executivecentre.com/service-office-locations/china-virtual-office-beijing-hyundai.html',
'http://www.executivecentre.com/service-office-locations/serviced-office-china-world-office-1.html'],['http://www.executivecentre.com/service-office-locations/skyfame-tower-guangzhou.html','http://www.executivecentre.com/service-office-locations/taikoo-hui-guangzhou.html'],['http://www.executivecentre.com/service-office-locations/serviced-office-gurgaon-cyber-city.html'],['http://www.executivecentre.com/service-office-locations/virtual-office-hong-kong-cambridge.html','http://www.executivecentre.com/service-office-locations/three-pacific-place-hong-kong.html','http://www.executivecentre.com/service-office-locations/wheelock-house-hong-kong.html','http://www.executivecentre.com/service-office-locations/serviced-office-in-hong-kong-one-island-east.html','http://www.executivecentre.com/service-office-locations/hong-kong-nexxus.html','http://www.executivecentre.com/service-office-locations/hong-kong-2exchange.html'],['http://www.executivecentre.com/service-office-locations/sampoerna-strategic.html'],['http://www.executivecentre.com/service-office-locations/aia-macau.html'],['http://www.executivecentre.com/service-office-locations/office-space-mumbai-kalpataru.html'],['http://www.executivecentre.com/service-office-locations/gangnam-finance-center-seoul.html','http://www.executivecentre.com/service-office-locations/seoul-financial-center-finance.html'],['http://www.executivecentre.com/service-office-locations/citic-shanghai.html','http://www.executivecentre.com/service-office-locations/chong-hing-finance-center-shanghai.html','http://www.executivecentre.com/service-office-locations/shanghai-virtual-office-xintiandi.html','http://www.executivecentre.com/service-office-locations/serviced-office-shanghai-ifc.html'],['http://www.executivecentre.com/service-office-locations/shenzhen-kerry-plaza.html'],['http://www.executivecentre.com/service-office-locations/virtual-office-in-singapore-raffles.html','http://www.executivecentre.com/service-office-locations/serviced-offices-singapore-prudential.html',
'http://www.executivecentre.com/service-office-locations/serviced-offices-singapore-ocean-financial.html'],['http://www.executivecentre.com/service-office-locations/abn-amro-tower-sydney.html','http://www.executivecentre.com/service-office-locations/serviced-offices-sydney-ausquare.html','http://www.executivecentre.com/service-office-locations/serviced-office-sydney-northpoint-tower.html'],['http://www.executivecentre.com/service-office-locations/virtual-office-taipei-101.html','http://www.executivecentre.com/service-office-locations/serviced-office-taipei-far-eastern-plaza.html'],['http://www.executivecentre.com/service-office-locations/meeting-room-tianjin-exchange.html','http://www.executivecentre.com/service-office-locations/serviced-office-tianjin-teda.html','http://www.executivecentre.com/service-office-locations/serviced-office-tianjin-wfc.html'],['http://www.executivecentre.com/service-office-locations/virtual-office-japan-tokyo-cerulean.html','http://www.executivecentre.com/service-office-locations/serviced-office-tokyo-bankers.html',
'http://www.executivecentre.com/service-office-locations/serviced-office-tokyo-sanno-park-tower.html']);


function removeChildrenFromNode(node) {
  if(node.hasChildNodes()) {
	  while(node.childNodes.length >= 1 ) {
		node.removeChild(node.firstChild);
	  }
  }
}

function cityCh(st1) {
	var str1="";
 	str1= "";
	
	target=document.getElementById('location1');
	removeChildrenFromNode(target)

	for(i=0;i<locationsAr[st1].length;++i)
	{
	 var element=document.createElement("option");
	element.setAttribute("value",i);
	var textnode=document.createTextNode(locationsAr[st1][i]);
	element.appendChild(textnode);
	target.appendChild(element);
	
	}


}
function viewDet(){
window.open(urlAr[document.getElementById('city').value][document.getElementById('location1').value])
}

 $(document).ready(  
 
/*--------------Testimonial------------------------*/

 function(){  
   $('ul#portfolio').innerfade({  
   speed: 1000,  
   timeout: 5000,  
   type: 'random',  
   containerheight: '220px'  
   });  
 
 
 
 $('.zoomoutmenu').zoomtabs(15);
$("#one,#two,#three,#four").hide();
$("#one").show();



		/*----------promotion ------------------*/
 

   $('ul#portfolio1').innerfade({  
   speed: 1000,  
   timeout: 5000,  
   type: 'random',  
   containerheight: '130px'  
   });
   

 });  

 /*----------------testimonial page---------------------------*/
 var temph='#taston';
var intr;
var stop;
jQuery(function( $ ){

$("#aston").show()
var testm="#aston";


$('#taston').addClass('thov');


$('.t-thumb').hover(thover)


function thover(){
								if(stop==0)
								window.clearInterval(intr)
								$(temph).removeClass('thov');
								$(this).addClass('thov');
								temph='#'+$(this).attr('id')

								$(testm).fadeOut(200)
								$("#"+$(this).attr('alt')).fadeIn(500)
								testm="#"+$(this).attr('alt');
								stop=0;
								}

								

intr=setInterval('rotate()',4000)





});
var i=1;

function rotate(){
stop=1
$('.t-thumb').eq(i).hover()
i++
if(i==21){
		i=0;
		}


}





	function valida_form( form, var_txt_name, var_txt_company, var_txt_phone, var_txt_email, var_sel_cities, var_cmb_so, var_cmb_vo, var_cmb_mf, var_cmb_vc, var_sel_num_people, var_action){
	
		var form = window.document.getElementById (form);
		var var_txt_name = window.document.getElementById (var_txt_name);
		var var_txt_company = window.document.getElementById (var_txt_company);
		var var_txt_phone = window.document.getElementById (var_txt_phone);
		var var_txt_email = window.document.getElementById (var_txt_email);
		var var_sel_cities = window.document.getElementById (var_sel_cities);
		var var_cmb_so = window.document.getElementById (var_cmb_so);
		var var_cmb_vo = window.document.getElementById (var_cmb_vo);
		var var_cmb_mf = window.document.getElementById (var_cmb_mf);
		var var_cmb_vc = window.document.getElementById (var_cmb_vc);
		
		
		if (var_txt_name.value == '' || var_txt_name.value == 'undefined' || var_txt_name.value == 'null'){
			//alert(txt_prof.value);
			alert('Please, insert your name.');
			var_txt_name.select();
			var_txt_name.focus();
			return false;
			
		}else if (var_txt_company.value == '' || var_txt_company.value == 'undefined' || var_txt_company.value == 'null'){
			//alert(txt_prof.value);
			alert('Please, insert your Company name.');
			var_txt_company.select();
			var_txt_company.focus();
			return false;
			
		}else if (var_txt_phone.value == '' || var_txt_phone.value == 'undefined' || var_txt_phone.value == 'null'){
			//alert(txt_prof.value);
			alert('Please, insert your Phone Number.');
			var_txt_phone.select();
			var_txt_phone.focus();
			return false;	
					
		}else if (var_txt_email.value == '' || var_txt_email.value == 'undefined' || var_txt_email.value == 'null' || var_txt_email.value.indexOf('.') == -1 || var_txt_email.value.indexOf('@') == -1){
			alert('Your Email field is empty or incorrect.');
			var_txt_email.select();
			var_txt_email.focus();
			return false;
			
		}else if(var_sel_cities.value == '' || var_sel_cities.value == 'undefined' || var_sel_cities.value == 'null'){
			alert('Please, select Interested Location.');
			var_sel_cities.select();
			var_sel_cities.focus();
			return false;
		}else if (var_cmb_so.checked == false && var_cmb_vo.checked == false && var_cmb_mf.checked == false && var_cmb_vc.checked == false){
			alert('Please, select at least 1 of our services.');
			var_cmb_so.select();
			var_cmb_so.focus();
			return false;
		}else{
			form.action = var_action;
			form.submit();
		}
		
	}

