

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;
}

 
id = 1;
function RpopUp( URL, W, H, L, T ) {
	id = id + 1;
	popup_sizeable(URL, id, W, H);
}

function popupUyelik(url) {
	popup_sizeable(url,'uyelik', 520, 600);
}

 
function popupBuyukResim(url,w,h) {
	popup_sizeable(url, 'buyuk_resim', w, h);
	return false;
}

function popupHaberResim(resim_id) {
	popup_sizeable('resim,' + resim_id + '.html', 'haber_resim', 600, 600);
}

function popupDosyaResim(resim_id) {
	popup_sizeable('resim,' + resim_id + '.html', 'haber_resim', 600, 600);
}
	
 
 

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};
}

 
 
function setInnerHTML(elementID, HTML) {
	var targetElement = document.getElementById(elementID);
	if (targetElement != null)
		targetElement.innerHTML = HTML;
}

 
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 loginKeyPress(evt) {
	var keyValue;

	if (evt.which)
		keyValue = evt.which;
	else
		keyValue = window.event.keyCode;

	if (keyValue == 13) 
		validateLogin();
}

function PopUpFixed( URL, name, W, H, L, T ) {
	var wnd = window.open(URL, name, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + W + ',height=' + H + ',left='+L+',top='+T);
	wnd.focus();
}

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 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"
}

