﻿(function($) {
	$(page_load);
})(jQuery);

function page_load(){
	$('#cdqssmainnav a').attr('target', '_blank');
	$('input.text, .file').each(function(){
		$(this).bind('focus', function(){
			this.select();
			$(this).addClass('focus');
			$(this).attr('isfocus', 'true');
		});
		$(this).bind('blur', function(){
			$(this).removeClass('focus');
			$(this).attr('isfocus', 'false');
		});
	});
	if(jQuery.fn.combobox){
		$("select.select").combobox();
	}
	document.onkeyup = function(event){
		var e = window.event || event;
		if(e.keyCode == 27){
			JobSelector.hideall();
		}
	}
}

/*
 * 选择器
 */
var JobSelector = {
	// 说明: 选择器同一时间只能显示一个窗口, 只有一个遮罩层实例
	// 遮罩层句柄放在这里
	overlay: null,
	// 页面滚动状态
	overflowstatus: '',
	// 所有窗口的句柄存在这里
	wnd: [],
	// 模块数据存在这里
	data: {
		'jobfunc': {
			prevobj: null,
			items: []
		},
		'jobindustry': {
			prevobj: null,
			items: []
		},
		'jobarea':{
			prevobj: null,
			items: []
		},
		'jobautoreply':{
		}
	},
	// 功能: 所有用到的函数都存放在这里
	func: {
		// 职位模块
		'jobfunc':{
			// 显示三级列表
			'showsub': function(obj){
				var prevobj = JobSelector.data.jobfunc.prevobj;
				if(prevobj && prevobj !== obj){
					prevobj.hide();
				}
				var subitem = $(obj).children('.sub');
				subitem.show();
				$(obj).each(function(){
					JobSelector.outside(this, function(){subitem.hide();});
				});
				JobSelector.data.jobfunc.prevobj = subitem;
			},
			'checkid': function(objid){
				this.wnd['jobfunc'].find('#jf' + objid).trigger('click');
			},
			// 选中当前项
			'check': function(obj){
				$(obj).each(function(){
					// 如果当前选项未被禁用
					if(!this.disabled){
						$(obj).parent().parent().find('.all').each(function(){
							if(this.checked){
								this.checked = false;
								JobSelector.func.jobfunc.remove(this);
							}
						});
						if(this.checked){
							//this.checked = false;
							JobSelector.func.jobfunc.add(this);
						}else{
							//this.checked = true;
							JobSelector.func.jobfunc.remove(this);
						}
					}else{
						$(obj).parent().find('.all').each(function(){
							if(this.checked){
								JobSelector.func.jobfunc.add(this);
							}
						});
						//$(obj).parent().find('.one').attr('disabled', false);
						//this.checked = true;
						JobSelector.func.jobfunc.remove(this);
					}
				});
				JobSelector.func.jobfunc.refresh();
			},
			'reset': function(){
				this.data.jobfunc.items = [];
				this.data.jobfunc.prevobj = null;
				$('#jobfunctable input').attr('checked', false);
				$('#jobfunctable .resultlist').html('&nbsp;');
			},
			'uncheck': function(id){
				this.wnd['jobfunc'].find('#jf' + id).trigger('click');
			},
			// 选中二级项
			'checkone': function(obj){
				$(obj).each(function(){
					if(!this.checked){
						if(JobSelector.func.jobfunc.remove(this)){
							$(obj).parent().parent().find('.one').attr('checked', false);
						}
					}else{
						$(obj).parent().parent().find('.one').each(function(){
							if(this.checked){
								this.checked = false;
								JobSelector.func.jobfunc.remove(this);
							}
							//this.disabled = true;
						});
						//this.checked = true;
						JobSelector.func.jobfunc.add(this);
					}
				});
				JobSelector.func.jobfunc.refresh();
			},
			'add': function(info){
				if(JobSelector.data.jobfunc.items.length >= JobSelector.data.jobfunc.callback.selectmax){
					info.checked = false;
					$('#jobfunctable .infotip').html(JobSelector.data.jobfunc.callback.selectmaxmsg[JobSelector.data.jobfunc.lang]);
					$('#jobfunctable .infotip').css('background-color', '#ffc');
					return false;
				}else{
					$('#jobfunctable .infotip').html('&nbsp;');
					$('#jobfunctable .infotip').css('background-color', '');
					JobSelector.data.jobfunc.items.push({id:info.value, title:info.title});
					return true;
				}
			},
			'remove': function(info){
				var isfound = false;
				$('#jobfunctable .infotip').html('&nbsp;');
				$('#jobfunctable .infotip').css('background-color', '');
				for(var n=0; n<JobSelector.data.jobfunc.items.length; n++){
					if(JobSelector.data.jobfunc.items[n].id == info.value){
						JobSelector.data.jobfunc.items.splice(n, 1);
						isfound = true;
						break;
					}
				}
				if(isfound){
					return true;
				}else{
					return false;
				}
			},
			'refresh': function(){
				var resultlist = $('#jobfunctable .resultlist');
				var html = '';
				for(var n=0; n<JobSelector.data.jobfunc.items.length; n++){
					var obj = JobSelector.data.jobfunc.items[n];
					html += '<a href="#" onclick="JobSelector.callfunc(\'jobfunc\', \'uncheck\', ' + obj.id + '); return false;"><input type="checkbox" class="check" checked="true" value="' + obj.id + '" />' + obj.title + '</a>';
				}
				html += '&nbsp;';
				resultlist.html(html);
			}
		},
		// 行业模块
		'jobindustry':{
			'reset': function(){
				this.data.jobindustry.items = [];
				this.data.jobindustry.prevobj = null;
				$('#jobindustrytable input').attr('checked', false);
				$('#jobindustrytable .resultlist').html('&nbsp;');
			},
			'check': function(obj){
				$(obj).each(function(){
					if(this.checked){
						JobSelector.func.jobindustry.add(this);
					}else{
						JobSelector.func.jobindustry.remove(this);
					}
				});
				JobSelector.func.jobindustry.refresh();
			},
			'uncheck': function(id){
				$('#ji' + id).trigger('click');
			},
			'add': function(info){
				if(JobSelector.data.jobindustry.items.length >= JobSelector.data.jobindustry.callback.selectmax){
					info.checked = false;
					$('#jobindustrytable .infotip').html(JobSelector.data.jobindustry.callback.selectmaxmsg[JobSelector.data.jobindustry.lang]);
					$('#jobindustrytable .infotip').css('background-color', '#ffc');
					return false;
				}else{
					$('#jobindustrytable .infotip').html('&nbsp;');
					$('#jobindustrytable .infotip').css('background-color', '');
					JobSelector.data.jobindustry.items.push({id:info.value, title:info.title});
					return true;
				}
			},
			'remove': function(info){
				var isfound = false;
				$('#jobindustrytable .infotip').html('&nbsp;');
				$('#jobindustrytable .infotip').css('background-color', '');
				for(var n=0; n<JobSelector.data.jobindustry.items.length; n++){
					if(JobSelector.data.jobindustry.items[n].id == info.value){
						JobSelector.data.jobindustry.items.splice(n, 1);
						isfound = true;
						break;
					}
				}
				if(isfound){
					return true;
				}else{
					return false;
				}
			},
			'checkid': function(objid){
				$('#ji' + objid).trigger('click');
			},
			'refresh': function(){
				var resultlist = $('#jobindustrytable .resultlist');
				var html = '';
				for(var n=0; n<JobSelector.data.jobindustry.items.length; n++){
					var obj = JobSelector.data.jobindustry.items[n];
					html += '<a href="#" onclick="JobSelector.callfunc(\'jobindustry\', \'uncheck\', ' + obj.id + '); return false;"><input type="checkbox" class="check" checked="true" value="' + obj.id + '" />' + obj.title + '</a>';
				}
				html += '&nbsp;';
				resultlist.html(html);
			}
		},
		'jobarea':{
			'check': function(obj){
				$(obj).each(function(){
					if(this.checked){
						JobSelector.func.jobarea.add(this);
					}else{
						JobSelector.func.jobarea.remove(this);
					}
				});
				JobSelector.func.jobarea.refresh();
			},
			'add': function(info){
				if(JobSelector.data.jobarea.items.length >= JobSelector.data.jobarea.callback.selectmax){
					info.checked = false;
					$('#jobareatable .infotip').html(JobSelector.data.jobarea.callback.selectmaxmsg[JobSelector.data.jobarea.lang]);
					$('#jobareatable .infotip').css('background-color', '#ffc');
					return false;
				}else{
					$('#jobareatable .infotip').html('&nbsp;');
					$('#jobareatable .infotip').css('background-color', '');
					JobSelector.data.jobarea.items.push({id:info.value, title:info.title});
					return true;
				}
			},
			'remove': function(info){
				var isfound = false;
				$('#jobareatable .infotip').html('&nbsp;');
				$('#jobareatable .infotip').css('background-color', '');
				for(var n=0; n<JobSelector.data.jobarea.items.length; n++){
					if(JobSelector.data.jobarea.items[n].id == info.value){
						JobSelector.data.jobarea.items.splice(n, 1);
						isfound = true;
						break;
					}
				}
				if(isfound){
					return true;
				}else{
					return false;
				}
			},
			'reset': function(){
				this.data.jobarea.items = [];
				this.data.jobarea.prevobj = null;
				$('#jobareatable input').attr('checked', false);
				$('#jobareatable .resultlist').html('&nbsp;');
			},
			'showsub': function(obj){
				var prevobj = JobSelector.data.jobarea.prevobj;
				if(prevobj && prevobj !== obj){
					prevobj.hide();
				}
				var subitem = $(obj).children('.sub');
				subitem.show();
				$(obj).each(function(){
					JobSelector.outside(this, function(){subitem.hide();});
				});
				JobSelector.data.jobarea.prevobj = subitem;
			},
			'uncheck': function(id){
				$('#ja' + id).trigger('click');
			},
			'checkid': function(objid){
				$('#ja' + objid).trigger('click');
			},
			'refresh': function(){
				var resultlist = $('#jobareatable .resultlist');
				var html = '';
				for(var n=0; n<JobSelector.data.jobarea.items.length; n++){
					var obj = JobSelector.data.jobarea.items[n];
					html += '<a href="#" onclick="JobSelector.callfunc(\'jobarea\', \'uncheck\', ' + obj.id + '); return false;"><input type="checkbox" class="check" checked="true" value="' + obj.id + '" />' + obj.title + '</a>';
				}
				html += '&nbsp;';
				resultlist.html(html);
			}
		}
	},
	/*
	 * 通过callfunc调用功能模块
	 * ns1: 模块名
	 * method: 函数名
	 * arg: 参数
	 */
	callfunc: function(ns1, method, arg){
		if(this.func[ns1][method]){
			this.func[ns1][method].call(this, arg);
		}
	},
	/*
	 * 在method里存放产生不同模块的函数, 函数返回值将放到窗口内
	 */
	method: {
		// 职位模块
		'jobfunc': function(){
			lang = arguments[1] || 0;
			var rval = ['<table id="jobfunctable" class="jobfunctable' + (lang == 0 ? " cn" : " en") + '" width="700" cellspacing="0" cellpadding="3" style="table-layout:fixed;">'];
			rval.push('<tr><td class="l1" width="170" height="20">' + (lang == 0 ? "已选职能" : 'Function Selected') + '</td><td class="resultlist">&nbsp;</td></tr>');
			rval.push('<tr><td colspan="2" class="infotip" height="20">&nbsp;</td></tr>');
			for(var n in jobfunc_dict){
				rval.push('<tr><td class="l1" width="170">' + jobfunc_dict[n].info[lang] + '</td>');
				rval.push('<td><ul class="l2">');
				for(var m in jobfunc_dict[n].child){
					rval.push('<li onclick="JobSelector.callfunc(\'jobfunc\', \'showsub\', this);">');
					rval.push('<a title="' + jobfunc_dict[n].child[m].info[lang] + '" href="#" onclick="return false;">' + jobfunc_dict[n].child[m].info[lang] + '</a>');
					rval.push('<div class="sub">');
					var jfid = (parseInt(n)*10000 + parseInt(m)*100 + parseInt(0));
					var jftitle = jobfunc_dict[n].child[m].info[lang];
					rval.push('<div class="sub-item" onmouseover="$(this).addClass(\'over\')" onmouseout="$(this).removeClass(\'over\')"><input id="jf' + jfid + '" title="(' + (lang == 0 ? "全部" : "All") + ')' + jftitle + '" type="checkbox" class="all" value="' + jfid + '" onclick="JobSelector.callfunc(\'jobfunc\', \'checkone\', this);" /><label for="jf' + jfid + '"><strong>(' + (lang == 0 ? "全部" : "All") + ')' + jftitle + '</strong></label></div>');
					for(var i in jobfunc_dict[n].child[m].child){
						var jfsid = (parseInt(n)*10000 + parseInt(m)*100 + parseInt(i))
						var jfstitle = jobfunc_dict[n].child[m].child[i][lang];
						rval.push('<div class="sub-item" onmouseover="$(this).addClass(\'over\')" onmouseout="$(this).removeClass(\'over\')"><input id="jf' + jfsid + '" title="' + jfstitle + '" type="checkbox" class="one" value="' + jfsid + '" onclick="JobSelector.callfunc(\'jobfunc\', \'check\', this);" /><label for="jf' + jfsid + '">' + jfstitle + '</label></div>');
					}
					rval.push('</div></li>');
				}
				rval.push("</ul></td></tr>");
			}
			rval.push('</table>');
			return rval.join('\n');
		},
		// 行业模块
		'jobindustry': function(){
			lang = arguments[1] || 0;
			var rval = ['<table id="jobindustrytable" class="jobfunctable' + (lang == 0 ? " cn" : " en") + '" width="700" cellspacing="0" cellpadding="3" style="table-layout:fixed;">'];
			rval.push('<tr><td class="l1" width="170" height="20">' + (lang == 0 ? "已选行业" : 'Industry Selected') + '</td><td class="resultlist">&nbsp;</td></tr>');
			rval.push('<tr><td colspan="2" class="infotip" height="20">&nbsp;</td></tr>');
			for(var n in jobindustry_dict){
				rval.push('<tr><td class="l1" width="170">' + jobindustry_dict[n].info[lang] + '</td>');
				rval.push('<td><ul class="l2">');
				for(var m in jobindustry_dict[n].child){
					var jfid = (parseInt(n)*100 + parseInt(m));
					var jftitle = jobindustry_dict[n].child[m][lang];
					rval.push('<div class="sub-item" onmouseover="$(this).addClass(\'over\')" onmouseout="$(this).removeClass(\'over\')"><input id="ji' + jfid + '" title="' + jftitle + '" type="checkbox" class="one" value="' + jfid + '" onclick="JobSelector.callfunc(\'jobindustry\', \'check\', this);" /><label for="ji' + jfid + '">' + jobindustry_dict[n].child[m][lang] + '</label></div>');
				}
				rval.push("</ul></td></tr>");
			}
			rval.push('</table>');
			return rval.join('\n');
		},
		// 区域
		'jobarea': function(){
			lang = arguments[1] || 0;
			var rval = ['<table id="jobareatable" class="jobfunctable' + (lang == 0 ? " cn" : " en") + '" width="500" cellspacing="0" cellpadding="3" style="table-layout:fixed;">'];
			rval.push('<tr><td class="l1" width="170" height="20">' + (lang == 0 ? "已选地区" : 'City Selected') + '</td><td class="resultlist">&nbsp;</td></tr>');
			rval.push('<tr><td colspan="2" class="infotip" height="20">&nbsp;</td></tr>');
				rval.push('<tr><td colspan="2"><ul class="l2">');
				for(var n in area_dict){
					rval.push('<li onclick="JobSelector.callfunc(\'jobarea\', \'showsub\', this);">');
					rval.push('<a href="#" onclick="return false;">' + area_dict[n].info[lang] + '</a>');
					rval.push('<div class="sub">');
					for(var m in area_dict[n].child){
						var jfid = (parseInt(n)*100 + parseInt(m))
						var jftitle = area_dict[n].child[m][lang];
						rval.push('<div class="sub-item" onmouseover="$(this).addClass(\'over\')" onmouseout="$(this).removeClass(\'over\')"><input id="ja' + jfid + '" title="' + jftitle + '" type="checkbox" class="one" value="' + jfid + '" onclick="JobSelector.callfunc(\'jobarea\', \'check\', this);" /><label for="ja' + jfid + '">' + jftitle + '</label></div>');
					}
					rval.push('</div></li>');
				}
				rval.push("</ul></td></tr>");
			rval.push('</table>');
			return rval.join('');
		}
	},
	/*
	* 调用此方法显示选择器窗口
	*/
	show: function(id, lang, callback){
		if(document.readyState != 'complete' && $.browser.msie){return;}
		if(typeof this.method[id] !== 'function'){
			return;
		}
		// 隐藏其他窗口
		this.hideall();
		// 如果没有遮罩层则创建一个
		if(!this.overlay){
			// 遮罩层
			var overlay	= $('<div class="selector_overlay"></div>');
			overlay.bind('dblclick', function(){JobSelector.hideall();});
			$('body').append(overlay);
			$(window).bind('resize', function(){JobSelector.resize()});
			this.overlay = overlay;
		}
		// 将参数传入
		this.data[id]['callback']	= callback; 
		this.data[id]['lang']	= lang;
		//设置遮罩层的大小
		this.overlay.css('width', document.documentElement.offsetWidth + "px");
		this.overlay.css('height', document.documentElement.scrollHeight + "px");
		var thisobj = this;
		// 如果当前窗口已创建, 则销毁
		if(this.wnd[id]){
			this.wnd[id].remove();
		}
		// 取得窗口内容
			var content = this.method[id].apply(this, arguments);
			var w = $('<div class="selectwnd"></div>').append($('<div class="selectwndwrap"><div class="selectwndtitle">' + callback.wndtitle[lang] + '</div></div>').append('<div class="selectwndcontent">' + content + '</div>'));
			var btn = $('<input type="button" class="selectwndapply" value="' + callback.wndapply[lang] + '" />');
			btn.click(function(){
				callback.set(JobSelector.data[id].items);
				JobSelector.hideall();
			});
			w.append(btn);
			this.wnd[id] = w;
			$('body').append(this.wnd[id]);
		
		if(callback.type == 'dialog'){
			this.wnd[id].find('.selectwndapply').hide();
		}
		// 设置窗口位置
		var pos_top = document.documentElement.scrollTop + (document.documentElement.clientHeight - this.wnd[id].height())/2;
		var pos_left = document.documentElement.scrollLeft + (document.documentElement.clientWidth - this.wnd[id].width())/2;
		pos_top = pos_top < 0 ? 0 : pos_top;
		pos_left = pos_left < 0 ? 0 : pos_left;
		this.wnd[id].css('left', pos_left + 'px');
		this.wnd[id].css('top', pos_top + 'px');
		var existitems = callback.get();
		this.callfunc(id, 'reset');
		if(existitems){
			for(var n=0; n<existitems.length; n++){
				this.callfunc(id, 'checkid', existitems[n]);
			}
		}
		// 使窗口可拖动 
		//this.drag({o:this.wnd[id][0], h:this.wnd[id].find('.selectwndtitle')[0], r:[0, document.documentElement.offsetWidth - this.wnd[id].width() - 4, 0, document.documentElement.offsetHeight - this.wnd[id].height()]});
		// 隐藏select
		$('select').css('visibility', 'hidden');
		// 显示遮罩
		this.overlay.show();
		// 显示窗口
		this.wnd[id].show();
	},
	// 隐藏所有窗口和遮罩层
	hideall: function(){
		if(this.overlay){
			this.overlay.hide();
		}
		for(var n in this.wnd){
			this.wnd[n].hide();
		}
		$('select').css('visibility', 'visible');
	},
	// 拖动函数
	drag: function(arg){
		o = arg.o;
		h = arg.h || o;
		r = arg.r;
		h.onmousedown=function(a){
			var d=document;if(!a)a=window.event;
			var x = a.clientX - o.offsetLeft + document.documentElement.scrollLeft;
			var y = a.clientY - o.offsetTop + document.documentElement.scrollTop;
			if(o.setCapture){
				o.setCapture();
			}
			else if(window.captureEvents){
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			}
	
			d.onmousemove=function(a){
				if(!a)a=window.event;
				var ispagex = true;
				if(!a.pageX){ispagex = false; a.pageX=a.clientX;}
				if(!a.pageY){a.pageY=a.clientY;}
				var tx=a.pageX-x,ty=a.pageY-y;
				o.style.left	= ((!ispagex ? document.documentElement.scrollLeft : 0) + (tx<r[0]?r[0]:tx>r[1]?r[1]:tx) + 'px');
				o.style.top		= ((!ispagex ? document.documentElement.scrollTop : 0) + (ty<r[2]?r[2]:ty>r[3]?r[3]:ty) + 'px');
			};
	
			d.onmouseup=function(){
				if(o.releaseCapture)
					o.releaseCapture();
				else if(window.captureEvents)
					window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
				d.onmousemove=null;
				d.onmouseup=null;
			};
		};
	},
	// 浏览器大小重置后调用这个函数调整选择器窗口大小
	resize: function(){
		if(this.overlay && this.overlay.css('display') !== 'none'){
			this.overlay.css('width', document.documentElement.offsetWidth + "px");
			this.overlay.css('height', document.documentElement.scrollHeight + "px");
		}
		for(var n in this.wnd){
			if(this.wnd[n].css('display') !== 'none'){
				var pos_top = document.documentElement.scrollTop + (document.documentElement.clientHeight - this.wnd[n].height())/2;
				var pos_left = document.documentElement.scrollLeft + (document.documentElement.clientWidth - this.wnd[n].width())/2;
				pos_top = pos_top < 0 ? 0 : pos_top;
				pos_left = pos_left < 0 ? 0 : pos_left;
				this.wnd[n].css('top', pos_top + 'px');
				this.wnd[n].css('left',  pos_left + 'px');
				//this.drag({o:this.wnd[n][0], h:this.wnd[n].children('.selectwndtitle')[0], r:[0, document.documentElement.offsetWidth - this.wnd[n].width(), 0, document.documentElement.offsetHeight - this.wnd[n].height()]});
			}
		}
	},
	/* 鼠标移出对象外的元素会触发callback
	 * obj: 对象(HTML Element)
	 * callback: 鼠标移出对象时调用的函数
	 * 注: onmouseout事件即使鼠标移到对象的子元素也会触发, 所以这里对onmouseout移出做了判断
	 */
	outside: function(obj, callback){
		$(obj).bind('mouseout', function(event){
			var e = window.event || event;
			var p = event.toElement || event.relatedTarget;
			var isfound = false;
			while(p){
				if(p == obj){
					isfound = true;
					break;
				}
				p = p.parentNode;
			}
			if(!isfound){
				callback.apply(obj);
			}
		});
	}
};

function removeme(obj){
	$(obj).remove();
}

var phpserver = {
	call: function(method, callback, args){
		$.ajax({url: 'ajaxcp.php?action=' + method,
		type:'POST',
		data:args,
		dataType: 'json',
		timeout: 1000,
		error: function(xmlhttp, textStatus){
			alert('与服务器通信发生错误, 请检查网络是否连通, 服务器是否可用\nErrorCode:\n' + xmlhttp.responseText);
			if(typeof(callback) == 'function'){
				callback.call(this, 'server.error', {errorCode: '-1', errorText: '与服务器通信发生错误'});
			}
		},
		success: function(data, textStatus){
			if(typeof(callback) == 'function'){
				if(!data.error || data.error.length <= 0){
					callback.call(this, 'success', data);
				}else{
					alert(data.error);
					callback.call(this, 'error', data);
				}
			}
		}	
		});
	}
}

var headerscroll = {
	stopped: false,
	domobj: null,
	effecttime: 1000,
	pausetime: 3000,
	scrollheight: 0,
	offsetheight: 0,
	scroll: function(istop){
		if(!headerscroll.stopped){
			var scrollheight = headerscroll.scrollheight;
			var offsetheight = headerscroll.offsetheight;
			var scrolltop = $(headerscroll.domobj).attr('scrollTop');
			var top	= scrolltop + offsetheight;
			$(headerscroll.domobj).animate({scrollTop: top}, headerscroll.effecttime, 'linear', function(){
				if((parseInt(top/offsetheight) + 1) * offsetheight > scrollheight){
					$(headerscroll.domobj).attr('scrollTop', 0);
				}
				setTimeout(headerscroll.scroll, headerscroll.pausetime);
			});
		}else{
			setTimeout(headerscroll.scroll, headerscroll.pausetime);
		}
	}, 
	scrollstop: function(){
		headerscroll.stopped = true;
	},
	scrollstart: function(){
		headerscroll.stopped = false;
	},
	init: function(objid){
		this.domobj = $(objid);
		if(this.domobj.length <= 0){return;}
		this.scrollheight = this.domobj.attr('scrollHeight');
		this.offsetheight = this.domobj.innerHeight();
		var html = this.domobj.html();
		this.domobj.html(html + html);
		this.domobj.hover(function(){headerscroll.scrollstop();}, function(){headerscroll.scrollstart();});
		setTimeout(headerscroll.scroll, headerscroll.pausetime);
	}
};

$(function(){
	headerscroll.init('#hotcomment-content');}
);