var Class = {
  create: function() {
    return function() {
      this.init.apply(this, arguments);
    }
  }
}

Array.prototype.unique = function()
{
var a = {}; for(var i=0; i<this.length; i++)
{
if(typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for(var i in a)
this[this.length] = i;
return this;
}

String.prototype.trim = function()   
{
return this.replace(/(^\s*)|(\s*$)/g,"");   
}

function CheckObj(obj)
{
    if(!obj)return false;
    if(obj===undefined)return false;
    if(obj==null)return false;
    return true;    
}
var $debuger_allow=false;//true
function $debuger()
{
	if(!$debuger_allow)
	{
		return;
	}
	var reval  = "";
	reval += "<table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">";
	reval += "  <tr>";
	reval += "    <td>JAVASCRIPT DEBUGER IN PAGE </td>";
	reval += "  </tr>";
	reval += "  <tr>";
	reval += "    <td align=\"left\" valign=\"top\" bgcolor=\"#FFFFFF\"><textarea name=\"___jsdebug_text\" cols=\"50\" rows=\"10\" id=\"___jsdebug_text\"></textarea>";
	reval += "      <br />";
	reval += "      <input type=\"checkbox\" id=\"___jsdebug_istry\" value=\"1\" />";
	reval += "    TRY MODE ";
//	reval += "      <input type=\"checkbox\" id=\"___jsdebug_iswrite\" value=\"1\" />";
//	reval += "    WRITE MODE ";
	reval += "    <input type=\"button\" id=\"___jsdebug_run\" value=\"RUN\" onclick=\"javascript:$debuger_run()\"/></td>";
	reval += "  </tr>";
	reval += "</table>";
	document.write(reval);
}

function $debuger_run()
{
	if(!$debuger_allow)
	{
		return;
	}
	var istryobj=document.getElementById("___jsdebug_istry");
	var iswriteobj=document.getElementById("___jsdebug_iswrite");
	var textobj=document.getElementById("___jsdebug_text");
	var istry=false;
	var iswrite=false;
	if(!istryobj)
	{
		alert("Get istry error");
		return;
	}
	else
	{
		if(istryobj.checked)
		{
			istry=true;
		}
		else
		{
			istry=false;
		}
	}
	
//	if(!iswriteobj)
//	{
//		alert("Get iswrite error");
//		return;
//	}
//	else
//	{
//		if(iswriteobj.checked)
//		{
//			iswrite=true;
//		}
//		else
//		{
//			iswrite=false;
//		}
//	}

	if(!textobj)
	{
		alert("Get text error");
		return;
	}
	
//    var tempObj;
//    if(iswrite)
//	{
//	    tempObj=document.createElement("script");
//	    tempObj.language="javascript"
//	    tempObj.innerHTML=textobj.value;
//	    document.body.appendChild(tempObj);
//	    return;
//	}
	
	if(istry)
	{
		try
		{
			window.eval(textobj.value);
		}
		catch(ex)
		{
			alert(ex);
		}
	}
	else
	{
		window.eval(textobj.value);
	}
}

function $getintf(s,f)
{
    var r=$getstr(s).replace(f,"");
    return $getint(r);
}
function $getint(s)
{
    try
    {
        var d=parseInt(s);
        var r=d+0;
        r=parseInt(r);
        if(d==r)
            return d;
        else
            return 0;
    }
    catch(ex)
    {
        return 0;
    }
}

function $getstr(s)
{
    try
    {
        return s+"";
    }
    catch(ex)
    {
        return "";
    }
}

function $gettext(s)
{
    try
    {
        var obj=$ce("div");
        obj.innerHTML=s;
        return obj.innerTEXT;
        obj=null;
    }
    catch(ex)
    {
        return " ";
    }
}

function $e(id)
{
	try
	{
		return 	$('#'+id).get(0);
	}
	catch(e)
	{
		return document.getElementById(id);
	}
}

function GetStrInArray(str,sp,d)
{
	var arr=str.split(sp);
	if(d<arr.length)return arr[d];
	else return "";
}

function JsLoader(){
  this.load=function(url){
  var ss=document.getElementsByTagName("script");  
  for(i=0;i<ss.length;i++)
  {   
    if(ss[i].src && ss[i].src.indexOf(url)!=-1)
    {   
      this.onsuccess(); 
      return;   
    }
  }
  s=document.createElement("script");  
  s.src=url.replace("&","&");
  
  var head=document.getElementsByTagName("head")[0];  
  head.appendChild(s);
  var self=this;
  s.onload=s.onreadystatechange=function()
  {   
  if(this.readyState && this.readyState=="loading")
    return;   
    self.onsuccess();  
  }
  s.onerror=function(){
  head.removeChild(s);   
  self.onfailure();  } 
  };
  this.onsuccess=function(){}; 
  this.onfailure=function(){};
}
  
function LoadJs(jspath,onsu,onfa)
{
var jl=new JsLoader();
if(onsu!=null)jl.onsuccess=onsu;
if(onfa!=null)jl.onfailure=onfa;
jl.load(unescape(jspath));
}

function CPos(x, y)
{
    this.x = x;
    this.y = y;
}

function GetObjPos(ATarget)
{
    var target = ATarget;
    var pos = new CPos(target.offsetLeft, target.offsetTop);
    
    var target = target.parentElement;
    while (target)
    {
        pos.x += target.offsetLeft;
        pos.y += target.offsetTop;
        
        target = target.parentElement
    }
    
    return pos;
}

function getPageSize(){//这个函数返回一个长度为四的数组{页面宽，页面高，窗口宽，窗口高}
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) { 
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){// all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var pageWidth,pageHeight,windowWidth,windowHeight;
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	} 
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){ 
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function $ce(etype,evalue)
{
	var eobj=document.createElement(etype);
	if(evalue)eobj.innerHTML=evalue;
	return eobj;
}
function $cdiv(ev)
{
	if(ev) return $ce("div");
	else return $ce("div",ev);
}
function $cspan(ev)
{
	if(ev) return $ce("span",ev);
	else return $ce("span");
}

var GetRandomNumObj={};
GetRandomNumObj.today=new Date(); 
GetRandomNumObj.seed=GetRandomNumObj.today.getTime(); 
function GetRandomNumHelper() { 
	GetRandomNumObj.seed = (GetRandomNumObj.seed*9301+49297) % 233280; 
	return GetRandomNumObj.seed/(233280.0); 
}
function GetRandomNum(num) {
	if(num)return Math.ceil(GetRandomNumHelper()*num);
	else return Math.ceil(GetRandomNumHelper()*100000000);
}

function PageADTimer(areaid)
{
	var area=$(areaid);
	var obj;
	if(area.childNodes.length<1)return;
	obj=area.childNodes[0];
	if(obj.tagName.toLowerCase()!='img')return;
	obj.onLoad=PageADTimerOpen(areaid,5);
}

function PageADTimerOpen(areaid,sc)
{
	eval("ADTimer_"+$(areaid).id+"=window.setInterval(\"PageADTimerClose('"+$(areaid).id+"')\",sc*1000);");
}
function PageADTimerClose(areaid)
{
	$(areaid).style.display='none';
	window.clearInterval(window.eval("ADTimer_"+$(areaid).id));
}

function FlashNews(areaid,tempjs,nwidth,nheight,ntitle)
{
	try{eval(tempjs);}
	catch(ex){$e(areaid).innerHTML='';return false;}
	var so = new SWFObject("/images/focus.swf", "nPageFlashNews", nwidth, nheight, "7", "#ffffff");
	so.addParam('wmode','transparent');
	so.addVariable("picurl",tempfile);
	so.addVariable("pictext",temptext);
	so.addVariable("piclink",templink);
	so.addVariable("pictime","5");
	so.addVariable("borderwidth",nwidth);
	so.addVariable("borderheight",nheight);
	so.addVariable("borderw","false");
	so.addVariable("buttondisplay","true");
	so.addVariable("textheight",ntitle);
	so.write(areaid);
}

var LoadShowImg=true;
var LoadShowImgUrl="/images/page_loading.gif";

$.ajaxSetup({global: false,type:"GET",async:false});

function LoadPart(name,oncomplated)
{
	var objid="LoadPart_"+GetRandomNum(1000000);
	var objurl = "/getjs/getpartjs.aspx?part="+name;
	if(LoadShowImg)
		document.write("<div id=\""+objid+"\"><img border=0 src="+LoadShowImgUrl+"></div>");
	else
		document.write("<div id=\""+objid+"\"></div>");
	var LoadPartJs_request;
	if(oncomplated)
	{
		$.ajax({url:objurl,success:function(rpt){$('#'+objid).html('');oncomplated(objid,rpt)}});
	}
	else
	{
		$('#'+objid).load(objurl);
	}
}

function LoadUc(path,oncomplated)
{
	var objid="LoadUc_"+GetRandomNum(1000000);
	var objurl = "/getjs/getucjs.aspx?file="+path;
	if(LoadShowImg)
		document.write("<div id=\""+objid+"\"><img border=0 src="+LoadShowImgUrl+"></div>");
	else
		document.write("<div id=\""+objid+"\"></div>");
	if(oncomplated)
	{
		$.ajax({url:objurl,success:function(rpt){$('#'+objid).html('');oncomplated(objid,rpt)}});
	}
	else
	{
		$('#'+objid).load(objurl);
	}
}

function LoadPage(path)
{
	var objid="LoadPage_"+GetRandomNum(1000000);
	document.write("<div id=\""+objid+"\"></div>");
	$('#'+objurl).load(path);
}

function fillImg(img,w,h,fill)
{
	try
	{
        var imageArr=img;
        var maxWidth=w;
        var maxHeight=h;
	    imageArr.style.display="";
        var imageRate = imageArr.offsetWidth / imageArr.offsetHeight;    
        
    	
        if(imageArr.offsetWidth > maxWidth)
        {
            imageArr.style.width=maxWidth + "px";
            imageArr.style.Height=maxWidth / imageRate + "px";
        }
	    else
	    {
		    if(fill==0)
		    {
			    imageArr.style.width=maxWidth + "px";
			    imageArr.style.Height=maxWidth / imageRate + "px";		
		    }
	    }
        
        if(imageArr.offsetHeight > maxHeight)
        {
            imageArr.style.width = maxHeight * imageRate + "px";
            imageArr.style.Height = maxHeight + "px";
        }
	    else
	    {
		    if(fill==1)
		    {
			    imageArr.style.width = maxHeight * imageRate + "px";
			    imageArr.style.Height = maxHeight + "px";
		    }
	    }
	}
	catch(ex)
	{
	    $(img).css("display","none");
	}
}

function autoImg(img,w,h)
{
    var imageArr=img;
    var maxWidth=w;
    var maxHeight=h;
    if(imageArr.style.display)
    {imageArr.style.display="";}
    var imageRate = imageArr.offsetWidth / imageArr.offsetHeight;    
    
    if(imageArr.offsetWidth > maxWidth)
    {
        imageArr.style.width=maxWidth + "px";
        imageArr.style.Height=maxWidth / imageRate + "px";
    }
    
    if(imageArr.offsetHeight > maxHeight)
    {
        imageArr.style.width = maxHeight * imageRate + "px";
        imageArr.style.Height = maxHeight + "px";
    }

    if(!CheckObj($(img).parent().attr("href")) || $(img).parent().attr("href")=="")
    {
    	img.style.cursor='hand';
    	img.alt='点击查看大图';
    	img.onclick=Function("window.oper=null;window.open(this.src)");
    }	
}
FixImgWidth=autoImg

var autoImage_Count=0;
function autoImage(spath,w,h)
{
    var stemp="<img id=\"autoImageObjLoad{lid}\" src=\"/images/page_loading.gif\" border=\"0\">";
    stemp=stemp.replace("{lid}",autoImage_Count);
    //project
    stemp+="<img id=\"autoImageObj{id}\" src=\"{path}\" border=\"0\" style=\"display:none;width:{width};height:{height}\" onLoad=\"javascript:autoImg(this,{w},{h})\">";
    stemp=stemp.replace("{id}",autoImage_Count);
    stemp=stemp.replace("{path}",spath);
    stemp=stemp.replace("{width}",w);
    stemp=stemp.replace("{height}",h);
    stemp=stemp.replace("{w}",w);
	stemp=stemp.replace("{h}",h);
    document.write(stemp);
    autoImage_Count+=1;
}

function autoImgsl(spath,slink,w,h)
{
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+w+"\" height=\""+h+"\"><param name=\"movie\" value=\"/images/swfoto.swf?image="+spath+"&imageLink="+slink+"\"><embed src=\"/images/swfoto.swf?image="+spath+"&imageLink="+slink+"\" width=\""+w+"\" height=\""+h+"\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed></object>");
}

var site_url="http://www.gyssw.com.cn/";
var site_name="广西公益诉讼网";
function setHomePage(obj)
{
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(site_url);
return false;
}
function setFavorite()
{
	window.external.AddFavorite(site_url,site_name);
}


function openWin(url)
{
	window.oper=null;
	window.open(url);
}

function startchat()
{
	openZoosUrl('chatwin');
	return false;
}

function fixContentImg(objname)
{
	var imgObj;
	var contentObj=document.getElementById(objname);
	if(contentObj) fixContentImgDo(contentObj);	
}

function fixContentImgDo(cobj)
{
	var imgObj;
	var contentObj=cobj
	for(i = 0; i < contentObj.childNodes.length; i++)
	{
		imgObj = contentObj.childNodes[i];
		if(imgObj.hasChildNodes())fixContentImgDo(imgObj);
		if(!imgObj)continue;
		if(!imgObj.tagName)continue;
		if(imgObj.tagName.toLowerCase()=="img")
		{
			if (imgObj.width >500)
			{ 
				autoImg(imgObj,500,1000);
				imgObj.style.cursor='hand';
				imgObj.alt='点击查看大图';
				imgObj.onclick=Function("window.oper=null;window.open(this.src)");
			} 
		}
	}	
}

fontobj="fontset";
function setfontas(obj,size)
{
	$('#'+obj).css("font-size",size);
}

function DataTimePicker(obj)
{
	new WdatePicker(obj,'%Y-%M-%D %h:%m',true,'default');	
}

function DataPicker(obj)
{
	new WdatePicker(obj,'%Y-%M-%D',true,'default');	
}

//var tab1_on=1;
//var tab1_num=2;
//var tab1_name="tab1";
//tab_init("tab1");
//
//t:tab1_t1 c:tab1_c1
//onclick="tab_chg(tab1_name,2)"
//css:tab1_t_on tab1_t_off
function tab_chgfs(pre,cre,d,fs)
{
    tab_chg(pre,cre,d);
    if(fs)
    {
        fs();
    }
}
function tab_chg(pre,cre,d)
{
	var dt=document.getElementById(pre+"_t"+d);
	var dto=document.getElementById(pre+"_t"+eval(pre+"_on+0"));
	var dc=document.getElementById(pre+"_c"+d);
	var dco=document.getElementById(pre+"_c"+eval(pre+"_on+0"));
	if(dt && dto)
	{
		dto.className=cre+"_off";
		dt.className=cre+"_on";			
		dco.style.display="none";
		dc.style.display="block";			
		eval(pre+"_on="+d);
	}
}
function tab_init(pre,cre)
{
	var i;
	var dt,dc
	for(i=1;i<=eval(pre+"_num+0");i++)
	{
		dt=document.getElementById(pre+"_t"+i);
		dc=document.getElementById(pre+"_c"+i);
		if(!dt)
		{alert(pre+"_t"+i+" error!");return;}
		if(!dc)
		{alert(pre+"_c"+i+" error!");return;}
		if(eval(pre+"_on+0")==i)
		{
			dt.className=cre+"_on";
			dc.style.display="block";
		}
		else
		{
			dt.className=cre+"_off";			
			dc.style.display="none";
		}
	}
}

//ProjectWork


var linkobj=0;
function pageLink()
{
	if(linkobj!=0)
	{
		window.clearTimeout(linkobj)
		linkobj=0;
	}
	else
	{
	    return;
	}
	$("a").each(
		function()
		{
			linkobj=$(this);
			if(linkobj.attr("title")=="" || CheckObj(linkobj.attr("title"))==false)
			{
			    linkobj=linkobj.html();
			    if(linkobj.indexOf("script")||linkobj.indexOf("img"))
			    {return;}
			    linkobj.attr("title",linkobj.html());
			}
			linkobj=$(this);
			if(linkobj.attr("target")=="" || CheckObj(linkobj.attr("target"))==false)
			{
			    linkobj.attr("target","_blank");
			}
		}
	);
}

function MainAreaS3_fs()
{
	$("img","#MainAreaS3_c"+MainAreaS3_on).each(
		function()
		{
			if(this)
			{autoImg(this,125,105);}
		}
	);
}

var $pageinit_timer=0;
function $pageInit()
{
	var pagesize=getPageSize();
	window.pageWidth=pagesize[0];
	window.pageHeight=pagesize[1];
	window.windowWidth=pagesize[2];
	window.windowHeight=pagesize[3];
	$pageinit_timer=window.setTimeout($pageExec,1000);
	//project
	linkobj=window.setTimeout(pageLink,5000);
}
function $pageExec()
{
	if($pageinit_timer!=0)
	{
		window.clearTimeout($pageinit_timer);
		$pageinit_timer=0;
	}
	else
	{
	    return;
	}
	var tempObj=new Array();
	for(i=0;i<autoImage_Count;i++)
	{
	    $("#autoImageObjLoad"+i).remove();
	    tempObj[0]=$("#autoImageObj"+i);
	    tempObj[1]=tempObj[0].get(0);
	    if(CheckObj(tempObj[1]))
	    {
	        tempObj[2]=$getintf(tempObj[0].css("width"),"px");
	        tempObj[0].css("width","");
	        tempObj[3]=$getintf(tempObj[0].css("height"),"px");
	        tempObj[0].css("height","");
	        autoImg(tempObj[1],tempObj[2],tempObj[3])
	    }
	}
	$pageinit_timer=window.setTimeout($pageEnd,1000);
	//project
}
function $pageEnd()
{
	if($pageinit_timer!=0)
	{
		window.clearTimeout($pageinit_timer);
		$pageinit_timer=0;
	}
	else
	{
	    return;
	}
	var tempObj=new Array();
	for(i=0;i<autoImage_Count;i++)
	{
	    $("#autoImageObjLoad"+i).remove();
	    tempObj[0]=$("#autoImageObj"+i);
	    tempObj[1]=tempObj[0].get(0);
	    if(CheckObj(tempObj[1]))
	    {
	        tempObj[2]=$getintf(tempObj[0].css("width"),"px");
	        tempObj[0].css("width","");
	        tempObj[3]=$getintf(tempObj[0].css("height"),"px");
	        tempObj[0].css("height","");
	        autoImg(tempObj[1],tempObj[2],tempObj[3])
	    }
	}
	//project
}
$(document).ready(function(){$pageInit()});


//project
function ToDay()
{
	var today = new Date(); 
	var day; 
	if(today.getDay()==0) day = "星期日" 
	if(today.getDay()==1) day = "星期一" 
	if(today.getDay()==2) day = "星期二" 
	if(today.getDay()==3) day = "星期三" 
	if(today.getDay()==4) day = "星期四" 
	if(today.getDay()==5) day = "星期五" 
	if(today.getDay()==6) day = "星期六" 
	date1 = today.getYear() + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 "+day; 
	document.write(date1) ;
}


