var debug=false;function setTagValue(result,id){getElement(id).value=result}function evalResponse(result){try{eval(result)}catch(ex){throw new Error('evalResponse()\n'+ex.message+'\n'+result)}}function onAjaxError_INTERNAL(status){}function getXmlHttp(){var xmlhttp=false;if(window.XMLHttpRequest){xmlhttp=new window.XMLHttpRequest()}else if(window.ActiveXObject){try{xmlhttp=new window.ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new window.ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}}return xmlhttp}function passAjaxResponseToFunction(url,callbackFunction,params){try{var xmlhttp=getXmlHttp();if(xmlhttp){xmlhttp.onreadystatechange=function orsc1(){var response='';var functionToCall='';try{if(xmlhttp&&xmlhttp.readyState===4){if(xmlhttp.status===200){response=xmlhttp.responseText;functionToCall=callbackFunction+'(response'+(params?','+params:'')+')';eval(functionToCall)}else{onAjaxError_INTERNAL(xmlhttp.status)}}}catch(ex){throw new Error('orsc1\neval: '+callbackFunction+'("'+response+'", '+params+')\n'+ex.message)}};xmlhttp.open('GET',url+(url.indexOf('?')===-1?'?':'&')+'rnd='+Math.random(),true);xmlhttp.send(null)}}catch(ex){throw new Error('passAjaxResponseToFunction("'+url+'", "'+callbackFunction+'", "'+params+'")\n'+ex.message)}}function ajaxPost(url,postdata,callbackFunction,params,async){try{if(async!==false){async=true}var xmlhttp=getXmlHttp();if(xmlhttp){xmlhttp.onreadystatechange=function orsc2(){var response='';try{if(xmlhttp&&xmlhttp.readyState===4){if(xmlhttp.status===200){response=xmlhttp.responseText;var functionToCall=callbackFunction+'(response'+(params?','+params:'')+')';eval(functionToCall)}else{onAjaxError_INTERNAL(xmlhttp.status)}}}catch(ex){throw new Error('orsc2\neval: '+callbackFunction+'("'+response+'", '+params+')\n'+ex.message)}};xmlhttp.open('POST',url+(url.indexOf('?')===-1?'?':'&')+'rnd='+Math.random(),async);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",postdata.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.send(postdata)}}catch(ex){throw new Error('ajaxPost("'+url+'", "'+postdata+'", "'+callbackFunction+'", "'+params+'")\n'+ex.message)}}function setInnerHTMLFromAjaxResponse(url,obj_id){var xmlhttp=getXmlHttp();if(xmlhttp){xmlhttp.onreadystatechange=function orsc3(){if(xmlhttp&&xmlhttp.readyState===4){if(xmlhttp.status===200){try{if(typeof obj_id==="object"){obj_id.innerHTML=xmlhttp.responseText}else{getElement(obj_id).innerHTML=xmlhttp.responseText}}catch(ex){throw new Error('orsc3()\n'+ex.message)}}else{onAjaxError_INTERNAL(xmlhttp.status)}}};xmlhttp.open('GET',url+(url.indexOf('?')===-1?'?':'&')+'rnd='+Math.random(),true);xmlhttp.send(null)}}; function getDocument(){if(document.all){return document.all}if(document.layers){return document.layers}if(document.getElementById){return document}return document.all}function getElement(id){return document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id]}function getElementsByName(name_tag){return document.getElementsByName(name_tag)}function getElementsByTagName(name_tag){return document.getElementsByTagName(name_tag)}function stopEvent(e){if(e.stopPropagation){e.stopPropagation()}if(e.preventDefault){e.preventDefault()}e.returnValue=false;e.cancelBubble=true}function getSelectValue(id){try{var node=getElement(id);return node.value}catch(ex){throw new Error('getSelectValue('+id+')\n'+ex.message)}}function removeChildren(node){while(node.hasChildNodes()){node.removeChild(node.firstChild)}}function addSelectOption(node,name,value){var opt=document.createElement('option');opt.text=name;opt.value=value;try{node.add(opt,null)}catch(ex){node.add(opt)}}function getParentForm(elem){try{while(elem&&elem.nodeName!=='FORM'){elem=elem.parentNode}return elem}catch(ex){throw new Error('getParentForm(...)\n'+ex.message)}}function getScreenSizes(){if(screen.availWidth){return{width:screen.availWidth,height:screen.availHeight}}if(typeof window.innerWidth==='number'){return{width:window.innerWidth,height:window.innerHeight}}if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return{width:document.body.clientWidth,height:document.body.clientHeight}}if(screen.width){return{width:screen.width,height:screen.height}}}function openCenteredWindow(url,windowname,params,popW,popH){var escapedUrl=url.replace(/&/g,'&');var sizes=getScreenSizes();var leftPos=(sizes.width-popW)/2;var topPos=(sizes.height-popH)/2;var options='width='+popW+',height='+popH+',top='+topPos+',left='+leftPos;options+=(params?','+params:'');window.open(escapedUrl,windowname,options)}function reloadPage(){window.location.reload()}function reloadPage_param(param,dontUseKey){if(!param){param=new Array()}if(typeof(dontUseKey)!=='object'){if(dontUseKey){dontUseKey=new Array(dontUseKey)}else{dontUseKey=new Array()}}var url=window.location.href;var questionMarkPos=url.indexOf('?');var url_param=questionMarkPos===-1?'':url.substr(questionMarkPos+1);var url=questionMarkPos===-1?url:url.substr(0,questionMarkPos+1);var params=new Array();var temp_params=url_param.split('&');for(var i=0;idocument.body.offsetHeight){yWithScroll=document.body.scrollHeight}else{yWithScroll=document.body.offsetHeight}window.scrollBy(0,yWithScroll)}function getElementsByClassName(strClass,strTag,objContElm){strTag=strTag||"*";objContElm=objContElm||document;var objColl=objContElm.getElementsByTagName(strTag);if(!objColl.length&&strTag==="*"&&objContElm.all){objColl=objContElm.all}var arr=[];var delim=(strClass.indexOf('|')!==-1?'|':' ');var arrClass=strClass.split(delim);for(var i=0,j=objColl.length;iarrObjClass.length){continue}var c=0;comparisonLoop:for(var k=0,l=arrObjClass.length;k0?m[2]:"0")+"."+m[4];num=parseFloat(cleanInput);return(isNaN(num)?null:num)}else if(dataType=="Currency"){expr=new RegExp("^\\s*([-\\+])?(((\\d+)\\"+val.groupchar+")*)(\\d+)"+((val.digits>0)?"(\\"+val.decimalchar+"(\\d{1,"+val.digits+"}))?":"")+"\\s*$");m=op.match(expr);if(m===null){return null}intermed=m[2]+m[5];cleanInput=m[1]+intermed.replace(new RegExp("(\\"+val.groupchar+")","g"),"")+((val.digits>0)?"."+m[7]:0);num=parseFloat(cleanInput);return(isNaN(num)?null:num)}else if(dataType=="Date"){yearFirstExp=new RegExp("^\\s*((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})\\s*$");m=op.match(yearFirstExp);if(m!==null&&(m[2].length==4||val.dateorder=="ymd")){day=m[6];month=m[5];year=(m[2].length==4)?m[2]:ownGetFullYear(parseInt(m[3],10))}else{if(val.dateorder==="ymd"){return null}yearLastExp=new RegExp("^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$");m=op.match(yearLastExp);if(m===null){return null}if(val.dateorder==="mdy"){day=m[3];month=m[1]}else{day=m[1];month=m[3]}year=(m[5].length==4)?m[5]:ownGetFullYear(parseInt(m[6],10))}month-=1;date=new Date(year,month,day);return(typeof date=="object"&&year==date.getFullYear()&&month==date.getMonth()&&day==date.getDate())?date.valueOf():null}else{return op.toString()}}function validatorCompare(operand1,operand2,operator,val){var dataType=val.type,op1=null,op2=null;op1=validatorConvert(operand1,dataType,val);if(null===op1){return false}if(operator=='DataTypeCheck'){return true}op2=validatorConvert(operand2,dataType,val);if(null===op2){return true}switch(operator){case'NotEqual':return op1!=op2;case'GreaterThan':return op1>op2;case'GreaterThanEqual':return op1>=op2;case'LessThan':return op10){result=confirm(LNG.ConfirmRecmnded)?valid:false;if(!result&&!exitConfirmEnabled){setExitConfirm()}return result}else{if(!valid){alert(LNG.ErrorInFormData)}return valid}}catch(ex){throw new Error('Validate("'+formid+'")\n'+ex.message)}}function ValidateExtendedList(sender,args){args.IsValid=validatorTrim(validatorGetValue(sender.getAttribute('ControlToValidate')))!==''||validatorTrim(validatorGetValue(sender.getAttribute('ControlToValidate')+'_m'))!==''}function ValidateExtendedList_Recommended(sender,args){args.IsValid=validatorTrim(validatorGetValue(sender.getAttribute('ControlToValidate')))!==''||validatorTrim(validatorGetValue(sender.getAttribute('ControlToValidate')+'_m'))!==''}function getExtendedListValue(id){return(getElement(id+'_m').value.length>0?getElement(id+'_m').value:getElement(id).value)}function validateNumber(sender,args){var regexp=/^\d+$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||regexp.test(value))}function validateNumberNegative(sender,args){var regexp=/^\d+$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=value===''||(value.charAt(0)!=='-'&®exp.test(value)||value.charAt(0)==='-'&®exp.test(value.substr(1)))}function validateEmail(sender,args){var email=validatorGetValue(sender.getAttribute('ControlToValidate'));if(email){args.IsValid=false;passAjaxResponseToFunction('index.php?preq=fw&op=isValidEmail&email='+email,'validateEmail_Impl',sender.id)}else{args.IsValid=true}}function validateEmail_Impl(response,validator){validator.isvalid=response.charAt(0)=='1';validatorUpdateDisplay(validator)}function validateEmailJS(sender,args){var regexp=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+[a-zA-Z]{2,4}$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||regexp.test(value))}function validateEmailNoCitromail(sender,args){try{var regexp=/^([a-zA-Z0-9_\.\-])+\@citromail\.hu$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||!regexp.test(value))}catch(ex){alert(ex.message)}}function validateDate(sender,args){var regexp=/^\d{4}-\d{2}-\d{2}$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||regexp.test(value))}function validateYear(sender,args){var year=new Date().getFullYear(),regexp=/^\d{4}$/,value=validatorGetValue(sender.getAttribute('ControlToValidate')),valid=true;if(value!==''&&(!regexp.test(value)||valueyear)){valid=false}args.IsValid=valid}function validateMonth(sender,args){var regexp=/^\d{1,2}$/,value=validatorGetValue(sender.getAttribute('ControlToValidate')),valid=true;if(value!==''&&(!regexp.test(value)||value<1||value>12)){valid=false}args.IsValid=valid}function validatePersonHeight(sender,args){var regexp=/^\d+$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||regexp.test(value)&&value>=50&&value<=250)}function validatePersonWeight(sender,args){var regexp=/^\d+$/,value=validatorGetValue(sender.getAttribute('ControlToValidate'));args.IsValid=(value===''||regexp.test(value)&&value>=10&&value<=300)}function validateTop5(sender,args){var i=0,j=0,selIdxI,selIdxJ,nameBase=sender.getAttribute('ControlToValidate');nameBase=nameBase.substr(0,nameBase.length-1);args.IsValid=true;for(i=0;i<5;i+=1){selIdxI=getElement(nameBase+i).selectedIndex;if(selIdxI<=0){continue}for(j=0;j<5;j+=1){if(i==j){continue}selIdxJ=getElement(nameBase+j).selectedIndex;if(selIdxJ<=0){continue}if(selIdxI==selIdxJ){args.IsValid=false;return}}}}function checkRadiosChosen(formid,ids_json){try{var ids=JSON.parse(nb_decode(ids_json)),all_filled=true,count=ids.length,i=0;for(i=0;i0}; var PP_UI_UPDATE_FREQ=5000;function onServerNotAvailable(){try{getElement('ServerNotAvailCont').style.display='block'}catch(ex){throw new Error('onServerNotAvailable()\n'+ex.message)}}function onAutoPairPaintUploadFinished(){try{getElement('PaintCont').style.display='none';getElement('TestCont').style.display='block'}catch(ex){throw new Error('onAutoPairPaintUploadFinished()\n'+ex.message)}}function autopp_onPartnerFinishedPainting(){try{getElement('PartnerFinishedPaintingCont').style.display='block'}catch(ex){throw new Error('autopp_onPartnerFinishedPainting()\n'+ex.message)}}function ppStartUpdateA(ppid){setTimeout('ppUpdateA('+ppid+');',PP_UI_UPDATE_FREQ)}function ppUpdateA(ppid){passAjaxResponseToFunction('pairpicture.php?preq=paint&op=UpdateA&ppid='+ppid,'evalResponse');setTimeout('ppUpdateA('+ppid+');',PP_UI_UPDATE_FREQ)}function ppStartUpdateB(ppid){setTimeout('ppUpdateB('+ppid+');',PP_UI_UPDATE_FREQ)}function ppUpdateB(ppid){passAjaxResponseToFunction('pairpicture.php?preq=paint&op=UpdateB&ppid='+ppid,'evalResponse');setTimeout('ppUpdateB('+ppid+');',PP_UI_UPDATE_FREQ)}function ppStartUpdateUI(ppid){setTimeout('ppUpdateUI('+ppid+');',PP_UI_UPDATE_FREQ)}function ppUpdateUI(ppid){passAjaxResponseToFunction('pairpicture.php?preq=paint&op=UpdateUI&ppid='+ppid,'evalResponse');setTimeout('ppUpdateUI('+ppid+');',PP_UI_UPDATE_FREQ)}function ppOnUserFinished(ppid,sessionID,urlbase,noSave){try{if(noSave!==true){noSave=false}if(getElement('FinishedButton').disabled){return}getElement('FinishedButton').disabled=true;callAppletFunc('Paint','js_SetFinished');passAjaxResponseToFunction('pairpicture.php?preq=paint&op=Finished&ppid='+ppid,'evalResponse');if(!noSave){callAppletFunc('Paint','js_Save')}}catch(ex){throw new Error('ppOnUserFinished('+ppid+', '+sessionID+', '+urlbase+', '+noSave+')\n'+ex.message)}}function createBrushSizeSlider(){try{var A_TPL_Brush_Size={'b_vertical':false,'b_watch':false,'n_controlWidth':120,'n_controlHeight':16,'n_sliderWidth':19,'n_sliderHeight':15,'n_pathLeft':1,'n_pathTop':1,'n_pathLength':98,'s_imgControl':'images/slider/sldr2h_bg.gif','s_imgSlider':'images/slider/sldr2h_sl.gif','n_zIndex':1};var A_INIT_Brush_Size={'s_form':null,'s_name':'BrushSize','s_func':'onBrushSizeChanged','n_minValue':2,'n_maxValue':100,'n_value':16,'n_step':1};return new slider(A_INIT_Brush_Size,A_TPL_Brush_Size)}catch(ex){throw new Error('createBrushSizeSlider()\n'+ex.message)}}function onBrushSizeChanged(){try{var brushSize=getElement('BrushSize').value;var label=getElement('BrushSizeLabel');if(label){label.innerHTML=brushSize}callAppletFunc('Paint','js_SetBrushSize',brushSize)}catch(ex){throw new Error('onBrushSizeChanged()\n'+ex.message)}}function createBrushHardnessSlider(){try{var A_TPL_Brush_Hardness={'b_vertical':false,'b_watch':false,'n_controlWidth':120,'n_controlHeight':16,'n_sliderWidth':19,'n_sliderHeight':15,'n_pathLeft':1,'n_pathTop':1,'n_pathLength':98,'s_imgControl':'images/slider/sldr2h_bg.gif','s_imgSlider':'images/slider/sldr2h_sl.gif','n_zIndex':1};var A_INIT_Brush_Hardness={'s_form':null,'s_name':'BrushHardness','s_func':'onBrushHardnessChanged','n_minValue':1,'n_maxValue':100,'n_value':47,'n_step':1};return new slider(A_INIT_Brush_Hardness,A_TPL_Brush_Hardness)}catch(ex){throw new Error('createBrushHardnessSlider()\n'+ex.message)}}function onBrushHardnessChanged(){try{var brushHardness=getElement('BrushHardness').value;var label=getElement('BrushHardnessLabel');if(label){label.innerHTML=brushHardness}var newBrushHardness=100-parseInt(brushHardness,10);callAppletFunc('Paint','js_SetBrushHardness',newBrushHardness.toString())}catch(ex){throw new Error('onBrushHardnessChanged()\n'+ex.message)}}function createEraserSizeSlider(){try{var A_TPL_Eraser_Size={'b_vertical':false,'b_watch':false,'n_controlWidth':120,'n_controlHeight':16,'n_sliderWidth':19,'n_sliderHeight':15,'n_pathLeft':1,'n_pathTop':1,'n_pathLength':98,'s_imgControl':'images/slider/sldr2h_bg.gif','s_imgSlider':'images/slider/sldr2h_sl.gif','n_zIndex':1};var A_INIT_Eraser_Size={'s_form':null,'s_name':'EraserSize','s_func':'onEraserSizeChanged','n_minValue':2,'n_maxValue':100,'n_value':16,'n_step':1};return new slider(A_INIT_Eraser_Size,A_TPL_Eraser_Size)}catch(ex){throw new Error('createEraserSizeSlider()\n'+ex.message)}}function onEraserSizeChanged(){try{callAppletFunc('Paint','js_SetEraserSize',getElement('EraserSize').value)}catch(ex){throw new Error('onEraserSizeChanged()\n'+ex.message)}}function createEraserHardnessSlider(){try{var A_TPL_Eraser_Hardness={'b_vertical':false,'b_watch':false,'n_controlWidth':120,'n_controlHeight':16,'n_sliderWidth':19,'n_sliderHeight':15,'n_pathLeft':1,'n_pathTop':1,'n_pathLength':98,'s_imgControl':'images/slider/sldr2h_bg.gif','s_imgSlider':'images/slider/sldr2h_sl.gif','n_zIndex':1};var A_INIT_Eraser_Hardness={'s_form':null,'s_name':'EraserHardness','s_func':'onEraserHardnessChanged','n_minValue':1,'n_maxValue':100,'n_value':47,'n_step':1};return new slider(A_INIT_Eraser_Hardness,A_TPL_Eraser_Hardness)}catch(ex){throw new Error('createEraserHardnessSlider()\n'+ex.message)}}function onEraserHardnessChanged(){try{var hardness=100-parseInt(getElement('EraserHardness').value,10);callAppletFunc('Paint','js_SetEraserHardness',hardness.toString())}catch(ex){throw new Error('onEraserHardnessChanged()\n'+ex.message)}}var PAINT_GUI={};PAINT_GUI.onDoneClicked=function(){try{callAppletFunc('Paint','js_SetMode','2');getElement('PicFinish').style.display='none';getElement('ManFinish').style.display='block'}catch(ex){throw new Error('onDoneClicked()\n'+ex.message)}return false};PAINT_GUI.onManDoneClicked=function(){try{callAppletFunc('Paint','js_SetMode','3');getElement('ManFinish').style.display='none';getElement('TaskFinish').style.display='block'}catch(ex){throw new Error('onManDoneClicked()\n'+ex.message)}return false};PAINT_GUI.onFinalDoneClicked=function(warning,param){var result=false;try{if(getElement('title').value.trim()===''){alert(warning)}else{TIMER.setAppletElapsedTime('Paint');callAppletFunc('Paint','js_Save',param);result=true}}catch(ex){throw new Error('PAINT_GUI.onFinalDoneClicked(..., ...)\n'+ex.message)}return result};PAINT_GUI.onFinalDoneClickedV2=function(param){var result=false;try{TIMER.setAppletElapsedTime('Paint');callAppletFunc('Paint','js_Save',param);result=true}catch(ex){throw new Error('PAINT_GUI.onFinalDoneClickedV2(..., ...)\n'+ex.message)}return result};PAINT_GUI.onClearClicked=function(confirm_text){var result=false;try{if(confirm(confirm_text)){callAppletFunc('Paint','js_Clear');result=true}}catch(ex){throw new Error('PAINT_GUI.onClearClicked()\n'+ex.message)}return result};PAINT_GUI.flipVisibility=function(link,id,baseurl){try{var img=link.firstChild.firstChild;var imgid=img.id.split('_')[0];var old_state=parseInt(img.id.split('_')[1],10);var new_state=(old_state?'0':'1');var isVisible=(new_state==='1'?true:false);img.id=imgid+'_'+new_state;var post='&id='+id+'&visible='+new_state;ajaxPost('pairpicture.php?preq=fw&op=SetPictureVisibility',post,'evalResponse',null);img.src=baseurl+'/'+(isVisible?'':'in')+'visible.gif'}catch(ex){throw new Error('PAINT_GUI.flipVisibility(...)\n'+ex.message)}};PAINT_GUI.reportPopupId='report_content_popup_container';PAINT_GUI.onReportIconClicked=function(userid,imageid){try{var url='pairpicture.php?preq=fw&op=CreateReportImageForm'+'&user='+userid+'&image='+imageid;POPUP.showPopup(PAINT_GUI.reportPopupId,500,300,url,{'padding':'10px'})}catch(ex){throw new Error('PAINT_GUI.onReportIconClicked('+userid+', '+imageid+')\n'+ex.message)}};PAINT_GUI.reportImage=function(reported_user,reported_image,text_id,cont_id){try{var text=getElement(text_id).value;var encoded=nb_encode(text);url='pairpicture.php?preq=fw&op=ReportImage'+'&reported='+reported_user+'&image='+reported_image+'&reason='+encoded;passAjaxResponseToFunction(url,'void');POPUP.hidePopup(cont_id)}catch(ex){throw new Error('PAINT_GUI.reportImage('+reported_user+', '+reported_image+', '+text_id+')\n'+ex.message)}};; var PS={};PS.inputId='palsearch';PS.linkId='palsearchlink';PS.startSearch=function(){try{var url=getElement(PS.linkId).getAttribute('href')+getElement(PS.inputId).value;gotoUrl(url)}catch(ex){throw new Error('PS.startSearch()\n'+ex.message)}};PS.searchBoxClicked=function(){try{var sb=getElement(PS.inputId);sb.className='active';sb.value=''}catch(ex){throw new Error('PS.searchBoxClicked()\n'+ex.message)}};PS.searchBoxKeyPress=function(e){try{var ev=e||window.event;var key=ev.which||ev.keyCode;if(13===key){PS.startSearch()}}catch(ex){throw new Error('PS.searchBoxKeyPress()\n'+ex.message)}};PS.keyHandler=function(formid,e){try{var ev=e||window.event;var key=ev.which||ev.keyCode;if(13===key){if(typeof Validate!=='function'||Validate(formid)){var form=getElement(formid);form[0].value='StartSearch';form[1].value='';form.submit()}}}catch(ex){throw new Error('PS.keyHandler()\n'+ex.message)}};; var POPUP={};POPUP.id='SendImageAsMailPopup';POPUP.showSendImageAsMailPopup=function(userid,imageid){try{var popup=getElement(POPUP.id);if(!popup){popup=document.createElement('div');popup.setAttribute('id',POPUP.id);popup.innerHTML='';popup.innerHTML+=' '+LNG.Email+':
\n';popup.innerHTML+='

\n';popup.innerHTML+=' '+LNG.Text+':
\n';popup.innerHTML+='

\n';popup.innerHTML+=' '+LNG.Send+'   \n';popup.innerHTML+=' '+LNG.Cancel+'\n';document.body.appendChild(popup)}var w=800,h=600;w=window.innerWidth?window.innerWidth:(screen.availWidth?screen.availWidth:screen.width);h=window.innerHeight?window.innerHeight:(screen.availHeight?screen.availHeight:screen.height);var leftPos=Math.round((w-300)/2);var topPos=Math.round((h-100)/2);popup.style.left=leftPos+'px';popup.style.top=topPos+'px';popup.style.display='block'}catch(ex){alert('POPUP.createSendImageAsMailPopup('+userid+', '+imageid+')\n'+ex.message)}};POPUP.showPopup=function(id,w,h,url,css){try{var div=getElement(id);if(!css){css={}}if(!div){div=document.createElement('div');div.setAttribute('id',id);document.body.appendChild(div);div.style.border='2px solid black';div.style.background='white';div.style.position='absolute';div.style.width=w+'px';div.style.height=h+'px';var scr=getScreenSizes();div.style.left=Math.round((scr.width-w)/2)+'px';div.style.top=Math.round((scr.height-h)/2)+'px';for(var property in css){if(css.hasOwnProperty(property)){div.style[property]=css[property]}}}div.style.display='block';div.innerHTML=LNG.Loading;setInnerHTMLFromAjaxResponse(url+'&contid='+id,id)}catch(ex){alert('POPUP.showPopup("'+id+'", '+w+', '+h+', "'+url+'")\n'+ex.message)}};POPUP.hidePopup=function(id){try{getElement(id).style.display='none';getElement(id).innerHTML=''}catch(ex){alert('POPUP.hidePopup("'+id+'")\n'+ex.message)}};POPUP.hideSendImageAsMailPopup=function(){try{var popup=getElement(POPUP.id)||null;if(popup){popup.style.display='none';getElement('img_email').value='';getElement('img_text').value=''}}catch(ex){alert('POPUP.hideSendImageAsMailPopup()\n'+ex.message)}};POPUP.sendImageAsMail=function(userid,imageid){try{var popup=getElement(POPUP.id)||null;if(!popup||!userid||!imageid){return}var mail=getElement('img_email').value;var text=getElement('img_text').value;var post='';post+='&image='+imageid;post+='&user='+userid;post+='&email='+mail;post+='&text='+text;ajaxPost('index.php?preq=fw&op=SendImageAsEmail',post,'POPUP.checkResult')}catch(ex){alert('POPUP.sendImageAsMail('+imageid+')\n'+ex.message)}};POPUP.checkResult=function(result){try{if(''===result){POPUP.hideSendImageAsMailPopup();getElement('img_email').value='';getElement('img_text').value=''}else{alert(result)}}catch(ex){throw new Error('POPUP.checkResult()\n'+ex.message)}};POPUP.FB={};POPUP.FB.ppId='ReplyToFeedback';POPUP.FB.textId='reply_text';POPUP.FB.open=false;POPUP.FB.sendTo='';POPUP.FB.smallKeyHandler=function(evnt){var e=evnt||event;var key=e.which||e.keyCode;if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true;return false};POPUP.FB.createPopup=function(){try{var code='';code+='

\n';code+=''+LNG.Send+'\n';code+='   \n';code+=''+LNG.Cancel+'\n';var pp=document.createElement('div');pp.setAttribute('id',POPUP.FB.ppId);pp.innerHTML=code;document.body.appendChild(pp)}catch(ex){alert('POPUP.FB.createPopup()\n'+ex.message)}};POPUP.FB.showPopup=function(email){try{if(!getElement(POPUP.FB.ppId)){POPUP.FB.createPopup()}if(POPUP.FB.open){return}POPUP.FB.open=true;POPUP.FB.sendTo=email;var pp=getElement(POPUP.FB.ppId)||null;var w=(screen.availWidth?screen.availWidth:1000);var h=(screen.availHeight?screen.availHeight:700);pp.style.left=Math.round((w-400)/2)+'px';pp.style.top=Math.round((h-300)/2)+'px';pp.style.display='block'}catch(ex){alert('POPUP.FB.showPopup("'+email+'")\n'+ex.message)}};POPUP.FB.hidePopup=function(){try{getElement(POPUP.FB.textId).value='';getElement(POPUP.FB.ppId).style.display='none';POPUP.FB.open=false}catch(ex){alert('POPUP.FB.hidePopup()\n'+ex.message)}};POPUP.FB.sendReply=function(){try{var text=getElement(POPUP.FB.textId).value;var post='';post+='&email='+POPUP.FB.sendTo;post+='&text='+text;ajaxPost('index.php?preq=tablemanager&op=SendFeedbackReplyEmail',post,'POPUP.FB.afterSent')}catch(ex){alert('POPUP.FB.sendReply()\n'+ex.message)}};POPUP.FB.afterSent=function(result){try{if(0!==result.indexOf('OK')){alert(LNG.MailSendFailed+'\n\n'+result)}else{POPUP.FB.hidePopup()}}catch(ex){alert('POPUP.FB.afterSent(...)\n'+ex.message)}};; var SI={};SI.onlyincpp=null;SI.UI_UPDATE_FREQ=30*1000;function siInit(onlyincpp){SI.onlyincpp=onlyincpp;setTimeout(siUpdateUI,SI.UI_UPDATE_FREQ)}function siUpdateUI(){try{passAjaxResponseToFunction('index.php?preq=siteinfo&op=UpdateUI&onlyincpp='+SI.onlyincpp,'evalResponse');setTimeout(siUpdateUI,SI.UI_UPDATE_FREQ)}catch(ex){throw new Error('siUpdateUI()\n'+ex.message)}}; var USERS={};USERS.mainContainer='user_list';USERS.profiles=[];USERS.startUpdateUserList=function(user,mode,offset,limit,page,club){var post='';post+='&user='+user;post+='&mode='+mode;post+='&offset='+offset;post+='&limit='+limit;post+='&page='+page;if(club){post+='&club='+club}USERS.updateUserList(LNG.Loading);ajaxPost('index.php?preq=mycontacts&op=GetUserList',post,'USERS.updateUserList',null,true)};USERS.updateUserList=function(code){try{getElement(USERS.mainContainer).innerHTML=code}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.updateUserList(...)\n'+ex.message)}};USERS.userList=[];USERS.userListMax=6;USERS.userListCont='user_list';USERS.initUserList=function(users){try{USERS.userList=users}catch(ex){throw new Error('USERS.initUserList('+users+')\n'+ex.message)}};USERS.addUser=function(userid){try{var num=0,empty=null,insertbefore=null,userCont=null,url='';if(USERS.userList.length===USERS.userListMax){USERS.removeUser(USERS.userList[0])}USERS.userList[USERS.userList.length]=userid;num=USERS.userListMax-(USERS.userList.length-1);empty=getElement('empty_slot_'+num);getElement(USERS.userListCont).removeChild(empty);insertbefore=getElement('empty_slot_1')||null;userCont=document.createElement('div');userCont.setAttribute('id','userlist_'+userid);userCont.className='user_in_userlist';userCont.innerHTML=LNG.Loading;getElement(USERS.userListCont).insertBefore(userCont,insertbefore);url='index.php?preq=connectionmap&op=GetUserNameAndIcons&user='+userid;setInnerHTMLFromAjaxResponse(url,'userlist_'+userid)}catch(ex){throw new Error('USERS.addUser('+userid+')\n'+ex.message)}};USERS.removeUser=function(userid){try{var list_length=USERS.userList.length,found=false,where=0,i=0,num=0,empty=null;for(i=0;i30?pos.x-30:pos.x),y=pos.y+20,tt=getElement(tt_id),new_div=null;if(!tt){new_div=document.createElement('div');new_div.setAttribute('id',tt_id);new_div.setAttribute('class','tooltip');document.body.appendChild(new_div);tt=getElement(tt_id)}tt.innerHTML=LNG.Loading;USERS.showTooltipAtXY(user,tt_id,x,y,hide)}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.showTooltip("'+where+'", "'+user+'", "'+tt_id+'", "'+scroll+'")\n'+ex.message)}};USERS.showTooltipAtXY=function(user,which,x,y,hide){try{var scheme=(getElement('scheme')?getElement('scheme').value:0),i=0,found=false,params='',post='',tip=getElement(which)||null;tip.style.display='block';tip.style.left=x+'px';tip.style.top=y+'px';for(i=0;i0?y:0);y=(y<100?y:100);return y}}try{if(!getElement('slider_1')){return}USERS.x+=1;var i=0;for(i=1;i<=USERS.count;i+=1){getElement('slider_'+i).style.width=f(USERS.x,USERS.widths[i])+'px'}if(USERS.x<100){setTimeout(USERS.setWidths,10)}}catch(ex){throw new Error('USERS.setWidths()\n'+ex.message)}};function updatePsychoMapSearchProgress(receivedResultUserCount,allUserCount,finished){try{var percent=0;if(finished)percent=100;else{if(allUserCount>0)percent=Math.round(receivedResultUserCount/allUserCount*100);else percent=0}if(percent<0){percent=0}if(percent>100){percent=100}getElement('PsychoMapProgress').innerHTML=percent}catch(ex){throw new Error('updatePsychoMapSearchProgress('+receivedResultUserCount+', '+allUserCount+', '+finished+')\n'+ex.message)}}USERS.showUserPicture=function(response,cont_id){try{if(getElement(cont_id)){getElement(cont_id).innerHTML=response}}catch(ex){throw new Error('USERS.showUserPicture(..., "'+cont_id+'")\n'+ex.message)}};USERS.onMouseOverUser=function(user){try{USERS.showTooltip('tooltip_placeholder',user,'tooltip',null,true);var post='';post+='&user='+user;ajaxPost('index.php?preq=connectionmap&op=GetOneUserDrawnPicture',post,'USERS.showUserPicture','"img_goes_here"',true)}catch(ex){throw new Error('USERS.onMouseOverUser('+user+')\n'+ex.message)}};var lastSelectedMapUserUpdateID=1;function updateSelectedMapUsers(users){try{ajaxPost('index.php?preq=connectionmap&op=GenerateSelectedUserList&users='+users,'','onSelectedUserListGenerated',lastSelectedMapUserUpdateID);lastSelectedMapUserUpdateID+=1}catch(ex){throw new Error('updateSelectedMapUsers('+users+')\n'+ex.message)}}function onSelectedUserListGenerated(response,updateID){try{if(updateID.toString()!==lastSelectedMapUserUpdateID.toString()){return}getElement('SelectedUserList').innerHTML=response}catch(ex){throw new Error('onSelectedUserListGenerated(..., '+updateID+')\n'+ex.message)}}USERS.onMouseOutUser=function(user){try{USERS.hideTooltip('tooltip');getElement('img_goes_here').innerHTML=''}catch(ex){throw new Error('USERS.onMouseOutUser('+user+')\n'+ex.message)}};USERS.startPairDrawing=function(userA,userB){try{var post='';post+='&userA='+userA;post+='&userB='+userB;ajaxPost('index.php?preq=connectionmap&op=InviteToPairDrawing',post,'USERS.alertResult',null,true)}catch(ex){throw new Error('USERS.startPairDrawing()\n'+ex.message)}};USERS.alertResult=function(result){alert(result)};USERS.removePairRequest=function(req_id,user,mode,offset,limit,page){try{if(!confirm(LNG.ConfirmDelReq)){return}var post='';post+='&request='+req_id;post+='&user='+user;post+='&mode='+mode;post+='&offset='+offset;post+='&limit='+limit;post+='&page='+page;ajaxPost('index.php?preq=mycontacts&op=DeletePairRequest',post,'USERS.updateUserList',null,true)}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.removePairRequest\n'+ex.message)}};USERS.refuseRequest=function(req_id,user,mode,offset,limit,page){try{if(!confirm(LNG.ConfirmRefPair)){return}var post='';post+='&request='+req_id;post+='&user='+user;post+='&mode='+mode;post+='&offset='+offset;post+='&limit='+limit;post+='&page='+page;ajaxPost('index.php?preq=mycontacts&op=RefusePairRequest',post,'USERS.updateUserList',null,true)}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.refuseRequest\n'+ex.message)}};USERS.acceptRequest=function(req_id,user,pair,mode,offset,limit,page){try{var post='';post+='&request='+req_id;post+='&user='+user;post+='&pair='+pair;post+='&mode='+mode;post+='&offset='+offset;post+='&limit='+limit;post+='&page='+page;ajaxPost('index.php?preq=mycontacts&op=AcceptPairRequest',post,'USERS.updateUserList',null,true)}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.acceptRequest\n'+ex.message)}};USERS.deleteAckPair=function(user,pair,mode,offset,limit,page){try{if(!confirm(LNG.ConfirmDelPair)){return}var post='';post+='&user='+user;post+='&pair='+pair;post+='&mode='+mode;post+='&offset='+offset;post+='&limit='+limit;post+='&page='+page;ajaxPost('index.php?preq=mycontacts&op=RemovePair',post,'USERS.updateUserList',null,true)}catch(ex){alert(LNG.ErrorInJSFunc+'\nUSERS.deleteAckPair(...)\n'+ex.message)}};USERS.changePermission=function(cell,plc){try{var i=0,arr=cell.getAttribute('id').split('_'),subj=arr[1]-0,perm=arr[2]-0,field=getElement('permissions'),permissions=field.value;for(i=1;i<=plc;i+=1){getElement('td_'+subj+'_'+i).innerHTML=''}getElement('td_'+subj+'_'+perm).innerHTML='';permissions=JSON.parse(permissions);for(i=0;i