<!--
$(function(){
	 $(".imgw149h82").LoadImage(true,149,82,false);
	 //去除a虚线框 如：首页 促销产品 数字js分页
	 $('.tab .taba a').bind('focus',function(){ if(this.blur){ this.blur(); }; });
	 showhide('.tab', '.taba li', '.tabc .c', 'curr', 'mouseover');
});

//整站选项卡函数 t选项卡盒子标签 a事件标签 c内容标签 l当前选项卡a的class s绑定事件
function showhide(t, a, c, l, s){
	$(t).each(function(){
		var tab = $(this);
		$(this).find(a).bind(s,function(i){
			if(!$(this).hasClass(l)){
				tab.find(a).removeClass(l);
				$(this).addClass(l);
				tab.find(c).hide();
				tab.find(c+':eq(' + tab.find(a).index(this) + ')').show();
			}
		})
	});
}

// 文本框文本域提示文字的自动显示与隐藏
(function($) {
  $.fn.textRemindAuto = function(options) {
    options = options || {};
    var defaults = {
      blurColor: "#999",
      focusColor: "#000",
      auto: true,
      chgClass: ""
    };
    var settings = $.extend(defaults, options);
    $(this).each(function() {
      if (defaults.auto) {
        $(this).css("color", settings.blurColor);
      }
      var v = $.trim($(this).val());
      if (v) {
        $(this).focus(function() {
          if ($.trim($(this).val()) === v) {
            $(this).val("");
          }
          $(this).css("color", settings.focusColor);
          if (settings.chgClass) {
            $(this).toggleClass(settings.chgClass);
          }
        }).blur(function() {
          if ($.trim($(this).val()) === "") {
            $(this).val(v);
          }
          $(this).css("color", settings.blurColor);
          if (settings.chgClass) {
            $(this).toggleClass(settings.chgClass);
          }
        });
      }
    });
  };
})(jQuery);

/*图片预加载 等比例缩放 插件**********************/ 
jQuery.fn.LoadImage=function(scaling,width,height,loadpic){ 
	if(loadpic==null) loadpic="static/images/imgload.gif";
	return this.each(function(){
		var t=$(this); 
		var src=$(this).attr("src") 
		var img=new Image(); 
		//alert("Loading") 
		img.src=src; 
		//自动缩放图片 
		var autoScaling=function(){ 
			if(scaling){ 
				if(img.width>0 && img.height>0){ 
					if(width<=0){
						if(height<img.height){
							t.height(height);
							t.width((img.width/img.height)*height);
						}
						else{
							t.height(img.height);
							t.width(img.width);
						}
					}
					else if(height<=0){
						if(width<img.width){
							t.width(width);
							t.height((img.height/img.width)*width); 
						}
						else{
							t.height(img.height);
							t.width(img.width);
						}
					}
					else 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); 
						} 
					} 
				} 
			} 
			else{
				t.width(width);
				t.height(height);	
			}
		} 
		//处理ff下会自动读取缓存图片 
		if(img.complete){ 
			//alert("getToCache!"); 
			autoScaling(); 
			return; 
		} 
		$(this).attr("src",""); 
		var loading=$("<img alt=\"加载中\" title=\"图片加载中\" src=\""+loadpic+"\" />"); 
		
		t.hide(); 
		//t.after(loading); 
		$(img).load(function(){ 
			autoScaling(); 
			loading.remove(); 
			t.attr("src",this.src); 
			t.show(); 
			//alert("finally!") 
		}); 
	
	}); 
} 

//长度判断
function checkByteLength(str,minlen,maxlen) {
	if (str == null) return false;
	var l = str.length;
	var blen = 0;
	for(i=0; i<l; i++) {
		if ((str.charCodeAt(i) & 0xff00) != 0) {
			blen ++;
		}
		blen ++;
	}
	if (blen > maxlen || blen < minlen) {
		return false;
	}
	return true;
}

/**==================================设为首页与加入收藏夹js================================**/

//监听网页的单击事件，主要监听设为首页与加入书签标签
document.onclick = function(e)
{
  var target = e ? e.target : window.event.srcElement;
  while (target && !/^(a|body)$/i.test(target.nodeName))
  {
    target = target.parentNode;
  }
  if (target && target.getAttribute('rel'))
  {
  	if (target.rel == 'external'){
	    var external = window.open(target.href);
	    return external.closed;
    } else if (target.rel == 'setAsHomepage'){
    	setAsHomepage(target,target.href);
    	return false;
    } else if (target.rel == 'addToBookmark'){
    	addToBookmark(target.title,target.href,"");
    	return false;
    }
  }
}
//设为首页
//<a href="" class="SetAsHomepage" rel="setAsHomepage">设为首页</a>
function setAsHomepage(element,Url)
{
	try
	{
		element.style.behavior='url(#default#homepage)';element.setHomePage(Url);
	}
	catch(e){
		if(window.netscape)
		{
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}  
			catch (e) 
			{ 
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'"); 
				return false;  
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage',Url);
		}
	}
}
//加入收藏夹
//<a href="" title="" class="AddToBookmark" rel="addToBookmark">加入书签</a>
function addToBookmark(WebsiteName,Url,Description)   
{
	if (window.sidebar) {  
		window.sidebar.addPanel(WebsiteName,Url,Description); //Mozilla browser  
	} else if( document.all ) { //IE browser  
		window.external.AddFavorite(Url, WebsiteName);   
	} else if( window.opera && window.print ) { //Not Support Now  
		return true;  
	}  
}
-->
