﻿// JScript 文件

if(location.href.indexOf('?')>=0){
    var arr = location.href;
    arr = arr.split("?");
    
    arr = arr[1].split("-");
    
    if(arr[1]==null){
        document.getElementById("ifr").height='480';
        document.getElementById("ifr").src = 'http://0-1.me/flash/flash/flashpage.htm';
    }else if(arr[2]==null){  
        document.getElementById("ifr").src = 'menu'+arr[0]+'-'+arr[1]+'.htm';
    }else{
        document.getElementById("ifr").src = 'menu'+arr[0]+'-'+arr[1]+'/chanpin'+arr[2]+'.htm';
    }
    
}else if(location.href.indexOf("0-1.me")>=0){
    document.getElementById("ifr").src = "menu2-3.htm";
}else{
    document.getElementById("ifr").height=920;
    document.getElementById("ifr").src = 'first.htm';
} 


//计算iframe高度
function reinitIframe(){
    var iframe;
    if($.browser.msie){
        iframe = document.getElementById("ifr").contentWindow.document.documentElement.scrollHeight;
    }else{
        iframe = document.getElementById("ifr").contentDocument.body.scrollHeight;
    }    
    try{
    document.getElementById("ifr").height=iframe;
    }catch (ex){}
    
    window.scroll(0,0);
    resize();
}
//window.setInterval("reinitIframe()",200);
//计算菜单位置
function resize(){
    var devi = 0;
    if((document.body.scrollWidth-document.body.clientWidth)>0){
        devi = -7;
    }    
    
    document.getElementById("menu2").style.left = document.getElementById("top2").getBoundingClientRect().left + devi + "px";
    document.getElementById("menu2").style.top = parseInt(document.getElementById("top2").getBoundingClientRect().top) + 58 + "px";

    document.getElementById("menu3").style.left = document.getElementById("top3").getBoundingClientRect().left + devi + "px";
    document.getElementById("menu3").style.top = parseInt(document.getElementById("top3").getBoundingClientRect().top) + 58 + "px";

    document.getElementById("menu4").style.left = document.getElementById("top4").getBoundingClientRect().left + devi + "px";
    document.getElementById("menu4").style.top = parseInt(document.getElementById("top4").getBoundingClientRect().top) + 58 + "px";

    document.getElementById("menu5").style.left = document.getElementById("top5").getBoundingClientRect().left + devi + "px";
    document.getElementById("menu5").style.top = parseInt(document.getElementById("top5").getBoundingClientRect().top) + 58 + "px";
}

var img = new Image();
var images = new Array();
images[0] = "data/shouye/button1-2.png";
images[1] = "data/shouye/button2-2.png";
images[2] = "data/shouye/buttondise1.GIF";
images[3] = "data/shouye/buttondise2.GIF";
for(var i=0;i<=3;i++){
    img.src = images[i];
    //document.body.innerHTML=document.body.innerHTML+"<img src='"+img.src+"'/>";
}
        
window.onresize = function(){
    resize();
}

//hover
$("#topM").hover(function(){
    $(this).css({"background-image": "url(data/shouye/button1-2.png)"});
},function(){
    $(this).css({"background-image": "url(data/shouye/button1-1.png)"});    
});

$("#top2").hover(function(){
    $(this).css({"background-image": "url(data/shouye/button2-2.png)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/button2-1.png)"}); 
    $(this).css({"color": "#b4b4b4"});   
});

$("#top3").hover(function(){
    $(this).css({"background-image": "url(data/shouye/button2-2.png)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/button2-1.png)"});
    $(this).css({"color": "#b4b4b4"});       
});

$("#top4").hover(function(){
    $(this).css({"background-image": "url(data/shouye/button2-2.png)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/button2-1.png)"});
    $(this).css({"color": "#b4b4b4"});       
});

$("#top5").hover(function(){
    $(this).css({"background-image": "url(data/shouye/button2-2.png)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/button2-1.png)"}); 
    $(this).css({"color": "#b4b4b4"});      
});

$("div").mouseup(function(){
    $("div").hide();
});

$("#m21,#m22,#m23").hover(function(){
    $(this).css({"background-image": "url(data/shouye/buttondise2.GIF)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/buttondise1.GIF)"}); 
    $(this).css({"color": "#b4b4b4"});
});

$("#top2,#menu2").hover(function(){
    $("#menu2").show();
},function(){
    $("#menu2").hide();
});

$("#m31,#m32,#m33,#m34").hover(function(){
    $(this).css({"background-image": "url(data/shouye/buttondise2.GIF)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/buttondise1.GIF)"}); 
    $(this).css({"color": "#b4b4b4"});
});

$("#top3,#menu3").hover(function(){
    $("#menu3").show();
},function(){
    $("#menu3").hide();
});

$("#m41,#m42").hover(function(){
    $(this).css({"background-image": "url(data/shouye/buttondise2.GIF)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/buttondise1.GIF)"}); 
    $(this).css({"color": "#b4b4b4"});
});

$("#top4,#menu4").hover(function(){
    $("#menu4").show();
},function(){
    $("#menu4").hide();
});

$("#m51,#m52").hover(function(){
    $(this).css({"background-image": "url(data/shouye/buttondise2.GIF)"});
    $(this).css({"color": "black"});
},function(){
    $(this).css({"background-image": "url(data/shouye/buttondise1.GIF)"}); 
    $(this).css({"color": "#b4b4b4"});
});

$("#top5,#menu5").hover(function(){
    $("#menu5").show();
},function(){
    $("#menu5").hide();
});

$("p").hover(function(){
    $(this).css({"text-decoration":"underline"});
},function(){
    $(this).css({"text-decoration":"none"});
});
//click
$("#topM").click(function(){
    document.getElementById("ifr").src = "first.htm";
});

$("#m21").click(function(){
    document.getElementById("ifr").src = "menu2-1.htm";
});

$("#m22").click(function(){
    document.getElementById("ifr").src = "menu2-2.htm";
});

$("#m23").click(function(){
    //document.getElementById("ifr").src = "menu2-3.htm";
    window.open('http://movingmovie.net/01/','_blank');
});

$("#m31").click(function(){
    document.getElementById("ifr").src = "menu3-1.htm";
});

$("#m32").click(function(){
    document.getElementById("ifr").src = "menu3-2.htm";
});

$("#m33").click(function(){
    document.getElementById("ifr").src = "menu3-3.htm";
});

$("#m34").click(function(){
    document.getElementById("ifr").src = "menu3-4.htm";
});

$("#m41").click(function(){
    //document.getElementById("ifr").src = "menu4-1.htm";
    window.open('http://movingmovie.net/01/reg.htm','_blank');
});

$("#m42").click(function(){
    document.getElementById("ifr").src = "menu4-2.htm";
});

$("#m51").click(function(){
    //document.getElementById("ifr").src = "menu5-1.htm";
    window.open('http://movingmovie.net/c','_blank');
});

$("#m52").click(function(){
    //document.getElementById("ifr").src = "menu5-2.htm";
    window.open('http://movingmovie.net/u','_blank');
});
