var phone_mod = 0;
var footer_margin = 0;
var max_screen_width = 1920;
var search_width = 40;
var submenu_timeout = Array();
var current_sub_menu = -1;
var submenu_on = Array();
var scrollTop;
var news_page = 1;
var news = Array();
var video_news = Array();
var big_interval = 0;
var csr_to = Array();
var video_to = Array();
var news_to = Array();
var video_news_to = Array();
function transfer_vw(px){
return (px == 0) ? "0vw" : ((px / max_screen_width) * 100).toFixed(2) + "vw";
}
function $(id){
return document.getElementById(id);
}
function show_top_weixin(){
$("top_weixin").style.display = "block";
}
function hide_top_weixin(){
$("top_weixin").style.display = "none";
}
function show_search_box(){
show_search_flag = 1;
window.setTimeout("do_show_search_box()", 10);
}
function hide_search_box(){
show_search_flag = -1;
window.setTimeout("do_hide_search_box()", 100);
}
function keep_search_box(){
show_search_flag = 1;
}
function do_show_search_box(){
//var width = $("search").clientWidth;
if(search_width < 300 && show_search_flag == 1){
$("search").style.borderColor = "#ffffff";
$("search").style.width = transfer_vw((search_width));
search_width += 10;
window.setTimeout("do_show_search_box()", 10);
}
else{
$("search_input").style.display = "block";
}
}
function do_hide_search_box(){
if(show_search_flag == 1)return;
$("search_input").style.display = "none";
if(search_width > 40 && show_search_flag == -1){
$("search").style.width = transfer_vw((search_width - 10));
search_width -= 10;
window.setTimeout("do_hide_search_box()", 10);
}
else{
$("search").style.borderColor = "#111625";
}
}
function show_submenu(id){
window.clearTimeout(submenu_timeout[id]);
if(current_sub_menu > -1 && current_sub_menu != id){
do_hide_submenu(current_sub_menu);
}
submenu_on[id] = 1;;
current_sub_menu = id;
$("top_menu_background").style.opacity = 1;
$("submenu_" + id).style.display = "block";
}
function keep_submenu(id){
window.clearTimeout(submenu_timeout[id]);
}
function hide_submenu(id){
submenu_timeout[id] = window.setTimeout("do_hide_submenu(" + id + ")", 200);
}
function do_hide_submenu(id){
$("submenu_" + id).style.display = "none";
submenu_on[id] = 0;
for(var i = 0; i < 5; i ++){
if(submenu_on[i] == 1){
return;
}
}
if(scrollTop / document.body.clientWidth * 100 > 3){
$("top_menu_background").style.opacity = 0.7;
}
}
function show_phone_menu(){
if($("phone_menu_container").style.display == "block"){
$("phone_menu_container").style.display = "none";
$("phone_menu_mask").style.display = "none";
document.body.style.overflowY = "auto";
phone_menu_on = 1;
}
else{
$("phone_menu_container").style.display = "block";
$("phone_menu_mask").style.display = "block";
document.body.style.overflowY = "hidden";
phone_menu_on = 0;
// if(scrollTop / clientWidth * 100 > 3){
if($("top_menu_background").style.opacity == 0.7){
$("phone_menu_container").style.top = "4.45vw";
$("phone_menu_mask").style.top = "4.45vw";
}
else{
$("phone_menu_container").style.top = "7.45vw";
$("phone_menu_mask").style.top = "7.45vw";
}
}
}
function show_comment(){
if(footer_margin == 0){
$("comment_button_2").style.backgroundImage = "url('images/collapse.png')";
$("comment_button_1").style.backgroundImage = "url('images/collapse.png')";
$("comment_button_1").style.display="none";
do_show_comment();
}
if(footer_margin == 11){
$("comment_button_2").style.backgroundImage = "url('images/expand.png')";
$("comment_button_1").style.backgroundImage = "url('images/expand.png')";
do_hide_comment();
}
}
function do_show_comment(){
$("footer").style.marginTop = transfer_vw(footer_margin * 47.7 - 527);
footer_margin ++;
if(footer_margin == 11){
return;
}
window.setTimeout("do_show_comment()", 20);
}
function do_hide_comment(){
footer_margin --;
$("footer").style.marginTop = transfer_vw(footer_margin * 47.7 - 577);
if(footer_margin == 0){
$("comment_button_1").style.display="block";
return;
}
window.setTimeout("do_hide_comment()", 20);
}
function do_send_comment(){
if(validation()){
document.forms["comment_form"].submit();
}
}
function validation(){
if($("real_name").value == '您的姓å'){
alert("请输入您的姓å");
return false;
}
if($("tel").value == '您的电è¯'){
alert("请输入您的电è¯");
return false;
}
if($("email").value == '您的电å邮箱'){
alert("请输入您的电å邮箱");
return false;
}
if($("user_comment").value == '您的留言'){
alert("请输入您的留言");
return false;
}
return true;
}
function show_footer_weixin(){
$("footer_weixin").style.display = "block";
}
function hide_footer_weixin(){
$("footer_weixin").style.display = "none";
}
function go_top(){
do_go_top();
}
function do_go_top(){
var step = 200;
scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
if(scrollTop > step){
if(document.documentElement.scrollTop){
document.documentElement.scrollTop -= step;
}
else{
document.body.scrollTop -= step;
}
window.setTimeout("do_go_top()", 10);
}
else{
if(document.documentElement.scrollTop){
document.documentElement.scrollTop = 0;
}
else{
document.body.scrollTop = 0;
}
}
}
window.onscroll = document.onscroll = window.ontouchmove = document.ontouchmove = function(){
var clientWidth = document.documentElement.clientWidth || document.body.clientWidth;
scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;
if(scrollTop / clientWidth * 100 > 3){
$("phone_menu_button").style.top = "1vw";
$("top_menu_background").style.top = "0vw";
for(var i = 0; i < 5; i ++){
$("submenu_" + i).style.top = "4.45vw";
}
$("top_menu").style.top = "0vw";
$("top_menu_background").style.opacity = "0.7";
}
else{
$("top_menu_background").style.opacity = "1";
for(var i = 0; i < 5; i ++){
$("submenu_" + i).style.top = 7.45 - scrollTop / clientWidth * 100 + "vw";
}
$("phone_menu_button").style.top = 4 - scrollTop / clientWidth * 100 + "vw";
$("top_menu_background").style.top = 3 - scrollTop / clientWidth * 100 + "vw";
$("top_menu").style.top = 3 - scrollTop / clientWidth * 100 + "vw";
}
//document.title=document.body.clientWidth;
if(scrollTop / clientWidth * 100 > 50){
$("top_button").style.display = "block";
}
else{
$("top_button").style.display = "none";
}
}
function highlight_brand(obj){
obj.className = "page-brand-item-on";
}
function dehighlight_brand(obj){
obj.className = "page-brand-item";
}
function do_big_interval(){
for(var key in news_to){
if(news_to[key] == 1){
do_show_news_detail(key);
}
else{
if(news_to[key] == -1){
do_hide_news_detail(key);
}
}
}
for(var key in csr_to){
if(csr_to[key] == 1){
do_show_csr_detail(key);
}
else{
if(csr_to[key] == -1){
do_hide_csr_detail(key);
}
}
}
for(var key in video_to){
if(video_to[key] == 1){
do_show_video_detail(key);
}
else{
if(video_to[key] == -1){
do_hide_video_detail(key);
}
}
}
for(var key in video_news_to){
if(video_news_to[key] == 1){
do_show_video_news_detail(key);
}
else{
if(video_news_to[key] == -1){
do_hide_video_news_detail(key);
}
}
}
big_interval = window.setTimeout("do_big_interval()", 10);
}
function draw_weibo(){
if($("weibo_container")){
if(phone_mod == 1){
$("weibo_container").style.display = "none";
}
else{
$("weibo_container").style.display = "block";
$("weibo_container").innerHTML = '';
var weibo_frame_width = $("weibo_frame").clientWidth;
var weibo_frame_height = $("weibo_frame").clientHeight;
$("weibo_frame").src = "http://widget.weibo.com/list/list.php?language=zh_cn&width=" + (weibo_frame_width - 2) + "&height=" + (weibo_frame_height - 2)+ "&listid=3958555063845768&appkey=2308579169&uname=%E6%9C%AA%E6%9D%A5%E8%9E%8D%E5%90%88&uid=1879143802&listname=%E8%A1%A3%E6%81%8B%E9%9B%86%E5%9B%A2&color=&showcreate=0&isborder=0&info=0&sidebar=0&footbar=1&skin=0&dpc=1";
}
}
}
function toggle_phone(){
if(document.body.clientWidth < 900){
phone_mod = 1;
}
else{
phone_mod = 0;
}
}
window.onresize = toggle_phone;