﻿var ajax = new sack();

function whenLoading(){
	var e = document.getElementById("replaceme"); 
	e.innerHTML = "<p><center><img src='loader.gif' border='0' style='background:;border:0;'> Lütfen bekleyin.</p>";
}

function whenLoading2(){
	var e = document.getElementById("replaceme2"); 
	e.innerHTML = "<p><center><img src='loader.gif' border='0' style='background:;border:0;'> Lütfen bekleyin.</p>";
}

function whenLoaded(){
	var e = document.getElementById("replaceme"); 
	e.innerHTML = "<p><center>Yorumunuz postalandı.</p>";
}

function whenInteractive(){
	var e = document.getElementById("replaceme"); 
	e.innerHTML = "<p><center><img src='loader.gif' border='0' style='background:;border:0;'> <font color=#ff0000>Veri okunuyor!</font></p>";
}

function whenCompleted(){
	var e = document.getElementById("sackdata"); 
	if (ajax.responseStatus){
		var string = "<p>Status: " + ajax.responseStatus[0] + "</p><p>Mesaj: " + ajax.responseStatus[1] + "</p><p>URL: " + ajax.URLString + "</p>";
	} else {
		var string = "<p>URLString Sent: " + ajax.URLString + "</p>";
	}
	e.innerHTML = string;	
}

function doit(){
	var form = document.getElementById("form");

	ajax.setVar("ID", form.ID.value); 
	ajax.setVar("namei", form.namei.value); 
	ajax.setVar("maili", form.maili.value); 
	ajax.setVar("uanket", form.uanket.value); 
	ajax.setVar("yorum", form.yorum.value); 
	ajax.setVar("tablo", form.tablo.value); 

    ajax.responseStatus=false;
	ajax.requestFile = "formkayit.php";
	ajax.method = "GET";
	ajax.element = "replaceme";
	ajax.onLoading = whenLoading;
//	ajax.onLoaded = whenLoaded; 
//	ajax.onInteractive = whenInteractive;
//	ajax.onCompletion = whenCompleted;
	ajax.runAJAX();
}

function doit2(){
	var form = document.getElementById("tagform");

	ajax.setVar("tagler", form.tagler.value); 
	ajax.setVar("ID", form.ID.value); 

    ajax.responseStatus=false;
	ajax.requestFile = "tagkayit.php";
	ajax.method = "GET";
	ajax.element = "replaceme2";
	ajax.onLoading = whenLoading2;
//	ajax.onLoaded = whenLoaded; 
//	ajax.onInteractive = whenInteractive;

//	ajax.onCompletion = whenCompleted;
	ajax.onCompletion = slideup("mydiv");  

	ajax.runAJAX();
}

function doit3(){
	var form = document.getElementById("tagform");

	ajax.setVar("tagler", form.tagler.value); 
	ajax.setVar("ID", form.ID.value); 

    ajax.responseStatus=false;
	ajax.requestFile = "tagkayit2.php";
	ajax.method = "GET";
	ajax.element = "replaceme2";
	ajax.onLoading = whenLoading2;
//	ajax.onLoaded = whenLoaded; 
//	ajax.onInteractive = whenInteractive;

//	ajax.onCompletion = whenCompleted;
	ajax.onCompletion = slideup("mydiv");  

	ajax.runAJAX();
}

this.screenshotPreview = function(){	
		
		xOffset = 10;
		yOffset = 30;
		
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

	$(document).ready(function(){

var bekle="<p><img src='busy.gif' style='border:0;margin:0;padding:0;' alt='yükleniyor' align=left/> &nbsp; içerik yükleniyor, lütfen bekleyin.. </p>";

	screenshotPreview();

	$(".ml1").attr("id","current");


  function resetet() {  

		$(".ml1").attr("id","ml1");
		$(".ml2").attr("id","ml2");
		$(".ml3").attr("id","ml3");
		$(".ml4").attr("id","ml4");
		$(".ml5").attr("id","ml5");
		$(".ml6").attr("id","ml6");
     }  

  function yukle(sayfasi,idsi) {  

	$("#bekle").slideDown('fast').html(bekle).animate({opacity: 1}, 4000, function() {
	$("#bekle").slideUp('normal');   });

	$("#main").animate({opacity: 0}, 1000, function() {
	$("#main").load(sayfasi,{id:idsi}).animate({opacity: 0}, 2000).animate({opacity: 1}, 1000);  });

  }


 $("a.m1")
     .click(function(){

		resetet();
		 $(".ml1").attr("id","current");
	
       $("#bekle").slideDown('fast').html(bekle).animate({opacity: 1}, 4000, function() {
       $("#bekle").slideUp('normal');   });

	$("#main").animate({opacity: 0}, 1000, function() {
	$("#main").load("mainindex.php").animate({opacity: 0}, 2000).animate({opacity: 1}, 1000);   });

     })
   .end();


 $("a.m2")
     .click(function(){

		resetet();
		 $(".ml2").attr("id","current");

 yukle("web_main.php",2);

     })
   .end();


 $("a.m3")
     .click(function(){

		resetet();
		 $(".ml3").attr("id","current");

 yukle("web_main.php",3);

     })
   .end();


 $("a.m4")
     .click(function(){

		resetet();
		 $(".ml4").attr("id","current");

 yukle("web_main.php",4);

     })
   .end();


 $("a.m5")
     .click(function(){

		resetet();
		 $(".ml5").attr("id","current");

 yukle("web_main.php",5);

     })
   .end();


 $("a.m6")
     .click(function(){

		resetet();
		 $(".ml6").attr("id","current");

 yukle("web_main.php",6);

     })
   .end();

$(".gyorums").accessNews();

	});