function submitViewChanges(){
var _1=document.getElementById("filter_endorsed");
var _2=_1.checked;
var _3=Number($F("map_filter_rating"));
var _4=$F("map_filter_category");
var _5=$F("map_filter_size_comp");
var _6=$F("map_filter_size_num");
var _7=$F("sort_type");
window.location="MapBrowser?sort="+_7+"&filterEndorsed="+_2+"&filterRating="+_3+"&filterCategory="+_4+"&mapSizeComp="+_5+"&reqMapSize="+_6;
}
function showMapFilterOptions(){
var _8=$("map_filter_options");
if(_8.style.display=="none"){
Effect.SlideDown($("map_filter_options"),{duration:0.5});
}else{
Effect.SlideUp($("map_filter_options"),{duration:0.3});
}
}
var mapIndex=0;
var mapsPerSheet=15;
var imageSlider=null;
function initSheets(){
unloadSheet("left");
unloadSheet("middle");
unloadSheet("right");
loadSheet(0,"middle",true);
loadSheet(mapsPerSheet,"right");
disableButton("previous_btn");
if(imageSlider==null){
imageSlider=new Slider(document.getElementById("slider-1"),document.getElementById("slider-input-1"));
imageSlider.setUnitIncrement(mapsPerSheet);
imageSlider.onchange=function(){
var _9=imageSlider.getValue();
setSliderPositionText(_9);
};
imageSlider.onDragEnd=function(){
loadSheetFromSlider();
};
}
imageSlider.setValue(0);
}
function loadSheetFromSlider(){
var _a=getMapOffsetIndex();
unloadSheet("middle");
unloadSheet("left");
unloadSheet("right");
loadSheet(_a,"middle",true);
if(_a+mapsPerSheet<mapList.length){
enableButton("next_btn");
loadSheet(_a+mapsPerSheet,"right");
}else{
disableButton("next_btn");
}
if(_a>0){
enableButton("previous_btn");
loadSheet(Math.max((_a-mapsPerSheet),0),"left");
}else{
disableButton("previous_btn");
}
mapIndex=_a;
}
function getMapOffsetIndex(){
var _b=imageSlider.getValue()/100;
var _c=Math.round(_b*mapList.length);
if(_c<0){
_c=0;
}else{
if(_c>=mapList.length){
_c=mapList.length-1;
}
}
return _c;
}
function setSliderPositionText(_d){
var _e=$F("sort_type");
var _f=getMapOffsetIndex();
var _10=mapList[_f];
if(_e=="name"){
$("slider_position_text").innerHTML=_10.name;
}else{
if(_e=="rating"){
$("slider_position_text").innerHTML=_10.avg+" / 10";
}else{
if(_e=="popularity"){
$("slider_position_text").innerHTML=_10.playCount+" plays";
}else{
if(_e=="author"){
$("slider_position_text").innerHTML=_10.author;
}
}
}
}
}
function setSliderPos(){
var _11=mapIndex/mapList.length;
if(mapIndex+mapsPerSheet>mapList.length){
imageSlider.setValue(100);
}else{
imageSlider.setValue(Math.round(_11*100));
}
}
function loadSheet(_12,_13,_14){
var _15=$("sc_"+_13);
var _16=document.createElement("DIV");
_16.style.position="relative";
if(!_14){
_16.style.display="none";
}
_16.setAttribute("id","map_sheet_container_"+_13);
_15.appendChild(_16);
var div=document.createElement("DIV");
var _18=document.createElement("TABLE");
var _19=null;
var _1a=5;
if(mapsPerSheet==8){
_1a=4;
}else{
if(mapsPerSheet==24){
_1a=6;
}
}
for(var ndx=0;ndx<mapsPerSheet;ndx++){
if(ndx%_1a==0){
_19=_18.insertRow(-1);
}
var _1c=_19.insertCell(-1);
_1c.style.verticalAlign="top";
_1c.style.padding="10 20 10 20";
var map=mapList[ndx+_12];
if(typeof map=="undefined"){
if(ndx==0){
disableButton("next_btn");
}
_1c.innerHTML="&nbsp;";
_1c.style.height="170px";
continue;
}
var _1e="";
if(forMapSelection()){
_1e="<input type='checkbox' onclick='selectMapForPlay(\""+map.name+"\")'>";
}
_1c.innerHTML="<a href='maps/"+map.name+"/map_image.jpg' class='highslide' onclick='return hs.expand(this, {})'><img class='map_image_thumbnail' src='maps/"+map.name+"/map_thumbnail.jpg'></a><div style='cursor:pointer;font-size:12px;color:#353535;'>"+_1e+map.name+"</div><table cellpadding='0' cellspacing='0' width='100%'><tr><td style='font-size:10px;color:#1478DA'>"+map.author+"</td><td style='text-align:right;font-size:9px;color:#009B00'>"+map.avg+"/10</td></tr></table>";
}
div.appendChild(_18);
_16.appendChild(div);
}
function unloadSheet(_1f){
if($("map_sheet_container_"+_1f)!=null){
$("map_sheet_container_"+_1f).parentNode.removeChild($("map_sheet_container_"+_1f));
}
}
function shiftPagesLeft(){
unloadSheet("left");
$("map_sheet_container_middle").setAttribute("id","map_sheet_container_left");
$("map_sheet_container_right").setAttribute("id","map_sheet_container_middle");
var _20=$("sc_left");
var _21=$("sc_middle");
var _22=$("sc_right");
_21.appendChild($("map_sheet_container_middle"));
_20.appendChild($("map_sheet_container_left"));
mapIndex+=mapsPerSheet;
loadSheet(mapIndex+mapsPerSheet,"right");
enableButton("previous_btn");
setSliderPos();
}
function nextMapPage(){
new Effect.Parallel([new Effect.SlideLeftIn("map_sheet_container_right",{transition:Effect.Transitions.linear}),new Effect.SlideLeftOut("map_sheet_container_middle",{transition:Effect.Transitions.linear})],{afterFinish:shiftPagesLeft});
}
function shiftPagesRight(){
unloadSheet("right");
$("map_sheet_container_middle").setAttribute("id","map_sheet_container_right");
$("map_sheet_container_left").setAttribute("id","map_sheet_container_middle");
var _23=$("sc_left");
var _24=$("sc_middle");
var _25=$("sc_right");
_24.appendChild($("map_sheet_container_middle"));
_25.appendChild($("map_sheet_container_right"));
mapIndex-=mapsPerSheet;
if(mapIndex<0){
mapIndex=0;
}
if(mapIndex<=0){
disableButton("previous_btn");
}else{
var _26=mapIndex-mapsPerSheet;
if(_26<0){
_26=0;
}
loadSheet(_26,"left");
}
enableButton("next_btn");
setSliderPos();
}
function prevMapPage(){
new Effect.Parallel([new Effect.SlideRightIn("map_sheet_container_left",{transition:Effect.Transitions.linear}),new Effect.SlideRightOut("map_sheet_container_middle",{transition:Effect.Transitions.linear})],{afterFinish:shiftPagesRight});
}
var bForMapSelection=null;
function forMapSelection(){
if(bForMapSelection==null){
bForMapSelection=(typeof window.opener!="undefined"&&window.opener!=null&&typeof window.opener.selectMap!="undefined");
}
return bForMapSelection;
}
function selectMapForPlay(_27){
if(forMapSelection()){
window.opener.selectMap(_27);
window.close();
}
}
function setGrid(_28){
mapsPerSheet=_28;
$("grid_8").style.backgroundColor="";
$("grid_15").style.backgroundColor="";
$("grid_24").style.backgroundColor="";
$("grid_"+_28).style.backgroundColor="#A6A6A6";
if(_28==8){
$("sheets_table").style.width="700px";
$("sheets_slider_table").style.width="700px";
}else{
if(_28==15){
$("sheets_table").style.width="850px";
$("sheets_slider_table").style.width="850px";
}else{
if(_28==24){
$("sheets_table").style.width="950px";
$("sheets_slider_table").style.width="950px";
}
}
}
imageSlider.recalculate();
initSheets();
}
