var ResultLength=null;var Groups=null;var GroupSize=null;var Thumbs=null;var LoadedThumbs=null;var LeftMostThumb=0;var ShowAllPictures=false;var oScroll=false;var PreLoadURL=null;var Executer=null;var Selected=0;function calculateInterval(aa,ba){var ca=0;if(ba)ca=aa;else ca=Math.round(120*(1-aa))+6;return ca;}
function PreLoadThumbs(da){if(!isThumbsLoaded(da)){debug("PreLoadThumbs Loading The Group "+da);var ea=PreLoadURL+'?groupToLoad='+da;var fa=new Ajax.Updater('Thumbs',ea,{asynchronous:true,insertion:Insertion.Bottom,onSuccess:function(ga){debug("PreLoadThumbs Loaded The Group "+da);}});setThumbsLoaded(da);}}
function setShowAllPictures(ha){ShowAllPictures=ha;ShowProfile2(Selected,Selected);}
function isThumbsLoaded(i){return LoadedThumbs[i]=='loaded';}
function setThumbsLoaded(i){LoadedThumbs[i]='loaded';}
function HideThumb(i){$("Thumb"+i).style.display='none';}
function ShowThumbs(){for(var i=LeftMostThumb;i<ResultLength&&i<=getRightMostThumb();i++){if($("Thumb"+i)!=null)$("Thumb"+i).style.display='block';}}
function getRightMostThumb(){return LeftMostThumb+Thumbs-1;}
function GoLeft(){if(LeftMostThumb==0)return;HideThumb(getRightMostThumb());LeftMostThumb--;ShowThumbs();}
function GoRight(){if(getRightMostThumb()>=ResultLength-1)return;if($("Thumb"+(getRightMostThumb()+1))==null){alert("Lütfen biraz sonra tekrar deneyin. Sonuçları alıyorum.");return;}
HideThumb(LeftMostThumb);LeftMostThumb++;var ia=(LeftMostThumb-(LeftMostThumb%GroupSize))/GroupSize+1;PreLoadThumbs(ia+1);ShowThumbs();}
function Forward(ja){var ka=Selected;if(Selected<ResultLength-1)Selected++;else return Selected;if(Selected>getRightMostThumb()){GoRight();}
if(ja)ShowProfile2(Selected,ka);else UpdateThumb(Selected,ka);return Selected;}
function Backward(la){var ma=Selected;if(Selected>0)Selected--;else return Selected;if(Selected<LeftMostThumb){GoLeft();}
if(la)ShowProfile2(Selected,ma);else UpdateThumb(Selected,ma);return Selected;}
function ShowProfile2(i,na){var oa='ListMatches_GetProfileDetails.jsp?index='+i+'&showAllPictures='+ShowAllPictures+"&showFriends=true";UpdateProfile(oa,i,na);}
function UpdateProfile(pa,i,qa){OpenL();new Ajax.Updater('ProfileDetail',pa,{onComplete:function(){CloseL();},asynchronous:true,evalScripts:true});UpdateThumb(i,qa);}
function UpdateThumb(i,ra){Selected=i;var sa=$('Thumb'+ra);var ta=$('Thumb'+Selected);if(sa!=null){sa.style.border="none";}
if(ta!=null){ta.style.border="1px";ta.style.borderColor="coral";ta.style.borderStyle="solid";}$('thbns').innerHTML=' '+(i+1)+' ';}
function SendNo(ua,i){Puff('Evet');Puff('Hayir');var va=Selected;var wa=Forward(false);ua=ua+'?dispatch=no&index='+wa+'&showAllPictures='+ShowAllPictures;UpdateProfile(ua,wa,va);}
function SendYes(xa,i){Puff('Evet');Puff('Hayir');SubmitURLMB(xa+'?dispatch=yes&sender='+i);}
function onClickThumb(i){ShowProfile2(i,Selected);}
function onMouseOverRight(){RunSlideShow(0.5,true);}
function onMouseOutRight(){StopSlider();}
function onClickRight(){StopSlider();Forward(false);}
function onClickLeft(){StopSlider();Backward(false);}
function onClickYes(ya,i){SendYes(ya,i);}
function onClickNo(za,i){SendNo(za,i);}
function setShowAllPictures(Aa){ShowAllPictures=Aa;ShowProfile2(Selected,Selected);}
function OpenImage(Ba,Ca){$('ptbDiv').style.left=Position.positionedOffset($('LeftProfileBox'))[0];$('ptbDiv').style.top=Position.positionedOffset($('LeftProfileBox'))[1]-25;$('ptbDiv').style.display="block";$('ptbPic').style.visibility="hidden";$('ptbLoad').style.visibility="visible";$('ptbPic').onload=function(){$('ptbPic').style.visibility="visible";$('ptbLoad').style.visibility="hidden";};$('ptbPic').onerror=function(){$('ptbPic').style.visibility="visible";$('ptbLoad').style.visibility="hidden";};$('ptbPic').src=Ba;$('ptbTitle').innerHTML=$('ptText'+Ca).innerHTML;}
function OpenDiv(Da,Ea){$(Da).style.left=Position.positionedOffset($(Ea))[0];$(Da).style.top=Position.positionedOffset($(Ea))[1];$(Da).style.display="block";}
function StopSlider(){TerminateSlider();}
function TerminateSlider(){if(Executer!=null){Executer.stop();Executer=null;}}
function RunSlideShow(Fa,Ga){oScroll=Ga;TerminateSlider();if(Fa<0.01)return;Executer=new PeriodicalExecuter(function(pe){if($("LMContainer")==null){TerminateSlider();return;}
Forward(!oScroll);},calculateInterval(Fa,oScroll));}
var Slider=null;function setSliderValue(Ha){Slider.setValue(Ha);Slider.OldValue=Ha;}
function onChangeSlider(Ia,Ja){if(Ia!=0.5)setSliderValue(0.5);}
function onSlideSlider(Ka,La,Ma){if(Ka-Slider.OldValue<-0.03){Backward(false);Slider.OldValue=Ka;}else if(Ka-Slider.OldValue>0.03){Forward(false);Slider.OldValue=Ka;}}
function toggleDisp(){for(var i=0;i<arguments.length;i++){var d=$(arguments[i]);if(d.style.display=='none')d.style.display='block';else d.style.display='none';}}
function toggleTab(Na,Oa,Pa,Qa){if($('tabContent'+Na).style.display=='none'){for(var i=1;i<=Oa;i++){if((Pa==null)||(Pa!=i)){var Ra='tabHeader'+i;var h=$(Ra);if(!h){var h=$('tabHeaderActive');h.id=Ra;}
var Sa='tabContent'+i;var c=$(Sa);if(c.style.display!='none'){if(Qa||typeof Qa=='undefined')Effect.toggle(Sa,'blind',{duration:0.5,queue:{scope:'menus',limit:3}});else toggleDisp(Sa);}}}
var h=$('tabHeader'+Na);if(h)h.id='tabHeaderActive';h.blur();var c=$('tabContent'+Na);c.style.marginTop='2px';if(Qa||typeof Qa=='undefined'){Effect.toggle('tabContent'+Na,'blind',{duration:0.5,queue:{scope:'menus',position:'end',limit:3}});}else{toggleDisp('tabContent'+Na);}}}