//document.write("<scr" + "ipt type=\"text/javascript\" src=/Js/JQuery22.js></scr" + "ipt>");
//if (document.domain == "zph.hxhr.com.cn") document.domain="hxhr.com.cn";

//选项卡切换
function tabMenu(obj, parObj, type, callback){
	var _obj = $(obj);
	var isRunFun = false;
	if (type == "click"){
		_obj.click(function(){
			changeClass(this, _obj, parObj);
			if ($.isFunction(callback) && parObj == "#main_topic") new callback(_obj.index(this)); isRunFun = true;
		}).mouseleave(function(){
			$(this).removeClass("mouseover");
		}).mouseover(function(){
			$(this).addClass("mouseover");
		});
	}else{
		_obj.mouseenter(function(){
			changeClass(this, _obj, parObj);
			if ($.isFunction(callback) && parObj == "#main_topic") new callback(_obj.index(this)); isRunFun = true;
		});
	}
	if ($.isFunction(callback) && !isRunFun) new callback;
	
	function changeClass(_this, _obj, parObj){
		if (_this.className == "selected") return;
		$(_this).addClass("selected").siblings().removeClass("selected");
		if (parObj != "") $(parObj + " .tabs-panel").eq(_obj.index(_this)).show().siblings(".tabs-panel").hide();
	}
}

//显示内容(报纸招聘，便民信息)[首页]
function disContentHtml(obj, act, id, key){
	$.ajax({
		url: "/Ads.ashx",
		//cache: false,
		data: {"act": act, "obj": obj, "id": id, "key": key},
		success: function(html){
			var _tmp = unescape(html).split("{$间隔符号}");
			$("#pop_title").html(_tmp[1]);
			$("#pop_content").html(_tmp[2]);
			$("#pop_contact").html(_tmp[3]);
			$("#pop_date").html(_tmp[4]);
		}
	});
}
//报纸招聘，便民信息（首页）内容框
function doAction(){
	$("#main_ads .tabs-panel a, #job ul.html a, #hot_job li.html a, #hotent li a").mouseover(function(){
		//event.stopPropagation();
		var offset = $(this).offset();
		$("#hx_hr_pop_log").css({top: offset.top + $(this).height(), left: offset.left});
		$("#hx_hr_pop_log").show();
	}).mouseout(function(){
		$("#hx_hr_pop_log").hide();
	})
}

function LoginCheck(){
	var uname = $("#username");
	if (uname.val() == "" || uname.val() == "请输入您的用户名"){
		alert("用户名不能为空");
		uname.focus();
		return false;
	}
	var upwd = $("#password");
	if (upwd.val() == "" || upwd.val() == "请输入您的密码"){
		alert("密码不能为空");
		upwd.focus();
		return false;
	}
}

function JobPop(){
	$(".newjob .list a, .newspaper .tabs-panel a").hover(function(e){
		var _this = $(this);
		var offset = _this.offset();
		$.ajax({
			url: "/Ads.ashx",
			dataType: "json",
			//cache: false,
			async: false,
			data: {"obj": _this.attr("obj"), "type": _this.attr("type"), "cid": _this.attr("cid") },
			success: function(json){
				if (json.status == "200"){
					$("#pop_title").html(json.title);
					$("#pop_content").html(unescape(json.content));
					$("#pop_contact").html(unescape(json.contact));
					$("#pop_date").html(json.date);
					//_this.mouseenter();
				}
			}
		});
		var mouseX = e.pageX + 10;
		var mouseY = e.pageY + 10;
		var obj = $("#jobpop");
		var objVixX = $(window).width() - (mouseX + obj.width());
		var objVixY = $(window).height() - (mouseY + obj.height());
		if (objVixX < 10) mouseX = e.pageX - obj.width() - 10;
		if (mouseX < 0) mouseX = 10;
		if (objVixY < 10) mouseY = e.pageY - obj.height();
		if (mouseY < 0) mouseY = 10;
		obj.css({ top: mouseY, left: mouseX});
		obj.show();
	}, function(){
		$("#jobpop").hide();
	})
}


//人物，名企，风尚，专栏
function topicContent(obj){
	$.ajax({
		url: "Ads.ashx",
		data: {"act": "topic", "obj": obj},
		beforeSend : function(){
			$("#topic_html").html("<li class='load'><img src='/Images/loading.gif' align='absmiddle' border='0' />&nbsp;正在加载中...</li>");},
		success: function(html){
			$("#topic_html").html(unescape(html));
		}
	})
}

$.fn.selectRange = function(start, end) {
    return this.each(function() {
        if (this.setSelectionRange) {
            this.focus();
            this.setSelectionRange(start, end);
        } else if (this.createTextRange) {
            var range = this.createTextRange();
            range.collapse(true);
            range.moveEnd('character', end);
            range.moveStart('character', start);
            range.select();
        }
    });
};


function QueryString(item){
	var sValue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
	return sValue ? sValue[1] : "";
}

function SearchClassJob(id, key){
	if (key != "") window.location.href = "/Class.aspx?id=" + id + "&key=" + escape(key);
}

//全选＆反选
function BindBtns() {
    $("#select_all").click(function() {
        $("input[name='Chk_ID']").attr("checked", $(this).attr("checked"));
    });
    $("#select_reverse").click(function() {
        $("input[name='Chk_ID']").each(function(idx, item) {
            $(item).attr("checked", !$(item).attr("checked"));
        });
    });
}

function Tips(obj, tips) {
    $(obj).hover(function() {
        tip = $(this).find(tips);
        tip.show();
    }, function() {
        tip = $(this).find(tips);
        tip.hide();
    }).mousemove(function(e) {
        tip = $(this).find(tips);
        var mouseX = e.pageX + 20;
        var mouseY = e.pageY + 20;
        var tipWidth = tip.width();
        var tipHeight = tip.height();
        var tipVisX = $(window).width() - (mouseX + tipWidth);
        var tipVisY = $(window).height() - (mouseY + tipHeight);
        if (tipVisX < 20)
            mouseX = e.pageX - tipWidth - 20;
		if (mouseX < 0 ) mouseX = 20;
        if (tipVisY < 20)
            mouseY = e.pageY - tipHeight - 20;
		if (mouseY < 0) mouseY = 20;
        tip.css({ top: mouseY, left: mouseX });
    });
}

$(document).ready(function(){
	//登录框提示
	$("#username").focus(function(){
		var obj = $(this);
		if (obj.val() == "请输入您的用户名") obj.val("").removeClass("ccc");
	}).blur(function(){
		var obj = $(this);
		if (obj.val() == "") obj.val("请输入您的用户名").addClass("ccc");
	})
	
	$("#password").focus(function(){
		var obj = $(this);
		if (obj.val() == "请输入您的密码") obj.val("").removeClass("ccc");
	}).blur(function(){
		var obj = $(this);
		if (obj.val() == "") obj.val("请输入您的密码").addClass("ccc");
	})//.keyup(function(){
		//setTimeout(function() { var objval=$("#pwd").val().split('');for(i=0;i<objval.length;i++){if(objval[i]!="●"){$("#password").val($("#password").val()+objval[i]);objval[i]="●"}};$("#pwd").val(new Array(objval.length+1).join("●")); }, 500);
//		var objval = $("#pwd").val().split('');
//		for(i = 0; i < objval.length; i++){
//			if (objval[i] != "●"){
//				$("#password").val($("#password").val() + objval[i]);
//				objval[i] = "●";
//			}
//		}
//		$("#pwd").val(new Array(objval.length+1).join("●"));
	//})

			
	//字号大小
	if ($("#fontSmall")[0]){
		$("#fontSmall").click(function(){
			$("#Cnt_Main p, #Cnt_Main div").css({"font-size":"12px","line-height":"22px"});
		});
		$("#fontBig").click(function(){
			$("#Cnt_Main p, #Cnt_Main div").css({"font-size":"14px","line-height":"25px"});
		})
	}
})

//顶/踩文章
function MsgArticle(_act,_id){
	$.ajax({
		url: "/Controls/BasicCommon.ashx",
		cache: false,
		data: ({"type":"article","act":_act,"val":_id}),
		success: function(msg){
			var obj = msg.split("|");
			if (parseInt(obj[0]) == 0 && parseInt(obj[1]) == 0){
				$("#topLine").css("width","1px");
				$("#treadLine").css("width","1px");
			}else{
				$("#topNum").text("(" + obj[0] + ")");
				$("#topLine").css("width",Math.ceil(110*parseInt(obj[0]) / (parseInt(obj[0]) + parseInt(obj[1]))) + "px");
				$("#topPer").text(((obj[0] * 100 / (parseInt(obj[0]) + parseInt(obj[1]))).toFixed(2) + "00").substring(0, 5) + "%");
				$("#treadNum").text("(" + obj[1] + ")");
				$("#treadLine").css("width",Math.floor(110 * parseInt(obj[1]) / (parseInt(obj[0]) + parseInt(obj[1]))) + "px");
				$("#treadPer").text(((parseInt(obj[1]) * 100 / (parseInt(obj[0]) + parseInt(obj[1]))).toFixed(2) + "00").substring(0, 5) + "%");
				if (obj[2] != "") alert(obj[2]);
			}
		}
	})
}

//复制到剪贴板
function copyToClipBoard(Text){
	window.clipboardData.setData("Text",Text);
	alert("复制成功");
}

//url参数
function getUrlQuery(obj){
	var sValue = location.search.match(new RegExp("[\?\&]" + obj + "=([^\&]*)(\&?)","i"));
	return sValue ? sValue[1] : sValue;
};


//弹窗
var JalertWin_Iframe_divLeft,JalertWin_Iframe_divTop,JalertWin_Iframe_isSumit;

var Jalert = new Object();

Jalert.Msg = function(str,times,bgcolor) {
    $(document).ready(function() {
		if (typeof times == "undefined") times = 3000;
		if (typeof bgcolor == "undefined") bgcolor = "#b8e1f5";
        var c = document.getElementsByTagName('body').item(0);
        if (document.getElementById('JalertWin_MsgBg')) {
            c.removeChild(document.getElementById('JalertWin_MsgBg'));
        }
        var b = document.createElement("div");
        b.setAttribute('id', 'JalertWin_MsgBg');
        b.style.cssText = 'background-color:' + bgcolor + ';position:absolute;top:0;left:0;width:100%;z-index:999;filter:Alpha(Opacity=10);opacity:0.1;height:' + $(document).height() + 'px;';
        c.appendChild(b);
		$("#JalertWin_MsgBg").fadeTo(0,"0");
		$("#JalertWin_MsgBg").fadeTo(300,"0.7");
        
        if (!document.getElementById('JalertWin_Msg')) {
            var b = document.createElement("div");
            b.setAttribute('id', 'JalertWin_Msg');
			b.style.cssText = 'padding:8px 20px;background-color:#fff;border:3px solid #014d71;position:absolute;z-index:99999;font-size:14px;color:#061f2c;';
            c.appendChild(b);
        }

        $("#JalertWin_Msg").html(str);
        var divLeft = document.documentElement.clientWidth / 2 - $("#JalertWin_Msg").width() / 2;
        var divTop = document.documentElement.clientHeight / 2 - $("#JalertWin_Msg").height() / 2 + document.documentElement.scrollTop;
        $("#JalertWin_Msg").css({ "left": divLeft, "top": divTop }).fadeTo(0,'100');

        window.setTimeout("$('#JalertWin_MsgBg').fadeTo(300,'0').slideUp();$('#JalertWin_Msg').fadeTo(300,'0').slideUp()", times);
    });
}

//对象提示层
Jalert.Img = function(obj, bg) {
    $(document).ready(function() {
		var c = document.getElementsByTagName('body').item(0);
        if (bg == 1) {
            if (document.getElementById('JalertWin_Bg')) {
                c.removeChild(document.getElementById('JalertWin_Bg'))
            }
            var b = document.createElement("div");
            b.setAttribute('id', 'JalertWin_Bg');
            b.style.cssText = 'background-color:#b8e1f5;position:absolute;top:0;left:0;width:100%;z-index:999;filter:Alpha(Opacity=30);opacity:0.3;height:' + $(document).height() + 'px;';
            c.appendChild(b);
        }
		//框架外层阴影层
		if (document.getElementById('JalertWin_Content_Bg')) {
            c.removeChild(document.getElementById('JalertWin_Content_Bg'))
        }
		
		var b = document.createElement("div");
		b.setAttribute('id', 'JalertWin_Content_Bg');
		b.style.cssText = 'position:absolute;z-index:9998;background-color:#b8d6e4;';
		c.appendChild(b);
			
        var picwidth = $("" + obj + "").eq(0).width();
        if ((picwidth > picheight) && (picwidth > document.documentElement.clientWidth)) {
            picwidth = document.documentElement.clientWidth * 0.9;
            $("" + obj + "").eq(0).find("img").css({ "width": picwidth + "px" });
        }
        var picheight = $("" + obj + "").eq(0).height();
        if ((picheight > document.documentElement.clientHeight)) {
            picheight = document.documentElement.clientHeight * 0.9;
            $("" + obj + "").eq(0).find("img").css({ "height": picheight + "px" });
        }

        var divTop = $("" + obj + "").height() - 50;
        $("" + obj + "").eq(0).find("div#txtcont").remove();
        $("" + obj + "").eq(0).append("<div style='background-color:#000;position:absolute;filter:Alpha(Opacity=30);opacity:0.3;top:" + divTop + "px;left:2px;width:" + $("" + obj + "").width() + "px;height:35px;position:absolute;float:left;'></div><div id='txtcont' style='position:absolute;height:35px;line-height:35px;text-align:center;'><a href='javascript:;' style='color:#fff;font-size:14px;' onclick=\"Jalert.Show.Close('" + obj + "')\">" + $("" + obj + "").eq(0).find("img").attr("alt") + " [点击关闭]</a></div>");
        $("" + obj + "").eq(0).find("div#txtcont").css({ "width": $("" + obj + "").width() + "px", "top": divTop + "px", "left": 0 });
        var divLeft = document.documentElement.clientWidth / 2 - $("" + obj + "").width() / 2;
        var divTop = document.documentElement.clientHeight / 2 - $("" + obj + "").height() / 2 + document.documentElement.scrollTop;
        $("" + obj + "").animate({ "left": divLeft, "top": divTop }).show("fast");
		$("#JalertWin_Content_Bg").animate({ "left": divLeft+5, "top": divTop+5, "width":$("" + obj + "").width()+14, "height":$("" + obj + "").height()+14 }).show("fast");
    });
}

//对象提示层
Jalert.Show = function(obj, ts, bg) {
    $(document).ready(function() {
        if (bg == 1) {
            var c = document.getElementsByTagName('body').item(0);
            if (document.getElementById('JalertWin_Bg')) {
                c.removeChild(document.getElementById('JalertWin_Bg'))
            }
            var b = document.createElement("div");
            b.setAttribute('id', 'JalertWin_Bg');
            b.style.cssText = 'background-color:#b8e1f5;position:absolute;top:0;left:0;width:100%;z-index:999;filter:Alpha(Opacity=30);opacity:0.3;height:' + $(document).height() + 'px;';
            c.appendChild(b);
	  		$("#JalertWin_Bg").fadeTo(0,"0");
	  		$("#JalertWin_Bg").fadeTo(300,"0.7");
	    }
	
        var divLeft = document.documentElement.clientWidth / 2 - $("" + obj + "").width() / 2;
        var divTop = document.documentElement.clientHeight / 2 - $("" + obj + "").height() / 2 + document.documentElement.scrollTop;
        $("" + obj + "").css({ "left": divLeft, "top": divTop }).slideDown(200);

        //		$(window).bind("scroll",function(){
        //			var divScrollTop = document.documentElement.scrollTop + divTop;
        //			var divScrollLeft = divLeft - document.documentElement.scrollLeft/2;
        //			$("" + obj + "").animate({top: divScrollTop + "px",left: divScrollLeft + "px"},10);
        //		});
        //		
        //if(ts>0) window.setTimeout("Jalert.Show.Close('" + obj + "')",1000*ts);
    });
}
Jalert.Show.Close = function(obj){
	$("" + obj + "").slideUp(100);
	$('#JalertWin_Bg').hide(10);
	$("#JalertWin_Content_Bg").slideUp(100);
}

//操作提示层
Jalert.Win = function(_url,w,h){
    $(document).ready(function() {
        //背景层
        var c = document.getElementsByTagName('body').item(0);
        if (document.getElementById('JalertWin_Bg')) {
            c.removeChild(document.getElementById('JalertWin_Bg'))
        }
        var b = document.createElement("div");
        b.setAttribute('id', 'JalertWin_Bg');
		b.style.cssText = 'background-color:#b8e1f5;position:absolute;top:0;left:0;width:100%;z-index:999;filter:Alpha(Opacity=30);opacity:0.3;height:' + $(document).height() + 'px;';
        c.appendChild(b);
		$("#JalertWin_Bg").fadeTo(0,"0");
		$("#JalertWin_Bg").fadeTo(300,"0.7");
        
	    if(!w) w=100;
		if(!h) h=50;
		//框架外层阴影层
		if (document.getElementById('JalertWin_Iframe_Content_Bg')) {
            c.removeChild(document.getElementById('JalertWin_Iframe_Content_Bg'))
        }
		var d = document.createElement("div");
		d.setAttribute('id', 'JalertWin_Iframe_Content_Bg');
		c.appendChild(d);
		//框架外层
		if (document.getElementById('JalertWin_Iframe_Content')) {
            c.removeChild(document.getElementById('JalertWin_Iframe_Content'))
        }
		var d = document.createElement("div");
		d.setAttribute('id', 'JalertWin_Iframe_Content');
		c.appendChild(d);
		
		if(_url.indexOf('?')>0)
		    _url = _url + "&" + Math.random();
	    else
		    _url = _url + "?" + Math.random();
		//框架
		var WinContent = '<ul id="JalertWin_Iframe_Cose"><li>正在加载...</li>'
			+ '<li><a href="#" style="color:#fff" onclick="Jalert.Close();return false;">关闭</a></li>'
			+ '</ul>';
		WinContent += '<div id="JalertWin_IframeDiv"><iframe id="JalertWinIframe" name="JalertWinIframe" scrolling="no" src="' + _url + '" frameborder="0" onload="Jalert.Win.ResetSize()"></iframe></div>';
		
		$("#JalertWin_Iframe_Content").html(WinContent);
		$("#JalertWin_Iframe_Content").hide();
		
		var headheight=30;
		JalertWin_Iframe_divLeft =  document.documentElement.clientWidth/2 - (w)/2;
		JalertWin_Iframe_divTop =  document.documentElement.clientHeight/2 - (h+headheight+5)/2 + document.documentElement.scrollTop;
		$("#JalertWin_Iframe_Content_Bg").attr('style', 'position:absolute;z-index:9998;background-color:#b8d6e4;width:' + w + 'px;height:' + h + 'px;left:' + JalertWin_Iframe_divLeft + 'px;top:' + JalertWin_Iframe_divTop + 'px');
		$("#JalertWin_Iframe_Content").attr('style', 'position:absolute;z-index:9999;width:' + w + 'px;height:' + h + 'px;left:' + JalertWin_Iframe_divLeft + 'px;top:' + JalertWin_Iframe_divTop + 'px');
		$("#JalertWin_IframeDiv").attr('style','background-color:#fff;border:5px solid #014d71;border-top:0;overflow:hidden;');
		$("#JalertWin_Iframe_Cose").attr('style','background-color:#014d71;color:#fff;height:'+headheight+'px;line-height:'+headheight+'px;padding:0 5px;');
		$("#JalertWin_Iframe_Cose li").eq(0).attr('style', 'float:left;color:#fff;');
		$("#JalertWin_Iframe_Cose li").eq(1).attr('style', 'float:right;');
		JalertWin_Iframe_isSumit=false;
	});
	return;
}
Jalert.Win.ResetSize = function() {
    if (JalertWin_Iframe_isSumit == false) {
        var ifr = window.frames["JalertWinIframe"];
        var fobj = ifr.document.body;
        if (fobj) {
            var headheight = 30;
			var w = 0;
			if (parseInt(jQuery.browser.version) > 6)
            	w = ifr.document.documentElement.scrollWidth;
			else
				w = $(fobj).width();
            //var h = ifr.document.documentElement.scrollHeight;
            var h = $(fobj).height();
            JalertWin_Iframe_divLeft = document.documentElement.clientWidth / 2 - (w) / 2;
			if ((h + headheight + 5) > document.documentElement.clientHeight)
				JalertWin_Iframe_divTop = 5;
			else
	            JalertWin_Iframe_divTop = document.documentElement.clientHeight / 2 - (h + headheight + 5) / 2 + document.documentElement.scrollTop;
            $("#JalertWin_IframeDiv").show("fast");
            $("#JalertWin_Iframe_Content_Bg").stop().animate({ width: (w + 11) + 'px', height: (h + headheight + 5) + 'px', top: (JalertWin_Iframe_divTop + 5) + 'px', left: (JalertWin_Iframe_divLeft + 4) + 'px' }, 200).show("fast");
            $("#JalertWin_Iframe_Content").stop().animate({ width: (w + 10) + 'px', height: h + 'px', top: JalertWin_Iframe_divTop + 'px', left: JalertWin_Iframe_divLeft + 'px' }, 200).show("fast");
            $("#JalertWinIframe").stop().animate({ width: w + 'px', height: h + 'px' }, 500).slideDown("fast");
            $("#JalertWin_Iframe_Cose li").eq(0).html(ifr.document.title);
            //alert(JalertWin_Iframe_isSumit);
            JalertWin_Iframe_isSumit = true;
        } else {
            setTimeout("Jalert.Win.ResetSize()", 1000);
        }
    }
}
Jalert.Close = function(){
    $("#JalertWin_Bg").slideUp(100);
	$("#JalertWin_Iframe_Content_Bg").slideUp(200);
    $("#JalertWin_Iframe_Content").slideUp(200);
	//JalertWin_Iframe_isSumit=false;
	//return false;
}
//























