function onReady(){
	$('table.table_border1px tr:odd').addClass("box01");
	$('table.table_border1px tr').mouseover(function(){     
	$(this).addClass("box02");}).mouseout(function(){    
	$(this).removeClass("box02");})
	$('table.table_border1px tr:odd').mouseover(function(){     
	$(this).removeClass("box01");
	$(this).addClass("box02");}).mouseout(function(){    
	$(this).removeClass("box02");
	$(this).addClass("box01");})

	
// TOP管理中心下拉菜单	
  $('.drop_down_menu').mouseover(function(){
	 $(this).next("ul").slideDown("fast");
	 $(this).addClass("drop_down_menu_hover");
  });
  $('#top ul,.drop_down_menu').parent("div").bind("mouseleave",function(){
	 $(this).find("ul").slideUp("fast");
	 $(this).find("a").eq(0).removeClass("drop_down_menu_hover");
  });

// 空链接禁止跳头部
	$("a").each(function(){
		if($(this).attr("href")=="#")$(this).attr("href","javascript:;");
	});
						 
// 自动提示
	$(".inputTag").powerFloat({ eventType: "focus", targetMode: "ajax", targetAttr: "rel", position: "1-4" });
	$(".inputTitle").powerFloat({ eventType: "focus", targetMode: "remind", targetAttr: "title", position: "1-4" });


  inputTip();
  hightLightTag();
  liveHelpButton();
  liveUserInfo();
}
function liveUserInfo(){
	$(".client").each(function(){//客户信息代码提醒
  	 $(this).powerFloat({
		eventType: "hover",
		targetMode: "remind",
		targetAttr: "rel"
	 });
	 });
	$(".providers").each(function(){//服务商信息代码提醒
  	 $(this).powerFloat({
		eventType: "hover",
		targetMode: "remind",
		targetAttr: "rel"
	 });
	 });
};
function liveHelpButton(){ //鼠标hover/out 时显示或隐藏请求协助按钮
  $(".list_Business_01").mouseover(function(){
		$(this).find(".call").fadeIn("fast");
  });
  $(".list_Business_02 .photo,.list_Business_05 .photo").mouseover(function(){
		$(this).parent("div").find(".call").fadeIn("fast");
  });
  $(".list_Business_01,.list_Business_02,.list_Business_05").bind("mouseleave",function(){
		$(this).find(".call").fadeOut("fast");
  });
}
function inputTip(){ // 加灰输入框默认文本，点击后默认文本消失使用方法为input 加上class="inputTip" label="默认文本" 默认值=默认文本
  $(".inputTip").css("color","#AAA").focus(function(){
	  if($(this).val()==$(this).attr("label"))$(this).val("");
	  $(this).css("color","#000");
  }).blur(function(){
	if($(this).val()==""){
	  $(this).val($(this).attr("label"));
	  $(this).css("color","#AAA");
	 }
  });
}
function hightLightTag(){ // 加亮Tag 标签
	var offset=6;
	var num=4;
	$(".tag_zone a").each(function(){
		var rnd=Math.ceil((num+offset)*Math.random());
		if(rnd>offset)$(this).addClass("tag"+(rnd-offset));
	})
}
function radioCheck(radioArryobj){ 
	var s = '';                     		
	radioArryobj.each(function(){
		if(this.type=="radio" ){
			if(this.checked){
				s = this.value;                     		
			}
		}
	});
	if(s != ""){
		return s;
	}else return false;
}

function getClientInfo(){
  if(!$("#bb").length){$("body").append('<form id="bb" method="post" action="">'
										+'<div class="padding5px box_12">'
										+'<div class="padding10px center box_10" style="width:300px;">'
										+'  <div class="box_03 padding5px border_03 c28" id="pin_error"><input name="按钮2" type="button" class="icon_failed" value=" " /> 错误</div>'
										+'  <p>你是匿名用户，需要提供联系方式再连接服务商</p>'
										+'  <table border="0" align="center" cellspacing="10">'
										+'	<tr>'
										+'	  <td><input name="textfield" type="text" id="textfield" value="昵称" size="20" class="inputTip" label="昵称" /></td>'
										+'	  </tr>'
										+'	<tr>'
										+'	  <td><input name="textfield" type="text" id="textfield" value="Email或手机" size="20" class="inputTip" label="Email或手机" /></td>'
										+'	  </tr>'
										+'	<tr>'
										+'	  <td><input type="submit" class="button_01_01 cursorhand" value="连接" />'
										+'		<p class="padding_top10px"><a href="#">不想输入这个，去注册>></a></p></td>'
										+'	  </tr>'
										+'  </table>'
										+'</div></div>'
										+'</form>')};
	$(".button_bb_online,.bb").each(function(){
		if($(this).attr("rel")=="#bb"){
				$(this).powerFloat({
				target: $("#bb")
		 });
		}
	});
}
function copyToClipBoard(src){
    var clipBoardContent=$("#"+src)[0].value;
	window.clipboardData.setData("Text",clipBoardContent); 
    alert("复制成功,直接在地址栏粘贴即可");
}

/*
 *
 * 功能：图片自适应容器大小
 * 说明：本功能可以实现图片自适应图片容器(可有可无)的大小，
 *       并居中于容器中央
 * 使用：<img src="http://hiphotos.baidu.com/activezfj/pic/item/dd0da3ec8103303a63d09f64.jpeg"
 *                                    |                             onload="SetImg(this,        400,      400);" />
 *                                    ↓                                                      ↓          ↓          ↓
 * 参数：                    图片路径                                   要设置的对象 容器宽度 容器高度
 *
*/
function SetImg(ImgD,iwidth,iheight){
var imgH,imgW;
var image=new Image();
	image.src=ImgD.src;
     if(image.height/image.width>= iheight/iwidth){
      if(image.height>iheight){
       imgH=iheight;
       imgW=(image.width*iheight)/image.height;
      }else{
       imgW=image.width;
       imgH=image.height;
      }
     }

     else{
      if(image.width>iwidth){
       imgW=iwidth;
       imgH=(image.height*iwidth)/image.width;
      }else{
       imgW=image.width;
       imgH=image.height;
      }
     }
	 if(imgW&&imgH)
	 	$(ImgD).attr("style","width:"+imgW+"px;height:"+imgH+"px;");
	 else
	 	$(ImgD).attr("style","width:"+iwidth+"px;height:"+iheight+"px;");
}
	
/*function imgGroup(obj,W,H){
  $(obj+" img").each(function() {
	  SetImg(this,W,H);
  })
	$(obj+" a[rel=group]").colorbox().attr("style","width:"+W+"px;height:"+H*102/100+"px;*height:auto;*font-size:"+H+"px");
	$(obj+" td").attr("style","width:"+W+"px;height:"+H+"px;");
}*/
function imgResize(obj,W,H){//把一组图片限定在W,H范围内并水平垂直居中，obj=包含图片的对象名如“.pic”,其内容结构固定，参考实例。
  $(obj).find("img").each(function() {
	  SetImg(this,W,H);
  })
  $(obj).attr("style","display:table-cell;vertical-align:middle;text-align:center;width:"+W+"px;height:"+H+"px;*height:auto;font-size:"+H*80/100+"px");
}

 function expend(obj){//展开隐藏内容。obj包含.expend展开按钮，.expend_content隐藏的内容,其内容结构固定，参考实例。
$(obj+" .expend_content").hide();
$(obj+" .expend").live("click", function(){
		$(this).hide();
		$(obj+" .expend_content").slideDown("fast");
	});
 $(obj).hoverIntent({
    sensitivity:  3,
	interval: 50,   // number = milliseconds of polling interval
	over: function(){
	},
	timeout: 1000,   // number = milliseconds delay before onMouseOut function call
	out: function(){
		$(obj+" .expend_content").addClass("block").slideUp("fast");
		$(obj+" .expend_content").hide();
		$(obj+" .expend").show();
	}
 });
/*
  $(obj).hover(
	function(){
	}, function(){
		$(obj+" .expend_content").slideUp("fast");
		$(obj+" .expend").show();
	});
*/ }




//遮罩指定区域，并在遮罩层上显示指定html内容
//调用方式 $("#form1").MsgBox({delaedClose:5000,msg:"提示文本"}); 遮罩#form1并在其上显示"提示文本" 5秒钟。
//手动隐藏遮罩 $(document).trigger("hideMsgBox")
(function($) {
	$.fn.MsgBox = function(s) {
		s = $.extend({
			delayedClose: '0',
			msg         : '<div class="box_03 padding5px border_03 c28 size14" id="msg"><input type="button" class="icon_failed"/> 这是消息内容文本，msg参数是可以包含结构的html代码</div>'
		}, s || {});
		var MsgBoxClose=function() {
			$("#msg_box").fadeOut()
		};
		
		if(!$("#msg_box").length)$("body").append($('<div id="msg_box"><table cellpadding="10"><tr><td align="center" valign="middle"></td></tr></table></div>'));
		$("#msg_box td").html(s.msg);
		$("#msg_box").attr("style","top:"+this.offset().top+"px;left:"+this.offset().left+"px");
		$("#msg_box table").attr("style","width:"+this.width()+"px;height:"+this.height()+"px");
		$("#msg_box").bgiframe();
		if (s.delayedClose > 0) {
			closeOnDelay = setTimeout(MsgBoxClose, delayedClose);
    	}
		$(document).bind('hideMsgBox', function(e) {
			MsgBoxClose();
		});
		return this;
	};
})(jQuery);

(function($) {//此方法的功能为判定输入框的默认文本有无修改 调用方式为 $("#input_01").isModified();反回true(已修改)和false(未修改)
	$.fn.isModified = function() {
		return this.attr("label")==this.val() ? false:true;
	};
})(jQuery);


/**
 * 判断指定字符串是否合法的HTML源代码，不允许a、iframe、script、embed标签
 * @param str 字符串
 * @param shwoAlert 是否显示alert提示框
 * @return shwoAlert为true时以alert提示框方式提示错误返回true|false；否则将错误消息作为结果返回，无错误时返回null
 */
function legalHtmlSource(str, showAlert){
    if(showAlert == undefined){
        showAlert = false;
    }
    if(str!=undefined && str!=null && str!=""){
        str = str.toLowerCase();
        var msg = null;
        var illegalHtmlTags = ["a","iframe","script","object","embed"];
        for(var i=0;i<illegalHtmlTags.length;i++){
            if(str.indexOf("<"+illegalHtmlTags[i]+" ")>=0){
                var msg = "不允许使用 "+illegalHtmlTags[i].toUpperCase()+" 标签";
                if(showAlert){
                    alert(msg);
                    return false;
                }else{
                    return msg;
                }
            }
        }
    }
    return showAlert ? true : null;
}
