var Layer=function(isModal,setID){this.isModal=isModal;this.setID=setID?setID:false;};Layer.dialogName='dialogBox';Layer.imagePath='objects/sysicons/';Layer.className='dialogBox';Layer.closeIcon=null;Layer.maxDepth=5;Layer.prototype.create=function(){var container=Layer.createElement('div');container.style.position='absolute';container.style.display='none';container.className=Layer.className;container.dialogBox=this;this.container=container;var mainTable=Layer.createElement('table',container);mainTable.cellSpacing='0';mainTable.cellPadding='0';mainTable.border='0';var tBodyM=Layer.createElement('tbody',mainTable);var rowM=Layer.createElement('tr',tBodyM);var cellM=Layer.createElement('td',rowM);var titleTable=Layer.createElement('table',cellM);titleTable.cellSpacing='0';titleTable.cellPadding='0';titleTable.border='0';titleTable.width='100%';titleTable.className='dboxTbTitle';var tBodyT=Layer.createElement('tbody',titleTable);var rowT=Layer.createElement('tr',tBodyT);var cellT=Layer.createElement('td',rowT);cellT.className='dboxTbLeft';var titleCell=Layer.createElement('td',rowT);this.titleCell=titleCell;titleCell.className='dboxTitle';var cellT=Layer.createElement('td',rowT);cellT.className='dboxTbRight';Layer.initCloseIcon();var closeIcon=Layer.createElement('img',cellT);closeIcon.src=Layer.closeIcon.src;closeIcon.border='0';closeIcon.alt='Kapat';closeIcon.dialogBox=this;var aLink=Layer.createElement('a',cellT);aLink.href='javascript:void(0)';aLink.appendChild(closeIcon);aLink.onclick=Layer.closeBox;var rowM=Layer.createElement('tr',tBodyM);var cellM=Layer.createElement('td',rowM);cellM.className='dboxMainPanel';var contentArea=Layer.createElement('div',cellM);this.contentArea=contentArea;contentArea.className='dboxContentArea';var rowB=Layer.createElement('tr',tBodyM);var cellB=Layer.createElement('td',rowB);cellB.className='dboxButtons';var buttonsArea=Layer.createElement('div',cellB);this.buttonsArea=buttonsArea;Drag.init(titleCell,container,0,null,0);};Layer.prototype.createBox=function(){var container=Layer.createElement('div');container.style.position='absolute';container.style.display='none';container.dialogBox=this;this.container=container;var mainTable=Layer.createElement('table',container);mainTable.bgColor='#dddddd';mainTable.cellSpacing='10';mainTable.cellPadding='0';mainTable.border='0';var tBodyM=Layer.createElement('tbody',mainTable);var rowM=Layer.createElement('tr',tBodyM);var cellM=Layer.createElement('td',rowM);cellM.bgColor='#ffffff';var contentArea=Layer.createElement('div',cellM);this.contentArea=contentArea;};Layer.prototype.show=function(){if(this.isModal){this.veil=Layer.veiling.show(this.veilCss?this.veilCss:null);}Layer.body.toTop(this.container);this.container.style.display='block';Layer.box.hideShowBehind();};Layer.prototype.hide=function(){if(this.isModal){Layer.veiling.hide(this.veil);}if(this.contentType=='object'){this.contentArea.childNodes[0].style.display='none';this.htmlContentParent.appendChild(this.contentArea.childNodes[0]);}this.container.parentNode.removeChild(this.container);Layer.box.hideShowBehind();if(this.closeFunction){this.closeFunction();}};Layer.prototype.setWidth=function(width){this.contentArea.style.width=width+'px';};Layer.prototype.setHeight=function(height){this.contentArea.style.height=height+'px';this.contentArea.style.overflow='auto';};Layer.prototype.setTitle=function(title){this.titleCell.innerHTML=title;};Layer.prototype.setVeilCss=function(val){this.veilCss=val;};Layer.prototype.setContent=function(htmlContent){this.contentType=typeof htmlContent;if(this.contentType=='string'){this.contentArea.innerHTML=htmlContent;if(this.setID){this.container.id=(Layer.dialogName+Math.random());}}else if(this.contentType=='object'){htmlContent.style.position='relative';htmlContent.style.display='block';this.htmlContentParent=htmlContent.parentNode;this.contentArea.appendChild(htmlContent);if(this.setID){this.container.id=(Layer.dialogName+htmlContent.id);}}};Layer.prototype.resetForm=function(formName){if(document.forms[formName]){document.forms[formName].reset();}};Layer.prototype.setCloseFunction=function(func){this.closeFunction=func;};Layer.prototype.addButton=function(attributes){var button=document.createElement('input');button.type='button';button.id=(attributes.name?attributes.name:('btn'+Math.random()));button.name=(attributes.name?attributes.name:('btn'+Math.random()));button.value=(attributes.value?attributes.value:'Buton');button.style.cssText=(attributes.css?attributes.css:'');button.onclick=attributes.onclick||Layer.closeBox;this.buttonsArea.appendChild(button);};Layer.prototype.addToButtonsArea=function(html){this.buttonsArea.innerHTML=html;};Layer.prototype.focusOn=function(el){if(el){el.focus();}else{var els=this.contentArea.getElementsByTagName('input');if(els.length>0){for(var i=0;i<els.length;i++){if((els[i].type=='button')||(els[i].type=='text')){els[i].focus();break;}}}else{var buts=this.buttonsArea.getElementsByTagName('input');if(buts.length>0){buts[buts.length-1].focus();}}}};Layer.prototype.moveTo=function(x,y){if(!x||(x==-1)){x=Math.round((document.documentElement.clientWidth-this.container.offsetWidth)/2);}if(!y||(y==-1)){y=Math.round((document.documentElement.clientHeight-this.container.offsetHeight)/2)+document.documentElement.scrollTop;}this.container.style.left=x+'px';this.container.style.top=y+'px';};Layer.prototype.setUrl=function(url,height){if(!this.frmEl){this.frmEl=document.createElement('iframe');this.frmEl.frameBorder='no';this.frmEl.style.width='100%';if(height){this.frmEl.style.height=height+'px';}this.contentArea.appendChild(this.frmEl);}this.frmEl.src=url;};Layer.prototype.getUrl=function(){if(this.frmEl){var url=this.frmEl.src;if(this.frmEl.contentWindow){try{url=this.frmEl.contentWindow.location.href;}catch(e){}}return url;}return false;};Layer.prototype.getContentNode=function(){return this.contentArea;};Layer.initCloseIcon=function(){if(Layer.closeIcon==null){Layer.closeIcon=new Image();Layer.closeIcon.src=Layer.imagePath+'close.gif';}};Layer.closeBox=function(e){if(!e){e=window.event;}var node=e.target?e.target:e.srcElement;var count=0;while((node!=null)&&(count<Layer.maxDepth)){if(node.dialogBox){node.dialogBox.hide();break;}node=node.parentNode;count++;}};Layer.closeBoxById=function(id){var el=document.getElementById(Layer.dialogName+id);if(el&&el.dialogBox){el.dialogBox.hide();}};Layer.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS('http://www.w3.org/1999/xhtml',type);}else{el=document.createElement(type);}if(typeof parent!='undefined'){parent.appendChild(el);}return el;};Layer.body={toTop:function(el,unclickable){if(!Layer.body.que){Layer.body.que=document.createElement('div');document.body.appendChild(Layer.body.que);}if(!el.bodyZ){el.bodyZ=Layer.body.nid++;if(!unclickable){addListener(el,'mousedown',function(){Layer.body.toTop(el)});}Layer.body.que.appendChild(el);Layer.body.set(el);}else if(el.bodyZ!=Layer.body.last.bodyZ){Layer.body.set(el);}},set:function(el){el.style.zIndex=Layer.body.nextZ++;Layer.body.last=el;},nid:1,nextZ:10001};Layer.veiling={show:function(css){var veil=Layer.veiling.create();for(var prop in Layer.veiling.css)veil.style[prop]=Layer.veiling.css[prop];if(css){for(var prop in css)veil.style[prop]=css[prop];}else{veil.style['backgroundColor']='#000000';veil.style['filter']='alpha(opacity=60)';veil.style['opacity']=0.6;}veil.style.display='block';return veil;},hide:function(el){el.parentNode.removeChild(el);},create:function(){var shadow=Layer.createElement('div');shadow.innerHTML='';Layer.body.toTop(shadow,true);addListener(window,'resize',function(){Layer.veiling.fix(shadow);});Layer.veiling.fix(shadow);return shadow;},fix:function(el){el.style.width=Math.max(document.body.scrollWidth,getWinW())+'px';el.style.height=Math.max(document.body.scrollHeight,getWinH())+'px';},css:{position:'absolute',display:'none',top:0,left:0,cursor:'not-allowed'}};Layer.box={getAllBox:function(){var divs=new Array();var els=document.getElementsByTagName('div');for(var i=0;i<els.length;i++){if(els[i].dialogBox){divs.push(els[i]);}}return divs;},getTopBox:function(){var divs=this.getAllBox();if(divs.length>0){return divs[divs.length-1];}else{return document.body;}},hideShowBehind:function(){var tags=new Array('object','applet','iframe');if(navigator.appName=="Microsoft Internet Explorer"){var rawVersion=/MSIE\s([0-9]+)\.[0-9];/g.exec(navigator.appVersion);var version=parseInt(rawVersion[1]);if(version<7){tags.push('select');}}for(var k=0;k<tags.length;k++){var arr=document.getElementsByTagName(tags[k]);for(var i=0;i<arr.length;i++){arr[i].style.visibility='hidden';}}var target=this.getTopBox();for(var k=0;k<tags.length;k++){var arr=target.getElementsByTagName(tags[k]);for(var i=0;i<arr.length;i++){arr[i].style.visibility='visible';}}}};var Drag={obj:null,init:function(o,oRoot,minX,maxX,minY,maxY,bSwapHorzRef,bSwapVertRef,fXMapper,fYMapper){o.onmousedown=Drag.start;o.hmode=bSwapHorzRef?false:true;o.vmode=bSwapVertRef?false:true;o.root=oRoot&&oRoot!=null?oRoot:o;if(o.hmode&&isNaN(parseInt(o.root.style.left))){o.root.style.left='0px';}if(o.vmode&&isNaN(parseInt(o.root.style.top))){o.root.style.top='0px';}if(!o.hmode&&isNaN(parseInt(o.root.style.right))){o.root.style.right='0px';}if(!o.vmode&&isNaN(parseInt(o.root.style.bottom))){o.root.style.bottom='0px';}o.minX=typeof minX!='undefined'?minX:null;o.minY=typeof minY!='undefined'?minY:null;o.maxX=typeof maxX!='undefined'?maxX:null;o.maxY=typeof maxY!='undefined'?maxY:null;o.xMapper=fXMapper?fXMapper:null;o.yMapper=fYMapper?fYMapper:null;o.root.onDragStart=new Function();o.root.onDragEnd=new Function();o.root.onDrag=new Function();},start:function(e){var o=Drag.obj=this;e=Drag.fixE(e);var y=parseInt(o.vmode?o.root.style.top:o.root.style.bottom);var x=parseInt(o.hmode?o.root.style.left:o.root.style.right);o.root.onDragStart(x,y);o.lastMouseX=e.clientX;o.lastMouseY=e.clientY;if(o.hmode){if(o.minX!=null){o.minMouseX=e.clientX-x+o.minX;}if(o.maxX!=null){o.maxMouseX=o.minMouseX+o.maxX-o.minX;}}else{if(o.minX!=null){o.maxMouseX=-o.minX+e.clientX+x;}if(o.maxX!=null){o.minMouseX=-o.maxX+e.clientX+x;}}if(o.vmode){if(o.minY!=null){o.minMouseY=e.clientY-y+o.minY;}if(o.maxY!=null){o.maxMouseY=o.minMouseY+o.maxY-o.minY;}}else{if(o.minY!=null){o.maxMouseY=-o.minY+e.clientY+y;}if(o.maxY!=null){o.minMouseY=-o.maxY+e.clientY+y;}}document.onmousemove=Drag.drag;document.onmouseup=Drag.end;return false;},drag:function(e){e=Drag.fixE(e);var o=Drag.obj;var ey=e.clientY;var ex=e.clientX;var y=parseInt(o.vmode?o.root.style.top:o.root.style.bottom);var x=parseInt(o.hmode?o.root.style.left:o.root.style.right);var nx,ny;if(o.minX!=null){ex=o.hmode?Math.max(ex,o.minMouseX):Math.min(ex,o.maxMouseX);}if(o.maxX!=null){ex=o.hmode?Math.min(ex,o.maxMouseX):Math.max(ex,o.minMouseX);}if(o.minY!=null){ey=o.vmode?Math.max(ey,o.minMouseY):Math.min(ey,o.maxMouseY);}if(o.maxY!=null){ey=o.vmode?Math.min(ey,o.maxMouseY):Math.max(ey,o.minMouseY);}nx=x+((ex-o.lastMouseX)*(o.hmode?1:-1));ny=y+((ey-o.lastMouseY)*(o.vmode?1:-1));if(o.xMapper){nx=o.xMapper(y);}else if(o.yMapper){ny=o.yMapper(x);}Drag.obj.root.style[o.hmode?'left':'right']=nx+'px';Drag.obj.root.style[o.vmode?'top':'bottom']=ny+'px';Drag.obj.lastMouseX=ex;Drag.obj.lastMouseY=ey;Drag.obj.root.onDrag(nx,ny);return false;},end:function(){document.onmousemove=null;document.onmouseup=null;Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode?'left':'right']),parseInt(Drag.obj.root.style[Drag.obj.vmode?'top':'bottom']));Drag.obj=null;},fixE:function(e){if(typeof e=='undefined'){e=window.event;}if(typeof e.layerX=='undefined'){e.layerX=e.offsetX;}if(typeof e.layerY=='undefined'){e.layerY=e.offsetY;}return e;}};function getPosition(el){var r={x:el.offsetLeft,y:el.offsetTop};if(el.offsetParent){var tmp=getPosition(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;}function addListener(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);}else if(obj.attachEvent){obj.attachEvent('on'+evType,fn);}}function remListener(obj,evType,fn){if(obj.removeEventListener){obj.removeEventListener(evType,fn,false);}else if(obj.detachEvent){obj.detachEvent('on'+evType,fn);}}function getWinW(){if(document.documentElement&&(document.documentElement.clientWidth>0)){return document.documentElement.clientWidth;}else if(window.innerWidth){return window.innerWidth;}else{return document.body.clientWidth;}}function getWinH(){if(window.innerHeight){return window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientHeight>0)){return document.documentElement.clientHeight;}else{return document.body.clientHeight;}}function getScrollLeft(){if(window.pageXOffset){return window.pageXOffset;}else if(document.documentElement&&(document.documentElement.scrollLeft>0)){return document.documentElement.scrollLeft;}else{return document.body.scrollLeft;}}function getScrollTop(){if(window.pageYOffset){return window.pageYOffset;}else if(document.documentElement&&(document.documentElement.scrollTop>0)){return document.documentElement.scrollTop;}else{return document.body.scrollTop;}}function wolAdd(func){addListener(window,'load',function(){eval(func)});}function worAdd(func){addListener(window,'resize',function(){eval(func)});}function layer(status,target,width,height,title,buttons,opa){if(status=='hide'){Layer.closeBoxById(target);}else{var targetObj=document.getElementById(target);if(!targetObj){messageDialog('Hedef içerik bulunamadı!',{type:'OK',icon:'warning.gif'});}else{var dialog=new Layer(true,true,'auto');dialog.create();dialog.setWidth(width);dialog.setTitle(title);dialog.setContent(targetObj);if(opa||(Layer.box.getAllBox().length>0)){dialog.setVeilCss({backgroundColor:'#ffffff',filter:'alpha(opacity=0)',opacity:0});}if(buttons){if(buttons.align){dialog.buttonsArea.style.textAlign=buttons.align;}if(buttons.onClose){dialog.setCloseFunction(buttons.onClose);}switch(buttons.type){case'YESNO':var labelYES=buttons.labelYES?buttons.labelYES:'Evet';var labelNO=buttons.labelNO?buttons.labelNO:'Hayır';var functionYES=buttons.functionYES?(typeof(buttons.functionYES)=='function'?buttons.functionYES:function(){eval(buttons.functionYES)}):'';var functionNO=buttons.functionNO?(typeof(buttons.functionNO)=='function'?buttons.functionNO:function(){eval(buttons.functionNO)}):'';dialog.addButton({name:'btnYes',value:labelYES,onclick:functionYES});dialog.addButton({name:'btnNo',value:labelNO,onclick:functionNO});break;case'YESNOCANCEL':var labelYES=buttons.labelYES?buttons.labelYES:'Evet';var labelNO=buttons.labelNO?buttons.labelNO:'Hayır';var labelCANCEL=buttons.labelCANCEL?buttons.labelCANCEL:'İptal';var functionYES=buttons.functionYES?(typeof(buttons.functionYES)=='function'?buttons.functionYES:function(){eval(buttons.functionYES)}):'';var functionNO=buttons.functionNO?(typeof(buttons.functionNO)=='function'?buttons.functionNO:function(){eval(buttons.functionNO)}):'';var functionCANCEL=buttons.functionCANCEL?(typeof(buttons.functionCANCEL)=='function'?buttons.functionCANCEL:function(){eval(buttons.functionCANCEL)}):'';dialog.addButton({name:'btnYes',value:labelYES,onclick:functionYES});dialog.addButton({name:'btnNo',value:labelNO,onclick:functionNO});dialog.addButton({name:'btnCancel',value:labelCANCEL,onclick:functionCANCEL});break;case'OKCANCEL':var labelOK=buttons.labelOK?buttons.labelOK:'Tamam';var labelCANCEL=buttons.labelCANCEL?buttons.labelCANCEL:'İptal';var functionOK=buttons.functionOK?(typeof(buttons.functionOK)=='function'?buttons.functionOK:function(){eval(buttons.functionOK)}):'';var functionCANCEL=buttons.functionCANCEL?(typeof(buttons.functionCANCEL)=='function'?buttons.functionCANCEL:function(){eval(buttons.functionCANCEL)}):'';dialog.addButton({name:'btnOk',value:labelOK,onclick:functionOK});dialog.addButton({name:'btnCancel',value:labelCANCEL,onclick:functionCANCEL});break;case'SAVECANCEL':var labelSAVE=buttons.labelSAVE?buttons.labelSAVE:'Kaydet';var labelCANCEL=buttons.labelCANCEL?buttons.labelCANCEL:'İptal';var functionSAVE=buttons.functionSAVE?(typeof(buttons.functionSAVE)=='function'?buttons.functionSAVE:function(){eval(buttons.functionSAVE)}):'';var functionCANCEL=buttons.functionCANCEL?(typeof(buttons.functionCANCEL)=='function'?buttons.functionCANCEL:function(){eval(buttons.functionCANCEL)}):'';dialog.addButton({name:'btnSave',value:labelSAVE,onclick:functionSAVE});dialog.addButton({name:'btnCancel',value:labelCANCEL,onclick:functionCANCEL});break;case'SAVEDELETECANCEL':var labelSAVE=buttons.labelSAVE?buttons.labelSAVE:'Kaydet';var labelDELETE=buttons.labelDELETE?buttons.labelDELETE:'Sil';var labelCANCEL=buttons.labelCANCEL?buttons.labelCANCEL:'İptal';var functionSAVE=buttons.functionSAVE?(typeof(buttons.functionSAVE)=='function'?buttons.functionSAVE:function(){eval(buttons.functionSAVE)}):'';var functionDELETE=buttons.functionDELETE?(typeof(buttons.functionDELETE)=='function'?buttons.functionDELETE:function(){eval(buttons.functionDELETE)}):'';var functionCANCEL=buttons.functionCANCEL?(typeof(buttons.functionCANCEL)=='function'?buttons.functionCANCEL:function(){eval(buttons.functionCANCEL)}):'';dialog.addButton({name:'btnSave',value:labelSAVE,onclick:functionSAVE});dialog.addButton({name:'btnDelete',value:labelDELETE,onclick:functionDELETE});dialog.addButton({name:'btnCancel',value:labelCANCEL,onclick:functionCANCEL});break;case"OK":var labelOK=buttons.labelOK?buttons.labelOK:'Tamam';var functionOK=buttons.functionOK?(typeof(buttons.functionOK)=='function'?buttons.functionOK:function(){eval(buttons.functionOK)}):'';dialog.addButton({name:'btnOk',value:labelOK,onclick:functionOK});break;default:if(buttons.html){dialog.addToButtonsArea(buttons.html);}}}dialog.show();addListener(window,'resize',function(){dialog.moveTo()});addListener(window,'scroll',function(){dialog.moveTo()});dialog.moveTo();dialog.resetForm(target+'form');dialog.focusOn();}}}function messageDialog(message,properties,status){var targetID='processDialog';if(status&&(status=='hide')){if(document.getElementById(targetID)){layer('hide',targetID);document.getElementById(targetID).parentNode.removeChild(document.getElementById(targetID));}return false;}if(document.getElementById(targetID)){targetID=targetID+Math.random();}var el=Layer.createElement('div');el.id=targetID;var table=Layer.createElement('table',el);table.width='100%';table.border='0';table.cellPadding='0';table.cellSadding='0';var tbody=Layer.createElement('tbody',table);var tr=Layer.createElement('tr',tbody);var td=Layer.createElement('td',tr);td.align='center';td.height='85';if(properties&&properties.icon){var im=Layer.createElement('img',td);im.width='32';im.height='32';im.alt='Simge';im.border='0';im.hspace='5';im.align='absmiddle';im.src=Layer.imagePath+properties.icon;}var span=Layer.createElement('span',td);span.innerHTML=message;document.body.appendChild(el);var type=(properties&&properties.type)?properties.type:'OK';var title=(properties&&properties.title)?properties.title:'Mesaj';var closeFunc=(properties&&properties.onClose)?properties.onClose:'';switch(type){case"YESNO":var labelYES=properties.labelYES?properties.labelYES:'Evet';var labelNO=properties.labelNO?properties.labelNO:'Hayır';var functionYES=properties.functionYES?(typeof(properties.functionYES)=='function'?function(){properties.functionYES();layer('hide',targetID)}:function(){eval(properties.functionYES);layer('hide',targetID)}):function(){layer('hide',targetID)};var functionNO=properties.functionNO?(typeof(properties.functionNO)=='function'?function(){properties.functionNO();layer('hide',targetID)}:function(){eval(properties.functionNO);layer('hide',targetID)}):function(){layer('hide',targetID)};layer('show',targetID,400,160,title,{type:'YESNO',labelYES:labelYES,labelNO:labelNO,height:35,align:'center',functionYES:functionYES,functionNO:functionNO,onClose:closeFunc},(properties.opa?true:false));break;default:var labelOK=properties.labelOK?properties.labelOK:'Tamam';var functionOK=properties.functionOK?(typeof(properties.functionOK)=='function'?function(){properties.functionOK();layer('hide',targetID)}:function(){eval(properties.functionOK);layer('hide',targetID)}):function(){layer('hide',targetID)};layer('show',targetID,400,160,title,{type:'OK',labelOK:labelOK,height:35,align:'center',functionOK:functionOK,onClose:closeFunc},(properties.opa?true:false));}return true;}function processDialog(status,message){var targetID='messageDialog';if(status&&(status=='hide')){Layer.closeBoxById(targetID);document.body.removeChild(document.getElementById(targetID));}else{var html=Layer.createElement('div');html.id=targetID;var table=Layer.createElement('table',html);table.width='100%';table.border='0';table.cellPadding='5';table.cellSpacing='0';var tbody=Layer.createElement('tbody',table);var tr1=Layer.createElement('tr',tbody);var tr2=Layer.createElement('tr',tbody);var td1=Layer.createElement('td',tr1);var td2=Layer.createElement('td',tr2);td1.align='center';td2.align='center';var img=Layer.createElement('img',td1);img.width='32px';img.height='32px';img.border='0';img.src=Layer.imagePath+'loading.gif';img.alt='Yükleniyor...';var b=Layer.createElement('b',td2);b.innerHTML=message?message:'Yükleniyor, lütfen bekleyiniz...';document.body.appendChild(html);var dialog=new Layer(true,true);dialog.createBox();dialog.setWidth(250);dialog.setContent(html);dialog.setVeilCss({backgroundColor:'#ffffff',filter:'alpha(opacity=0)',opacity:0});dialog.show();addListener(window,'resize',function(){dialog.moveTo()});addListener(window,'scroll',function(){dialog.moveTo()});dialog.moveTo();}}var ajaxObject=function(method,url,params,extras){this.http=false;this.running=false;this.method=method;this.url=(/\?/.test(url))?url:url+'?';this.params=params?params:null;this.extra=extras?extras:{};this.errors={'support':'AJAX desteklemeyen bir tarayıcı kullanıyorsunuz!','fatal':'AJAX işlemi gerçekleştirilemiyor!','status':'Sunucudan istenilen sayfa çağırılamadı!'};this.init();};ajaxObject.prototype.debug=false;ajaxObject.prototype.init=function(){if(typeof(XMLHttpRequest)!='undefined'){this.http=new XMLHttpRequest();}else if(window.ActiveXObject){try{this.http=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{this.http=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){this.http=false;}}}if(this.http){this.running=true;this.onIdle('start');}else{this.onError('support');}};ajaxObject.prototype.run=function(){if(!this.running){return false;}var that=this;try{this.http.onreadystatechange=function(){ajaxObject.handler(that);};if(this.debug){alert('Method: '+this.method+'\n'+'URL: '+this.url+'\n'+'Parameters: '+this.params+'\n');}if(this.method&&(/post/i.test(this.method))){var uri=this.url+'&rnd='+Math.random();this.http.open("POST",uri,true);this.http.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.http.setRequestHeader("Content-Length",(this.params?this.params.length:0));this.http.setRequestHeader("Cache-control","no-cache");this.http.setRequestHeader("Connection","close");this.http.send(this.params);}else{var uri=this.url+((this.params&&(this.params.length>0))?'&'+this.params:'')+'&rnd='+Math.random();this.http.open("GET",uri,true);this.http.send(null);}}catch(e){this.running=false;this.onLoad();this.onError('fatal');}};ajaxObject.handler=function(refObj){if(refObj.debug){alert('State: '+refObj.http.readyState);}if((refObj.http.readyState==4)||(refObj.http.readyState=='complete')){refObj.running=false;refObj.onIdle('stop');if(refObj.debug){alert('Status: '+refObj.http.status);}refObj.text=refObj.http.responseText;refObj.xml=refObj.http.responseXML?refObj.http.responseXML:null;refObj.status=refObj.http.status;if(refObj.http.status==200){refObj.onLoad();refObj.http=false;}else{refObj.onError('status');}}};ajaxObject.prototype.onError=function(type){switch(type){case'connection':alert(this.errors.connection);break;case'fatal':alert(this.errors.fatal);break;case'status':alert(this.errors.status);break;default:alert(type);}};ajaxObject.prototype.onIdle=function(act){var type=this.extra.type?this.extra.type:'NONE';var message=this.extra.message?this.extra.message:'Lütfen bekleyin...';var target=(this.extra.target&&document.getElementById(this.extra.target))?document.getElementById(this.extra.target):null;if(this.extra.form){if(act=='start'){formDisabled(this.extra.form,true);}else{formDisabled(this.extra.form,false);}}switch(type){case'DIALOG':if(act=='start'){if(target){if(!document.getElementById('loadingpoint')){var el=document.createElement('div');el.id='loadingpoint';el.className='loadingpoint';el.innerHTML=message;target.appendChild(el);ajaxObject.mask.show(target);}else{document.getElementById('loadingpoint').innerHTML=message;}}}else{if(target){if(document.getElementById('loadingpoint')){target.removeChild(document.getElementById('loadingpoint'));}ajaxObject.mask.hide(target);}}break;case'LIST':if(target){if(act=='start'){target.innerHTML='<div style="color:#FF0000; text-align:center; line-height:40px;">'+message+'<\/div>';}else{target.innerHTML='';}}break;case'MESSAGE':if(act=='start'){processDialog('show',message);}else{processDialog('hide');}break;}};ajaxObject.mask={maskID:'dialogBoxMask',show:function(target){var el=this.create();if(target){target.appendChild(el);this.hideShowBehind(target,'hidden');this.buttons(target,true);}el.style.display='block';el.style.width=target.scrollWidth+'px';el.style.height=target.scrollHeight+'px';},hide:function(target){var el=document.getElementById(this.maskID);if(el){el.parentNode.removeChild(el);this.hideShowBehind(target,'visible');this.buttons(target,false);}},buttons:function(target,disabled){var el=document.getElementById(Layer.dialogName+target.id);if(el&&el.dialogBox&&el.dialogBox.buttonsArea){var els=el.dialogBox.buttonsArea.getElementsByTagName('input');for(var i=0;i<els.length;i++){els[i].disabled=disabled;}}},create:function(){var el=document.getElementById(this.maskID);if(!el){var el=document.createElement('div');el.setAttribute('id',this.maskID);el.style['position']='absolute';el.style['top']=0;el.style['left']=0;el.style['backgroundColor']='#000000';el.style['mozOpacity']='0.01';el.style['opacity']='0.01';el.style['filter']='alpha(opacity=1)';el.innerHTML='&nbsp;';}return el;},hideShowBehind:function(target,act){var tags=new Array('object','applet','iframe');if(navigator.appName=="Microsoft Internet Explorer"){var rawVersion=/MSIE\s([0-9]+)\.[0-9];/g.exec(navigator.appVersion);var version=parseInt(rawVersion[1]);if(version<7){tags.push('select');}}for(var k=0;k<tags.length;k++){var arr=target.getElementsByTagName(tags[k]);for(var i=0;i<arr.length;i++){arr[i].style.visibility=act;}}}};ajaxObject.prototype.onLoad=function(){};function ajax(method,url,params,callbackFunction,extra,debug){var AJAX=new ajaxObject(method,url,params,extra);if(debug){AJAX.debug=true;}AJAX.run();AJAX.onLoad=function(){callbackFunction(AJAX.xml,(extra?extra:null),AJAX.text);};};var formAction=function(){return{url:'index.php',uri:{'x':0,'y':20},width:500,title:'Kayıt',targetList:'list',targetDialog:'dialog',paging:true,contents:{'dialog':true,'editing':true,'deleting':true,'listing':true},messages:{'loading':'Yükleniyor...','saving':'Kaydediliyor...','deleting':'Siliniyor...','noResult':'Kayıt bulunamadı!','confirmDelete':'Kaydı silmek istediğinize emin misiniz?','noReturn':'Sonuç dönmedi!','noResponse':'Sunucudan istenilen cevap gelmedi!'},actions:{'list':'list','save':'save','del':'delete','getvalues':'getvalues'},resetHiddens:function(){var target=document.getElementById(this.targetDialog);if(target){var els=document.getElementById(this.targetDialog).getElementsByTagName('input');for(var i=0;i<els.length;i++){if(els[i].type=='hidden'){els[i].value=!isNaN(els[i].value)?0:'';}}}},show:function(id){var obj=this;if(id&&this.contents.deleting){var buttons={type:'SAVEDELETECANCEL',functionSAVE:function(){obj.save()},functionDELETE:function(){obj.del(id)},functionCANCEL:function(){layer('hide',obj.targetDialog)}}}else{var buttons={type:'SAVECANCEL',functionSAVE:function(){obj.save()},functionCANCEL:function(){layer('hide',obj.targetDialog)}}}if(this.onShow&&!this.onShow()){return false;}layer('show',this.targetDialog,this.width,300,this.title,buttons);this.resetHiddens();if(id){this.values(id);}return true;},list:function(uri){var obj=this;var url=this.url+this.actions.list;if(uri){this.uri=uri;for(var prop in uri){url+='&'+prop+'='+uri[prop];}}var AJAX=new ajaxObject('get',url,null,{type:'LIST',message:this.messages.loading,target:this.targetList});AJAX.run();AJAX.onLoad=function(){obj.setList(AJAX.xml);};},save:function(){if(this.onSave&&!this.onSave()){return false;}var obj=this;var AJAX=new ajaxObject('post',this.url+this.actions.save,getParams(this.form?this.form:this.targetDialog+'form'),{type:(this.contents.dialog?'DIALOG':'MESSAGE'),message:this.messages.saving,target:(this.contents.dialog?this.targetDialog:null)});AJAX.run();AJAX.onLoad=function(){obj.setResult(AJAX.xml);};return true;},del:function(id,forced){var obj=this;if(!forced){messageDialog(this.messages.confirmDelete,{type:'YESNO',icon:'caution.gif',functionYES:function(){obj.del(id,true)}});}else{var AJAX=new ajaxObject('post',this.url+this.actions.del,'id='+id,{type:(this.contents.dialog?'DIALOG':'MESSAGE'),message:this.messages.deleting,target:(this.contents.dialog?this.targetDialog:null)});AJAX.run();AJAX.onLoad=function(){obj.setResult(AJAX.xml);};}},values:function(id){var obj=this;var AJAX=new ajaxObject('get',this.url+this.actions.getvalues+'&id='+id,null,{type:(this.contents.dialog?'DIALOG':'MESSAGE'),message:this.messages.loading,target:(this.contents.dialog?this.targetDialog:null)});AJAX.run();AJAX.onLoad=function(){if(this.xml){var xml=this.xml.getElementsByTagName('value');for(var i=0;i<xml.length;i++){if(xml.item(i).getAttribute('function')){if(xml.item(i).getAttribute('function')=='eval'){eval(xml.item(i).firstChild.data);}else{var arr=eval(xml.item(i).firstChild.data);obj.getChilds(arr[0],arr[1],arr[2],arr[3]);}}else{setParam(xml.item(i).getAttribute('target'),xml.item(i).firstChild.data);}}}else{messageDialog(obj.messages.noResponse,{type:'OK',icon:'warning.gif'});}};},setResult:function(response){var obj=this;var listFunction=function(refObj){var uri=obj.uri?obj.uri:{};uri.x=uri.x?uri.x:0;uri.y=uri.y?uri.y:20;refObj.list(uri);};if(response){var xml=response.getElementsByTagName('result');if(xml.length>0){if(xml.item(0).getAttribute('title')=='OK'){if(this.contents.dialog){layer('hide',this.targetDialog);}messageDialog(xml.item(0).firstChild.data,{type:'OK',icon:'caution.gif',functionOK:function(){if(obj.contents.listing){listFunction(obj)}}});}else{messageDialog(xml.item(0).firstChild.data,{type:'OK',icon:'caution.gif'});}}else{messageDialog(this.messages.noReturn,{type:'OK',icon:'warning.gif'});}}else{messageDialog(this.messages.noResponse,{type:'OK',icon:'warning.gif'});}},setList:function(response){var target=document.getElementById(this.targetList);if(target.hasChildNodes()){while(target.childNodes.length>=1){target.removeChild(target.firstChild);}}if(response){var xml=response.getElementsByTagName('list');if(this.paging){var stat=response.getElementsByTagName('stat');if(stat.length>0){var total=parseInt(stat.item(0).getAttribute('total'));var x=parseInt(stat.item(0).getAttribute('x'));var y=parseInt(stat.item(0).getAttribute('y'));}else{var total=0;var x=0;var y=0;}}if(xml.length>0){if(this.paging){var p=this.setPaging;p.obj=this;p.total=total;p.x=x;p.y=y;p.refObj=this;target.appendChild(p.show('top'));}if(this.listFunction&&(typeof(this.listFunction)=='function')){target.appendChild(this.listFunction(xml));}else{for(var i=0;i<xml.length;i++){target.appendChild(this.parseXML(xml.item(i),this))}}if(this.paging){target.appendChild(p.show('bottom'));}}else{var div=Layer.createElement('div');div.className='warning';div.innerHTML=this.messages.noResult;target.appendChild(div);}}else{var div=Layer.createElement('div');div.className='warning';div.innerHTML=this.messages.noResponse;target.appendChild(div);messageDialog(this.messages.noResponse,{type:'OK',icon:'warning.gif'});}},getChilds:function(act,targetObjID,parentID,selectedID){var targetObj=document.getElementById(targetObjID);if(targetObj){clearList(targetObj);listOptions(targetObj,this.messages.loading,0);var AJAX=new ajaxObject('get',this.url+act+'&id='+parentID,null);AJAX.run();AJAX.onLoad=function(){if(this.xml){var xml=this.xml.getElementsByTagName('list');clearList(targetObj);if(xml.length>0){for(var i=0;i<xml.length;i++){listOptions(targetObj,xml.item(i).firstChild.data,xml.item(i).getAttribute('id'));}if(selectedID){setParam(targetObjID,selectedID);}}}}}else{messageDialog(targetObjID+'??',{type:'OK',icon:'warning.gif'});}},setPaging:{total:0,x:0,y:20,refObj:null,labels:{'first':'İlk','previous':'Önceki','next':'Sonraki','last':'Son','total':'Toplam'},yS:{10:10,20:20,30:30,50:50},init:function(){this.first_id=0;this.prev_id=this.x-this.y;this.next_id=this.x+this.y;this.last_id=this.total-((this.total%this.y==0)?this.y:(this.total%this.y));},show:function(position){this.init();return this.createBody(position);},createFirst:function(obj){var refObj=this.refObj;if(this.first_id==this.x){var show_first=Layer.createElement('span');show_first.style.color='#cccccc';show_first.innerHTML=this.labels.first;}else{var show_first=Layer.createElement('a');show_first.href='javascript:void(0)';show_first.title=this.labels.first;show_first.onclick=function(){var uri=refObj.uri?refObj.uri:{};uri.x=0;uri.y=refObj.setPaging.getY(obj);refObj.list(uri);};show_first.innerHTML=this.labels.first;}return show_first;},createPrevious:function(obj){var refObj=this.refObj;if(this.x>0){var show_prev=Layer.createElement('a');show_prev.href='javascript:void(0)';show_prev.title=this.labels.previous;show_prev.onclick=function(){var uri=refObj.uri?refObj.uri:{};uri.x=refObj.setPaging.prev_id;uri.y=refObj.setPaging.getY(obj);refObj.list(uri);};show_prev.innerHTML=this.labels.previous;}else{var show_prev=Layer.createElement('span');show_prev.style.color='#cccccc';show_prev.innerHTML=this.labels.previous;}return show_prev;},createNext:function(obj){var refObj=this.refObj;if(this.x<(this.total-this.y)){var show_next=Layer.createElement('a');show_next.href='javascript:void(0)';show_next.title=this.labels.next;show_next.onclick=function(){var uri=refObj.uri?refObj.uri:{};uri.x=refObj.setPaging.next_id;uri.y=refObj.setPaging.getY(obj);refObj.list(uri);};show_next.innerHTML=this.labels.next;}else{var show_next=Layer.createElement('span');show_next.style.color='#cccccc';show_next.innerHTML=this.labels.next;}return show_next;},createLast:function(obj){var refObj=this.refObj;if((this.x>=(this.total-this.y))||(this.y>=this.total)){var show_last=Layer.createElement('span');show_last.style.color='#cccccc';show_last.innerHTML=this.labels.last;}else{var show_last=Layer.createElement('a');show_last.href='javascript:void(0)';show_last.title=this.labels.last;show_last.onclick=function(){var uri=refObj.uri?refObj.uri:{};uri.x=refObj.setPaging.last_id;uri.y=refObj.setPaging.getY(obj);refObj.list(uri);};show_last.innerHTML=this.labels.last;}return show_last;},createBody:function(position){var obj=this;var table=Layer.createElement('table');table.width='100%';table.border='0';table.cellPadding='5';table.cellSpacing='0';var tbody=Layer.createElement('tbody',table);var tr=Layer.createElement('tr',tbody);var td1=Layer.createElement('td',tr);td1.width='33%';var td2=Layer.createElement('td',tr);td2.width='34%';td2.align='center';var td3=Layer.createElement('td',tr);td3.width='33%';td3.align='right';var select=Layer.createElement('select',td1);select.name='paging'+Math.random();select.onchange=function(){var uri=obj.refObj.uri?obj.refObj.uri:{};uri.x=0;uri.y=obj.getY(select);obj.refObj.list(uri);};var z=0;for(i in this.yS){listOptions(select,this.yS[i],this.yS[i]);if(this.y==this.yS[i]){select.options[z].selected=true;}z++;}var pipe=Layer.createElement('span');pipe.innerHTML='&nbsp;|&nbsp;';if(position=='top'){var span1=Layer.createElement('span',td2);span1.innerHTML=this.labels.total+': '+this.total;td2.appendChild(pipe.cloneNode(true));var span2=Layer.createElement('span',td2);span2.innerHTML=(this.x+1)+' - '+(this.x+this.y);}else{var selectP=Layer.createElement('select',td2);selectP.name='pagingY';selectP.onchange=function(){var uri=obj.refObj.uri?obj.refObj.uri:{};uri.x=obj.getY(selectP);uri.y=obj.getY(select);obj.refObj.list(uri);};for(i=0;i<Math.ceil(this.total/this.y);i++){listOptions(selectP,(i+1),(i*this.y));if((i*this.y)==this.x){selectP.options[i].selected=true;}}}td3.appendChild(this.createFirst(select));td3.appendChild(pipe.cloneNode(true));td3.appendChild(this.createPrevious(select));td3.appendChild(pipe.cloneNode(true));td3.appendChild(this.createNext(select));td3.appendChild(pipe);td3.appendChild(this.createLast(select));return table;},getY:function(obj){return obj.options[obj.selectedIndex].value;}},parseXML:function(xml){var head=xml.getElementsByTagName('head');var body=xml.getElementsByTagName('body');var titles=head.item(0).getElementsByTagName('title');var rows=body.item(0).getElementsByTagName('row');if(rows.length>0){var table=Layer.createElement('table');table.width='100%';table.border='0';table.cellPadding='5';table.cellSpacing='0';var tbody=Layer.createElement('tbody',table);if(titles.length>0){var th=Layer.createElement('tr',tbody);for(var i=0;i<titles.length;i++){var td=Layer.createElement('td',th);td.className='gridTitle';if(titles.item(i).getAttribute('width')){td.width=titles.item(i).getAttribute('width');}if(titles.item(i).getAttribute('align')){td.align=titles.item(i).getAttribute('align');}td.innerHTML=titles.item(i).firstChild.data;}}for(var y=0;y<rows.length;y++){var tr=Layer.createElement('tr',tbody);var column=rows[y].childNodes;for(var i=0;i<column.length;i++){var td=Layer.createElement('td',tr);td.rowID=rows[y].getAttribute('id');if(titles.item(i).getAttribute('align')){td.align=titles.item(i).getAttribute('align');}if(rows[y].getAttribute('onmouseover')){td.onmouseover=new Function(rows[y].getAttribute('onmouseover'));}if(rows[y].getAttribute('onmouseout')){td.onmouseout=new Function(rows[y].getAttribute('onmouseout'));}if(this.contents.editing&&rows[y].getAttribute('id')){var obj=this;td.onclick=function(e){if(!e){var e=window.event;}var node=e.target?e.target:e.srcElement;if(node.rowID){obj.show(node.rowID);}}}else if(rows[y].getAttribute('onclick')){td.onclick=new Function(rows[y].getAttribute('onclick'));}if(column[i].getAttribute('colspan')){td.colSpan=column[i].getAttribute('colspan');}if(column[i].getAttribute('rowspan')){td.rowSpan=column[i].getAttribute('rowspan');}if(column[i].getAttribute('class')){td.className=column[i].getAttribute('class');}else{td.className='gridRow';}if(column[i].getAttribute('style')){td.style.cssText=column[i].getAttribute('style');}td.innerHTML=(column[i]?column[i].firstChild.data:'&nbsp;');}}}return table;}}};function listOptions(targetOpt,optlabel,optvalue){var newOption=document.createElement('option');newOption.text=optlabel;newOption.value=optvalue;try{targetOpt.add(newOption,null);}catch(ex){targetOpt.add(newOption);}return newOption;};function clearList(targetOpt){while(targetOpt.length>0){targetOpt.remove(0);}};function getValue(objID){var obj=document.getElementById(objID);if(obj){switch(obj.type){case'select-one':if(obj.options.length>0){return obj.options[obj.selectedIndex].value;}else{return null;}break;case'select-multiple':if(obj.options.length>0){var tmp=new Array();for(var i=0;i<obj.options.length;y++){if(obj.options[i].selected)tmp.push(obj.options[i].value);}return tmp;}else{return null;}break;case'radio':case'checkbox':if(obj.checked){return obj.value;}else{return null;}break;case'text':case'textarea':case'hidden':case'password':return obj.value;break;default:if(obj.innerHTML){return obj.innerHTML;}}}return null;};function getParams(formName){var params=new Array();if(document.forms[formName]){for(var i=0;i<document.forms[formName].elements.length;i++){var obj=document.forms[formName].elements[i];switch(obj.type){case'select-one':var objName=obj.name;if(obj.options.length>0){var objValue=encodeURIComponent(obj.options[obj.selectedIndex].value);}else{var objValue='0';}params.push(objName+'='+objValue);break;case'select-multiple':var objName=obj.name;if(obj.options.length>0){var tmp=new Array();for(var y=0;y<obj.options.length;y++){if(obj.options[y].selected)tmp.push(encodeURIComponent(obj.options[y].value));}var objValue=((tmp.length>0)?tmp.join(','):0);}else{var objValue='0';}params.push(objName+'='+objValue);break;case'radio':case'checkbox':if(obj.checked){var objName=obj.name;var objValue=encodeURIComponent(obj.value);params.push(objName+'='+objValue);}break;case'text':case'textarea':case'hidden':case'password':var objName=obj.name;var objValue=encodeURIComponent(obj.value);params.push(objName+'='+objValue);break;}}}return params.join('&');};function setParam(targetID,val){var target=typeof(targetID)=='object'?targetID:document.getElementById(targetID);var targets=document.getElementsByName(targetID);if(target){switch(target.type){case"select-one":for(var i=0;i<target.options.length;i++){if(target.options[i].value==val){target.options[i].selected=true;break;}}break;case"select-multiple":var raw=val.split(',');for(var i=0;i<target.options.length;i++){for(var y=0;y<raw.length;y++){if(raw[y]==target.options[i].value){target.options[i].selected=true;}}}break;case"radio":case"checkbox":if(target.value==val){target.checked=true;}else{target.checked=false;}break;default:target.value=val;break;}}else if(targets){for(var i=0;i<targets.length;i++){if((targets[i].type=='radio')||(targets[i].type=='checkbox')){if(targets[i].value==val){targets[i].checked=true;}else{targets[i].checked=false;}}}}};function formDisabled(target,status){var fr=document.forms[target];if(fr){for(var i=0;i<fr.elements.length;i++){fr.elements[i].disabled=status;}}};