
var onButton=function(options){
	var li = $(options.li);
	var cont = $(options.cont);
	$tag(li.parentNode,"LI")._each(
		function(button){
			if(button.id && button.id == li.id){
				button.className = options.onbut;
			}
			else{
				button.className = options.outbut;
			}
		}
	);
	//alert($$('#'+cont.parentNode.id+' div[class~="'+options.css+'"]'));
	$$('#'+cont.parentNode.id+' div[class~="'+options.css+'"]')._each(
		function(content){
			if(content.id && content.id == cont.id){
				content.style.display = "block";
			}
			else{
				content.style.display = "none";
			}
		}
	);
};
var index;
if(!index) index={};
index.userlogin=function(){
	if(!index.usercheck()){return(false);}
	ajax.update({method:"POST",form:"userlogin",action:"ParaUserLogin.asp"});
};
index.userchecklogin=function(){
	ajax.update({action:"ParaUserLoginCheck.asp"});
};
index.usercheck=function(){
	var uid=$F("userid");
	var upass=$F("userpassword");
	if (isNull(uid) || !uid.isInt()){
		alert("请正确输入用户ID号");
		$("userid").focus();
		return(false);
	}
	if (isNull(upass) || !uid.isNumberLowercase()){
		alert("请正确输入用户密码");
		$("userpassword").focus();
		return(false);
	}
	return(true);
};
index.bus={
	config:{
		bustab:"newbusiness",
		tds:[],
		on:"newBusinessTdOn",
		out:"newBusinessTdOut",
		content:"newBusinessTdContent",
		//path:"g4aha4abaXaVaQa4adajagQajaRa4aXagadaCaXa1aSaUaja1a1aGaSa1adaT4a1aVaza4akadaSafaUaZ",
		path:"/ajaxupdate/defaultBusinessList.asp",
		initcontent:false,
		count:0,
		update:1,
		stop:false,
		time:5000,
		timer:null
	},
	contentmouseover:function(){index.bus.config.stop=true;},
	mouseover:function(){
		var obj=document.This();
		index.bus.config.stop=true;
		if(index.bus.config.timer!=null){window.clearTimeout(index.bus.config.timer);}
		if(obj.tagName!="TD"){obj=Event.findElementExt(obj,"TD");}
		try{var number=parseInt(obj.id.replace(/BUS(\d)/,"$1"));}catch(e){index.bus.outrun();return;}
		index.bus.config.tds.each(function(object,index_){if(number==index_){object.obj.className=index.bus.config.on;}else{object.obj.className=index.bus.config.out;}});
		index.bus.changehtml(number);
	},
	mouseout:function(){index.bus.config.stop=false;},
	outrun:function(){
		if(!index.bus.config.stop){
			if(index.bus.config.count>=index.bus.config.tds.length){index.bus.config.count=0;}
			index.bus.play(index.bus.config.count);
		}
		else{
			if(index.bus.config.timer!=null){window.clearTimeout(index.bus.config.timer);}
			index.bus.config.timer=window.setTimeout(index.bus.outrun,index.bus.config.time);
		}
		return;
	},
	play:function(n){
		index.bus.config.tds.each(function(object,index_){if(n==index_){object.obj.className=index.bus.config.on;}else{object.obj.className=index.bus.config.out;}});
		index.bus.config.count++;
		index.bus.coutent(index.bus.config.tds[n].number);
	},
	coutent:function(action){//每更新15次后重新刷新数据
		//if(!index.bus.config.initcontent || (index.bus.config.update%15)==0){new ajax.update({method:"GET",action:index.bus.config.path,encrypt:true,finish:function(){index.bus.config.initcontent=true;para.index.bus.changehtml(action);}});}
		//else{para.index.bus.changehtml(action);}
		index.bus.changehtml(action);
	},
	changehtml:function(action){
		//index.bus.config.update++;
		//$T(index.bus.config.content,e.getHtml("BUSCONT"+action));
		$tag("newBusinessTdContent","UL")._each(
			function(ul){
				if(ul.id && ul.id == ("newbusiness"+action)){
					ul.className="open";
				}
				else{
					ul.className="close";
				}
			}
		);
		index.bus.config.timer=window.setTimeout(index.bus.outrun,index.bus.config.time);
	},
	init:function(){
		var tdid;
		$tag(index.bus.config.bustab,"TD").each(function(td){if(td.id.indexOf("BUS")>=0){tdid=parseInt(td.id.replace(/BUS(\d)/,"$1"));index.bus.config.tds.push({obj:td,number:tdid});}});
		index.bus.config.tds.each(function(object){Event.observe(object.obj.id.toString(),"mouseover",index.bus.mouseover);Event.observe(object.obj.id.toString(),"mouseout",index.bus.mouseout);});
		 Event.observe(index.bus.config.content,"mouseover",index.bus.contentmouseover);
		 Event.observe(index.bus.config.content,"mouseout",index.bus.mouseout);
		//index.bus.config.path=unscript(index.bus.config.path);
		index.bus.config.path=index.bus.config.path;
		index.bus.outrun();
	}
};
//bus-end
index.slide={};
index.slide.lable = Class.create(); //标签滑动门效果
index.slide.lable.prototype={
	initialize:function(options){
		this.ele                 = options.element!=null?options.element:"";
		this.tag                 = options.tag!=null?options.tag:"";
		this.reg                 = options.reg!=null?options.reg:("").reg("");
		this.str                 = options.contIDstring!=null?options.contIDstring:"";
		this.css                 = options.overcss!=null?options.overcss:"";
		this.event               = options.event!=null?options.event:"";
		this.duration            = options.duration!=null?options.duration:100;
		this.open                = options.open !=null?options.open :"";
		this.height              = options.height !=null?options.height :"";
		this.velocity            = 10;
		this.count               = 0;
		this.run                 = false;
		this.on                  = null;
		this.init();
	},
	init:function(){
		if(isNull(this.ele) || isNull(this.tag) || isNull(this.str)){return;}
		var This=this;
		$tag(this.ele,this.tag).each(function(ele){Event.observe(ele,This.event,This.onfocus.bind(This));});
		This=null;
		if(!isNull(this.open)){
			this.open=$(this.open);
			this.open.className=this.css;
			this.on=$(this.str+this.open.id.replace(this.reg,"$1"));
			//e.opened(this.on);
			//this.on.show();
			//e.setStyle(this.on,"height","1px");
			this.on.setStyle({display:"block",height:'1px'});
			this.move();
		}
	},
	onfocus:function(){
		var obj=document.This();
		if(isNull(obj)){return;}
		if(!obj.tagName || obj.tagName!=this.tag){
			//obj=Event.findElement(obj,this.tag);
			obj=obj.parentNode;
			}
		var id=obj.id;
		var idnumber=id.replace(this.reg,"$1");
		if(!isNull(this.open)){
			if(id==this.open.id){return;}
			else{
				this.open.className="";
				//e.closed(this.str+this.open.id.replace(this.reg,"$1"));
				//$(this.str+this.open.id.replace(this.reg,"$1")).hide();
				$(this.str+this.open.id.replace(this.reg,"$1")).setStyle({display:"none"});

			}
		}
		this.open=obj;
		obj.className=this.css;
		this.on=$(this.str+idnumber);
		//e.opened(this.on);
		//this.on.show();
		//e.setStyle(this.on,"height","1px");
		this.on.setStyle({display:"block",height:'1px'});
		this.move();
	},
	move:function(){
		this.count+=this.velocity;
		this.on.style.height=this.count+"px";
		if(this.count>this.height){
			this.count=0;
			this.on.style.height=this.height+"px";
			window.clearTimeout(timer);
		}
		else{
			timer=window.setTimeout(this.move.bind(this),this.duration);
		}
	}
};
index.video={
	con:{width:185,height:157,userid:[],title:[],url:[],pic:[],hit:[]},
	init:function(){
		//var rnd = (0).rand(1);
		var rnd = (0);
		var html = this.FlvHtml({width:this.con.width,height:this.con.height,movie:this.con.url[rnd],image:this.con.pic[rnd]});
		$("videoplayer").innerHTML=html;
		$("videoplayerstate").innerHTML="<strong>&nbsp;正在播放：</strong><a href=\"http://"+(this.con.userid[rnd])+".parajx.com\" target=\"_blank\">"+(this.con.title[rnd])+"</a>（<span id=\"videoplayercount\">"+(this.con.hit[rnd])+"</span>）";
		var html  = "";
		var This = this;
		html += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
		this.con.userid.each(function(uid,id){
			html += "<tr><td><img alt=\""+This.con.title[id]+"\" src=\""+This.con.pic[id]+"\" width=\"88\" height=\"31\" border=\"0\" class=\"hand border\" onclick=\"javascript:index.video.play("+id+");\" /></td></tr>";
		});
		html += "</table>";
		//$("videoplaylist").innerHTML=html;
		This = null;
		html = null;
	},
	play:function(id){
		var html = this.FlvHtml({width:this.con.width,height:this.con.height,movie:this.con.url[id],image:this.con.pic[id]});
		$("videoplayer").innerHTML=html;
		$("videoplayerstate").innerHTML="<strong>&nbsp;正在播放：</strong><a href=\"http://"+(this.con.userid[id])+".parajx.com\" target=\"_blank\">"+(this.con.title[id])+"</a>（<span id=\"videoplayercount\">"+(this.con.hit[id])+"</span>）";
	},
	FlvHtml:function(options){
		var reval  = "";
		reval += "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" height=\""+options.height+"\" width=\""+options.width+"\" align=\"center\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">";
		reval += "<param name=\"FlashVars\" value=\"file="+options.movie+"&image="+options.image+"&autostart=true&repeat=false\" />";
		reval += "<param name=\"Movie\" value=\"http://www.parajx.com/public/player/flv.swf\" />";
		reval += "<param name=\"Src\" value=\"http://www.parajx.com/public/player/flv.swf\" />";
		reval += "<param name=\"WMode\" value=\"Window\" />";
		reval += "<param name=\"Play\" value=\"1\" />";
		reval += "<param name=\"Loop\" value=\"0\" />";
		reval += "<param name=\"Quality\" value=\"High\" />";
		reval += "<param name=\"SAlign\" value=\"LT\" />";
		reval += "<param name=\"Menu\" value=\"0\" />";
		reval += "<param name=\"Scale\" value=\"NoScale\" />";
		reval += "<param name=\"DeviceFont\" value=\"0\" />";
		reval += "<param name=\"EmbedMovie\" value=\"0\" />";
		reval += "<param name=\"BGColor\" value=\"000000\" />";
		reval += "<param name=\"SeamlessTabbing\" value=\"1\" />";
		reval += "<param name=\"Profile\" value=\"0\" />";
		reval += "<param name=\"ProfilePort\" value=\"0\" />";
		reval += "<param name=\"AllowNetworking\" value=\"all\" />";
		reval += "<param name=\"AllowFullScreen\" value=\"true\" />";
		reval += "<embed type=\"application/x-shockwave-flash\" src=\"http://www.parajx.com/public/player/flv.swf\" width=\""+options.width+"\" height=\""+options.height+"\" style=\"margin:0px;\" align=\"center\" wmode=\"Window\" play=\"true\" loop=\"True\" quality=\"high\" menu=\"false\" scale=\"noscale\" devicefont=\"false\" embedmovie=\"false\" bgcolor=\"#000000\" seamlesstabbing=\"true\" profile=\"false\" profileport=\"false\" allownetworking=\"all\" allowfullscreen=\"true\" flashvars=\"file="+options.movie+"&image="+options.image+"&autostart=true&repeat=false\"></embed>";
		reval += "</object>";
		return(reval);
	}
};
