﻿// JavaScript Document

var $j = jQuery.noConflict();
$j(document).ready(function() {
	//input cleartxt
	$j(".inputqk input").focus(function(){
			$j(this).css({"background-color":"#e1eef7"})
			if($j(this).val() ==this.defaultValue){  
                  $j(this).val("");           
			  } 
		}).blur(function(){
			$j(this).css({"background-color":"#fff"})
			if ($j(this).val() == '') {
                $j(this).val(this.defaultValue);
             }
		});
	//input cleartxt END
	
	//index search input
	$j(".ind_search input").focus(function(){
			if($j(this).val() ==this.defaultValue){  
                  $j(this).val("");           
			  } 
		}).blur(function(){
			if ($j(this).val() == '') {
                $j(this).val(this.defaultValue);
             }
		});
	//index search input END
	
	
	
	/*label
	 *id设置：
	 *标签栏 bt<组>_<编号>_<样式编号>
	 *内容栏 b<组>_<编号>
	 */
	$j(".labelbt").mouseover(function(){
		var this_tg = $j(this);
		t = setTimeout(function(){
			showlabel(this_tg);
		},400)	//设置延时时间 1000=1秒
		function showlabel(actlabel){
		var getid = $j(actlabel).attr("id");
		var nowIdArr = new Array();
		var nowIdArr = getid.split("_"); 		
		for (j=1;j<=20;j++){
        if ($j("#b"+nowIdArr[1]+"_"+[j]).length>0){
            var total=j;}}
		for(var i=1;i<=total;i++){
			if(i==nowIdArr[2]){
				$j(actlabel)[0].className='bq' + nowIdArr[3] + '_' + 1 ;
				$j("#b"+nowIdArr[1]+"_"+[i]).animate({opacity:'show'}, 800); }
			else{
				$j("#b"+nowIdArr[1]+"_"+[i]).hide();
				$j("#bt_"+nowIdArr[1]+"_"+[i]+"_"+nowIdArr[3]).attr('class','bq'+nowIdArr[3]+'_'+2);
			}}}
	}).mouseout(function(){clearTimeout(t);});//label END
});


//list auto pic size
(function($j){
    $j.fn.zoom = function(settings){
                settings = $j.extend({
					width:0,
                    height:0,
                    loading:"http://www.3mrw.com/images/public/no_photo_1.jpg"
                    },settings);
                var images = this;
                $j(images).hide();
                var loadding = new Image();
                loadding.className="loadding"
                loadding.src = settings.loading;
                $j(images).after(loadding);    
                var preLoad = function($jthis){
                    var img = new Image();
                    img.src = $jthis.src;
                    if (img.complete) {
                        processImg.call($jthis);
                        return;}
                    img.onload = function(){
                        processImg.call($jthis);
                        img.onload=function(){};} 
                }
                function processImg(){
                        //var m = this.height/settings.height;
                        //var n = this.width / settings.width;
						var m = this.width/this.height;
						var n = settings.width/settings.height;
						var oldHeight = this.height;
						var oldWidth = this.width;
                        if(m<=n){
							var newHeight = this.height > settings.height ? settings.height : this.height;
                            this.height = newHeight;
							this.width = parseInt((this.width*newHeight)/oldHeight);}
                        else{
							var newWidth = this.width > settings.width ? settings.width : this.width;
                            this.width = newWidth;
							this.height = parseInt((this.height*newWidth)/oldWidth);}
						if (this.height<settings.height){
							var marTop = parseInt((settings.height-this.height)/2);
							$j(this).css("margin-top",marTop);}
                        $j(this).next(".loadding").remove();
                        $j(this).show();
                }
                return $j(images).each(function(){
                    preLoad(this);
                });
        }
})(jQuery);
function autoImgSize(setwidth,setheight){
	$j(function(){$j(".pic_con_size img").zoom({width:setwidth,height:setheight});})
}
//list auto pic size END

