/********************************************
Basis of dwsFramework , Writen by CNLei@dws
*********************************************/
var addEvent = function(o, t, f)
{
var d = 'addEventListener', n = 'on' + t, rO = o, clean = (t != 'unload');
if (o[d]) o[d](t, f, false);
else if (o.attachEvent) o.attachEvent(n, f);
else
{
clean = false;
if (!o._evts) o._evts = {};
if (!o._evts[t])
{
o._evts[t] = o[n] ? { b: o[n] } : {};
o[n] = new Function('e', 'var r = true, o = this, a = o._evts["' + t + '"], i; for (i in a) { o._f = a[i]; r = o._f(e||window.event) != false && r; o._f = null; } return r');
if (t != 'unload') clean = true;
}
if (!f._i) f._i = addEvent._i++;
o._evts[t][f._i] = f;
}
if (clean) addEvent(window, 'unload', function(){removeEvent(rO, t, f);});
};
addEvent._i = 1;

var removeEvent = function(o, t, f)
{
var d = 'removeEventListener';
try
{
if (o[d]) o[d](t, f, false);
else if (o.detachEvent) o.detachEvent('on' + t, f);
else if (o._evts && o._evts[t] && f._i) delete o._evts[t][f._i];
} catch (e) {}
};

function cancelEvent(e, c)
{
e.returnValue = false;
if (e.preventDefault) e.preventDefault();
if (c)
{
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
}
};


function AJAXRequest() {
var ct = null;
this.timeout = 20000;
var xmlObj = false;
var CBfunc,ObjSelf;
ObjSelf=this;
try { xmlObj=new XMLHttpRequest; }
catch(e) {
try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
catch(e2) {
try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e3) { xmlObj=false; }
}
}
if (!xmlObj) return false;
if(arguments[0]) this.url=arguments[0]; else this.url="";
if(arguments[1]) this.callback=arguments[1]; else this.callback=function(obj){return};
if(arguments[2]) this.content=arguments[2]; else this.content="";
if(arguments[3]) this.method=arguments[3]; else this.method="POST";
if(arguments[4]) this.async=arguments[4]; else this.async=true;
this.send=function() {
var purl,pcbf,pc,pm,pa;
if(arguments[0]) purl=arguments[0]; else purl=this.url;
if(arguments[1]) pc=arguments[1]; else pc=this.content;
if(arguments[2]) pcbf=arguments[2]; else pcbf=this.callback;
if(arguments[3]) pm=arguments[3]; else pm=this.method;
if(arguments[4]) pa=arguments[4]; else pa=this.async;
if(!pm||!purl||!pa) return false;
ct = setTimeout(function(){
		xmlObj.abort();
		try{ clearTimeout(ct); } catch(e) {};
		pcbf();
		}, this.timeout);
xmlObj.open (pm, purl, pa);
if(pm=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlObj.onreadystatechange=function() {
if(xmlObj.readyState==4) {
try{ clearTimeout(ct); } catch(e) {};
try {
if(xmlObj.status==200) {
c = xmlObj.responseText.parseJSON();
pcbf(c);
}
else {
pcbf(null);
}
}
catch(e){pcbf(null);};
}
}
if(pm=="POST")
xmlObj.send(pc);
else
xmlObj.send("");
}
this.get=function() {
var purl,pcbf;
if(arguments[0]) purl=arguments[0]; else purl=this.url;
if(arguments[1]) pcbf=arguments[1]; else pcbf=this.callback;
if(!purl&&!pcbf) return false;
this.send(purl,"",pcbf,"GET",true);
}
this.post=function() {
var fo,pcbf,purl,pc,pm;
if(arguments[0]) fo=arguments[0]; else return false;
if(arguments[1]) pcbf=arguments[1]; else pcbf=this.callback;
if(arguments[2])
purl=arguments[2];
else if(fo.action)
purl=fo.action;
else
purl=this.url;
if(arguments[3])
pm=arguments[3];
else if(fo.method)
pm=fo.method.toLowerCase();
else
pm="post";
if(!pcbf&&!purl) return false;
pc=this.formToStr(fo);
if(!pc) return false;
if(pm) {
if(pm=="post")
this.send(purl,pc,pcbf,"POST",true);
else
if(purl.indexOf("?")>0)
this.send(purl+"&"+pc,"",pcbf,"GET",true);
else
this.send(purl+"?"+pc,"",pcbf,"GET",true);
}
else
this.send(purl,pc,pcbf,"POST",true);
}
// formToStr
// from SurfChen <surfchen@gmail.com>
// @url     http://www.surfchen.org/
// @license http://www.gnu.org/licenses/gpl.html GPL
// modified by xujiwei
// @url     http://www.xujiwei.cn/
this.formToStr=function(fc) {
var i,query_string="",and="";
for(i=0;i<fc.length;i++) {
e=fc[i];
if (e.name!='') {
if (e.type=='select-one') {
element_value=e.options[e.selectedIndex].value;
}
else if (e.type=='checkbox' || e.type=='radio') {
if (e.checked==false) {
continue;	
}
element_value=e.value;
}
else {
element_value=e.value;
}
element_value=encodeURIComponent(element_value);
query_string+=and+e.name+'='+element_value;
and="&";
}
}
return query_string;
}
}

function Cookie(){
this.SetValue=function(name,value,hours,path,domain,secure){
var str=new String();
if(hours>=0){
var nextTime=new Date();
nextTime.setHours(nextTime.getHours()+hours);
}
else{
	var nextTime=new Date();
	nextTime.setTime(nextTime.getTime()-1000*hours);
}
str=name+"="+escape(value);
if(hours)
str+=";expires="+nextTime.toGMTString();
if(path)
str+=";path="+path;
if(domain)
str+=";domain="+domain;
if(secure)
str+=";secure";
document.cookie=str;
}
this.GetValue=function(name){
var rs=new RegExp("(^|)"+name+"=([^;]*)(;|$)","gi").exec(document.cookie),tmp;
if(tmp=rs)
return unescape(tmp[2]);
return null;
}
}
(function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
array: function (x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
	if (b) {
		a[a.length] = ',';
	}
	a[a.length] = v;
	b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function (x) {
return String(x);
},
'null': function (x) {
return "null";
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
object: function (x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
	v = f(v);
	if (typeof v == 'string') {
		if (b) {
			a[a.length] = ',';
		}
		a.push(s.string(i), ':', v);
		b = true;
	}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
	return c;
}
c = b.charCodeAt();
return '\\u00' +
	Math.floor(c / 16).toString(16) +
	(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};

Object.prototype.toJSONString = function () {
return s.object(this);
};

Array.prototype.toJSONString = function () {
return s.array(this);
};
})();

String.prototype.parseJSON = function () {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + this + ')');
} catch (e) {
return false;
}
};

function by(id)
{
	return document.getElementById(id);
}
function $(id)
{
	return document.getElementById(id);
}

Array.prototype.remove = function(dx) {
    if(isNaN(dx) || dx>this.length){return false;}
    this.splice(dx,1);
}
String.prototype.getNumber = function() {return this.replace(/[^\d]/g,""); }
String.prototype.replaceAll = stringReplaceAll;
function stringReplaceAll(AFindText,ARepText){
 var raRegExp = new RegExp(AFindText.replace(/([\(\)\[\]\{\}\^\$\+\-\*\?\.\"\'\|\/\\])/g,"\\$1"),"ig");
 return this.replace(raRegExp,ARepText);
}
var dwsFw = {};
var dwsBrowser = {};
dwsBrowser.agt = navigator.userAgent.toLowerCase();
dwsBrowser.isW3C = document.getElementById ? true:false;
dwsBrowser.isIE = ((dwsBrowser.agt.indexOf("msie") != -1) && (dwsBrowser.agt.indexOf("opera") == -1) && (dwsBrowser.agt.indexOf("omniweb") == -1));
dwsBrowser.isNS6 = dwsBrowser.isW3C && (navigator.appName=="Netscape") ;
dwsBrowser.isOpera = dwsBrowser.agt.indexOf("opera") != -1;
dwsBrowser.isGecko = dwsBrowser.agt.indexOf("gecko") != -1;
dwsBrowser.ieTrueBody  =function (){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
var dwsElement={
  addClassName: function(element, className) {
    if (!(element = $(element))) return;
	dwsElement.delClassName(element, className);
	element.className=element.className+" "+className;
  },
  delClassName: function(element, className) {
    if (!(element = $(element))) return;
	var arrClssOld=element.className.replaceAll("  "," ");
	arrClssOld=arrClssOld.split(" ");
	for (var i=arrClssOld.length-1;i>=0;i--){
	 if (className==arrClssOld[i]){
	 arrClssOld.remove(i);
	 }
	}
	element.className=arrClssOld.join(" ");
  },
	isChild		: function(cNode,pNode){
		while(cNode!=null){
			cNode=cNode.parentNode;
			if(cNode==pNode) return true; 
		}
		return false;
	},
	getChild	: function(oChild,oParent){
		oParent.appendChild(oChild);
	},
	rePos	: function(obj,nLt,nTop){
		var o=$(obj);
		o.style.left	= nLt + "px";
		o.style.top		= nTop + "px";
	},
	getXYWH	: function(o){
		var nLt=0;
		var nTp=0;
		var offsetParent = o;
		while (offsetParent!=null && offsetParent!=document.body) {
			nLt+=offsetParent.offsetLeft;
			nTp+=offsetParent.offsetTop;
			if(dwsBrowser.isIE){
				parseInt(offsetParent.currentStyle.borderLeftWidth)>0?nLt+=parseInt(offsetParent.currentStyle.borderLeftWidth):"";
				parseInt(offsetParent.currentStyle.borderTopWidth)>0?nTp+=parseInt(offsetParent.currentStyle.borderTopWidth):"";
			}
			offsetParent=offsetParent.offsetParent;
		}
		return {"X":nLt, "Y":nTp, "W":o.offsetWidth, "H":o.offsetHeight}
	}
}
var dwsPosition={
	rePos	: function(obj,nLt,nTop){
		var o=$(obj);
		o.style.left	= nLt + "px";
		o.style.top		= nTop + "px";
	}
}
function $(element) {
	return document.getElementById(element)?document.getElementById(element):element;
}
document.getElementsByClassName = function(className,oBox) {
	 this.d= oBox || document;
	 var children = this.d.getElementsByTagName('*') || document.all;
	 var elements = new Array();
	 for (var i = 0; i < children.length; i++) {
		 var child = children[i];
		 var classNames = child.className.split(' ');
		 for (var j = 0; j < classNames.length; j++) {
			 if (classNames[j] == className) {
				 elements.push(child);
				 break;
			 }
		 }
	 }
	 return elements;
}

$Cls = document.getElementsByClassName ;
var dwsTAB = {
	idSuffix		: "_Tabs",
	tabTagName		: "li",
	activeClassName	: "active",
	waitInterval	: null,
	delayTime		: 30,
	tempTAB			: null
}
dwsTAB.init = function(){
	for(var i=0;i<arguments.length;i++) {
			var oTabBox=document.getElementById(arguments[i]+dwsTAB.idSuffix);
			if(!oTabBox)continue;
			var arrTabs=oTabBox.getElementsByTagName(dwsTAB.tabTagName);	
			var oCurrTAB=null;
			for(var j=0;j<arrTabs.length;j++) {
				oCurrTAB=arrTabs[j];
				if(oCurrTAB.parentNode!=oTabBox) continue;
				var oTabLink=oCurrTAB.getElementsByTagName("a")[0];
				var sDataStaut=oTabLink.getAttribute("rel");
				oCurrTAB.setActive=function(bactive){
					var oDataId = this.getElementsByTagName("a")[0].getAttribute("urn");
					if(bactive){
						this.status="active";
						dwsElement.addClassName(this,dwsTAB.activeClassName);
						dwsElement.delClassName($(oDataId),"hidden");
					}else{
						this.status="normal";
						dwsElement.delClassName(this,dwsTAB.activeClassName);
						dwsElement.addClassName($(oDataId),"hidden");
					}
				}
				oCurrTAB.getTabData=function(){
					this.setActive(true);
					this.parentNode.activetab.setActive(false);
					this.parentNode.activetab=this;					
					var oTabLink=this.getElementsByTagName("a")[0];
				}
				oCurrTAB.onmouseover=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var fm=myEvent.fromElement;
					if(dwsElement.isChild(fm,this) || fm==this) return;
					if(this.status=="active") return;
					dwsTAB.tempTAB=this;
					clearTimeout(dwsTAB.waitInterval);
					dwsTAB.waitInterval=window.setTimeout("dwsTAB.tempTAB.getTabData();",dwsTAB.delayTime);
				}
				oCurrTAB.onmouseout=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var em=myEvent.toElement;
					if(dwsElement.isChild(em,this) || em==this) return;
					if(this.status=="active") return;
					clearTimeout(dwsTAB.waitInterval);
				}
				if(sDataStaut.indexOf("#default")!=-1){
					oCurrTAB.setActive(true);
					oTabBox.activetab=oCurrTAB;
				} else {
					oCurrTAB.setActive(false);
				}

			}
		if(oTabBox.activetab==null) oTabBox.activetab=arrTabs[0];
	}
}

dwsTAB.init2 = function(){
	for(var i=0;i<arguments.length;i++) {
			var oTabBox=document.getElementById(arguments[i]+dwsTAB.idSuffix);
			var arrTabs=oTabBox.getElementsByTagName(dwsTAB.tabTagName);	
			var oCurrTAB=null;
			for(var j=0;j<arrTabs.length;j++) {
				oCurrTAB=arrTabs[j];
				if(oCurrTAB.parentNode!=oTabBox) continue;
				var oTabLink=oCurrTAB.getElementsByTagName("a")[0];
				var sDataStaut=oTabLink.getAttribute("rel");
				oCurrTAB.setActive=function(bactive){
					var oDataId = this.getElementsByTagName("a")[0].getAttribute("urn");
					if(bactive){
						this.status="active";
						dwsElement.addClassName(this,dwsTAB.activeClassName);
						dwsElement.delClassName($(oDataId),"hidden");
					}else{
						this.status="normal";
						dwsElement.delClassName(this,dwsTAB.activeClassName);
						dwsElement.addClassName($(oDataId),"hidden");
					}
				}
				oCurrTAB.getTabData=function(){
					this.setActive(true);
					this.parentNode.activetab.setActive(false);
					this.parentNode.activetab=this;					
					var oTabLink=this.getElementsByTagName("a")[0];
				}
				oCurrTAB.onclick=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var fm=myEvent.fromElement;
					if(dwsElement.isChild(fm,this) || fm==this) return;
					if(this.status=="active") return;
					dwsTAB.tempTAB=this;
					dwsTAB.tempTAB.getTabData();
					//clearTimeout(dwsTAB.waitInterval);
					//dwsTAB.waitInterval=window.setTimeout("dwsTAB.tempTAB.getTabData();",dwsTAB.delayTime);
				}
				if(sDataStaut.indexOf("#default")!=-1){
					oCurrTAB.setActive(true);
					oTabBox.activetab=oCurrTAB;
				} else {
					oCurrTAB.setActive(false);
				}

			}
		if(oTabBox.activetab==null) oTabBox.activetab=arrTabs[0];
	}
}

dwsFw.setHome = function(o,s){
	if (dwsBrowser.isIE) {
		o.style.behavior='url(#default#homepage)';
		o.setHomePage(s);
		return(false);
	}
}
dwsFw.addFavUrl = function(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( dwsBrowser.isIE ) {
		window.external.AddFavorite( url, title);
	} else if(dwsBrowser.isOpera && window.print ) {
		  var elem = document.createElement('a');
		  elem.setAttribute('href',url);
		  elem.setAttribute('title',title);
		  elem.setAttribute('rel','sidebar');
		  elem.click();
	}
}
var oldBoxNo=0;
function nextFace(sParentId,sSubBoxTag,n){
var arrFaceBox=$(sParentId).getElementsByTagName(sSubBoxTag);
var nNewBoxNo=oldBoxNo+n;
nNewBoxNo<0?nNewBoxNo=(arrFaceBox.length-1):"";
nNewBoxNo>=arrFaceBox.length?nNewBoxNo=0:"";
for (var i=0;i<arrFaceBox.length;i++ ) {
 arrFaceBox[i].style.display=i==nNewBoxNo?"":"none";/**/
}
oldBoxNo=nNewBoxNo;
}
var dwsPopMsg = {};
dwsPopMsg.show = function(o,sId,nOffX,nOffY){
this.offX = nOffX || 0;
this.offY = nOffY || 0;
var oBox = $(sId);
var nPos = dwsElement.getXYWH(o);
var nLt,nTop;
nLt = nPos.X + (nPos.W/2) + this.offX;
nTop = nPos.Y + this.offY;
dwsElement.rePos(oBox,nLt,nTop);
dwsElement.delClassName(oBox,"hidden");
//alert(nPos.X);
}
dwsPopMsg.close = function(sId){
var oBox = $(sId);
dwsElement.addClassName(oBox,"hidden");
}
function chgInp(o){
	o.value=o.value==o.defaultValue?"":o.value;
	o.onblur= function(){
		this.value=this.value==""?this.defaultValue:this.value;
	}
}

// search input
var dwsSearch = {
	hoverBtn	: function(o,s){
		dwsElement.addClassName(o,s);
		o.onmouseout = function(){
			dwsElement.delClassName(this,s);
		}
	},
	doInput	: function(o){
		if (o.value==o.defaultValue) {
			o.value="";
		}
		o.onblur = function(){
			o.value==""?o.value=o.defaultValue:"";
		}
	}
}

function socheck(obj) {
	if(document.search.keywords.value=='') { 
		alert('请输入关键字');
		document.search.keywords.focus();
		return false;
	} 

	obj.disabled=true; 
	document.search.submit();
}

/* ads code*/
function loadAds(c, s, w, h)
{
	try{
		$(c).innerHTML = $(s).innerHTML;
		$(s).innerHTML = "";
		document.write('<style>');
		document.write('#'+c+'{position:static!important; display:block!important;');
		if (w)document.write('width:'+w+'px!important;');
		if (h)document.write('height:'+h+'px!important;');
		document.write('}</style>');
	}catch (e){/*do not*/}
} 

function setAdsSize(s, w, h)
{
	try
	{
		document.getElementById(s).style.width = w;
		document.getElementById(s).style.height = h;
	}
	catch (e)
	{/*do not*/}
}

/*hideText*/
function hideText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);
	if ("" == conText)
	{
		conText = textBox.innerHTML;
	}

	if(navigator.appName.indexOf("Explorer") > -1)
	{
		if (textBox.innerText.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.innerText.substr(0, conLen);    
	}
	else
	{
		if (textBox.textContent.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.textContent .substr(0, conLen);
	}
	textBox.innerHTML += '...&nbsp;&nbsp;<a href="javascript:;" onclick="showText(\'' + e + '\',\'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str1 + '</a>';
}

function showText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);;
	textBox.innerHTML = conText + '&nbsp;&nbsp;<a href="javascript:;" onclick="hideText(\'' + e + '\', \'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str2 + '</a>';
}