// JavaScript Document
function flashpic(sObj, sPic, sLink)
{
	this.init = function()
	{		
		oObj			= document.getElementById(sObj);
		this.Obj		= oObj;
		oObj.SourceObj 	= this;
		this.picArr	 	= sPic.split("|");
		this.urlArr		= sLink.split("|");
		this.picObj		= new Array();
		this.adNum		= 0;
		this.theTimer	= null;
		this.Obj.onclick = new Function("this.SourceObj.openUrl();");	
	
	}
	
	this.setTransition = function()
	{
		if (document.all)
		{
			this.Obj.filters.revealTrans.Transition=Math.floor(Math.random()*23); 
			this.Obj.filters.revealTrans.apply(); 
		}
	}
	
	this.playTransition = function()
	{
		if (document.all) this.Obj.filters.revealTrans.play() 
	}
	this.playAd = function(n)
	{
		clearInterval(this.theTimer);
		if (n<this.picArr.length)
		{
			this.setTransition(); 
			this.Obj.src=this.picArr[n]; 
			this.playTransition();
		}		
		this.theTimer=setInterval("oObj.SourceObj.nextAd(oObj.SourceObj)", 5000);
	}
	this.nextAd = function(cur)
	{
		if(cur.adNum<cur.picArr.length-1) { cur.adNum++;  }
		else { cur.adNum=0; }
		cur.playAd(cur.adNum);
	} 

	this.openUrl = function()
	{
		sUrl=this.urlArr[this.adNum]; 
		if (sUrl != "") { window.open(sUrl, "_blank"); }
	}
	this.init();
	this.nextAd(oObj.SourceObj);
}


function movediv(sObj, sObj1, sObj2, sSpeed, sDirection)
{
	var self = this;	
	this.init = function()
	{
		this.speed = sSpeed;
		this.Obj	= document.getElementById(sObj);
		this.Obj1	= document.getElementById(sObj1);
		this.Obj2	= document.getElementById(sObj2);
		this.Obj2.innerHTML = this.Obj1.innerHTML;
		this.timer=setInterval(this.move, this.speed);		
		this.Obj.onmouseover=function() {clearInterval(self.timer)};
		this.Obj.onmouseout=function() {self.timer=setInterval(self.move, self.speed)};
	}
	
	this.move = function()
	{
		if (sDirection == 1) //向上
		{
			if(self.Obj2.offsetTop-self.Obj.scrollTop<=0) { self.Obj.scrollTop-=self.Obj1.offsetHeight; }
			else{self.Obj.scrollTop++; }
		}
		else if (sDirection == 2) // 向下
		{
			if(self.Obj1.offsetTop-self.Obj.scrollTop>=0) { self.Obj.scrollTop+=self.Obj2.offsetHeight; }
			else{self.Obj.scrollTop--; }
		}
		else if (sDirection == 3) // 向左
		{
			if(self.Obj2.offsetWidth-self.Obj.scrollLeft<=0) { self.Obj.scrollLeft-=self.Obj1.offsetWidth; }
			else{self.Obj.scrollLeft++;}
		}
		else if (sDirection == 4) // 向右
		{
			if(self.Obj.scrollLeft<=0) { self.Obj.scrollLeft+=self.Obj2.offsetWidth; }
			else{ self.Obj.scrollLeft--; }
		}
	}
	this.init();
}


var addrList	    = "00,不限;0000,;000000,;33,浙江;3301,杭州;330101,杭州市辖区;330102,上城区;330103,下城区;330104,江干区;330105,拱墅区;330106,西湖区;330108,滨江区;330122,桐庐;330127,淳安;330181,萧山区;330182,建德;330183,富阳;330184,余杭区;330185,临安;3302,宁波;330201,宁波市辖区;330203,海曙区;330204,江东区;330205,江北区;330206,北仑区;330211,镇海区;330225,象山;330226,宁海;330227,鄞州区;330281,余姚;330282,慈溪;330283,奉化;3303,温州;330301,温州市辖区;330302,鹿城区;330303,龙湾区;330304,瓯海区;330322,洞头;330324,永嘉;330326,平阳;330327,苍南;330328,文成;330329,泰顺;330381,瑞安;330382,乐清;3304,嘉兴;330401,嘉兴市辖区;330402,秀城区;330411,嘉兴市郊区;330421,嘉善;330424,海盐;330481,海宁;330482,平湖;330483,桐乡;3305,湖州;330501,湖州市辖区;330521,德清;330522,长兴;330523,安吉;3306,绍兴;330601,绍兴市辖区;330602,越城区;330621,绍兴县;330624,新昌;330681,诸暨;330682,上虞;330683,嵊州;3307,金华;330701,金华市辖区;330702,婺城区;330721,金华县;330723,武义;330726,浦江;330727,磐安;330781,兰溪;330782,义乌;330783,东阳;330784,永康;3308,衢州;330801,衢州市辖区;330802,柯城区;330821,衢县;330822,常山;330824,开化;330825,龙游;330881,江山;3309,舟山;330901,舟山市辖区;330902,定海区;330903,舟山普陀区;330921,岱山;330922,嵊泗;3310,台州;331001,台州市辖区;331002,椒江区;331003,黄岩区;331004,路桥区;331021,玉环;331022,三门;331023,天台;331024,仙居;331081,温岭;331082,临海;3325,丽水;332501,莲都区;332502,龙泉;332522,青田;332523,云和;332525,庆元;332526,缙云;332527,遂昌;332528,松阳;332529,景宁;31,上海;3101,上海市辖区;310101,黄浦区;310102,南汇区;310103,卢湾区;310104,徐汇区;310105,长宁区;310106,静安区;310107,上海普陀区;310108,闸北区;310109,虹口区;310110,杨浦区;310112,闵行区;310113,宝山区;310114,嘉定区;310115,浦东新区;310116,金山区;310117,松江区;3102,上海市县;310225,南汇;310226,奉贤;310229,青浦;310230,崇明;32,江苏;3201,南京;320101,南京市辖区;320102,玄武区;320103,白下区;320104,秦淮区;320105,建邺区;320106,南京鼓楼区;320107,下关区;320111,浦口区;320112,大厂区;320113,栖霞区;320114,雨花台区;320121,江宁;320122,江浦;320123,六合;320124,溧水;320125,高淳;3202,无锡;320201,无锡市辖区;320202,崇安区;320203,南长区;320204,北塘区;320211,无锡市郊区;320281,江阴;320282,宜兴;320283,锡山;3203,徐州;320301,徐州市辖区;320302,徐州鼓楼区;320303,云龙区;320304,九里区;320305,贾汪区;320311,泉山区;320321,丰县;320322,沛县;320323,铜山;320324,睢宁;320381,新沂;320382,邳州;3204,常州;320401,常州市辖区;320402,天宁区;320404,钟楼区;320405,戚墅堰区;320411,常州市郊区;320481,溧阳;320482,金坛;320483,武进;3205,苏州;320501,苏州市辖区;320502,沧浪区;320503,平江区;320504,金阊区;320511,苏州市郊区;320581,常熟;320582,张家港;320583,昆山;320584,吴江;320585,太仓;320586,吴县;3206,南通;320601,南通市辖区;320602,崇川区;320611,港闸区;320621,海安;320623,如东;320681,启东;320682,如皋;320683,通州;320684,海门;3207,连云港;320701,连云港市辖区;320703,连云区;320704,云台区;320705,新浦区;320706,海州区;320721,赣榆;320722,东海;320723,灌云;320724,灌南;3208,淮阴;320801,淮阴市辖区;320802,清河区;320811,清浦区;320821,淮阴县;320826,涟水;320829,洪泽;320830,盱眙;320831,金湖;320882,淮安;3209,盐城;320901,盐城市辖区;320902,盐城市城区;320921,响水;320922,滨海;320923,阜宁;320924,射阳;320925,建湖;320928,盐都;320981,东台;320982,大丰;3210,扬州;321001,扬州市辖区;321002,广陵区;321011,扬州市郊区;321023,宝应;321027,邗江;321081,仪征;321084,高邮;321088,江都;3211,镇江;321101,镇江市辖区;321102,京口区;321111,润州区;321121,丹徒;321181,丹阳;321182,扬中;321183,句容;3212,泰州;321201,泰州市辖区;321202,海陵区;321203,高港区;321281,兴化;321282,靖江;321283,泰兴;321284,姜堰;3213,宿迁;321301,宿迁市辖区;321302,宿城区;321321,宿豫;321322,沭阳;321323,泗阳;321324,泗洪;11,北京;12,天津;13,河北;1301,石家庄;1302,唐山;1303,秦皇岛;1304,邯郸;1305,邢台;1306,保定;1307,张家口;1308,承德;1309,沧州;1310,廊坊;1311,衡水;14,山西;1401,太原;1402,大同;1403,阳泉;1404,长治;1405,晋城;1406,朔州;1422,忻州;1423,吕梁;1424,晋中;1426,临汾;1427,运城;15,内蒙古;1501,呼和浩特;1502,包头;1503,乌海;1504,赤峰;1521,呼伦贝尔盟;1522,兴安盟;1523,哲里木盟;1525,锡林郭勒盟;1526,乌兰察布盟;1527,伊克昭盟;1528,巴彦淖尔盟;1529,阿拉善盟;21,辽宁;2101,沈阳;2102,大连;2103,鞍山;2104,抚顺;2105,本溪;2106,丹东;2107,锦州;2108,营口;2109,阜新;2110,辽阳;2111,盘锦;2112,铁岭;2113,朝阳;2114,葫芦岛;22,吉林;2201,长春;2202,吉林市;2203,四平;2204,辽源;2205,通化;2206,白山;2207,松原;2208,白城;2224,延边;23,黑龙江;2301,哈尔滨;2302,齐齐哈尔;2303,鸡西;2304,鹤岗;2305,双鸭山;2306,大庆;2307,伊春;2308,佳木斯;2309,七台河;2310,牡丹江;2311,黑河;2323,绥化;2327,大兴安岭;34,安徽;3401,合肥;3402,芜湖;3403,蚌埠;3404,淮南;3405,马鞍山;3406,淮北;3407,铜陵;3408,安庆;3410,黄山;3411,滁州;3412,阜阳;3413,宿州;3424,六安;3425,宣城;3426,巢湖;3429,池州;35,福建;3501,福州;3502,厦门;3503,莆田;3504,三明;3505,泉州;3506,漳州;3507,南平;3508,龙岩;3522,宁德;36,江西;3601,南昌;3602,景德镇;3603,萍乡;3604,九江;3605,新余;3606,鹰潭;3607,赣州;3622,宜春;3623,上饶;3624,吉安;3625,抚州;37,山东;3701,济南;3702,青岛;3703,淄博;3704,枣庄;3705,东营;3706,烟台;3707,潍坊;3708,济宁;3709,泰安;3710,威海;3711,日照;3712,莱芜;3713,临沂;3714,德州;3715,聊城;3723,滨州;3729,菏泽;41,河南;4101,郑州;4102,开封;4103,洛阳;4104,平顶山;4105,安阳;4106,鹤壁;4107,新乡;4108,焦作;4109,濮阳;4110,许昌;4111,漯河;4112,三门峡;4113,南阳;4114,商丘;4115,信阳;4127,周口;4128,驻马店;42,湖北;4201,武汉;4202,黄石;4203,十堰;4205,宜昌;4206,襄樊;4207,鄂州;4208,荆门;4209,孝感;4210,荆州;4211,黄冈;4212,咸宁;4228,恩施;43,湖南;4301,长沙;4302,株洲;4303,湘潭;4304,衡阳;4305,邵阳;4306,岳阳;4307,常德;4308,张家界;4309,益阳;4310,郴州;4311,永州;4312,怀化;4325,娄底;4331,湘西;44,广东;4401,广州;4402,韶关;4403,深圳;4404,珠海;4405,汕头;4406,佛山;4407,江门;4408,湛江;4409,茂名;4412,肇庆;4413,惠州;4414,梅州;4415,汕尾;4416,河源;4417,阳江;4418,清远;4419,东莞;4420,中山;4451,潮州;4452,揭阳;4453,云浮;45,广西;4501,南宁;4502,柳州;4503,桂林;4504,梧州;4505,北海;4506,防城港;4507,钦州;4508,贵港;4509,玉林;4521,南宁地区;4522,柳州地区;4524,贺州;4526,百色;4527,河池;46,海南;4601,海口;4602,三亚;50,重庆;51,四川;5101,成都;5103,自贡;5104,攀枝花;5105,泸州;5106,德阳;5107,绵阳;5108,广元;5109,遂宁;5110,内江;5111,乐山;5113,南充;5115,宜宾;5116,广安;5130,达川;5131,雅安;5132,阿坝;5133,甘孜;5134,凉山;5137,巴中;5138,眉山;5139,资阳;52,贵州;5201,贵阳;5202,六盘水;5203,遵义;5222,铜仁;5223,黔西南;5224,毕节;5225,安顺;5226,黔东南;5227,黔南;53,云南;5301,昆明;5303,曲靖;5304,玉溪;5321,昭通;5323,楚雄;5325,红河;5326,文山;5327,思茅;5328,西双版纳;5329,大理;5330,保山;5331,德宏;5332,丽江;5333,怒江;5334,迪庆;5335,临沧;54,西藏;5401,拉萨;5421,昌都;5422,山南;5423,日喀则;5424,那曲;5425,阿里;5426,林芝;61,陕西;6101,西安;6102,铜川;6103,宝鸡;6104,咸阳;6105,渭南;6106,延安;6107,汉中;6124,安康;6125,商洛;6127,榆林;62,甘肃;6201,兰州;6202,嘉峪关;6203,金昌;6204,白银;6205,天水;6221,酒泉;6222,张掖;6223,武威;6224,定西;6226,陇南;6227,平凉;6228,庆阳;6229,临夏;6230,甘南;63,青海;6301,西宁;6321,海东;6322,海北;6323,黄南;6325,海南藏族州;6326,果洛;6327,玉树;6328,海西;64,宁夏;6401,银川;6402,石嘴山;6403,吴忠;6422,固原;65,新疆;6501,乌鲁木齐;6502,克拉玛依;6521,吐鲁番;6522,哈密;6523,昌吉;6527,博尔塔拉;6528,巴音郭楞;6529,阿克苏;6530,克孜勒苏;6531,喀什;6532,和田;6540,伊犁哈萨克州;6541,伊犁地区;6542,塔城;6543,勒泰;6590,新疆直辖县;71,台湾;81,香港;83,澳门;90,国外";
// 二级列表
function SetMItemData(oObj1, oObj2, sData, sValue)
{
	this.init = function()
	{
		//防止同一个Select对象被多个实例初始化而引起混乱
		if (oObj1.SourceObj || oObj2.SourceObj)
		{
			alert("初始化失败!引用的<select>对象有一个或多个已经被初始化过,请使用这个<select>对象的obj.SourceObj.reset()方法进行重新加载!");
			return null;
		}

		this.init = true;  //记录是否在初始化过程中
		this.Obj1 = oObj1;  //记录第一层下拉框对象
		this.Obj2 = oObj2;  //记录第二层下拉框对象
		this.SourceData = sData.split(";"); //源数据
		this.LenPerLevel = 2;  //指定代码中每一层级的字符位数
		this.ValueObj = eval(sValue);
		//this.FormFields = document.getElementsByName(sValue);  //自动赋值到的表单域集合
		this.FirstLevel = new Array();  //属于第一层的数据数组,分开存放它们是为了提高性能
		this.SecondLevel = new Array();  //属于第二层的数据数组
		//向各层次数据数组填充数据
		for (var i=0; i<this.SourceData.length; i++)
		{
			var codeLen = this.SourceData[i].split(",")[0].length;
			if (codeLen == this.LenPerLevel)this.FirstLevel[this.FirstLevel.length] = this.SourceData[i];
			if (codeLen == this.LenPerLevel * 2)this.SecondLevel[this.SecondLevel.length] = this.SourceData[i];
		}

		//标记每一个<select>对象的源对象
		oObj1.SourceObj = oObj2.SourceObj = this;
		oObj1.ParentLevel = null;
		oObj2.ParentLevel = oObj1;
	}

	//对象的初始化功能函数
	this.reset = function()
	{
		this.init = true;
		
		this.clearOpts(this.Obj1);
		this.clearOpts(this.Obj2);
		for(var i=0; i<this.FirstLevel.length; i++)
			this.Obj1.options.add(new Option(this.FirstLevel[i].split(",")[1],this.FirstLevel[i].split(",")[0]));
		//顶级下拉需要空白选项时,请去掉下面两行的注释标记
		//设置顶级下拉空白项// this.Obj1.options.add(new Option("",""),0);
		//设置顶级下拉空白项// this.Obj1.value = "";

		this.Obj1.onchange = new Function("this.SourceObj.optionChanged(this.SourceObj.Obj2, this.SourceObj.SecondLevel, this.value);");
		this.Obj2.onchange = new Function("this.SourceObj.setHideFormValue(this);");
		
		this.Obj2.style.display = "none";
		this.Obj1.onchange();
		this.Obj2.onchange();

		//if(this.FormFields.length>0 && this.FormFields[0].value)
		if (this.ValueObj != null)
		{
			//defaultValue = this.FormFields[0].value;
			defaultValue = this.ValueObj.value;
			this.Obj1.value = defaultValue.substr(0,this.LenPerLevel);
			this.Obj1.onchange();
			this.Obj2.value = defaultValue.substr(0,this.LenPerLevel * 2);
			this.Obj2.onchange();
		}
		this.init = false;
		this.setHideFormValue(this.Obj1);
	};

	//下拉选项被改变时要做的事情,包括更新下级下拉列表和列新表单域值
	this.optionChanged = function(slt, arrData, value)
	{
		var started = false;
		if(value=="" || slt.ParentLevel.options[slt.ParentLevel.selectedIndex].style.color=="#888888") value="没可能的数据";
		this.clearOpts(slt);
		for (var i=0; i<arrData.length; i++)
		{
			if(arrData[i].substr(0,value.length) == value)
			{
				started = true;
				slt.options.add(new Option(arrData[i].split(",")[1],arrData[i].split(",")[0]));
			}
			else if(started) break;
		}
		if(slt.options.length>0)
		{
			if(slt.ParentLevel.selectedIndex == -1) slt.ParentLevel.selectedIndex = 0;
			var opt = slt.ParentLevel.options[slt.ParentLevel.selectedIndex];
			slt.options.add(new Option("(" + slt.ParentLevel.options[slt.ParentLevel.selectedIndex].text + ")",slt.ParentLevel.options[slt.ParentLevel.selectedIndex].value),0);
			slt.options[0].style.color = "#888888";
			slt.value = opt.value;
			slt.style.display = "";
			slt.SourceObj.setHideFormValue(slt);
		}
		else
			slt.style.display = "none";

		if(slt.onchange)slt.onchange(); //递归调用下级下拉框的onchange事件
	};

	//设置隐藏表单域的值
	this.setHideFormValue = function(obj)
	{
		if(this.init)return;
		if (this.ValueObj == null) return;
		//if(obj.SourceObj.FormFields <= 0)return;
		var val = null;
		var val1= null;

		if(obj.SourceObj.Obj2.style.display!="none" && obj.SourceObj.Obj2.value!="") 
			val = obj.SourceObj.Obj2.value;
		else
			val = obj.SourceObj.Obj1.value;

		if(val!=null) this.ValueObj.value = val;
	}

	//清除下拉列表选项的功能函数
	this.clearOpts = function(slt)
	{
		while(slt.options.length>0)
			slt.options.remove(0);
	};

	//数组排序用到的函数
	this.SortFun = function(a,b)
	{
		var aa = a.split(",")[0];
		var bb = b.split(",")[0];
		if(aa.length>bb.length)aa = aa.substr(0,bb.length);
		else bb = bb.substr(0,aa.length);
		if(aa>bb)return 1;
		else if(aa<bb)return -1;
		else if(a.length<b.length)return -1;
		else if(a.length>b.length)return 1;
		else return 0;
	};

	//最后调用初始化函数初始化下拉框
	this.init();
	this.reset();
}

function order(sid, stype)
{
	var sUrl = "order.php";
	var sWidth = 600;
	var sHeight = 350;
	if (sid != "" && stype != "") { sUrl = sUrl+"?id="+sid+"&type="+stype; }
	var sLeft = (screen.width - sWidth) / 2;
	var sTop  = (screen.height - sHeight) /2;
	window.location = sUrl;
	//var nWin = window.open(sUrl, "order", "width="+sWidth+",height="+sHeight+",left="+sLeft+",top="+sTop+",resizable=yes,scrollbars=yes");
	return false;
}

function vote(sid)
{
	var sWidth = 600;
	var sHeight = 350;
	var sLeft = (screen.width - sWidth) / 2;
	var sTop  = (screen.height - sHeight) /2;
	var nWin = window.open("vote.php?sid="+sid, "vote", "width="+sWidth+",height="+sHeight+",left="+sLeft+",top="+sTop+",resizable=yes,scrollbars=yes");
	return false;
}

function shownew(sid)
{
	var obj1 = document.getElementById("pnew1");
	var obj2 = document.getElementById("pnew2");
	var obj3 = document.getElementById("pnew3");
	var obj4 = document.getElementById("pnew4");
	var link1= document.getElementById("plink1");
	var link2= document.getElementById("plink2");
	var link3= document.getElementById("plink3");
	var link4= document.getElementById("plink4");	
	if (sid == 1)	{ obj1.style.display = ""; link1.style.fontWeight="bold"; }
	else { obj1.style.display = "none";  link1.style.fontWeight=""; }
	if (sid == 2)	{ obj2.style.display = ""; link2.style.fontWeight="bold";  }
	else { obj2.style.display = "none";   link2.style.fontWeight=""; }
	if (sid == 3)	{ obj3.style.display = "";  link3.style.fontWeight="bold"; }
	else { obj3.style.display = "none";   link3.style.fontWeight=""; }
	if (sid == 4)	{ obj4.style.display = "";  link4.style.fontWeight="bold"; }
	else { obj4.style.display = "none";   link4.style.fontWeight=""; }
	return false;
}

