<!--
window.onerror=new Function("return true;")
function readCookie(s){var arr=document.cookie.match(new RegExp("(^| )"+s+"=([^;]*)(;|$)"));
if(arr!=null){return unescape(arr[2]);}else{return "";}}
function writeCookie(s,v,h){var expire="";if(h!=null){expire=new Date((new Date()).getTime()+h*3600000);
expire=";expires="+expire.toGMTString();}document.cookie=s+"="+escape(v)+expire;}

var IE_all_cache = new Object();
function IE_getElementById(id){if (IE_all_cache[id] == null){IE_all_cache[id] = document.all[id];}
	return IE_all_cache[id];
}

if(document.all){if (!document.getElementById){document.getElementById = IE_getElementById;}}

function isEmpty(s){return ((s == null)||(s.length == 0))}

function isWhitespace(s){
	var whitespace = " \t\n\r";var i;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) >= 0){return true;}
	}
	return false;
}

function rightChar(s,schar){
	if (s==null) return;
	if(schar==null) return s;
	return s.substring(s.lastIndexOf(schar)+1,s.length);
}

function isCharsInBagEx(s,bag){
	var c;
	for(var i = 0; i < s.length; i++){
		c = s.charAt(i);
		if (bag.indexOf(c) > -1)
			return true;
	}
	return false;
}

function isCharsInBag (s, bag){
	for (var i=0;i<s.length;i++){
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) return false;
	}
	return true;
}

function isEmail(s){
	//var re = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,5}$/
	var re = /^(([^()<>@,;:\\\"".[\]\ ]+)|(\""[^\r\""]+\""))((\.[^()<>@,;:\\\"".[\]\ ]+)|(\.\""[^\r\""]+\""))*@((([a-zA-Z0-9\-]+\.)*([a-zA-Z0-9][a-zA-Z0-9\-]+)*[a-zA-Z0-9]+\.[a-zA-Z]{2,})|(\[(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d?)(\.(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d|\d)){2}(\.(25[0-4]|2[0-4]\d|1\d{2}|[1-9]\d?)))\])$/
	return re.test(s)
}

function isInt(o,s){
	var validChar = "0123456789";
	if(!isCharsInBag(o.value,validChar)){
		o.focus();
		alert(s);
		return false;
	}
	return true;
}

function isNumeric(obj,s){
	if (isNaN(obj.value)){
		obj.value='';
		obj.focus();
		alert(s);
	}
}

 function isUserName(s){
 	var errorChar;
	var badChar = "><,[]{}?/+=|\\'\":;~!#$%()`"; 
 	if (isEmpty(s))	{
 		return false;
 	}
    if ((s.length<3)||(s.length>18)) {
	   	alert("2<Code<18");
 		return false;
    }
   	if(isWhitespace(s)){
		alert("Whitespace Error");	
		return false;
	}
	errorChar = isCharsInBagEx( s, badChar)
   	if (errorChar != "" ){
		alert(s+" invalid,\n\n" + badChar + " is bad Char!\n\n" );
		return false;
	} 	
	return true;
}

function SelfWindow(s){
	document.location.href=s;
}

function SelfWindowConfirm(s,mess){
	if(window.confirm(mess)){
		document.location.href=s;
	}
}

function NewWindow(url,windowName,width,height) {
	var windowFeature="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
	if (width!=null && height!=null) windowFeature="width="+width+",height="+height+","+windowFeature;
	if (windowName==null) windowName="_blank";
	var windowHandle = window.open(url, windowName, windowFeature);
	windowHandle.focus();
}

function newBrowse(url,windowName,width,height){
	if (window.showModelDialog){
		var windowFeature="status=no;scrollbars=yes,resizable=yes;help=no;edge=raised";
		if (width!=null && height!=null) windowFeature="dialogWidth="+width+"px,dialogHeight="+height+"px,"+windowFeature;
		if (windowName==null) windowName="_blank";
		var windowHandle = window.showModelDialog(url,windowName,windowFeature);
		windowHandle.focus();
	}
	else{
		var windowFeature="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
		if (width!=null && height!=null) windowFeature="width="+width+",height="+height+","+windowFeature;
		if (windowName==null) windowName="_blank";
		var windowHandle = window.open(url, windowName, windowFeature);
		windowHandle.focus();
	}
}

function CheckFormData(o,ary_field,ary_alert){
	for(var i=0;i<ary_field.length;i++){
		for(j=0;j<o.length;j++){
			if(o[j].name==ary_field[i]){
				if (isEmpty(o[j].value)){
					o[j].focus();
					alert(ary_alert[i]);
					return false;
					break;
				}
			}
		}
	}
	//o.submit();
	return true;
}

function CheckAll(o){
	for (var i=0;i<o.elements.length;i++){
		var e = o.elements[i];
		if (e.name != 'chkall')
			e.checked = o.chkall.checked;
	}
}

function GetText(o){
	var i=0;
	var str="";
	for (i=0;i<o.elements.length;i++){
		if (o.elements[i].type=="checkbox") {
			if (o.elements[i].checked==true&&o.elements[i].name != "chkall") 
				if ((str.length==0) || (str==null))
					str+=o.elements[i].value;
				else
					str+=","+o.elements[i].value; 
		}
	}
	return (str);
}

function CheckFlash(){
	var hasflash=false;
	if(navigator.plugins && navigator.plugins.length){
		for(var ii=0;ii<navigator.plugins.length;ii++){
			if(navigator.plugins[ii].name.indexOf('Shockwave Flash')!=-1){hasflash=true;break;}
		}
	}
	else if(window.ActiveXObject){
		for (var ii=10;ii>=2;ii--){
			try{
				var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
				if(fl){hasflash=true; break; }
			}
		catch(e) {}
		}
	}
	return hasflash;
}

function CreateRND(low,high){with (Math){return (floor(random() * (1 + high - low) + low));}}

/*
'-------------------------------Begin----------------------------------------------
' Projectname: DisplayPageCount
' Filename: DisplayPageCount
' File version: v1.0
' Author : LittleYu.com
' Start date: 2000-5-28
' LastEdit date : 2006-1-1
' Purpose :  
' Include file : no
' Input parameters :
'		CurrentPage-----------
'		TotalPage-------------
'		StrUrl--------
' -------------------------------End-----------------------------------------------
*/
function DisplayPageCount(CurrentPage,TotalPage,StrUrl){
	var i ;
	var strHref ;
	if (StrUrl.indexOf("?")<0)
		strHref="?Page=" ;
	else
		strHref = StrUrl + "&Page=" ;
	if (parseInt(TotalPage)<1) return;
	if (CurrentPage<1) CurrentPage=1;
	if (CurrentPage>TotalPage) CurrentPage=TotalPage;
	if (CurrentPage > 1){
		document.write ("<a href='" + strHref + "1'><font face='webdings' title=''>9</font></a>&nbsp;");
		document.write ("<a href='" + strHref + (TotalPage-1) +"'><font face='webdings' title=''>7</font></a>&nbsp;");
	}
	else{
		document.write ("<font face='webdings' title=''>9</font>&nbsp;") ;
		document.write ("<font face='webdings' title=''>7</font>&nbsp;") ;
	}

	if (TotalPage <= 15){
		for (i=1; i<=TotalPage; i++){
			if (i!=CurrentPage) document.write ("<a href='" + strHref + i + "' class='p_num'>"+i+"</a>&nbsp;")
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;") ;
		}

	}
	else{
		if (CurrentPage<9){
			for (i=1; i<=15; i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"' class='p_num'>"+i+"</a>&nbsp;");
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;");
			}
			document.write ("... ");
		}
		if (CurrentPage>TotalPage-8){
			document.write ("... ");
			for (i=TotalPage-15;i<=TotalPage;i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"'>"+i+"</a>&nbsp;");
			else document.write ("["+i+"]&nbsp;");
			}
		}

		if (CurrentPage-7>0 && CurrentPage+7<TotalPage && CurrentPage>8 && CurrentPage<TotalPage-7){
			document.write ("... ");
			for (i=CurrentPage-7;i<=CurrentPage+7;i++){
			if (i!=CurrentPage) document.write ("<a href='"+strHref+i+"'>"+i+"</a>&nbsp;");
			else document.write ("<a class='p_curpage'>["+i+"]</a>&nbsp;");
			}
			document.write ("... ");
		}
	}
	if (CurrentPage<TotalPage){
		document.write ("<a href='"+ strHref + (CurrentPage+1) +"'><font face='webdings' title=''>8</font></a>");
		document.write ("<a href='"+ strHref + (TotalPage) +"'><font face='webdings' title=''>:</font></a>");
	}
	if (TotalPage>0) document.write ("  &nbsp;&nbsp;&nbsp;<font color='#FF0000'>"+ CurrentPage +"</font>/"+TotalPage+"");
	document.write ('<input style="border:1px solid #808080;font-size:9pt;width:25px;" type="text" id="GotoPages" name="GotoPages" size="1" value="">');
	document.write ('<input style="border:1px solid #808080;font-size:9pt;" type="button" value="Go" onclick="gotoPage(\''+strHref+'\');">');
}

function gotoPage(u){var p;if (document.getElementById('GotoPages')){p=document.getElementById('GotoPages').value;if (isNaN(p)){ return;}if(p==""){return;}}else{p="1";}document.location.href=u+p;}

function showSeleColor(){
var c=new Array('#ffffff','#FAFBE6','#FFF2E2','#FDE6E0','#F3FFE1','#DAFAFE','#E9EBFE','#EAEAEF','#9DFF9D');
if(readCookie("newsColor")!=""){document.getElementById('newcnt').style.backgroundColor=readCookie("newsColor");}
for (var i=0;i<c.length-1;++i){document.write('<button style="margin-right:2px;;height:15px;width:15px;border:1px solid #cccccc;;background-color:'+c[i]+'" onclick="javascript:document.getElementById(\'newcnt\').style.backgroundColor=\''+c[i]+'\';writeCookie(\'newsColor\',\''+c[i]+'\',24000);">&nbsp;</button> ');}}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
//    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v=='hide')?'none':v; }
//    obj.visibility=v; }
    obj.display=v; }
}

function showObject(o){
	MM_findObj(o).style.display="block";
}
//-->

