pakisi = function(gun){
  var req = new Request.HTML({
    url: '.',
    method: 'post',
    data: {rpc:'pakisi','gun':gun},
    onRequest: function(){
      $('yayin').set('html','<center><img style="margin:50px 0px 0px 20px;" src="images/loading.gif"></center>');
    },
	onSuccess: function(resp,e,h,j) {
		$('yayin').set('html',h);
    $('gunImg').set('src','images/gun'+gun+'.png');
    eval(j);
	},
  onFailure: function(xhr){
    $('yayin').set('html','<center><span style="color:#FF0000; font-weight:bold">Hata oluştu!<br />Tekrar deneyin!</span></center>');
  },
  onException: function(h,v){
    $('yayin').set('html','<center><span style="color:#FF0000; font-weight:bold">Hata oluştu!<br />Tekrar deneyin!</span></center>');
  }
  });

  req.send();
}

subC = function(rpcData){
  var req = new Request.HTML({
    url: '.',
    method: 'post',
    data: rpcData,
    onRequest: function(){
      $('subC').set('html','<center><img style="margin:50px 0px 0px 20px;" src="images/loading.gif"></center>');
    },
	onSuccess: function(resp,e,h,j) {
		$('subC').set('html',h);
    eval(j);
	},
    onFailure: function(xhr){
      $('subC').set('html','<center><span style="color:#FF0000; font-weight:bold">Hata oluştu!<br />Tekrar deneyin!</span></center>');
    },
    onException: function(h,v){
      $('subC').set('html','<center><span style="color:#FF0000; font-weight:bold">Hata oluştu!<br />Tekrar deneyin!</span></center>');
    }
  });

  req.send();
}

window.addEvent('domready',function(){

  try{
    var nS4 = new noobSlide({
      box: $('box4'),
      items: $$('#box4 div'),
      size: 310,
      handles: $$('#handles div.btn'),
      onWalk: function(currentItem,currentHandle){
        this.handles.removeClass('active');
        currentHandle.addClass('active');
      }
    });
  }catch(e){}

  SqueezeBox.initialize({
     size: {x: 400, y: 400},
     handler: 'ajax',
     parse: 'rel',
     ajaxOptions: {
       method: 'post',
       evalScripts:false
     }
  });
  SqueezeBox.assign($$('a.boxed'));

  var div = document.createElement('div');
  div.id = 'ns2';
  div.ns2 = new noobSlide({
    mode: 'vertical',
    box: $('box2'),
    items: [1,2,3,4,5],
    size: 84,
    autoPlay: false,
    fxOptions: {
      duration: 1000,
      transition: Fx.Transitions.Bounce.easeOut,
      wait: false
    }
  });
  document.body.appendChild(div);

  var nS1 = new noobSlide({
    mode: 'vertical',
    box: $('box1'),
    handles: $$('div.Btns] a'),
    items: [1,2,3,4,5],
    size: 283,
    autoPlay: true,
    interval: 15000,
    fxOptions: {
      duration: 1000,
      transition: Fx.Transitions.Bounce.easeOut,
      wait: false
    },
    onWalk: function(cItem, cHandle){
      $('ns2').ns2.walk(cItem-1,false,false);
      this.handles.removeClass('active');
      cHandle.addClass('active');
    }
  });

  subC({rpc:'anasayfa'})
});
