var lasttable='';
var mainWin='timeline'; // ilk yuklendiğinde ortada timeline yukleniyor.
var scrollAyCell = new Array();
var last='';
var sonid='';

function uzmanPopup(gorusID) {
	var options = 'scrollbars=yes,resizable=no,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=' + 806 + ',height= ' + 700;
//    var win = window.open('uzmanPopup.php?gorusID=' + gorusID, '', options);
	fullScreen('uzmanPopup.php?gorusID=' + gorusID);
	
}

function flashPopup(url,w,h) {
	var options = 'scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=' + w + ',height= ' + h;
    var win = window.open(url, '', options);
}

function blink(spanid) {
if (document.getElementById(spanid).style.display == 'none') document.getElementById(spanid).style.display = 'inline';
else document.getElementById(spanid).style.display = 'none';
x = setTimeout(function(){blink(spanid)},700);
}

function openTable(ulke) {
var ulkeArray=ulke.split("baslik_");
ulke = ulkeArray[1];
if (lasttable != ulke) { 
	document.getElementById(ulke).style.display = 'block';
	lasttable = ulke;
	}
else { lasttable='';
	   document.getElementById(ulke).style.display = 'none';
}

}
function yenipen(url) {
	var options = 'scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=5,height=5';
    var win = window.open('showpic.php?url=' + url, '', options);
}

function popup(url,w,h) {
	var options = 'scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=' + w + ',height= ' + h;
    var win = window.open(url, '', options);
}

function goTo(start) {
 window.scrollBy(-5000,0); 
 window.scrollBy(((61 * scrollAyCell[start]) + 2),-7);	
}
function topScroll() {
	// parent.window.timeline_Main_Top.scrollBy(-5000,0);
	parent.window.timeline_Main_Top.scrollTo(document.body.scrollLeft,0);
	setTimeout(topScroll,10);	
}
function uzmanOpen() {	
	var uzmanID = document.timeline_Ne_yapmali.uzmanID;
	var options = 'scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no';
	    options += ',width=525,height=500';
    var uzmanaBasvurulacak = window.open('timeline_Uzmana_Basvurulacak.php?ID=' + uzmanID, '', options);
    uzmanaBasvurulacak.focus();
}

function ChangeColor(start,finish,table) {
	var table = document.getElementById(table);
	var rows = table.getElementsByTagName('tr');
	sutunlar = new Array();
	
	// Önceki seçili olanları temizle
	var cells = rows[0].getElementsByTagName('td');
		for(var j=laststart; j<=lastfinish; j++)
		{
		cells[j].style.fontWeight= 'normal';
		cells[j].style.color = 'black';
		cells[j].style.backgroundColor = '#F7FBED';
		}
	
	// Yeni Cell'leri Renklendir
	var cells = rows[0].getElementsByTagName('td');
		for(var j=start; j<=finish; j++)
		{
		cells[j].style.color = 'white';
		cells[j].style.fontWeight= 'bold';
		cells[j].style.backgroundColor = '#82B00F';
		}
	
	//	alert ( start + ' ve ' + finish);
		laststart  = start;
		lastfinish = finish;
		goTo (start);
}

function changeAge(age)
{
	if (lasttop && age != lasttop) document.getElementById(lasttop).src = 'images/top_' + lasttop + '_off.gif';
	lasttop = age;
	document.getElementById('rightMain').src = 'images/timeline_' + age + '_main.gif';
	document.getElementById('rightBottom').src = 'images/' + age + '_t.gif';
	ages = age.split("-");
	first = ages[0];
	last = ages[1];
	if (mainWin == 'timeline') {
		clearURLarray = window.timeline_Main.location.href.split("#");
		clearURL = clearURLarray[0];
		window.timeline_Main.location.href = clearURL + '#' + (first * 1);
		window.timeline_Main.ChangeColor(first * 1,last * 1,'timeline_table');
		window.timeline_Main_Top.ChangeColor(first * 1,last * 1,'timeline_table_top');
		window.timeline_Ne_yapmali.location.href = 'http://www.7cokgec.org/timeline_iframe_Ne_yapmali.php?firstLoad=' + (first * 1) + '&cat=' + lastleft;
	}
	if (mainWin == 'destek') {
		window.timeline_Main.location.href = 'http://www.7cokgec.org/timeline_iframe_Nasil_Desteklenir.php?cat=' + lastleft + '&baslangic_ay=' + first;
	}
}

function changeMenu(id) {
	if (lastleft && id != lastleft) {
		document.getElementById(lastleft).style.filter = 'alpha(opacity=30)';
		document.getElementById(lastleft).style.opacity = '0.3';	
	}		
	var ages = lasttop.split("-");
	var first = ages[0];
	var last = ages[1];
	document.getElementById('leftDestek').style.display = 'block';
	document.getElementById('leftDestek').src= 'images/' + id + '_destek.gif';
	if(id=="timeline_left_sosyaduygusal_gelisim"){
        document.getElementById('leftDestek').onClick="window.timeline_Main.location.href = 'http://www.7cokgec.org/timeline_iframe_Nasil_Desteklenir.php?cat=timeline_left_sosyaduygusal_gelisim'"
	window.timeline_Main.location.href= 'frames/timeline_iframe_Main.htm?menu=' + id + '&selected=' + lasttop + '#' + (first * 1);
	}else if(id=="timeline_left_zihinsel_gelisim"){
        document.getElementById('leftDestek').onClick="window.timeline_Main.location.href = 'http://www.7cokgec.org/timeline_iframe_Nasil_Desteklenir.php?cat=timeline_left_zihinsel_gelisim'"
	window.timeline_Main.location.href= 'frames/zihinsel_gelisim.htm?menu=' + id + '&selected=' + lasttop + '#' + (first * 1);	
	}else if(id=="timeline_left_bedensel_gelisim"){
        document.getElementById('leftDestek').onClick="window.timeline_Main.location.href = 'http://www.7cokgec.org/timeline_iframe_Nasil_Desteklenir.php?cat=timeline_left_bedensel_gelisim'"
	window.timeline_Main.location.href= 'frames/bedensel_gelisim.htm?menu=' + id + '&selected=' + lasttop + '#' + (first * 1);	
	}else if(id=="timeline_left_dil_gelisimi"){
         document.getElementById('leftDestek').onClick="window.timeline_Main.location.href = 'http://www.7cokgec.org/timeline_iframe_Nasil_Desteklenir.php?cat=timeline_left_dil_gelisimi'"
	window.timeline_Main.location.href= 'frames/dil_gelisimi.htm?menu=' + id + '&selected=' + lasttop + '#' + (first * 1);	
	}
	window.timeline_Ne_yapmali.location.href = 'http://www.7cokgec.org/timeline_iframe_Ne_yapmali.php?firstLoad=' + (first * 1) + '&cat=' + id;
	lastleft = id;
}

function timelineInit(selected) {
	document.getElementById(selected).src = 'images/top_' + selected + '_on.gif';
	changeAge(selected);
	document.getElementById('timeline_left_sosyaduygusal_gelisim').style.filter = 'alpha(opacity=100)';
	document.getElementById('timeline_left_sosyaduygusal_gelisim').style.opacity = '1';
	lastleft = 'timeline_left_sosyaduygusal_gelisim';
	var ages = lasttop.split("-");
	var first = ages[0];
	window.timeline_Ne_yapmali.location.href = 'timeline_iframe_Ne_yapmali.php?firstLoad=' + (first * 1) + '&cat=' + lastleft;
}

function old_closespan()
{
	var spans = document.getElementsByTagName('span');
		for (var i=0; i<spans.length; i++)
		{
			spans[i].innerHTML='';		
		}
}

function closespan()
{
	if (last) document.getElementById(last).innerHTML = '';
}

function fullScreen(url) {
    var options = 'scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=' + screen.availWidth + ',height=' + screen.availHeight;
    options += ',screenX=0,screenY=0,top=0,left=0';
    var win = window.open(url, '', options);
    win.focus();
    win.moveTo(0, 0);
    win.resizeTo(screen.availWidth, screen.availHeight);
}


