//
function tarih() {
now = new Date();
var weekdaysnames = new Array("Pazar", "Pazartesi", "Salı", "Çarşamba","Perşembe", "Cuma", "Cumartesi");
var monthnames = new Array("Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık");
var y = (now.getYear() % 100) + 2000;
document.write( '<b><font class="ver10 koyu_beyaz_renk">' + now.getDate() + '</font>&nbsp;');
document.write( '<b><font class="ver10 koyu_beyaz_renk">' + monthnames[now.getMonth()] + '</font>&nbsp;');
document.write( '<b><font class="ver10 koyu_beyaz_renk">' + y + '</font>&nbsp;');
document.write( '<b><font class="ver10 koyu_beyaz_renk">' + weekdaysnames[now.getDay()] + '</font>&nbsp;');
setTimeout('show()',10);
}
function stoperror(){
return true
}
window.onerror=stoperror

if (navigator.cookieEnabled==true){  
}else{  
window.opener;alert('Kullandığınız tarayıcının ""Cookie"" Desteği Kapalı bu bazı sayfalarda sorunla karşılaşmanıza neden olabilir!');  
}  
//
 
function sendPost(dosya,formId,spanId)
{ 
   var form = document[formId]; //document.forms
   var span = document.getElementById(spanId); 
   var span1 = 'Yükleniyor<br>'; // Alternatif yazili yukleniyor
   span.innerHTML = '<img src="images/loading.gif" width="70" height="10" border="0">'; 
 
   var postRequest = new String(""); 
   var nv,vn;// n -> name , v -> value 

 if (formId != 'yok') { 
   for(var ip=0; ip<form.elements.length; ip++) 
   { 
      nv = form.elements[ip].name; 
      vn = form.elements[ip].value; 
      postRequest += escape(nv) + '=' + escape(vn) + '&'; 
   } 
 } else { postRequest = "getir"; }

   var xmlhttp = new_xmlhttp(); 
   xmlhttp.open("POST", dosya ,true); 
   xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=windows-1254"); 
   xmlhttp.send(postRequest);
   xmlhttp.onreadystatechange = function() 
 { 
      if(spanId == 'oylar') return false;
      if(xmlhttp.readyState != 4 ) return; 
      if (xmlhttp.status == 200) 
 { 
         donenicerik = xmlhttp.responseText;
         span.innerHTML = donenicerik; 
		 donenicerik = donenicerik.replace(/<\/?\s*font class="tablo_font"[^>]*>/g, "");
		 donenicerik = donenicerik.replace(/<\/?\s*font[^>]*>/g, "");
		 if (xmlhttp.responseText.split('kapat').length >= 2) { setTimeout("document.location.href=self.location.href", 5000); }
		
      } 
      else 
      { 
         span.innerHTML = 'Üzgünüm hata oluştu'; 
      } 
   } 
   return false; 
} 
function new_xmlhttp() 
{ 
   var xmlhttp; 
   if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
    try { 
     xmlhttp = new XMLHttpRequest(); 
    } catch (e) { 
     xmlhttp=false; 
    } 
   } 
   return xmlhttp; 
} 
//

setInterval('blinkIt()', 500)
function blinkIt() {
    if (!document.all) return;
    else {
        for (i = 0; i < document.all.tags('blink').length; i++) {
            s = document.all.tags('blink')[i];
            s.style.visibility = (s.style.visibility == 'visible') ? 'hidden' : 'visible';
        }
    }
} 


var user_agent = navigator.userAgent;
var isOpera = user_agent.indexOf("Opera") >= 0;
var isFirefox = user_agent.indexOf("Firefox") >= 0;
var isWin32up = user_agent.indexOf("Win32") >= 0 
	|| user_agent.indexOf("Win64") >= 0
	|| user_agent.indexOf("Windows NT") >= 0;

// disallow Opera faking IE
var isIE = !isOpera && user_agent.indexOf("MSIE") >= 0;
var isIE55up = isIE && isWin32up && user_agent.match(/MSIE ((5\.5)|[6789])/);
var isIE70up = isIE && isWin32up && user_agent.match(/MSIE ([789])/);
var isIE55dn = isIE && !isIE55up;
var browser = "other";

if (isFirefox)
	browser = "firefox";
else if (isOpera) 
	browser = "opera";
else if (isIE55up) 
	browser = "ie55p";
else if (isIE55dn) 
	browser = "ie55d";

function setHomePage2(ths, url) {
	ths.style.behavior='url(#default#homepage)';
	ths.setHomePage(url);
}

function popup2(url, window_name, width, height) {
	var left = parseInt((screen.width - width) / 2);
	var top = parseInt((screen.height - height) / 2);
	
	var wnd = window.open(url, 
		window_name, 
		'status=1, toolbar=0, menubar=0, scrollbars=no, resizable=0, ' +
		'left=' + left + ', top=' + top + ', ' +
		'width=' + width + ', height=' + height);

	wnd.focus();
	return wnd;
}

function popup_sizeable(url, window_name, width, height) {
	var left = parseInt((screen.width - width) / 2);
	var top = parseInt((screen.height - height) / 2);
	
	var wnd = window.open(url, 
		window_name, 
		'status=1, toolbar=0, menubar=0, scrollbars=yes, resizable=1, ' +
		'left=' + left + ', top=' + top + ', ' +
		'width=' + width + ', height=' + height);

	wnd.focus();
	return wnd;
}


function getWindowClientSize() {
	var CScreenWidth;
	var CScreenHeight;

	// if (typeof(window.innerWidth) != "undefined") {
	if (window.innerWidth) {
		CScreenWidth = window.innerWidth;
		CScreenHeight = window.innerHeight;
	} else if (document.body.clientWidth) {
		CScreenWidth = document.body.clientWidth;
		CScreenHeight = document.body.clientHeight;
	} else {
		CScreenWidth = 0;
		CScreenHeight = 0;
	}
	return {width: CScreenWidth, height: CScreenHeight};
}



/** returns a browser specific alpha image layer.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImg(width, height, imgPNG, imgGIF, alt, title) {
	var imgSpacer = I_URL + "sp.gif";
	var html;
	var alt_title;
	
	if (alt != null)
		alt_title = " alt=\"" + alt + "\"";
	else
		alt_title = " alt=\"\"";

	if (title != null)
		alt_title += " title=\"" + title + "\"";

	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = '<img src="' + imgPNG + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else if (isIE55up) {
		// use directX filters
		html = '<img style="width: ' + width + 'px; height: ' + height + 'px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');\" src="' + imgSpacer + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else {
		// use failsafe GIF images
		html = '<img src="' + imgGIF + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	}
	
	document.write(html);
}

/** returns a browser specific alpha image background.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImgBG(imgPNG, imgGIF) {
	var html;
	
	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = 'background-image: url(' + imgPNG + ');';
	} else if (isIE55up) {
		// use directX filters
		html = 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');';
	} else {
		// use failsafe GIF images
		html = 'background-image: url(' + imgGIF + ');';
	}
	
	return html;
}


function strICompare(str1, str2) {
	if (str1.toLocaleUpperCase) {
		str1 = str1.toLocaleUpperCase();
		str2 = str2.toLocaleUpperCase();
	} else {
		str1 = str1.toUpperCase();
		str2 = str2.toUpperCase();
	}
		
	if (str1 < str2)
		return -1;
	else if (str1 > str2)
		return 1;
	else
		return 0;
}

/* Begin: MBG Ajax functions */
var arrMBGAjaxObjects = new Array();

function set_parameters()
{
	var params='';
	
	if(document.getElementsByTagName('input'))  
	{
		var inpts = document.getElementsByTagName('input');
		for ( i=0;i<inpts.length;i++)
		{
			if(inpts[i].type == "checkbox")
			{
				if(inpts[i].checked == true)
				{
	//				alert(inpts[i].name+'='+inpts[i].value)
					params+=inpts[i].name+'='+inpts[i].value+'&';
				}
			}
			else
				params+=inpts[i].name+'='+inpts[i].value+'&';
		}
	}
	  
	if(document.getElementsByTagName('textarea'))  
	{
		var txtars = document.getElementsByTagName('textarea');
		for ( i=0;i<txtars.length;i++)
		{
			params+=txtars[i].name+'='+txtars[i].value+'&'
		}
	}
	
	if(document.getElementsByTagName('select'))  
	{
		var slcts = document.getElementsByTagName('select');
		for ( i=0;i<slcts.length;i++)
		{
			params+=slcts[i].name+'='+slcts[i].value+'&'
		}
	}
	
	params = params.substring(0,params.length-1)
//	alert(params);
	return params;
} // function set_parameters()

function MBGAjaxProcessChange( index ) {
	var oMBGAjax = arrMBGAjaxObjects[index];
	if (oMBGAjax == null) return;
	
	// State 4 ise Sayfa yuklenmistir.
	//Ve tabii ki HTTP status 200 olmali
	if (oMBGAjax.XML.readyState == 4 && oMBGAjax.XML.status == 200) {
		// do callback if it is set
		if (oMBGAjax.callback != null)
			oMBGAjax.callback(oMBGAjax.XML.responseText);
		else if (oMBGAjax.targetDivID != null) {
			var obj = document.getElementById(oMBGAjax.targetDivID);
			if (obj != null)
				obj.innerHTML = oMBGAjax.XML.responseText;
		}
			
		// clear the referred object after it is used
		arrMBGAjaxObjects[index] = null;
	}
}

// Executes an asynchronous AJAX operation using GET method and launches 
// the callback with the response text when the request finishes.
function MBGAjaxInternal(url, callback, method, params, targetDivID) {
	if (method == null) method = "GET";
	
	var oXML = null;
	
	// Internet Explorer ise
	try {
		oXML = new ActiveXObject( "Msxml2.XMLHTTP" );
	} catch( e ) {
		try {
			oXML = new ActiveXObject( "Microsoft.XMLHTTP" );
		}
		catch( oc ) { req = null; }
	}

	// Mozailla veya Safari ise
	if ( oXML == null && typeof(XMLHttpRequest) != "undefined" ) {
		oXML = new XMLHttpRequest();
	}

	// save fields to a new object
	var index = arrMBGAjaxObjects.length;
	arrMBGAjaxObjects[index] = new Object();
	arrMBGAjaxObjects[index].XML = oXML;
	arrMBGAjaxObjects[index].callback = callback;
	arrMBGAjaxObjects[index].targetDivID = targetDivID;
	
	// Sayfa yuklendiyse processChange fonksiyonunu cagiriyoruz.
	if ( oXML != null ) {
		oXML.onreadystatechange = function() {
			MBGAjaxProcessChange(index);
		};
		oXML.open( method, url, true );
		if (strICompare(method, "POST") == 0)
			oXML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		oXML.send( params );
	}
}
/* End: MBG Ajax functions */


function dgid(obj)
{
	return document.getElementById(obj);
} // function dgid(obj)

function displayDIVBlock(id) {
	var obj = document.getElementById(id);
	if (obj != null) obj.style.display = "block"
}

function hideDIVBlock(id) {
	var obj = document.getElementById(id);
	if (obj != null) obj.style.display = "none"
}
