var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	}
	catch(e) {
		xmlhttp = false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	}
	catch(e) {
		xmlhttp = false;
	}
}

function chnIm() {
	on_air = true;
	img_id = img_id % im_on_air.length;
	while (on_air) {
		with (Math) res_id = round(random()*resimler.length);
		
		if (resimler[res_id]) {
			on_air = false;
			for (var i = 0; i < im_on_air.length; i++) {
				if (resimler[res_id] == im_on_air[i][0]) {
					on_air = true;
					break;
				}
			}
		}
		if (!on_air)
			im_on_air[img_id] = [resimler[res_id], genler[res_id], yukler[res_id]];
	}

	tst_im.src = 'thumb.php?op=makeThumb&resim=' + resimler[res_id] + '&rs=150&rt=gen';
	tst_im.onload  = function () {
		document.getElementById('et'+img_id).src = tst_im.src;
		img_id++;
		setTimeout('chnIm()', 10000);
	}
}


function resimGoster(resim, ww, hh) {
	if (!arguments[1]) {
		ww    = im_on_air[resim][1];
		hh    = im_on_air[resim][2];
		resim = im_on_air[resim][0];
	}
	lnk = 'resim_koy.php?resim=' + resim;
	boyut = 'status, width=' + (ww*1 + 20) + ', height=' + (hh*1 + 20);
	window.open(lnk, '', boyut);
}

var isIE = (document.getElementById && document.all) ? true : false;
var isNS4 = (document.layers) ? true : false;
var isNS6 = (document.getElementById && !document.all) ? true : false;
var newWidth;
//var scroller_timer;

// Genişlik 2'ye bölünüyor mu?
function setWidth() { 
	tableObj = (isIE) ? document.all("table") : document.getElementById("table"); 
	obj = (isIE) ? document.all.div1 : document.getElementById("div1");	 
	objWidth = getOffset(tableObj, "height");
	newWidth = objWidth + 1;
	obj.style.width = newWidth
	moveLayer(obj, newWidth);
	
}

// Bir piksel kaydır
function moveLayer(obj, width) {
	if (obj.style.top == "") {
		obj.style.top = 0;
	}
	
	if (parseInt(obj.style.top) < (0 - newWidth)) {
		obj.style.top = 0
	} else {
		obj.style.top = parseInt(obj.style.top) - 1;
	}
	scroller_timer = setTimeout ("moveLayer(obj, " + width + ");", 5); 
}

// Katmanın genişlik ve yüksekliğini al
function getOffset(obj, dim) {
	if (dim=="width") {
		oWidth = obj.offsetWidth;
		return oWidth;
	} else if (dim=="height") {
		oHeight = obj.offsetHeight;
		return oHeight;
	}		
}

function stopScroller(elm) {
	elm.style.cursor = 'pointer';
	clearTimeout(scroller_timer);
}

function runScroller() {
	if (!isNS4) {
		setWidth();
	}
}

/* from http://www.quirksmode.org/js/detect.html */
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i = 0; i < data.length; i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			} else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{	// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 	// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();