/**20131206 zhousg*/
$(function(){
/**菜单变化*/
var rightbox_id = $(".rightbox .content").attr("id");
var name = $(".rightbox .content").attr("name");
$(".leftbox #"+rightbox_id).addClass("linlistli_on");
if(name != undefined){
$(".leftbox #"+rightbox_id).next(".son_menu").show();
$(".leftbox #"+name).addClass("son_menu_on");
}
$(".lnlist li a").each(function(){
if($(this).next(".son_menu").length>0){
$(this).click(function(){
if($(this).next(".son_menu").is(":hidden")){
$(".lnlist li a").each(function(){
$(this).removeClass("linlistli_on");
$(this).next(".son_menu").hide(300);
});
$(this).addClass("linlistli_on");
$(this).next(".son_menu").show(300);
}
});
}
});
/**头像加载失败*/
if($(".lnuser img").length>0){
$(".lnuser img").error(function(){
$(this).attr("src",ctx+"images/uimg_tx.png");
});
}
});
if(window.Life == null){
window.Life = {};
};
Life.UploadImageUtil = function(coverPic,input,btnStyle){
if(btnStyle == undefined)btnStyle = {};
if(btnStyle.id == undefined)btnStyle.id = "spanButtonPlaceHolder";
if(btnStyle.label == undefined)btnStyle.label = "";
if(btnStyle.bgIcon == undefined)btnStyle.bgIcon = "theme/img/addPic_.png";
if(btnStyle.width == undefined)btnStyle.width = "100px";
if(btnStyle.height == undefined)btnStyle.height = "60px";
if(btnStyle.padLeft == undefined)btnStyle.padLeft = 0;
if(btnStyle.padTop == undefined)btnStyle.padTop = 0;
var config = {
flash_url : ctx+"js/swfupload.swf",
upload_url: ctx+"ajax/upload.action",
//file_size_limit : "2MB",
file_size_limit : "100KB",
file_types : "*.jpg;*.png;*.gif",
file_types_description : "Images Files",
debug: false,
//upload button style
button_image_url: ctx+btnStyle.bgIcon,
button_width: btnStyle.width,
button_height: btnStyle.height,
button_placeholder_id: btnStyle.id,
button_text: ""+btnStyle.label+"",
button_text_style: ".theFont {color: #C17B3C; font-size: 12px;}",
button_text_left_padding: btnStyle.padLeft,
button_text_top_padding: btnStyle.padTop,
file_dialog_complete_handler : function(numFilesSelected, numFilesQueued,file){
this.startUpload();
if(file != 'undefined' && file != null && file == 0){
alert("您上传的图片不符合规则,请上传JPG/GIF/PNG格式的图片且每张图片大小不超过100K。");
}
},
upload_success_handler : function(file,serverData){
$(coverPic).html(" 图片加载中111...");
var data = $.parseJSON(serverData);
var img = new Image();
img.onload = function(){
var h = img.height;
var w = img.width;
var sale = 0.6;
var imgSale = h/w;
if(imgSale <= sale){
img.width=100;
img.height = (100/w)*h;
img.style.marginTop = (60-img.height )/2+"px";
}else{
img.height = 60;
img.width = (60/h)*w;
img.style.marginLeft = (100-img.width)/2+"px";
}
$(coverPic).empty();
$(coverPic).append(img);
$(input).val(data.savename);
$(input).focus();
$(input).blur();
};
img.src = getImageURL(data.savename);
}
}
return new SWFUpload(config);
};
/*商户上传图片*/
Life.ShopUploadImageUtil = function(coverPic,input,btnStyle){
if(btnStyle == undefined)btnStyle = {};
if(btnStyle.id == undefined)btnStyle.id = "spanButtonPlaceHolder";
if(btnStyle.label == undefined)btnStyle.label = "";
if(btnStyle.bgIcon == undefined)btnStyle.bgIcon = "theme/img/addPic_.png";
if(btnStyle.width == undefined)btnStyle.width = "100px";
if(btnStyle.height == undefined)btnStyle.height = "60px";
if(btnStyle.padLeft == undefined)btnStyle.padLeft = 0;
if(btnStyle.padTop == undefined)btnStyle.padTop = 0;
var config = {
flash_url : ctx+"js/swfupload.swf",
upload_url: ctx+"ajax/shopUploadLocal.action",
//file_size_limit : "2MB",
file_size_limit : "100KB",
file_types : "*.jpg;*.png;*.gif",
file_types_description : "Images Files",
debug: false,
//upload button style
button_image_url: ctx+btnStyle.bgIcon,
button_width: btnStyle.width,
button_height: btnStyle.height,
button_placeholder_id: btnStyle.id,
button_text: ""+btnStyle.label+"",
button_text_style: ".theFont {color: #C17B3C; font-size: 12px;}",
button_text_left_padding: btnStyle.padLeft,
button_text_top_padding: btnStyle.padTop,
file_dialog_complete_handler : function(numFilesSelected, numFilesQueued,file){
this.startUpload();
if(file != 'undefined' && file != null && file == 0){
alert("您上传的图片不符合规则,请上传JPG/GIF/PNG格式的图片且每张图片大小不超过100K。");
}
},
upload_success_handler : function(file,serverData){
$(coverPic).html(" 图片加载中111...");
var data = $.parseJSON(serverData);
var img = new Image();
img.onload = function(){
var h = img.height;
var w = img.width;
var sale = 0.6;
var imgSale = h/w;
if(imgSale <= sale){
img.width=100;
img.height = (100/w)*h;
img.style.marginTop = (60-img.height )/2+"px";
}else{
img.height = 60;
img.width = (60/h)*w;
img.style.marginLeft = (100-img.width)/2+"px";
}
$(coverPic).empty();
$(coverPic).append(img);
$(input).val(data.savename);
$(input).focus();
$(input).blur();
};
img.src = getImageURL(data.savename);
}
}
return new SWFUpload(config);
};