<!--

var bw = navigator.userAgent.toLowerCase();
var page_url = window.location.href;
var page_referrer = document.referrer;

// Checkbox Switcher
// return checked number and checked value string(like 3,5,9,11)
// 反选
// Example: <input type=button value="switch" onClick="switchCheckbox('switch',form,form.article_id)">
// 反选（数组模式）
// Example: <input type=button value="switch" onClick="switchCheckbox('switch',form,'article_id[]')">
// 检查选择了几个项目
// alert(switchCheckbox('',f,'article_id[]')[0])
// 检查选择了哪些项目
// alert(switchCheckbox('',f,'article_id[]')[1])
// Copyright by http://www.hbcms.com
function switchCheckbox(type,f,o)	{
    var checked_ary = Array(0,'');
    if ( typeof(o) == "object" )	{
        switch (type) {
            case 'all' :
            for ( i=0; i<o.length; i++ )	{
                o[i].checked = true;
            }
            break;
            case 'empty' :
            for ( i=0; i<o.length; i++ )	{
                o[i].checked = false;
            }
            break;
            case 'switch' :
            for ( i=0; i<o.length; i++ )	{
                o[i].checked = !o[i].checked;
            }
            break;
        }
        for ( i=0; i<o.length; i++ )	{
            if ( o[i].checked == true )	{
                checked_ary[0]++;
                checked_ary[1] += f.elements[i].value + ',';
            }
        }
    } else {
        switch (type) {
            case 'all' :
            for ( i=0; i<f.elements.length; i++ )	{
                if ( f.elements[i].type == 'checkbox' && f.elements[i].name.indexOf(o) != -1)	{
                    f.elements[i].checked = true;
                }
            }
            break;
            case 'empty' :
            for ( i=0; i<f.elements.length; i++ )	{
                if ( f.elements[i].type == 'checkbox' && f.elements[i].name.indexOf(o) != -1)	{
                    f.elements[i].checked = false;
                }
            }
            break;
            case 'switch' :
            for ( i=0; i<f.elements.length; i++ )	{
                if ( f.elements[i].type == 'checkbox' && f.elements[i].name.indexOf(o) != -1 )	{
                    f.elements[i].checked = !f.elements[i].checked;
                }
            }
            break;
        }
        for ( i=0; i<f.elements.length; i++ )	{
            if ( f.elements[i].type == 'checkbox' && f.elements[i].name.indexOf(o) != -1 && f.elements[i].checked == true )	{
                checked_ary[0]++;
                checked_ary[1] += f.elements[i].value + ',';
            }
        }
    }
    if ( checked_ary[1] != '' )	{
        checked_ary[1] = checked_ary[1].substr(0, checked_ary[1].length-1);
    }
    return checked_ary;
}

// 鼠标移动改变<tr>背景颜色
var old_bc = "";
function trOn(t) {
	old_bc = t.bgColor;
	t.bgColor = "#FADFC7";
}
function trOut(t) {
	t.bgColor = old_bc;
}

function numSelectBox(start_num, end_num, box_name, selected_value)	{
	document.write('<select name="'+box_name+'">');
	for ( i=start_num; i<=end_num; i++ )	{
		selected_str = ( i == selected_value ) ? ' selected' : '';
		document.write('<option value="'+i+'"' + selected_str + '>'+i+'</option>');
	}
	document.write('</select>');
}


//################### cookie start ################### 
// opener.reply.usericon.selectedIndex=\''+i+'\';alert(opener.reply.usericon.selectedIndex);"

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
	return getCookieVal (j);    
	i = document.cookie.indexOf(" ", i) + 1;    
	if (i == 0) break;   
	}  
	return null;
}
function SetCookie (name, value) { 
	var exp1 = new Date(); 
	exp1.setTime(exp1.getTime() + (30*24*60*60*1000));
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : exp1;  
	var path = (argc > 3) ? argv[3] : '/';  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

//################### cookie end ###################

// 收藏当前网页
function add2favorite(url, title)	{
	if ( typeof(url) == "undefined" )	{
		url = page_url;
		title = window.document.title;
	}
	window.external.addFavorite(url,title);
	return true;
}

function randomValue(low, high) {
	return (Math.floor(Math.random() * (1 + high - low) + low));
}

function last_modified_date()	{
	last_modified_date = new Date(document.lastModified);
	return ""+last_modified_date.getYear()+"-"+(last_modified_date.getMonth()+1)+"-"+last_modified_date.getDate()+" "+last_modified_date.getHours()+":"+last_modified_date.getMinutes()+":"+last_modified_date.getSeconds()+""; 
}


function top_ad()	{

}


function bottom_ad(){

}

// 自动 COPY 代码开始
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function JM_cc(ob){
	var obj=MM_findObj(ob); if (obj) { 
	obj.select();js=obj.createTextRange();js.execCommand("Copy");}
	alert("Code copied!");
}
// 自动 COPY 代码结束


function delConfirm()	{
	if ( confirm("Are you sure you want to delete this?") )	{
		return true;
	}
	return false;
}

function showCode(id){
    if (document.getElementById(id).style.display=="block"){
        document.getElementById(id).style.display="none";
        }else{
        document.getElementById(id).style.display="block";
    }
}

function showTr_bak(id, rowlength, start, end)	{
	if ( !document.all )	{
		return false;
	}
	if ( id != '' )	{
		var tab = document.getElementById(id);
	} else {
		for(i=0; i<document.getElementsByTagName('TBODY').length; i++ )	{
			if (document.getElementsByTagName('TBODY')[i].rows.length>rowlength )
			{
				var tab = document.getElementsByTagName('TBODY')[i];
				break;
			}
		}
	}	
	for(i=start; i<tab.rows.length-end; i++)	{
		tab.rows[i].style.display = ( tab.rows[i].style.display == 'none' ) ? 'block' : 'none';

	}
	return false;
}


function hbcmsShowTr_bak(id)	{
	if ( id == '' )	{
		id = 'form_article';
	}
	var display_str = ( document.all ) ? 'block' : 'table-row';
	var tab = document.getElementById(id).getElementsByTagName('table')[0];
	for(i=0; i<tab.rows.length; i++)	{
		if ( tab.rows[i].cells[0].innerHTML.indexOf('hbcms_adv_item') != -1 ) {
			tab.rows[i].style.display = ( tab.rows[i].style.display == 'none' ) ? display_str : 'none';
		}
	}
	return false;
}
// jquery version
function hbcmsShowTr(id)	{
	if ( id == '' )	{
		id = 'form_article';
	}
	$("#"+ id +" td .hbcms_adv_item").each(function(){
	  $(this).parents("tr").eq(0).toggle();
	});
	return false;
}

function hbcmsOpenNewDiv(url,w,h) {
	var m = "hbcmsMask";
	var _id = 'hbcmsNewDiv';
	var dc = top.document;

	if (dc.getElementById(m))	{
		dc.body.removeChild(dc.getElementById(m));
	}

	if ( dc.getElementById(_id) )		{
		dc.body.removeChild(dc.getElementById(_id));
	}

	if ( url == '' )	{
		
		return false;
	} else {
		// 新激活_id图层
		var newDiv = dc.createElement("div");
		newDiv.id = _id;
		newDiv.style.position = "absolute";
		newDiv.style.zIndex = "9999";

		var avail_h =  screen.availHeight;
		var avail_w = ( dc.documentElement.scrollWidth > screen.availWidth) ? screen.availWidth : dc.documentElement.scrollWidth;


		if ( h > avail_h-160 )	{
			h = avail_h-160;
		}
		if ( w > avail_w-100 )	{
			w = avail_w-100;
		}

		//alert(dc.body.scrollHeight +'|'+screen.availHeight+'|'+h);
		//alert(dc.body.scrollWidth +'|'+screen.availWidth+'|'+w);

		newDiv.style.width = w+"px";
		newDiv.style.height = h+"px";
		newDiv.style.top = ( avail_h-h-150)/2 + parseInt(dc.documentElement.scrollTop)+"px";

		//alert(newDiv.style.top);

		newDiv.style.left = (parseInt(avail_w) - w) / 2 + "px"; // 屏幕居中
		newDiv.style.background = "#EFEFEF";
		newDiv.style.border = "1px solid #860001";
		newDiv.style.padding = "1px";
		newDiv.innerHTML = "<table width="+w+" cellpadding=0 cellspacing=1 ><tr><td><A HREF=# onclick=\"return hbcmsOpenNewDiv('',0,0);\" style='text-decoration: none;font-family: Arial;'>Close</A></td><td align=right valign=bottom style='padding-right:2px;'> <IMG SRC='../image/icon/close2.gif' WIDTH=14 HEIGHT=13 BORDER=0 ALT='Close' onclick=\"return hbcmsOpenNewDiv('',0,0);\" style='cursor:hand;'></td></tr></table><iframe src='"+url+"' width="+w+" height="+(h-20)+"></iframe>";
		dc.body.appendChild(newDiv);
		// mask图层
		var newMask = dc.createElement("div");
		newMask.id = m;
		newMask.style.position = "absolute";
		newMask.style.zIndex = "1";
		newMask.style.width = dc.documentElement.scrollWidth + "px";
		newMask.style.height = dc.documentElement.scrollHeight + "px";
		newMask.style.top = "0px";
		newMask.style.left = "0px";
		newMask.style.background = "#C0C0C0";
		newMask.style.filter = "alpha(opacity=40)";
		newMask.style.opacity = "0.80";
		dc.body.appendChild(newMask);
	}

	return false;
}

/*  hbcms ajax function */
var hbcms_xml_req = false;
var hbcms_xml_loading = 'Loading....';

function hbcms_ajax_req(url, functionName, httpType, sendData) {

 hbcms_xml_req = false;
 if (!httpType) httpType = "GET";

 if (window.XMLHttpRequest) { 
  hbcms_xml_req = new XMLHttpRequest();
  if (hbcms_xml_req.overrideMimeType) {
   hbcms_xml_req.overrideMimeType('text/plain');
  }
 } else if (window.ActiveXObject) {
  try {
   hbcms_xml_req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
	hbcms_xml_req = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (e) {}
  }
 }

 if (!hbcms_xml_req) {
  alert('Cannot send an XMLHTTP request');
  return false;
 }

var changefunc="hbcms_xml_req.onreadystatechange = "+functionName;
eval(changefunc);


 hbcms_xml_req.open(httpType, url, true);
 hbcms_xml_req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
 hbcms_xml_req.send(sendData);


}

function hbcms_ajax_return (id) {

	document.getElementById(id).style.display = "block";
	if ( hbcms_xml_req && hbcms_xml_req.readyState == 4) {
		
		if (hbcms_xml_req.status == 200) {
			var s = hbcms_xml_req.responseText;
			if ( document.getElementById(id+'_loading') != null && s.indexOf('Error_Prompt:') != -1 )	{
				document.getElementById(id+'_loading').innerHTML = s.replace('Error_Prompt:','');
			} else {
				document.getElementById(id).innerHTML = s;
			}

		} else {
			document.getElementById(id).innerHTML = 'sss';
		}
	 } else {
		

		if ( document.getElementById(id+'_loading') != null )	{
			id = id+'_loading';
		}
		document.getElementById(id).innerHTML = hbcms_xml_loading;	
	 }

	 return true;
}

// 鼠标移动到连接上，弹出下拉菜单的特效
// www.hbcms.com 原创 2007-6-27
function showMouseMenu(id,e)	{
	var a = document.getElementById(id);
	if (e == 0 )	{
		if ( a.style.pitch == 0 || a.style.pitch == '0Hz' ) {
			a.style.display = 'none';
		}
		return false;
	}
	var x = (document.all)? e.x : e.pageX;
	var y = (document.all)? (parseInt(document.documentElement.scrollTop)+e.y) : e.pageY;

	a.style.display = 'block';
	a.style.position = 'absolute';
	a.style.left = x + "px";
	a.style.top = y + "px";;
	a.style.pitch = '1Hz';

	return true;
}

function showMouseMenuLink(id,text,url,target,div_html)	{
	if ( url == 'div' && target == 'div' )	{
		if (document.getElementById(id) == null)
		{
			document.write('<div id="'+id+'" style="display:none;z-index:9999;padding:2px;pitch:3Hz;left:0;top0;" onmouseover="this.style.pitch=\'1Hz\';this.style.display=\'block\';" onmouseout="this.style.display=\'none\';this.style.pitch=\'0Hz\';">'+div_html+'</div>');
		} else {
			document.getElementById(id).innerHTML = div_html;
		}
		
	} else {
		document.write('<A HREF="'+url+'" target="'+target+'" onmouseover="'+div_html+'showMouseMenu(\''+id+'\',event);"  onmouseout="document.getElementById(\''+id+'\').style.pitch=\'0Hz\'; setTimeout(\'showMouseMenu(\\\''+id+'\\\',0)\',1500);">'+text+'</A>');
	}
}

//-->