﻿//按钮图片切换
function mouseOverOut(sourceObj, picfile_over, picfile_out) {

    $('#' + sourceObj).mouseover(function () {
        //alert(getRootPath() + picfile_over);
        $('#' + sourceObj).attr("src", getRootPath() + picfile_over);
    }).mouseout(function () {
        //alert(getRootPath() + picfile_out);
        $('#' + sourceObj).attr("src", getRootPath() + picfile_out);
    })
}

//获取根部路
function getRootPath() {
    //此段代码保证开发环境效果
    if (window.top.location.host.substring(0, 9) == 'localhost')
        return window.top.location.protocol + "//" + window.top.location.host + "/xiuyuan/";
    if (window.top.location.host.substring(0, 8) == '192.168.')
        return window.top.location.protocol + "//" + window.top.location.host + "/xiuyuan/";
    else
        return window.top.location.protocol + "//" + window.top.location.host + "/";
}
