function ackapa(className,filtertag){
this.className=className
this.collapsePrev=false
this.persistType="none"
this.filter_content_tag=(typeof filtertag!="undefined")? filtertag.toLowerCase(): ""}
ackapa.prototype.okno=function(openHTML,closeHTML){
this.statusOpen=openHTML
this.statusClosed=closeHTML}
ackapa.prototype.renk=function(openColor,closeColor){
this.colorOpen=openColor
this.colorClosed=closeColor}
ackapa.prototype.acikhaf=function(bool,days){
if(bool==true){
if(typeof days=="undefined")
this.persistType="session"
else{
this.persistType="days"
this.persistDays=parseInt(days)}}
else
this.persistType="none"}
ackapa.prototype.kapanmasin=function(bool){
this.collapsePrev=bool}
ackapa.prototype.sweepToggle=function(setting){
if(typeof this.headers!="undefined"&&this.headers.length>0){
for(var i=0;i<this.headers.length;i++){
if(setting=="expand")
this.expandcontent(this.headers[i])
else if(setting=="contract")
this.contractcontent(this.headers[i])}}}
ackapa.prototype.defaultExpanded=function(){
var expandedindices=[]
for(var i=0;(!this.collapsePrev&&i<arguments.length)||(this.collapsePrev&&i==0);i++)
expandedindices[expandedindices.length]=arguments[i]
this.expandedindices=expandedindices.join(",")}
ackapa.prototype.togglecolor=function(header,status){
if(typeof this.colorOpen!="undefined")
header.style.color=status}
ackapa.prototype.togglestatus=function(header,status){
if(typeof this.statusOpen!="undefined")
header.firstChild.innerHTML=status}
ackapa.prototype.contractcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-bas",""))
innercontent.style.display="none"
this.togglestatus(header,this.statusClosed)
this.togglecolor(header,this.colorClosed)}
ackapa.prototype.expandcontent=function(header){
var innercontent=document.getElementById(header.id.replace("-bas",""))
innercontent.style.display="block"
this.togglestatus(header,this.statusOpen)
this.togglecolor(header,this.colorOpen)}
ackapa.prototype.toggledisplay=function(header){
var innercontent=document.getElementById(header.id.replace("-bas",""))
if(innercontent.style.display=="block")
this.contractcontent(header)
else{
this.expandcontent(header)
if(this.collapsePrev&&typeof this.prevHeader!="undefined"&&this.prevHeader.id!=header.id)
this.contractcontent(this.prevHeader)}
if(this.collapsePrev)
this.prevHeader=header}
ackapa.prototype.collectElementbyClass=function(classname){
var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)","i")
this.headers=[],this.innercontents=[]
if(this.filter_content_tag!="")
var allelements=document.getElementsByTagName(this.filter_content_tag)
else
var allelements=document.all? document.all : document.getElementsByTagName("*")
for(var i=0;i<allelements.length;i++){
if(typeof allelements[i].className=="string"&&allelements[i].className.search(classnameRE)!=-1){
if(document.getElementById(allelements[i].id+"-bas")!=null){
this.headers[this.headers.length]=document.getElementById(allelements[i].id+"-bas")
this.innercontents[this.innercontents.length]=allelements[i]}}}}
ackapa.prototype.init=function(){
var instanceOf=this
this.collectElementbyClass(this.className)
if(this.headers.length==0)
return
if(this.persistType=="days"&&(parseInt(ackapa.getCookie(this.className+"_dtrack"))!=this.persistDays))
ackapa.setCookie(this.className+"_d","",-1)
var opencontents_ids=(this.persistType=="session"&&ackapa.getCookie(this.className)!="")? ','+ackapa.getCookie(this.className)+',' :(this.persistType=="days"&&ackapa.getCookie(this.className+"_d")!="")? ','+ackapa.getCookie(this.className+"_d")+',' :(this.expandedindices)? ','+this.expandedindices+',' : ""
for(var i=0;i<this.headers.length;i++){
if(typeof this.statusOpen!="undefined")
this.headers[i].innerHTML='<span class="status"></span>'+this.headers[i].innerHTML
if(opencontents_ids.indexOf(','+i+',')!=-1){
this.expandcontent(this.headers[i])
if(this.collapsePrev)
this.prevHeader=this.headers[i]}
else
this.contractcontent(this.headers[i])
this.headers[i].onclick=function(){instanceOf.toggledisplay(this)}}
ackapa.dotask(window,function(){instanceOf.rememberpluscleanup()},"unload")}
ackapa.prototype.rememberpluscleanup=function(){
var opencontents=new Array("none")
for(var i=0;i<this.innercontents.length;i++){
if(this.persistType!="none"&&this.innercontents[i].style.display=="block"&&(!this.collapsePrev ||(this.collapsePrev&&opencontents.length<2)))
opencontents[opencontents.length]=i
this.headers[i].onclick=null}
if(opencontents.length>1)
opencontents.shift()
if(typeof this.statusOpen!="undefined")
this.statusOpen=this.statusClosed=null
if(this.persistType=="session")
ackapa.setCookie(this.className,opencontents.join(","))
else if(this.persistType=="days"&&typeof this.persistDays=="number"){
ackapa.setCookie(this.className+"_d",opencontents.join(","),this.persistDays)
ackapa.setCookie(this.className+"_dtrack",this.persistDays,this.persistDays)}}
ackapa.dotask=function(target,functionref,tasktype){
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if(target.addEventListener)
target.addEventListener(tasktype,functionref,false)
else if(target.attachEvent)
target.attachEvent(tasktype,functionref)}
ackapa.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+","i")
if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return ""}
ackapa.setCookie=function(name,value,days){
if(typeof days!="undefined"){
var expireDate=new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie=name+"="+value+"; expires="+expireDate.toGMTString()}
else
document.cookie=name+"="+value}
var win=null
function pencere(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center"&&pos!="random")|| pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'
win=window.open(mypage,myname,settings);}
var ns6=document.getElementById&&!document.all
function restrictinput(maxlength,e,placeholder){
if(window.event&&event.srcElement.value.length>=maxlength)
return false
else if(e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/
if(pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()}}
function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if(window.event||e.target&&e.target==eval(placeholder)){
if(lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft}}
function formlimit(thename,theid,thelimit){
var theform=theid!=""? document.getElementById(theid): thename
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b>'
if(document.all||ns6)
document.write(limit_text)
if(document.all){
eval(theform).onkeypress=function(){return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){countlimit(thelimit,event,theform)}}
else if(ns6){
document.body.addEventListener('keypress',function(event){restrictinput(thelimit,event,theform)},true)
document.body.addEventListener('keyup',function(event){countlimit(thelimit,event,theform)},true)}}
function submitonce(theform){
if(document.all||document.getElementById){
for(i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true}}}
function formekle(asnf,altf,aTag, eTag) {
  var input = document.forms[asnf].elements[altf];
  input.focus();
  if(typeof document.selection != 'undefined') {
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);      
    }
    range.select();
  }
  else if(typeof input.selectionStart != 'undefined')
  {
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  else
  {
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Hata:(0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    var insText = prompt("Hata:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}
function gizleDiv(divID)
    {
    document.getElementById(''+divID+'').style.display = 'none';
    }
function gosterDiv(divID)
    {
    document.getElementById(''+divID+'').style.display = 'block';
    }

