var pwsCore=new pwsCore();function pwsCore(){Array.prototype.FindObject=function(object){for(var i=0;i<this.length;i++)if(typeof(this[i])==typeof(object))return i;return-1;};Array.prototype.Find=function(value){for(var i=0;i<this.length;i++)if(this[i]==value)return i;return-1;};Array.prototype.GetRandom=function(){return this.length>1?this[Math.floor(Math.random()*this.length)]:null;};pwsCore.prototype.IsIE6=function(){return typeof document.body.style.maxHeight=='undefined';};pwsCore.prototype.IsIE=function(){return document.selection;};pwsCore.prototype.AlertR=function(obj){str="";for(prop in obj)str+=prop+": "+obj[prop]+"\n";alert(str);};pwsCore.prototype.GetBaseUrl=function(){return location.href.match(/^([^?]*)/)[0];};pwsCore.prototype.GetWindowWidth=function(){return document.documentElement.clientWidth===0?document.body.offsetWidth:document.documentElement.clientWidth;};pwsCore.prototype.GetWindowHeight=function(){return document.documentElement.clientHeight===0?document.body.offsetHeight:document.documentElement.clientHeight;};pwsCore.prototype.GetDocumentWidth=function(){return document.body.clientWidth;};pwsCore.prototype.GetDocumentHeight=function(){return document.body.clientHeight;};pwsCore.prototype.GetScrollTop=function(){if(window.innerHeight)return window.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;else if(document.body)return document.body.scrollTop;return 0;};pwsCore.prototype.GetScrollLeft=function(){if(window.innerWidth)return window.pageXOffset;else if(document.documentElement&&document.documentElement.scrollLeft)return document.documentElement.scrollLeft;else if(document.body)return document.body.scrollLeft;return 0;};pwsCore.prototype.SetScrollTop=function(value){window.scrollBy(0,value-pwsCore.GetScrollTop());};pwsCore.prototype.GetPosition=function(element){var curleft=curtop=0;if(element.offsetParent){do{curleft+=element.offsetLeft;curtop+=element.offsetTop;}while(element=element.offsetParent);}else if(element.x)return [element.x,element.y];return [curleft,curtop];};pwsCore.prototype.GetMousePosition=function(e){return [(window.Event)?e.pageX:event.clientX+this.GetScrollLeft(),(window.Event)?e.pageY:event.clientY+this.GetScrollTop()];};pwsCore.prototype.GetEventElement=function(e){return window.event?window.event.srcElement:e.target;};pwsCore.prototype.IsChild=function(childElement,parentElement){if(childElement==parentElement)return true;else if(childElement==document.body)return false;else if(childElement.parentNode)return pwsCore.IsChild(childElement.parentNode,parentElement);return false;};pwsCore.prototype.GetParentByName=function(el,parentTagName,topEl){if(el==topEl)return;if(!el||(el.tagName&&el.tagName.match(parentTagName)==el.tagName))return el;if(el.parentNode)return this.GetParentByName(el.parentNode,parentTagName,topEl);};pwsCore.prototype.GetParentByClass=function(el,parentClassName){if(el.className&&el.className.match(parentClassName))return el;if(el.parentNode)return this.GetParentByClass(el.parentNode,parentClassName);};pwsCore.prototype.LoadCss=function(path){try{var el=document.createElement('link');el.rel='stylesheet';el.type='text/css';el.media='all';el.href=path;var head=document.getElementsByTagName('head')[0];head.insertBefore(el,head.firstChild);}catch(e){}};pwsCore.prototype.CloseWindow=function(element){var ajaxResult=null;if(window.pwsManager&&window.pwsAdministration&&pwsAdministration.EditObject&&pwsCore.IsChild(pwsAdministration.EditObject.Element,element.parentNode.parentNode))pwsAdministration.EndCurrentEdit();if(element.parentNode.parentNode.parentNode.id=='pwsAjaxResult'&&(ajaxResult=document.getElementById('pwsAjaxResult')).firstChild.nextSibling&&ajaxResult.firstChild.nextSibling.className!='pwsWindow')document.getElementById('pwsAjaxResult').parentNode.removeChild(document.getElementById('pwsAjaxResult'));else element.parentNode.parentNode.parentNode.removeChild(element.parentNode.parentNode);};pwsCore.prototype.StripTags=function(str){return str.replace(/<[^<>]*>/g,'');};pwsCore.prototype.HighlightSyntax=function(str){var part=null;var parts=str.split('{');var result='';for(var i=0;i<parts.length;i++){if(parts[i].search('}')!=-1&&(part=parts[i].split('}')))result+='<span style="color: #FF992B;">{'+part[0]+'}</span>'+part[1].replace(/([\w]+)(=[^ ]+)/g,'<span style="color: red">$1</span><span style="color: blue">$2</span>').replace(/&lt;/g,'<span style="color: blue">&lt</span><span style="color: brown">').replace(/&gt;/g,'</span><span style="color: blue">&gt;</span>');else result+=parts[i].replace(/([\w]+)(=[^ ]+)/g,'<span style="color: red">$1</span><span style="color: blue">$2</span>').replace(/&lt;/g,'<span style="color: blue">&lt</span><span style="color: brown">').replace(/&gt;/g,'</span><span style="color: blue">&gt;</span>');}return result};pwsCore.prototype.Basename=function(path){if(path[path.length-1]=='/')path=path.substring(0,path.length-1);return path.replace(/.*[\/]/,'');};pwsCore.prototype.Dirname=function(path){if(path[path.length-1]=='/')path=path.substring(0,path.length-1);return path.match(/.*[\/]/);};pwsCore.prototype.GetSelectionRange=function(){return document.selection?document.selection.createRange():(window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null);};pwsCore.prototype.PasteHtml=function(html,range){if(document.selection){if((range||(range=document.selection.createRange()))&&range.pasteHTML)range.pasteHTML(html);}else if(range||(window.getSelection().rangeCount&&(range=window.getSelection().getRangeAt(0)))){range.deleteContents();var tmpEl=document.createElement('div');tmpEl.innerHTML=html;range.insertNode(tmpEl.firstChild);}};pwsCore.prototype.SelectContents=function(el){var range;if(document.selection){if(range=document.body.createTextRange()){range.moveToElementText(el);range.select();}}else if(window.getSelection){if(range=document.createRange()){range.selectNode(el);window.getSelection().addRange(range);}}};pwsCore.prototype.GetSelectionParent=function(range){return document.selection?((range||(range=document.selection.createRange()))&&range.parentElement?range.parentElement():null):(window.getSelection?window.getSelection().anchorNode:document.getSelection().anchorNode);};pwsCore.prototype.GetSelectedText=function(range){return range?(document.selection?range.text:range.toString()):(document.selection?document.selection.createRange().text:(window.getSelection?window.getSelection().toString():document.getSelection().toString()));};pwsCore.prototype.UnselectAll=function(){return document.selection?document.selection.empty():(window.getSelection?window.getSelection().removeAllRanges():document.getSelection().removeAllRanges());};pwsCore.prototype.SetInnerText=function(element,value){if(typeof element.innerText=='undefined')element.textContent=value;else element.innerText=value;};pwsCore.prototype.GetInnerText=function(element,value){return typeof element.innerText=='undefined'?element.textContent:element.innerText;};};var pwsImage=new pwsImage();function pwsImage(){this.image=null;this.imageFrame=null;this.imageBackground=null;this.imageList=null;this.SlideShow=function(element,images,speed){pwsImage.slideShowImages=images;pwsImage.slideShowElement=element;pwsImage.slideShowActualImage=images[images.legth-1];pwsImage.slideShowDisplayedImages=new Array();if(speed>0&&images.length>1)pwsImage.SlideShowRun(speed);};this.FadeImages=function(element,newImage,onLoadCallBack){var filters=element.filters&&element.filters.length;element.onload=function(){if(filters)try{element.filters[0].play(0.4);}catch(e){pwsImage.FadeIn(element,70,400);}else pwsImage.FadeIn(element,70,400);if(onLoadCallBack)onLoadCallBack();};if(filters)try{element.filters[0].apply();}catch(e){}element.src=newImage;};this.FadeIn=function(element,startOpacity,duration){pwsImage.SetOpacity(element,startOpacity);var stop=duration/20;var step=(100-startOpacity)/stop;for(var i=0;i<=stop;i++){setTimeout(function(){pwsImage.SetOpacity(element,pwsImage.GetOpacity(element)+step)},20*i);}};this.SlideShowRun=function(speed){while(newImage=pwsImage.slideShowImages.GetRandom(),pwsImage.slideShowDisplayedImages.Find(newImage)>-1);if(pwsImage.slideShowDisplayedImages.length>=pwsImage.slideShowImages.length-1)pwsImage.slideShowDisplayedImages=new Array();pwsImage.slideShowDisplayedImages.push(pwsImage.slideShowActualImage=newImage);pwsImage.FadeImages(pwsImage.slideShowElement,pwsImage.slideShowActualImage);setTimeout('pwsImage.SlideShowRun('+speed+')',speed);};this.GetOpacity=function(el){return el.opacity?el.opacity:100;};this.SetOpacity=function(el,value){if(document.selection)el.style.filter="alpha(opacity="+value+")";else el.style.opacity=el.style.KhtmlOpacity=el.style.MozOpacity=(value/100);el.opacity=value;};this.Activate=function(element,path){var thumbPath=element.className=='pwsImageThumb'?pwsCore.Dirname(path)+'thumbs/'+pwsCore.Basename(path):null;if(window.pwsEditObject){element.onresizeend=function(){pwsImage.Resize(element,path,thumbPath?thumbPath:path);};if(thumbPath)element.ondblclick=function(){pwsImage.Show(element,path);};}else if(thumbPath)element.onclick=function(){pwsImage.Show(element,path);};};this.Edit=function(element,path){if(element.tagName=='A'){element.onclick=function(){return false;};element.ondblclick=function(){pwsAdministration.EndCurrentEdit();pwsImage.Show(element,path);};pwsAdministration.Edit(element,new pwsRequest('Images','Resample',path,pwsCore.Dirname(path)+'thumbs/'+pwsCore.Basename(path)),4,null,null);}else pwsAdministration.Edit(element,new pwsRequest('Images','Resample',path,path),4,null,null);};this.Resize=function(element,srcPath,dstPath){pwsManager.CallAjaxWithCallBack('Images','Resample',function(){element.src=element.src.replace(/\?.*/,'')+'?'+Math.floor(Math.random()*10000);},srcPath,dstPath,element.width,element.height);};this.ShowFrame=function(html){pwsCore.UnselectAll();this.imageBackground=document.createElement("div");this.imageBackground.onclick=function(){this.parentNode.removeChild(this);pwsImage.image=pwsImage.imageFrame=pwsImage.imageBackground=null};this.imageBackground.className='pwsImageBackground';this.imageBackground.innerHTML='<div class="pwsImageBgFill pwsImageLoading">&nbsp;</div>';this.imageBackground.style.position='fixed';var holderEl=pwsManager.FooterElement?pwsManager.FooterElement:document.body;if(!pwsCore.IsIE6())holderEl.appendChild(this.imageBackground);else{document.body.style.height='100%';this.imageBackground.style.position='absolute';var paddingBottom;holderEl.appendChild(this.imageBackground);this.imageBackground.firstChild.style.paddingTop=pwsCore.GetScrollTop()+'px';this.imageBackground.firstChild.style.paddingBottom=((paddingBottom=document.body.clientHeight-this.imageBackground.clientHeight-pwsCore.GetScrollTop())<0?0:paddingBottom)+'px';}this.imageFrame=document.createElement('div');this.imageFrame.className='pwsImageFrame';this.imageFrame.innerHTML='<a href="javascript:pwsImage.Close()" class="pwsImageClose">&times;</a>';if(html==null){this.imageFrame.style.top=this.imageFrame.style.height=this.imageFrame.style.width='200px';}else{this.imageFrame.innerHTML+=html;var cntElement=this.imageFrame.lastChild;this.imageFrame.style.width=cntElement.width+'px';this.imageFrame.style.top=(pwsImage.imageBackground.firstChild.style.paddingTop?parseInt(pwsImage.imageBackground.firstChild.style.paddingTop):0)+(pwsCore.GetWindowHeight()-40-cntElement.height)/2+'px';this.imageFrame.appendChild(cntElement);}this.imageBackground.firstChild.className='pwsImageBgFill';this.imageBackground.appendChild(pwsImage.imageFrame);};this.Show=function(element,path){pwsCore.UnselectAll();if(!this.imageBackground){this.imageBackground=document.createElement("div");this.imageBackground.onmouseup=function(e){return pwsCore.GetMousePosition(e)[0]>pwsCore.GetWindowWidth()/2?pwsImage.Next():pwsImage.Previous();};this.imageBackground.className='pwsImageBackground';this.imageBackground.style.position='fixed';var holderEl=pwsManager.FooterElement?pwsManager.FooterElement:document.body;if(!pwsCore.IsIE6())holderEl.appendChild(this.imageBackground);else{document.body.style.height='100%';this.imageBackground.style.position='absolute';var paddingBottom;holderEl.appendChild(this.imageBackground);this.imageBackground.firstChild.style.paddingTop=pwsCore.GetScrollTop()+'px';this.imageBackground.firstChild.style.paddingBottom=((paddingBottom=document.body.clientHeight-this.imageBackground.clientHeight-pwsCore.GetScrollTop())<0?0:paddingBottom)+'px';}}this.imageBackground.innerHTML='<div class="pwsImageBgFill pwsImageLoading">&nbsp;</div>';this.image=document.createElement('img');this.image.onload=this.imageLoaded;if(element.tagName=='IMG'){this.image.alt=element.alt;this.image.src=path;}else{if(this.imageList==null)this.loadImageList(element.href);this.image.alt=element.title;this.image.src=element.href;}};this.Next=function(){pwsImage.advanceImage(1);};this.Previous=function(){pwsImage.advanceImage(-1);};this.advanceImage=function(advanceIdx){if(!this.imageList||this.imageList.length<=1)return;var cnt=this.imageList.length;for(var i=0;i<cnt;i++){var el=this.imageList[i];if(el.href.indexOf(this.image.src)>=0){pwsImage.Show(this.imageList[(cnt+i+advanceIdx)% cnt]);if(window.pwsPhoto&&el.className.indexOf('pwsPhotoThumb')>=0)return advanceIdx>0?pwsPhoto.BtnNext.onclick():pwsPhoto.BtnPrev.onclick();break;}}};this.Close=function(){if(pwsImage.imageBackground)pwsImage.imageBackground.parentNode.removeChild(pwsImage.imageBackground);pwsImage.image=pwsImage.imageFrame=pwsImage.imageBackground=pwsImage.imageList=null;};this.loadImageList=function(filePath){var dirName=filePath.replace(/[^\/]*$/,'');var els=document.getElementsByTagName('A');this.imageList=new Array();for(var i=0;i<els.length;i++){var el=els[i];if((el.className.indexOf('pwsImage')>=0||el.className.indexOf('pwsPhotoThumb')>=0)&&el.href.indexOf(dirName)>=0)this.imageList.push(els[i]);}};this.imageLoaded=function(){var tmpWidth=pwsCore.GetWindowWidth()-80;var tmpHeight=pwsCore.GetWindowHeight()-80;if(pwsImage.image.width>tmpWidth||pwsImage.image.height>tmpHeight){var newWidth=pwsImage.image.width*tmpHeight/pwsImage.image.height;if(newWidth>tmpWidth){pwsImage.image.height=pwsImage.image.height*tmpWidth/pwsImage.image.width;pwsImage.image.width=tmpWidth;}else{pwsImage.image.width=newWidth;pwsImage.image.height=tmpHeight;}}pwsImage.imageFrame=document.createElement('div');pwsImage.imageFrame.className='pwsImageFrame';pwsImage.imageFrame.onmouseup=function(e){(window.event?window.event:e).cancelBubble=true;};pwsImage.imageFrame.innerHTML='<a href="javascript:pwsImage.Close()" class="pwsImageClose">&times;</a>';if(pwsImage.imageList&&pwsImage.imageList.length>1)pwsImage.imageFrame.innerHTML+='<a href="javascript:pwsImage.Previous()" class="pwsImagePrevious">◄</a><a href="javascript:pwsImage.Next()" class="pwsImageNext">►</a>';pwsImage.imageFrame.style.width=pwsImage.image.width+'px';pwsImage.imageFrame.style.top=(pwsImage.imageBackground.firstChild.style.paddingTop?parseInt(pwsImage.imageBackground.firstChild.style.paddingTop):0)+(tmpHeight-pwsImage.image.height+40)/2+'px';pwsImage.imageFrame.appendChild(pwsImage.image);pwsImage.imageBackground.firstChild.className='pwsImageBgFill';pwsImage.imageBackground.appendChild(pwsImage.imageFrame);};this.imageStretchFrame=function(limit,timeout,widthStep,heightStep){if(this.imageFrame!=null){this.imageFrame.style.width=this.imageFrame.clientWidth+widthStep+'px';this.imageFrame.style.height=this.imageFrame.clientHeight+heightStep+'px';if(--limit>=1)setTimeout('pwsImage.imageStretchFrame('+limit+', '+timeout+', '+widthStep+', '+heightStep+')',timeout);else{this.imageFrame.style.width=pwsImage.image.width+2+'px';this.imageFrame.style.height=pwsImage.image.height+2+'px';setTimeout('pwsImage.imageFrame.appendChild(pwsImage.image);',timeout);}}};}var pwsManager=new pwsManager();pwsManager.AtachEvent(document,'keydown',pwsManager.OnKeyDown);function pwsRequest(className,method){this.ClassName=className;this.Method=method;this.Params=Array.prototype.slice.call(arguments).slice(2);this.Content=null;}function pwsManager(){this.FooterElement;this.Requests=new Array();pwsManager.prototype.AtachEvent=function(el,evname,func){if(el['on'+evname]){if(el.addEventListener)el.addEventListener(evname,el['on'+evname],false);else el.attachEvent('on'+evname,el['on'+evname]);}if(el.addEventListener)el.addEventListener(evname,func,false);else el.attachEvent('on'+evname,func);};pwsManager.prototype.Call=function(className,method){if(!window.pwsAdministration||pwsAdministration.Confirm(method)){if(pwsManager.Requests.length>0&&window.pwsAdministration!=null&&!pwsAdministration.Confirm('UpdateItem'))pwsManager.Requests=new Array();var request=new pwsRequest(className,method);request.Params=Array.prototype.slice.call(arguments).slice(2);pwsManager.RegisterTopRequest(request);pwsManager.SubmitRequests();if(window.pwsAdministration!=null)pwsAdministration.ChangeState(false);}};pwsManager.prototype.CallAjax=function(className,method){var request=new pwsRequest(className,method);request.Params=Array.prototype.slice.call(arguments).slice(2);try{pwsManager.SubmitRequestByAjax(request,pwsManager.ClbWindow);}catch(e){pwsManager.RegisterRequest(request);pwsManager.SubmitRequests();}};pwsManager.prototype.CallAjaxWithCallBack=function(className,method,callback){var request=new pwsRequest(className,method);request.Params=Array.prototype.slice.call(arguments).slice(3);try{pwsManager.SubmitRequestByAjax(request,callback);}catch(e){pwsManager.RegisterRequest(request);pwsManager.SubmitRequests();}};pwsManager.prototype.SetInnerHtml=function(className,method,contentEl){var request=new pwsRequest(className,method);request.Params=Array.prototype.slice.call(arguments).slice(3);try{pwsManager.SubmitRequestByAjax(request,function(ajaxResult){contentEl.innerHTML=ajaxResult.replace(/^\s+/,'');});}catch(e){}};pwsManager.prototype.RegisterRequest=function(request){pwsManager.Requests.push(request);if(pwsManager.Requests.length==1)pwsAdministration.ActivateSaveButton();};pwsManager.prototype.RegisterTopRequest=function(request){for(var i=0;i<pwsManager.Requests.length;i++)with(pwsManager.Requests[i])if(ClassName==request.ClassName&&Method==request.Method&&((!request.Params&&!Params)||Params[0]==request.Params[0]))return pwsManager.Requests[i].Params=request.Params;var requestArr=new Array();requestArr.push(request);pwsManager.Requests=requestArr.concat(pwsManager.Requests);if(pwsManager.Requests.length==1)pwsAdministration.ActivateSaveButton();};pwsManager.prototype.BuildRequests=function(){var form='<input name="ScrollTop" type="hidden" value="'+pwsCore.GetScrollTop()+'" />';for(var i=0;i<pwsManager.Requests.length;i++){form+='<input name="Requests['+i+'][Class]" type="hidden" value="'+pwsManager.Requests[i].ClassName+'" />';form+='<input name="Requests['+i+'][Method]" type="hidden" value="'+pwsManager.Requests[i].Method+'" />';for(var j=0;j<pwsManager.Requests[i].Params.length;j++)form+='<input name="Requests['+i+'][Params][]" type="hidden" value="'+(pwsManager.Requests[i].Params[j]==null?'':pwsManager.Requests[i].Params[j])+'" />';if(pwsManager.Requests[i].Content!==null)form+='<textarea name="Requests['+i+'][Params][]">'+pwsManager.Requests[i].Content+'</textarea>';}return form;};pwsManager.prototype.SubmitRequests=function(){if(pwsManager.Requests.length>0){if(window.pwsAdministration!=null)pwsAdministration.ChangeState(true);var editForm=document.createElement('span');editForm.style.display='none';editForm.innerHTML='<form action="'+pwsCore.GetBaseUrl()+'?action=process" method="post">'+pwsManager.BuildRequests()+'</form>';pwsManager.Requests=new Array();document.body.appendChild(editForm);document.body.lastChild.firstChild.submit();}};pwsManager.prototype.SubmitRequestByAjax=function(request,ajaxCallBack){var httpRequest=window.XMLHttpRequest!=null?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHttp");var parameters='Class='+encodeURI(request.ClassName)+'&Method='+encodeURI(request.Method);for(var i=0;i<request.Params.length;i++)parameters+='&Params[]='+encodeURI(request.Params[i]);parameters+='&Params[]='+encodeURI(request.Content);if(window.pwsAdministration)pwsAdministration.ChangeState(true);httpRequest.open('POST',pwsCore.GetBaseUrl()+'?action=ajax',true);httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");httpRequest.onreadystatechange=function(){if(httpRequest.readyState==4){if(httpRequest.status==200&&ajaxCallBack)ajaxCallBack(httpRequest.responseText);if(window.pwsAdministration)pwsAdministration.ChangeState(false);}};httpRequest.send(parameters);};pwsManager.prototype.ClbWindow=function(ajaxResult){if(ajaxResult.length==0)return;var result=document.createElement('span');result.innerHTML=ajaxResult.replace(/^\s+/,'');if(result.firstChild.className=='pwsWindow'){var el=null;var lastWindow=null;if(el=pwsManager.FooterElement.firstChild.firstChild){do{if(el.className=='pwsWindow'||(el.firstChild&&el.firstChild.className=='pwsWindow'))lastWindow=el.className=='pwsWindow'?el:el.firstChild;}while(el=el.nextSibling);}if(result.firstChild.style){result.firstChild.style.top=(lastWindow?parseInt(lastWindow.style.top)+24:33)+'px';result.firstChild.style.left=(lastWindow?parseInt(lastWindow.style.left)+8:5)+'px';}}pwsManager.FooterElement.firstChild.appendChild(result);};pwsManager.prototype.ClbSingleWindow=function(ajaxResult){if(ajaxResult.length==0)return;var result=document.createElement('span');result.innerHTML=ajaxResult.replace(/^\s+/,'');if(result.firstChild.className=='pwsWindow'){pwsManager.CloseAllWindows();if(pwsAdministration)pwsAdministration.ScrollDialogs();if(result.firstChild.style){result.firstChild.style.top='33px';result.firstChild.style.left='5px';}}pwsManager.FooterElement.firstChild.appendChild(result);};pwsManager.prototype.CloseAllWindows=function(){if(!document.getElementById('pwsWindow1'))return;var el=null;var nextel=null;if(el=pwsManager.FooterElement.firstChild.firstChild){do{nextel=el.nextSibling;if(el.className=='pwsWindow'||(el.firstChild&&el.firstChild.className=='pwsWindow'))pwsManager.FooterElement.firstChild.removeChild(el);}while(el=nextel);}};pwsManager.prototype.ChooseDate=function(el,startDate,timestamp,showOldDates,dateFormat){var chooseDateEl=document.getElementById('pwsChooseDate');var id=el.id?el.id:(el.id='pwsChooseDateElement'+Math.floor(Math.random()*10000));if(chooseDateEl&&chooseDateEl.className!=id){chooseDateEl.parentNode.removeChild(chooseDateEl);chooseDateEl=null;}if(!chooseDateEl)chooseDateEl=document.createElement('span');chooseDateEl.id='pwsChooseDate';chooseDateEl.className=id;var position=pwsCore.GetPosition(el);chooseDateEl.style.left=position[0]-10+'px';chooseDateEl.style.top=position[1]+5+'px';pwsManager.FooterElement.appendChild(chooseDateEl);pwsManager.SetInnerHtml('Html', 'ChooseDate',chooseDateEl,id,!startDate?'':startDate,!timestamp?0:timestamp,el.tagName=='INPUT'?'value':'innerText',showOldDates?1:0,dateFormat?dateFormat:'');};pwsManager.prototype.SendEmail=function(to,subject,message){pwsManager.Call('Mail', 'Send',to,subject,message);return;pwsManager.CallAjaxWithCallBack('Mail', 'Send',function(result){alert('Message sent'+result);},to,subject,message);};pwsManager.prototype.OnKeyDown=function(e){e=window.event?window.event:e;switch(e.keyCode){case 27:pwsImage.Close();break;case 37:pwsImage.Previous();break;case 39:pwsImage.Next();break;}};}var pwsValidation=new pwsValidation();function pwsValidation(){pwsValidation.prototype.CheckEmptyValues=function(obligeteFieldsIds,alertMsg){var status=true;for(var index in obligeteFieldsIds){if(el=document.getElementById(obligeteFieldsIds[index])){if(el.value.length==0)status=false;el.className=el.value.length!=0?null:'pwsNeedValue';}}if(!status&&alertMsg!=null)alert(alertMsg);return status;};pwsValidation.prototype.Number=function(value){return value.replace(/[^0-9+-]+/g,'');};pwsValidation.prototype.Date=function(value){value=value.replace(/[^0-9./-]+/g,'');var re=/^([0-3][0-9]|[1-9]|[1-9][0-9]{3})[./-]([0-1][0-9]|[1-9])[./-]([0-3][0-9]|[1-9]|[1-9][0-9]{3})$/;return re.test(value)?value:'';};pwsValidation.prototype.Email=function(value){var re=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return re.test(value)?value:'';};pwsValidation.prototype.RemoveNewLines=function(value){return value.replace(/<[\/]?(P|DIV|BR)[^<>]*>/ig,'');};pwsValidation.prototype.RemoveWrongEmbeds=function(value){return value.replace(/<[\/]EMBED>/g,'');};pwsValidation.prototype.IsImage=function(path){return path.toLowerCase().match(/\.(jpg|gif|png)$/);};pwsValidation.prototype.MatchFileType=function(path,typeDefinition){return path.toLowerCase().match(new RegExp('\.('+typeDefinition.replace(/,/g,'|').replace(/[*]|\w+[\/]/g,'')+')$'));};}var pwsSubmenu=new pwsSubmenu();function pwsSubmenu(){this.activeSubmenu=null;this.timeout=null;pwsSubmenu.prototype.Display=function(parentSubmenuEl){if(pwsSubmenu.activeSubmenu!=null)pwsSubmenu.HideActive();window.clearTimeout(pwsSubmenu.timeout);parentSubmenuEl.onmouseout=function(){window.clearTimeout(pwsSubmenu.timeout);pwsSubmenu.timeout=window.setTimeout("pwsSubmenu.HideActive()",1000);};var submenuEl=parentSubmenuEl.previousSibling;submenuEl.onmouseover=function(){window.clearTimeout(pwsSubmenu.timeout);};submenuEl.onmouseout=function(){pwsSubmenu.timeout=window.setTimeout("pwsSubmenu.HideActive()",1000);};pwsImage.FadeIn(submenuEl,50,200);submenuEl.style.display='block';var offset=submenuEl.offsetLeft+submenuEl.clientWidth-pwsCore.GetDocumentWidth();if(offset>0)submenuEl.style.marginLeft=-offset+'px';pwsSubmenu.activeSubmenu=submenuEl;};pwsSubmenu.prototype.HideActive=function(){pwsSubmenu.activeSubmenu.style.display='none';pwsSubmenu.activeSubmenu=null;};}
