function callflash(flashurl,flashwidth,flashheight,flashwmode,flashversion){document.write('');}//normal version 8.0.24
function addfavorite(surl, stitle) {surl = encodeuri(surl); try{window.external.addfavorite(surl, stitle);}catch(e) {try{window.sidebar.addpanel(stitle, surl, "");}catch (e) {alert("加入收藏失败,请使用ctrl+d进行添加,或手动在浏览器里进行设置.");}}}
function sethome(url){if (document.all) {document.body.style.behavior='url(#default#homepage)';document.body.sethomepage(url);}else{alert("您好,您的浏览器不支持自动设置页面为首页功能,请您手动在浏览器里设置该页面为首页!");}}
function showlocale(objd){var str;var yy = objd.getyear();if(yy<1900) yy = yy+1900;var mm = objd.getmonth()+1;if(mm<10) mm = '0' + mm;var dd = objd.getdate();if(dd<10) dd = '0' + dd;var ww = objd.getday();if (ww==0) ww="星期日";if (ww==1) ww="星期一";if (ww==2) ww="星期二";if (ww==3) ww="星期三";if (ww==4) ww="星期四";if (ww==5) ww="星期五";if (ww==6) ww="星期六";str =yy + "年" + mm + "月" + dd + "日 " + ww;return(str);}
function thisday(){var today;today = new date();document.write('今天是:'+showlocale(today));}
function tabsv1(thisobj,num){if(thisobj.classname == "tabcurrent")return;var tabobj = thisobj.parentnode.id;var tablist = document.getelementbyid(tabobj).getelementsbytagname("li");for(i=0; i topmain){nav.addclass("webheaderscroll");}else{nav.removeclass("webheaderscroll");}});})
*/
$.fn.extend({
mymenu: function() {
$(this).children('ul').children('li').hover(
function() {
if(!$(this).children('ul').hasclass('focus')) {
$(this).addclass('focus');
$(this).children('ul:first').stop(true, true).fadein(500);
//$(this).children('ul:first').stop(true, true).animate({ height:'show' }, 'fast');
}
},
function() {
$(this).removeclass('focus');
$(this).children('ul:first').stop(true, true).stop(true, true).fadeout(500);
//$(this).children('ul:first').stop(true, true).animate({height:'hide', opacity:'hide'}, 'slow');
}
);
$(this).children('ul').children('li').children('ul').hover(
function() {
$(this).addclass('focus');
},
function() {
$(this).removeclass('focus');
}
);
}
});
/*
example:
#sitenav为导航区域的id
$(document).ready(function(){$('#sitenav').mymenu();});
*/
/*等比例缩放图片*/
function autoresizeimage(maxwidth,maxheight,objimg){
var img = new image();
img.src = objimg.src;
var hratio;
var wratio;
var ratio = 1;
var w = img.width;
var h = img.height;
wratio = maxwidth / w;
hratio = maxheight / h;
if (maxwidth ==0 && maxheight==0){
ratio = 1;
}else if (maxwidth==0){//
if (hratio<1) ratio = hratio;
}else if (maxheight==0){
if (wratio<1) ratio = wratio;
}else if (wratio<1 || hratio<1){
ratio = (wratio<=hratio?wratio:hratio);
}
if (ratio<1){
w = w * ratio;
h = h * ratio;
}
objimg.height = h;
objimg.width = w;
}
//缩略图
jquery.fn.loadimage=function(scaling,width,height,loadpic){
if(loadpic==null)loadpic="/temp/images/loading.gif";
return this.each(function(){
var t=$(this);
var src=$(this).attr("src")
var img=new image();
img.src=src;
//自动缩放图片
var autoscaling=function(){
if(scaling){
if(img.width>0 && img.height>0){
if(img.width/img.height>=width/height){
if(img.width>width){
t.width(width);
t.height((img.height*width)/img.width);
}else{
t.width(img.width);
t.height(img.height);
}
}
else{
if(img.height>height){
t.height(height);
t.width((img.width*height)/img.height);
}else{
t.width(img.width);
t.height(img.height);
}
}
}
}
}
//处理ff下会自动读取缓存图片
if(img.complete){
autoscaling();
return;
}
$(this).attr("src","");
var loading=$("");
t.hide();
t.after(loading);
$(img).load(function(){
autoscaling();
loading.remove();
t.attr("src",this.src);
t.show();
//$('.photo_prev a,.photo_next a').height($('#big-pic img').height());
});
});
}