var accordion_focus;

function tradeShowDetail(id,lng_num) {
	var popup;
	popup = window.open('/intro/20101207/inc_trade_show_detail.php?id='+id+'&lng_num='+lng_num,'popup','width=820,height=400,scrolling=1');
}

function searchTradeShow(oby) {
	if (oby == '1') {
		$('#city_search').val('');
	} else if(oby='2') {
        $('#country_search').val('');		
	}
	
    $.get('/intro/20101207/inc_trade_show_search_body.php',$('#formSearchTrade').serialize(),function(data) {
        if ($('#lng_num').val() == '2') {
			$('#trade_show_search_body_eng').html(data);
		} else {
			$('#trade_show_search_body_chn').html(data);
		}
			
    });
//	$('#formSearchTrade').submit();
}

function showCategory(id) {
    if(accordion_focus==id) return;
    accordion_focus = id;

    $('#accordion > div').css({'display':'none'});
    $('#accordion > h3').css({'margin-top':'1px solid white'});

	$('#category-'+id).css({'display':''});
    $('#category-'+id).css({'height':'118px'});
    $('#category-'+id).css({'border-top':'1px solid white'});
}

$(function(){
    showCategory('02');
});

$(function(){
  
  // Bind an event to window.onhashchange that, when the hash changes, gets the
  // hash and adds the class "selected" to any matching nav link.
  $(window).hashchange( function(){
    var hash = location.hash;
    
    // Set the page title based on the hash.
    // document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'blank' ) + '.';
    
    // Iterate over all nav links, setting the "selected" class as-appropriate.
    $('.menu-top a').each(function(){
      var that = $(this);
      that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
    });
  })
  
  // Since the event is only triggered when the hash changes, we need to trigger
  // the event now, to handle the hash the page may have loaded with.
  $(window).hashchange();
});

$(document).ready(function() {
	$( "#accordion" ).css('display','');
	/*
	$( "#accordion" ).accordion({
		navigation: false,
		event: 'mouseover',
		collapsible: true
	});
	*/
	
	$('#news-top .eng li:odd').css('margin','0 1px');
	$('#news-top .chn li:odd').css('margin','0 1px');
	
    $('#click_home').click(function() {
		$('#content1col').css('display','none');
		$('#content2col').css('display','');
        $.get('/intro/20101207/tmp_home_eng.php',{lng_num:"2"},function(data) {
            $('#content2col-eng').html(data);
        });
        $.get('/intro/20101207/tmp_home_chn.php',{lng_num:"10"},function(data) {
            $('#content2col-chn').html(data);
        });
    });

	$('#click_abo_company').click(function() {
        $('#content1col').css('display','none');
        $('#content2col').css('display','');
		$('#content2col-eng').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $('#content2col-chn').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $.get('/intro/20101207/tmp_abo_company_eng.php',{lng_num:"2"},function(data) {
            $('#content2col-eng').html(data);
        });
        $.get('/intro/20101207/tmp_abo_company_chn.php',{lng_num:"10"},function(data) {
            $('#content2col-chn').html(data);
        });
	});

    $('#click_trade_show').click(function() {
        $('#content1col').css('display','none');
        $('#content2col').css('display','');
        $('#content2col-eng').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $('#content2col-chn').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $.get('/intro/20101207/inc_trade_show_search.php',{lng_num:"2"},function(data) {
            $('#content2col-eng').html(data);
        });
        $.get('/intro/20101207/inc_trade_show_search.php',{lng_num:"10"},function(data) {
            $('#content2col-chn').html(data);
        });
    });

    $('#click_city').click(function() {
        $('#content1col').css('display','none');
        $('#content2col').css('display','');
        $('#content2col-eng').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $('#content2col-chn').html("<div style='margin-top:150px;text-align:center;'><img src='/css/images/waiting.gif'></div>");
        $.get('/intro/20101207/tmp_city_eng.php',{lng_num:"2"},function(data) {
            $('#content2col-eng').html(data);
        });
        $.get('/intro/20101207/tmp_city_chn.php',{lng_num:"10"},function(data) {
            $('#content2col-chn').html(data);
        });
    });

	$('#click_global_network').click(function() {
		$('#content2col').css('display','none');
		$('#content1col').css('display','');
	    $.get('/intro/20101207/tmp_global_network.php',function(data) {
	        $('#content1col-content').html(data);
	    });
	});

    $('#click_gnp').click(function() {
		var stat = $('#gnp-content').css('display');
        
		if(stat=='none') {
			$('#gnp-content').css('display','');
		    $.get('/index_network.php',function(data) {
		        $('#gnp-content').html(data);
		    });
        } else {
			$('#gnp-content').css('display','none');
		}
    });
});

function cityArticles(lng_num,city_num) {
    $('#content1col').css('display','none');
    $('#content2col').css('display','');
	
    $.get('/intro/20101207/inc_city_articles.php',{lng_num:lng_num,city_num:city_num},function(data) {
		if(lng_num=='2')
            $('#content2col-eng').html(data);
		else 
            $('#content2col-chn').html(data);
    });	
}

function tradeShow(id,lng) {
    $('#content1col').css('display','none');
    $('#content2col').css('display','');
    $.get('/intro/20101207/inc_trade_show_detail.php',{id:id,lng:lng},function(data) {
        $('#content2col-eng').html(data);
    });
	$('#content2col-chn').css('overflow','hidden'); 
    $('#content2col-chn').html("<img src='http://115.92.103.26/1.png' width='100%'>");
}

function googleSearch(str) {
	var f = document.formGoogle;
	f.q.value = str;
	f.submit();
}

