var iframeids=["myframe"]

var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadpage(url){
if (document.getElementById)
document.title='Sayfa Yükleniyor..';
document.getElementById('myframe').style.display='none';
document.getElementById('status').style.display='block';
document.getElementById('myframe').src=url
}

function loadpage2(url){
if (parent.document.getElementById)
parent.document.title='Sayfa Yükleniyor..';
parent.document.getElementById('myframe').style.display='none';
parent.document.getElementById('status').style.display='block';
parent.document.getElementById('myframe').src='modules/'+url;
}

function loadpage3(){
if (parent.document.getElementById)
parent.document.title='Sayfa Yükleniyor..';
parent.document.getElementById('myframe').style.display='none';
parent.document.getElementById('status').style.display='block';
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller



function getXmlHttp() {
	var xmlHttp = null;
	try {
		xmlHttp = new XMLHttpRequest();
	} catch (e) {
		var progIds = ['Microsoft.XMLHTTP', 'MSXML2.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0']
		var success = false;
		for (var iterator = 0; (iterator < progIds.length) && ( ! success); iterator ++) {
			try {
				xmlHttp = new ActiveXObject(progIds[iterator]);
				success = true;
			} catch (e) {}
		}
		if ( ! success ) {
			return null;
		}
	}
	return xmlHttp;
}
function save(url,id) {
var cid = document.getElementById('category_' + id).value;
if(cid == 0) {
alert('Lütfen bir kategori seçiniz!');
return false;
}
    xmlHttp = getXmlHttp();
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
		alert(url + ' sitesinin kategorisi değiştirildi!');
		window.location='sites.php';
}
}
};
xmlHttp.open('GET', 'updatecategory.php?url=' + url + '&category=' + cid + '&id=' + id, true); 
xmlHttp.send(null);
}

function getpayment() {	
    xmlHttp2 = getXmlHttp();
	xmlHttp2.onreadystatechange = function() {
		if(xmlHttp2.readyState == 4) {
			if(xmlHttp2.status == 200) {
if(xmlHttp2.responseText=='OK') {
alert('Ödeme talebiniz alınmıştır...');
window.location='payments.php';
} else if(xmlHttp2.responseText=='WAIT') {
alert('Bir önceki ödeme talebiniz sonuçlanmadan yeni ödeme talebinde bulunamazsınız...');
window.location='stats.php';
} else {
alert('Ödeme talebi için yeterli bakiyeniz bulunmamakta veya ödeme günü değildir.');
window.location='stats.php';
return false;
}

}
}
};

var agree=confirm("Ödeme talep etmek istediğinizden emin misiniz?");
agree;
if (agree) {
xmlHttp2.open('GET', 'getpayment.php', true);
xmlHttp2.send(null);
} else {
	return false ;
}

}


function times(refreshtime) {
setInterval("total_publisher()", refreshtime);
}

function total_publisher() {
    xmlHttp = getXmlHttp();
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
if(xmlHttp.responseText=='ERROR') {
return false;
} else {
document.getElementById('total_publisher').innerHTML=xmlHttp.responseText;
}


}
}
};
xmlHttp.open('GET', 'publicstats.php', true); 
xmlHttp.send(null);
}