JQ = $;
JQ = jQuery.noConflict();
//DrawImage 用例：<Img src="ImageUrl" onload="javascrip:DrawImage(this,100,100)" />
var DrawImage = function (ImgD,iwidth,iheight){
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
        if(image.width/image.height>= iwidth/iheight){
            if(image.width>iwidth){
                ImgD.width=iwidth;
                ImgD.height=(image.height*iwidth)/image.width;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        }
        else{
            if(image.height>iheight){
                ImgD.height=iheight;
                ImgD.width=(image.width*iheight)/image.height;
            }else{
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
        }
    }
}
//一级下拉菜单实现
var initMenu = function () {
    var submenu = JQ('#menu > ul');
    if (submenu) {
        JQ(submenu).hover(
            function(){
                JQ(this).children(".submenu").slideToggle(300);
            },function(){
                JQ(this).children(".submenu").slideUp(300)
            })
    }
}
//网站里常用函数实现
var booweiApp = {
    nurl: function(url) {
        top.location.href = url;
    },
    alert: function(msg) {
        alert("\n"+msg+"\n");
    },
    //Flash调用
    FlashPanel:function(ur,w,h){
        document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="' + w + '" height="' + h + '">');
        document.write('<param name="movie" value="' + ur + '">');
        document.write('<param name="quality" value="high"> ');
        document.write('<param name="wmode" value="transparent"> ');
        document.write('<param name="menu" value="false"> ');
        document.write('<embed src="' + ur + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '" quality="High" wmode="transparent">');
        document.write('</embed>');
        document.write('</object>');
    }
}
//网站页面加载
JQ(document).ready(function(){
    initMenu();
    var maxLeftHeight = JQ("div.mainbox > div.left").height();
    var maxHeight = JQ("div.mainbox").height();
    if (maxHeight > maxLeftHeight){
        JQ(".mainbox > .left").height(maxHeight);
    }
    JQ('a').focus(function(){
        JQ(this).attr("hideFocus","false");
        JQ(this).css("outline","none");
    })
})
JQ(window).unload(function(){
    //alert("Bye now!");
});
