function cateSch(fa){
	this.frmAction = fa;
	this.container = document.getElementById("cscontainer");
	this.mtbar = "<select name=\"t\" id=\"movietype\"><option>Loading...<\/option><\/select>";
	this.cbar = "<select name=\"c\" id=\"country\"><option>Loading...<\/option><\/select>";
	this.ybar = "<select name=\"y\" id=\"years\"><option>Loading...<\/option><\/select>";
	this.sbar = "<select name=\"sort\" id=\"sort\"><option>Loading...<\/option><\/select>";
	this.btn = "<input type=\"button\" id=\"submitBtn\" value=\"Search Trailer\" />"
	this.params = document.location.search;
	this.nbox = '';
	this.isShowSort = 1;

	this._c = this._t = this._y = this._cx = this._tx = this._yx = this._s = "";
	this._movieType_ary = [1,'Adult',2,'Adventure',3,'Crime',4,'Documentary',5,'Fantasy',6,'Film-Noir',7,'Horror',8,'Musical',9,'Reality-TV',10,'Romance',11,'Sci-Fi',12,'Sport',13,'Talk-Show',14,'Thriller',15,'Western',16,'Action',17,'Animation',18,'Biography',19,'Comedy',20,'Drama',21,'Family',22,'Game-Show',23,'History',24,'Music',25,'Mystery',26,'News',27,'Short',28,'War'];
	this._country_ary = [1,'Afghanistan',2,'Albania',3,'Algeria',4,'Andorra',5,'Angola',6,'Antigua and Barb',7,'Argentina',8,'Armenia',9,'Aruba',10,'Australia',11,'Austria',12,'Azerbaijan',13,'Bahamas',14,'Bahrain',15,'Bangladesh',16,'Barbados',17,'Belarus',18,'Belgium',19,'Belize',20,'Benin',21,'Bhutan',22,'Bolivia',23,'Bosnia-Herzegov',24,'Botswana',25,'Brazil',26,'Bulgaria',27,'Burkina Faso',28,'Burma',29,'Burundi',30,'Cambodia',31,'Cameroon',32,'Canada',33,'Cape Verde',34,'Central African',35,'Chad',36,'Chile',37,'China',38,'Colombia',39,'Congo',40,'Costa Rica',41,'Croatia',42,'Cuba',43,'Cyprus',44,'Czech Republic',45,'Czechoslovakia',46,'Democratic Republic of Congo',47,'Denmark',48,'Djibouti',49,'Dominican Republic',50,'East Germany',51,'Ecuador',52,'Egypt',53,'El Salvador',54,'Eritrea',55,'Estonia',56,'Ethiopia',57,'Federal Republic of Yugoslavia',58,'Finland',59,'France',60,'Gabon',61,'Georgia',62,'Germany',63,'Ghana',64,'Greece',65,'Greenland',66,'Guadeloupe',67,'Guatemala',68,'Guinea',69,'Guinea-Bissau',70,'Guyana',71,'Haiti',72,'Honduras',73,'Hong Kong',74,'Hungary',75,'Iceland',76,'India',77,'Indonesia',78,'Iran',79,'Iraq',80,'Ireland',81,'Israel',82,'Italy',83,'Ivory Coast',84,'Jamaica',85,'Japan',86,'Jordan',87,'Kazakhstan',88,'Kenya',89,'Korea',90,'Kosovo',91,'Kuwait',92,'Kyrgyzstan',93,'Laos',94,'Latvia',95,'Lebanon',96,'Libya',97,'Liechtenstein',98,'Lithuania',99,'Luxembourg',100,'Macau',101,'Madagascar',102,'Malaysia',103,'Mali',104,'Malta',105,'Martinique',106,'Mauritania',107,'Mauritius',108,'Mexico',109,'Moldova',110,'Monaco',111,'Mongolia',112,'Morocco',113,'Mozambique',114,'Namibia',115,'Nepal',116,'Netherlands',117,'New Zealand',118,'Nicaragua',119,'Niger',120,'Nigeria',121,'Niue',122,'North Korea',123,'North Vietnam',124,'Norway',125,'Oman',126,'Pakistan',127,'Palestine',128,'Panama',129,'Papua New Guinea',130,'Paraguay',131,'Peru',132,'Philippines',133,'Poland',134,'Portugal',135,'Puerto Rico',136,'Republic of Mac',137,'Romania',138,'Russia',139,'Rwanda',140,'San Marino',141,'Saudi Arabia',142,'Senegal',143,'Serbia and Monte',144,'Seychelles',145,'Siam',146,'Singapore',147,'Slovakia',148,'Slovenia',149,'Somalia',150,'South Africa',151,'South Korea',152,'Soviet Union',153,'Spain',154,'Sri Lanka',155,'Sudan',156,'Suriname',157,'Sweden',158,'Switzerland',159,'Syria',160,'Taiwan',161,'Tajikistan',162,'Tanzania',163,'Thailand',164,'Togo',165,'Tonga',166,'Trinidad And Tobago',167,'Tunisia',168,'Turkey',169,'Turkmenistan',170,'Uganda',171,'UK',172,'Ukraine',173,'United Arab Emirates',174,'Uruguay',175,'USA',176,'Uzbekistan',177,'Venezuela',178,'Vietnam',179,'West Germany',180,'Yugoslavia',181,'Zaire',182,'Zambia',183,'Zimbabwe'];
	this._years_ary = [1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009];
	this._sort_ary = [5,'total views',1,'release date'];
}

cateSch.prototype.init = function(){
	
	if (this.params != '')
	{
		re = /\?genre=(.*?)\&country=(.*?)\&year=(.*?)\&order=(.*?)\&(?:.+)/g;
		this._c = "";
		this._t = "";
		this._y = "";
		this._cx = this.params.replace(re,"$2");
		this._tx = this.params.replace(re,"$1");
		this._yx = this.params.replace(re,"$3");
		this._s = this.params.replace(re,"$4");
	}

	var sbuilder = new stringBuilder();
	sbuilder.Append("country:");
	sbuilder.Append(this.cbar);
	sbuilder.Append("genre:");
	sbuilder.Append(this.mtbar);
	sbuilder.Append("year:");
	sbuilder.Append(this.ybar);
	if(this.isShowSort){
	sbuilder.Append("sorted by:");
	sbuilder.Append(this.sbar);
	}
	if(this.nbox!=''){
	sbuilder.Append("movie name:");
	sbuilder.Append(this.nbox);
	}
	sbuilder.Append(this.btn);
	this.container.innerHTML = sbuilder.toString("");

	//var btnSubmit = document.getElementById("submitBtn");
	//btnSubmit.onclick=function(){this._submitBtn_onclicked(this.frmAction);};
}

cateSch.prototype.showSchMTBar = function(){
		this._buildBar("==select a genre==",this._movieType_ary,"movietype",2,1,this._tx,'');
}

cateSch.prototype.showSchCBar = function(){
		this._buildBar("==select a country==",this._country_ary,"country",2,1,this._cx,'');
}

cateSch.prototype.showSchYBar = function(){
		this._years_ary.reverse()
		this._buildBar("==select a year==",this._years_ary,"years",1,0,this._yx,'');
}

cateSch.prototype.showSchSBar = function(){
		this._buildBar("week views",this._sort_ary,"sort",2,1,this._s,3);
}

cateSch.prototype._buildBar = function(stitle,ary,soid,t,tt,sv,dvalue){
	var oc = document.getElementById(soid);
	for(var i = 0;i<oc.options.length;i++){
		oc.options[i] = null;
	}
	var oOption = document.createElement("OPTION");
	oc.options.add(oOption);
	oOption.innerHTML = stitle;
	oOption.value = dvalue;

	var j = 1;
	for(i=0;i<ary.length;i+=t){
		oOption = document.createElement("OPTION");
		oc.options.add(oOption);
		oOption.innerHTML = ary[i+tt];
		oOption.value = ary[i];
		if(!isNaN(ary[i+tt])){
			if(sv == ary[i+tt]){
				oc.options[j].selected = true;
			}
		}else{
			if(sv.toLowerCase() == ary[i+tt].toLowerCase()){
				oc.options[j].selected = true;
			}
		}
		j++;
	}
}

cateSch.prototype._submitBtn_onclicked = function(){
	try{
		var cc = document.getElementById('country');
		var tt = document.getElementById('movietype');
		var yy = document.getElementById('years');
		var ss = document.getElementById('sort');

		this._c = cc.options[cc.selectedIndex].value;
		this._t = tt.options[tt.selectedIndex].value;
		this._y = yy.options[yy.selectedIndex].value;
		if(this.isShowSort){
		this._s = ss.options[ss.selectedIndex].value;
		}
		if(cc.selectedIndex>0) this._cx = cc.options[cc.selectedIndex].text; else this._cx='';
		if(tt.selectedIndex>0) this._tx = tt.options[tt.selectedIndex].text; else this._tx='';
		if(yy.selectedIndex>0) this._yx = yy.options[yy.selectedIndex].text; else this._yx='';
		
		if(this.nbox != ''){
		    var mname = document.getElementById('mname');
		    if(mname.value!=''){
		        var schvalue=encodeURIComponent(mname.value)+'?dfrom='+this._y+'&dto='+this._y+'&field=0.1.2.4.5.6.3.7&select=0-'+encodeURIComponent(this._c)+'.1-'+encodeURIComponent(this._t)+'&sort='+this._s;
		        window.location.href='/search/query/'+schvalue;
		        return;
		    }
		}
		if (this._t==16) {this._t=2;this_tx='Adventure'};
		window.location.href = this.frmAction + "?genre="+escape(this._tx)+"&country="+escape(this._cx)+"&year="+escape(this._yx)+"&order="+this._s+"&Page=1";
		return;
	}
	catch(ex){}

	throw new Error("Submit Error!");
}