var ajax1 = false; // animasyon
var ajax2 = false; // referanslar

var oAppList = false;
var oRobotBilgi = false;
var activeArticle = false;
var clickedArticle = false;
var oAnimasyon = false;

function mouseoverApp()	
{
	if(this==clickedApp)return;
	if(activeArticle && activeArticle!=this){
		if(activeArticle==clickedArticle)
			activeArticle.className='articleClick';
		else
			activeArticle.className='';
		
	}
	this.className='articleMouseOver';
	activeArticle = this;	// Storing reference to this article
}

function animasyonuGoster ()
{
	oAnimasyon.innerHTML = ajax1.response;
}

function iletAnimasyonBekleniyor ()
{
	oAnimasyon.innerHTML = 'Yükleniyor... Lütfen bekleyin.<br>Loading... Please wait.';
}

function ajaxAnimasyonunuGetir(fileName)
{
	ajax1.requestFile = fileName;				// Specifying which file to get
	ajax1.onCompletion = animasyonuGoster;	// Specify function that will be executed after file has been found
	ajax1.onLoading = iletAnimasyonBekleniyor;		// Action when AJAX is loading the file
	ajax1.runAJAX();							// Execute AJAX function	
}

function animasyonuYukle ()
{
	ajax1 = new sack();
	if (screen.width <= 800)
		ajaxAnimasyonunuGetir('/animasyon800.html');
	else if (screen.width <= 1024)
		ajaxAnimasyonunuGetir('/animasyon1024.html');
	else {
		// alert ('burada');
		ajaxAnimasyonunuGetir('/animasyon1280.html');
	}
}

function showContent()	// Displaying content in the content <div>
{
	oRobotBilgi.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
}

function showWaitMessage()
{
	oRobotBilgi.innerHTML = 'Robot bilgisi alınıyor... Lütfen bekleyin.<br>Robot information is being gathered... Please wait.';
}

function getAjaxFile(fileName)
{
	ajax.requestFile = fileName;		// Specifying which file to get
	ajax.onCompletion = showContent;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage;	// Action when AJAX is loading the file
	ajax.runAJAX();						// Execute AJAX function	
}

function robotBilgisiniGetir()	// User have clicked on an article
{
	getAjaxFile('robot_goster.php?parametre=' + escape(this.id));
	// alert ('robot_goster.php?parametre=' + escape(this.id));
	if(clickedArticle && clickedArticle!=this)clickedArticle.className='articleMouseOver';
	this.className='articleClick';
	clickedArticle = this;
}

function initAjaxApp()
{
	oAnimasyon = document.getElementById('animasyon');
	animasyonuYukle();
	
	/*
	oAppList = document.getElementById('appList');
	var apps = oAppList.getElementsByTagName('LI');
	for (var no=0 ; no<apps.length ; no++){
		apps[no].onmouseover = mouseoverApp;
		apps[no].onclick = robotBilgisiniGetir;
	}	
	oRobotBilgi = document.getElementById('robotBilgi');
	*/
}

window.onload = initAjaxApp;
