﻿/*
*
* @author: dxenia Internet Solutions
* @website: www.dxenia.com
*
*/

function pencereAc(mypage,myname,w,h,scroll) {

	var win = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=' +scroll;
	win = window.open(mypage,myname,settings);
}

function dxenia() {
	pencereAc('http://www.dxenia.com/','dx','720','600','no');
	return false;
}

function correctZero(v) {
	if (v<=9)
		return "0" + v;
	else
		return v;
}

function getWeek(year,month,day){

    month += 1;
    var a = Math.floor((14-(month))/12);
    var y = year+4800-a;
    var m = (month)+(12*a)-3;
    var jd = day + Math.floor(((153*m)+2)/5) + 
                 (365*y) + Math.floor(y/4) - Math.floor(y/100) + 
                 Math.floor(y/400) - 32045;
 
    var d4 = (jd+31741-(jd%7))%146097%36524%1461;
    var L = Math.floor(d4/1460);
    var d1 = ((d4-L)%365)+L;
    NumberOfWeek = Math.floor(d1/7) + 1;
    return NumberOfWeek%4;        
}

function aktifSayfa(sayfa) {

	document.getElementById(sayfa).className='menu-2';
}

function toplantiTarihi() {

	// 2. ve 4. Persembe

	var mydate = new Date();
	var date = mydate.getDate();
	var day = mydate.getDay();
	var month = mydate.getMonth();
	var year = mydate.getYear();
	var week = getWeek(year,month,date);

	if ((week == 1) || (week==3))
		result = 'haftaya ';	
	else if (((week==2) && (day<=3)) || ((week==0) && (day<=3)))
		result = 'bu hafta ';
	else
		result = '2 hafta sonraki ';
	
	document.getElementById("tarihAlani").innerHTML = result;
}

function getthedate() {

	var mydate=new Date();
		
	var hours = mydate.getHours();
	var minutes = mydate.getMinutes();
	var seconds = mydate.getSeconds();

	seconds = correctZero(seconds);
	minutes = correctZero(minutes);
	hours = correctZero(hours);
	
	var cdate = hours + ":" + minutes + "<font color='#e5e5e5'>:" + seconds + "</font>";
	
	if (document.all)
		document.all.clock.innerHTML = cdate;
	else if (document.getElementById)
		document.getElementById("clock").innerHTML = cdate;
	else
		document.write(cdate);
	}
	
	if (!document.all&&!document.getElementById)
		getthedate();
		
function goforit() {
	if (document.all||document.getElementById)
		setInterval("getthedate()",1000)
}

function logoyuYarat() {

	var mydate = new Date();
	var month = mydate.getMonth();
	var season = Math.floor((month+1)/3);
	
	logolar = "<img src=\"images/logo_fatih_" + season + "_1.gif\"><img src=\"images/logo_fatih_" + season + "_2.gif\">";
	
	document.getElementById("logoAlani").innerHTML = logolar;
}

function dogrula(theForm) {
  if (theForm.ad.value == "") {
    alert("HATA!\r\n\r\nLütfen adınızı ve soyadınızı girin.");
    theForm.ad.focus();
    return false;
  }
  
  if (theForm.mail.value == "") {
    alert("HATA!\r\n\r\nLütfen e-mail adresinizi girin.");
    theForm.mail.focus();
    return false;
  }
  
  if (theForm.konu.value == "") {
    alert("HATA!\r\n\r\nLütfen bir konu girin.");
    theForm.konu.focus();
    return false;
  }
  
  if (theForm.mesaj.value == "") {
    alert("HATA!\r\n\r\nLütfen mesajınızı girin.");
    theForm.mesaj.focus();
    return false;
  }
  
  return true;
}

function dogrulaMail(mail) {
	if (mail.value.indexOf("@") < 1) {
		alert("HATA!\r\n\r\nGeçersiz mail adresi!\n\n- Lütfen @ işareti kullanın.");
		mail.focus();
	}
	else if (mail.value.indexOf(".") < 3) {
		alert("HATA!\r\n\r\nGeçersiz mail adresi!\n\n- Lütfen \".\" (nokta) işareti kullanın.");
		mail.focus();
	}
	else {
		alert("Önemli!\r\n\r\nMail adresiniz aracılığı ile size ulaşacağız.\n\nLütfen E-mail adresinizin doğru olduğundan emin olun..\n\n\tE-Mailiniz: "+mail.value);
	}
}

function otomatik() {
	goforit();
	//logoyuYarat();
	//toplantiTarihi();
}


function kisigoster(kisi) {

   ozet = document.getElementById("o_" + kisi);
   ozetgorunur = (ozet.style.display!="none");
   
   ayrinti = document.getElementById("a_" + kisi);
   
   gif = document.getElementById("g_" + kisi);
   
   	image1 = new Image();
	image1.src = "/www/bilgi/images/gerisay.gif";

   if (ozetgorunur) {
     ozet.style.display="none";
	 ayrinti.style.display="";
	 setTimeout("kisigizle('"+kisi+"')",10000);
   } 
   else {
     ozet.style.display="";
	 gif.src="/www/bilgi/images/spacer.gif";
     ayrinti.style.display="none";
   }
}

function kisigizle(kisi) {
	ozet = document.getElementById("o_" + kisi);
   	ayrinti = document.getElementById("a_" + kisi);
	ozet.style.display="";
    ayrinti.style.display="none";
}

function devamgoster(id) {
	ozet = document.getElementById("devam" + id);
	ozet.style.display="";
	
	devam = document.getElementById("d" + id);
	devam.style.display="none";
}

function panel(ozellik) {

	yeni = document.getElementById('eklemeAlani');
	eskiler = document.getElementById('eskilerAlani');
	
	yeni.style.display="none";
	eskiler.style.display="none";
	
	if (ozellik == 'ekle')
		yeni.style.display="block";
	else
		eskiler.style.display="block";
}

function deleteProp(id) {
	document.duzenlemeFormu.deleteItem.value = id;
}

function silmeOnay() {
	
	var answer = confirm("Girdi silenecek!\nEmin Misiniz?")
	
	if (answer)
		return true;
	
	else
		return false;
}