// JavaScript Document

function btnnormal(gelen){
	var id=gelen.id;
	document.getElementById(id).className='saribtn';
	}

function btnuzeri(gelen){
	var id=gelen.id;
	document.getElementById(id).className='morbtn';
	}
	
function menuboya(gelen){
	var id=gelen.id;
	document.getElementById(id).bgColor='#CCFFFF';
	document.getElementById(id).style.cursor='hand';
	}

	
function menubeyazla(gelen){
	var id=gelen.id;
	document.getElementById(id).bgColor='';
	document.getElementById(id).style.cursor='hand';
	}
	
	
function tdboya(gelenid){
	document.getElementById(gelenid).bgColor='#EEEEEE';
}
function tdbeyazla(gelenid){
	document.getElementById(gelenid).bgColor='';
}


	
function goster(gelen){
	document.getElementById(gelen).style.display='block';
	}

function gizle(gelen){
	document.getElementById(gelen).style.display='none';
	}
	
function git(sayfa){
	window.location=sayfa;	
	}
	
function popup(url,penadi,ozellik) {
	window.open(url,penadi,ozellik);
}
		
function sadecesayi(gelen){
        if (event.keyCode < 48 || event.keyCode > 57) return false;        
}

function sadecepara(gelen){
        if ((event.keyCode < 48 || event.keyCode > 57) && event.keyCode!=46) return false;        
}


function penciz(genislik,yukseklik) {
var gen_yukseklik=10;
var gen_genislik=10;
parent.window.resizeTo(parseInt(gen_genislik)+parseInt(genislik),parseInt(gen_yukseklik)+parseInt(yukseklik)); 
}

function yukle() {
	var elem = document.getElementById('sform_preloader');
	elem.style.display = 'none';
	elem.style.visibility = 'hidden';
	elem = document.getElementById('sform_container');
	elem.style.visibility='visible';
	elem.style.display = 'block';	
}

function ajaxnesnesi() {
	  if (window.XMLHttpRequest) { // Mozilla, Safari,...   
         ajax = new XMLHttpRequest();   
         if (ajax.overrideMimeType) {   
            ajax.overrideMimeType('text/html');   
         }   
      } else if (window.ActiveXObject) { // IE   
         try {   
            ajax = new ActiveXObject("Msxml2.XMLHTTP");   
         } catch (e) {   
            try {   
               ajax = new ActiveXObject("Microsoft.XMLHTTP");   
            } catch (e) {}   
         }   
      }   
      if (!ajax) {   
         alert('Browserýnýz ajaxý desteklemiyor');   
         return false;   
      }   
    return ajax;
}
var http = ajaxnesnesi();

function ajaxyap(sayfa) {

	http.open('post', sayfa,false);
   	http.onreadystatechange = alinancevap; 
	//  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
  //    http.setRequestHeader("Content-length", sayfa);   
//      http.setRequestHeader("Connection", "close");   
      http.send(sayfa);  
}

function alinancevap() {
if( http.readyState == 1 || http.readyState == 2 || http.readyState == 3) {
   document.getElementById(hangidiv).innerHTML=yukleniyor;
	}
  if(http.readyState == 4){
  document.getElementById(hangidiv).innerHTML=http.responseText;
  }
}


function selecttarih(objForm,yearActual,mesActual,diaActual, yearSelected) {
valorYearMes=objForm.yilay.options[objForm.yilay.selectedIndex].value.split('/');
valorMes=valorYearMes[0];
valorYear=valorYearMes[1];
timeA = new Date(valorYear,valorMes,1);
timeDifference = timeA - 86400000;
timeB = new Date(timeDifference);
var daysInMonth = timeB.getDate();
if(yearSelected==1){
	temp=objForm.gun.length;
	for (var i = 0; i < temp; i++) {
		objForm.gun.options[0] = null;
	}
}
	if(parseInt(valorMes)==parseInt(mesActual) && parseInt(yearActual)==parseInt(valorYear)){
		for (var i = diaActual,x=0; i <= daysInMonth; i++,x++) {
			
			if(i==diaActual+3){
			  objForm.gun.options[x] = new Option(i,i,"defaultSelected");
			}else{
			  objForm.gun.options[x] = new Option(i,i);
			}
		}
		if(objForm.gun.length>=4){
			objForm.day.options[3].selected = true;
		}
	}else{
		for (var i = 0; i < daysInMonth; i++) {
			if(i==0){
			  objForm.gun.options[i] = new Option(i+1,i+1,"defaultSelected");
			}else{
			  objForm.gun.options[i] = new Option(i+1,i+1);
			}
		}
	}
}



var testObj;

function pmgizle(gelenid) {
	testObj = document.getElementById(gelenid);
	for (var i=0;i<11;i++)
		setTimeout('setOpacity('+i+')',100*i);
	return false;
}

function setOpacity(value)
{
	testObj.style.opacity = value/10;
	testObj.style.filter = 'alpha(opacity='+ value*10 +');';
	testObj.style.zoom= 1;
}


