document.write("<style type=\"text/css\">"); 
document.write("ul.list1 li div p{*position:absolute;top:50%; left:0; display:table-cell; vertical-align:middle;width:100%;}");
document.write("#sresult,#friend ul li p{filter:Alpha(Opacity=90);}");
document.write("</style>"); 

$(function(){

	var comon=$('.bottomword01');
	$('>h2>span',comon).click(function(){
		var i=$(this).index();
		$('>div',comon).eq(i).show().siblings('div').hide();
		$('.bottomword01>h2').addClass('ac');
		if(i!=0)
		{
			$(this).siblings('a').hide();
		}else{
			$('.bottomword01>h2').removeClass('ac');
			$(this).siblings('a').show();
		}
	})

	$('.bottomword1').css("height",$('.bottomword3').outerHeight());
	$('.bottomword1>ul>li').click(function(){
		  $(this).siblings('li').children('ul').hide();
		  $(this).children('ul').show();
		  $(this).children('a.top').addClass('ac');
		  $(this).siblings('li').children('a.top').removeClass('ac');
		
    })	

	 $("#INTRO #flash").html(fplay("images/intro.swf","1002","600","transparent"));
	 $("#bottomword span.img").html(fplay("images/left.swf","189","115","transparent"));
	 $("#tonglan div.flash").html(fplay("images/" + $("body").attr("id").substring(1,3) + ".swf","944","197","transparent"));
	 $(".oninvco").html(fplay("ballot.swf","170","176","transparent"));
	 $("#tonglan0 div.flash").html(fplay("images/img.swf","944","336","transparent","pics=images/t1.jpg|images/t2.jpg|images/t3.jpg|images/t4.jpg&borderwidth=944&borderheight=336&textheight=0"));
	 
				$('.bottomword1').css("height",$('.bottomword3').outerHeight());
				$('.bottomword1>ul>li').click(function(){
					  
					  
					  $(this).siblings('li').children('ul').hide();
					  $(this).children('ul').show();
					  $(this).children('a.top').addClass('ac');
					  $(this).siblings('li').children('a.top').removeClass('ac');
					
			    })			   
							   

	  $('.bottomword1>ul>li>a').each(function(){
		var _ul=$(this).siblings('ul');
		  if(_ul.length>0)
			{
		  $(this).toggle(function(){
				_ul.slideDown("slow");
			},
			function(){
				_ul.slideUp("slow");
			})
			}
	  });

	$(".protree a.ac").parents("li").children("a").addClass("ac");

	 if ($("ul.list1 li div p a.thumb").length > 0) {$("ul.list1 li div p a.thumb").lightBox();}							   

/**/

    var map = $("#chinamap");
    var map_a = $(">div>a", map);
    map_a.each(function() {
        if($(this).attr("href").indexOf("#") > -1) {
            $(this).addClass("ok");
        }
    });
    map_a.hover(function() {
        $(this).addClass("over");
    }, function() {
        $(this).removeClass("over");
    });
    var prov_data = $("#map>dl.provdata");
    var viewb = $("#map>dl.desc");
    var bef = $("<div>");

    map_a.click(function() {
        bef.removeClass("ac");
        $(this).addClass("ac");
        bef = $(this);

        var href = $(this).attr("href");
        var st = href.indexOf("#");
        var myProv = prov_data.children("dt").filter("." + href.slice(st+1));

/*0608*/var dd = myProv.next("dd");
        var dd_br = dd.children("br");

        viewb.fadeOut("fast", function() {
            viewb.html("");
            viewb.append(myProv.clone()).append(myProv.next("dd").clone());

/*0608*/    if (dd_br.length > 15) {
                var t_pages = Math.ceil(dd_br.length/15);
                
                var temp_node = document.createDocumentFragment();

                var temp1 = $("<a class='up' href='javascript:void(null)'></a>")[0];
                var temp2 = $("<a class='down' href='javascript:void(null)'></a>")[0];
                var temp3 = $("<p class='c_page'>1</p>")[0];
                var temp5 = $("<p class='t_pages'>" + t_pages + "</p>")[0];

                temp_node.appendChild(temp1);
                temp_node.appendChild(temp2);
                temp_node.appendChild(temp3);
                temp_node.appendChild(temp5);

                viewb.append(temp_node);                    //fragment dom;

                var v_dd = $(">dd", viewb);
                v_dd.contents().wrapAll("<div>");                 //contents() method is very useful.

                /**/
                var up = $("a.up", viewb);
                var down = $("a.down", viewb);
                var step = 225;                             // 225 px / 15 lineheight =  15 lines;
                var cur_mg = 0;
                var page = 1;
                var wrap_div = $(">dd>div", viewb);
                var v_sp = $(">p.c_page", viewb);

                down.click(down_c = function() {
                    page += 1;
                    v_sp.text(page);
                    wrap_div.css("marginTop", cur_mg -= step);
                    if (page > 1) {
                        up.bind("click", up_c).removeClass("dis");
                    }
                    if (page >= t_pages) {
                        down.unbind("click", down_c).addClass("dis");
                    }
                });
                up.click(up_c = function() {
                    page -= 1;
                    v_sp.text(page);
                    wrap_div.css("marginTop", cur_mg += step);
                    if(page < t_pages) {
                        down.bind("click", down_c).removeClass("dis");
                    }
                    if (page <= 1) {
                        up.unbind("click", up_c).addClass("dis");
                    }
                });
                up.addClass("dis").unbind("click", up_c);    //first sight, up button must be disabled;
            }

            
            viewb.slideDown("fast");
        });

    });
/*map*/
})

function fplay(swf, swfwidth, swfheight,full,FlashVars) { 
    if (navigator.userAgent.indexOf('Firefox') > - 1) {
		if (FlashVars){
	        return('<embed src="' + swf + '" width="' + swfwidth + '" height="' + swfheight + '" quality="high" wmode="' + full + '" allowFullScreen="true" allowScriptAccess="always" FlashVars="' + FlashVars + '"></embed>');
		}else{
        return('<embed src="' + swf + '" width="' + swfwidth + '" height="' + swfheight + '" quality="high" wmode="' + full + '"></embed>');}
    } else {
		if (FlashVars){
			return('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + swfwidth + '" height="' + swfheight + '"><param name="movie" value="' + swf + '" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="' + full + '" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="wmode" value="' + full + '" /><param name="FlashVars" value="' + FlashVars + '" /></object>');
		}else{
        return('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + swfwidth + '" height="' + swfheight + '"><param name="movie" value="' + swf + '" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="' + full + '" /></object>');}
    }
}

