
var galeryPage=1;var galeryConfig=1;function galeryItemClick(id)
{if(!lockAll)
{SwitchPage(31,null,id,null);}}
function reSetGaleryPages()
{var pages=Math.ceil(parseInt($("hdnItemsCount").value)/oConfig.fotos);var i;for(i=1;i<pages+1;i++)
{if(i==galeryPage)
$("goPage"+i).innerHTML=i+"&nbsp;";else
$("goPage"+i).innerHTML="<a href='javascript:setGaleryPage("+i+")'>"+i+"</a>&nbsp;";}
for(j=i;$("goPage"+j)!=null;j++)
{$("goPage"+j).innerHTML="";}}
function setGaleryPage(page)
{if((!pagePaging)&&($("goPage"+page)!=null)&&($("goPage"+page).innerHTML!="")&&(page!=galeryPage))
{$("goPage"+galeryPage).innerHTML="<a href='javascript:setGaleryPage("+galeryPage+")'>"+galeryPage+"</a>&nbsp;";$("goPage"+page).innerHTML=page+"&nbsp;";SwitchPage(null,null,page,null);}}
moveSearchDivTimeout=null;moveConfigDivTimeout=null;function beginDivMove(id,top,step)
{switch(id)
{case"divSearch":clearTimeout(moveSearchDivTimeout);moveSearchDivTimeout=setTimeout("moveDivs('"+id+"', "+top+", "+step+")",1);break;case"divConfig":clearTimeout(moveConfigDivTimeout);moveConfigDivTimeout=setTimeout("moveDivs('"+id+"', "+top+", "+step+")",1);break;}}
function moveDivs(id,top,step)
{try
{if(top.toString()+"px"!=$(id).style.left)
{left=parseInt($(id).style.left.toString().replace("px",""))+step;$(id).style.left=left.toString()+"px";if(((step<0)&&(left>top))||((step>0)&&(left<top)))
{switch(id)
{case"divSearch":moveSearchDivTimeout=setTimeout("moveDivs('"+id+"', "+top+", "+step+")",30);break;case"divConfig":moveConfigDivTimeout=setTimeout("moveDivs('"+id+"', "+top+", "+step+")",30);break;}}}}
catch(err){alert(err);}}
function cancelSearchForm()
{oFilter.setFilterForm();oConfig.setConfigForm();beginDivMove("divSearch",-300,-20);}
function filter()
{this.name=null;this.type=null;this.seria=null;this.status=null;this.colors=null;this.setFilter=function setFilter(str)
{if((str!=null)&&(str!=""))
{str=decodeURI(str);strFilter=str.split("<``>");for(var i=0;i<strFilter.length-1;i++)
{elem=strFilter[i].split("<`>");switch(elem[0])
{case"n":this.name=elem[1];break;case"t":this.type=elem[1];break;case"se":this.seria=elem[1];break;case"st":this.status=elem[1];break;case"c":this.colors=elem[1];break;}}}
else
{this.name=null;this.type=null;this.seria=null;this.status=null;this.colors=null;}}
this.setFilterForm=function setFilterForm()
{if(this.name!=null)
$('sName').value=this.name;else
$('sName').value="";$('sType').selectedIndex=0;if(this.type!=null)
{for(var i=1;i<$('sType').options.length;i++)
{if($('sType').options[i].value==this.type)
$('sType').selectedIndex=i;}}
$('sSeria').selectedIndex=0;if(this.seria!=null)
{for(var i=1;i<$('sSeria').options.length;i++)
{if($('sSeria').options[i].value==this.seria)
$('sSeria').selectedIndex=i;}}
$('sStatus').selectedIndex=0;if(this.status!=null)
{for(var i=1;i<$('sStatus').options.length;i++)
{if($('sStatus').options[i].value==this.status)
$('sStatus').selectedIndex=i;}}
if(this.colors!=null)
{if(this.colors.indexOf("r")>-1)$('cbRed').checked=true;else $('cbRed').checked=false;if(this.colors.indexOf("o")>-1)$('cbOrange').checked=true;else $('cbOrange').checked=false;if(this.colors.indexOf("y")>-1)$('cbYellow').checked=true;else $('cbYellow').checked=false;if(this.colors.indexOf("g")>-1)$('cbGreen').checked=true;else $('cbGreen').checked=false;if(this.colors.indexOf("lb")>-1)$('cbLightblue').checked=true;else $('cbLightblue').checked=false;if(this.colors.indexOf("blu")>-1)$('cbBlue').checked=true;else $('cbBlue').checked=false;if(this.colors.indexOf("v")>-1)$('cbVialet').checked=true;else $('cbVialet').checked=false;if(this.colors.indexOf("bla")>-1)$('cbBlack').checked=true;else $('cbBlack').checked=false;if(this.colors.indexOf("w")>-1)$('cbWhite').checked=true;else $('cbWhite').checked=false;}}
this.getData=function getData(fromObj)
{var strData="";if(fromObj)
{if(this.name!=null)strData+="n<`>"+this.name+"<``>";if(this.type!=null)strData+="t<`>"+this.type+"<``>";if(this.seria!=null)strData+="se<`>"+this.seria+"<``>";if(this.status!=null)strData+="st<`>"+this.status+"<``>";if(this.colors!=null)strData+="c<`>"+this.colors+"<``>";}
else
{if($('sName').value.length>0)strData+="n<`>"+$('sName').value+"<``>";if($('sType').selectedIndex>0)strData+="t<`>"+$('sType').value+"<``>";if($('sSeria').selectedIndex>0)strData+="se<`>"+$('sSeria').value+"<``>";if($('sStatus').selectedIndex>0)strData+="st<`>"+$('sStatus').value+"<``>";var strColors="";if($('cbRed').checked)strColors+="r";if($('cbOrange').checked)strColors+="o";if($('cbYellow').checked)strColors+="y";if($('cbGreen').checked)strColors+="g";if($('cbLightblue').checked)strColors+="lb";if($('cbBlue').checked)strColors+="blu";if($('cbVialet').checked)strColors+="v";if($('cbBlack').checked)strColors+="bla";if($('cbWhite').checked)strColors+="w";if(strColors.length>0)
{strData+="c<`>"+strColors+"<``>";}}
if(strData.length>0)
return encodeURI(strData);else
return null;}}
var oFilter=new filter();function config()
{this.sort=1;this.direction=0;this.size=1;this.fotos=6;this.getData=function(fromObj)
{if(fromObj)
return this.sort.toString()+
this.direction.toString()+
this.size.toString()+
this.fotos.toString();else
{return $("order").options[$('order').selectedIndex].value.toString()+
$("direction").options[$('direction').selectedIndex].value.toString()+
$("sSize").options[$('sSize').selectedIndex].value.toString()+
$("sFotos").options[$('sFotos').selectedIndex].value.toString();}}
this.saveData=function()
{if(this.getData(true)!=this.getData(false))
{setCookie("oConfig",this.getData(false),365);}}
this.setData=function(str)
{if((str!=null)&&(str!=""))
{var tmp="6";if(str.charAt(0)!="")this.sort=parseInt(str.charAt(0));else this.sort=1;if(str.charAt(1)!="")this.direction=parseInt(str.charAt(1));else this.direction=0;if(str.charAt(2)!="")this.size=parseInt(str.charAt(2));else this.size=1;if(str.charAt(3)!="")tmp=str.charAt(3);if(str.charAt(4)!="")tmp+=str.charAt(4);this.fotos=parseInt(tmp);}}
this.setConfigForm=function()
{$("order").options[this.sort-1].selected="selected";$("direction").options[this.direction].selected="selected";$("sSize").options[this.size-1].selected="selected";sizeChanged();var i=0;while($("sFotos").options[i]!=null)
{if($("sFotos").options[i].value==this.fotos.toString())
$("sFotos").options[i].selected="selected";i++;}}}
var oConfig=new config();function sizeChanged()
{var val=$("sSize").options[$('sSize').selectedIndex].value.toString();var opt1;var opt2;var opt3;switch(val)
{case"1":opt1="6";opt2="8";opt3="10";break;case"2":opt1="24";opt2="27";opt3="30";break;case"3":opt1="40";opt2="44";opt3="48";break;}
$("sFotos").options[0].value=opt1;$("sFotos").options[0].text=opt1;$("sFotos").options[1].value=opt2;$("sFotos").options[1].text=opt2;$("sFotos").options[2].value=opt3;$("sFotos").options[2].text=opt3;}