/*
// ####################################################################
// ####################################################################
// ###
// ###	Kodlama : Elk-Elnk Müh. Agah ALICI
// ###
// ###	Bu dosya içindeki kodların izinsiz olarak kullanılması
// ###				ve/veya çoğaltılması yasaktır
// ###
// ####################################################################
// ###
// ###  Proje		: ADAMYO
// ###	Dosya Adı	: Global.js
// ###	Sürümü No	: 1.0.0.00
// ###
// ####################################################################
// ###
// ###	Dosya Yaratilis tarihi
// ###	03.07.2007 16:17:58
// ###
// ###	Son Güncelleme tarihi
// ###	03.07.2007
// ###
// ####################################################################
// ####################################################################
*/

<!-- document.oncontextmenu=new Function("return false"); -->
<!-- document.onselectstart = new Function( "return false" ); -->
var UA = navigator.userAgent.toLowerCase();
var OP = ( UA.indexOf('opera')   != -1);
var FF = ( UA.indexOf('firefox') != -1);
var IE = ((UA.indexOf('msie')    != -1) && (!OP) && (!FF));
var recoverpop = false;

function FindObject(name)
{
	var nesne = null;
	if (document.getElementById(name)) {
		return document.getElementById(name);
	}
	if (FF){
		return document.all[name];
		//return document.getElementById(name);
	}
	if (IE) {
		return document.getElementById(name);
	}
	if (OP) {
		return document.layers[name];
	}

}

function FindObject2( divID, oDoc ) {
	if( document.getElementById )
	{
		alert("getElementById" + document.getElementById(divID));
		return document.getElementById(divID);
	}
	if( document.all )
	{
		alert("all" + document.all(divID));
		return document.all[divID];
	}
	if( !oDoc ) { oDoc = document; }
	if( document.layers )
	{
		if( oDoc.layers[divID] )
		{
			return oDoc.layers[divID];
		}
		else
		{
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ )
			{
				y = FindObject(divID,oDoc.layers[x].document);
			}
			return y;
		}
	}
	return false;
}


function Ques(uyari, hedef)
{
	if( confirm( uyari + '\r\n' + AreYouSure ) )
	{
		self.location = hedef;
	}
}

function Pencere(URL, W, H, SB, NM)
{
	window.open( URL, NM, "top=0,left=0,width=" + W + ",height=" + H + ",status,resize=no,scrollbars=" + SB );
}

function GosterGizle(name)
{
	var nesne = FindObject(name);

	if( nesne.style.display == 'inline' )
		GizleID(nesne);
	else
		GosterID(nesne);
}

function Goster(name)
{
	var nesne = FindObject(name);

	GosterID(nesne);
}

function GosterID(nesne)
{
	if (nesne)
		nesne.style.display = 'inline';
}

function Gizle(name)
{
	var nesne = FindObject(name);

	GizleID(nesne);
}

function GizleID(nesne)
{
	if (nesne)
		nesne.style.display = 'none';
}

function setStatus(string)
{
	window.status = string;
}

function resetStatus()
{
	window.status = '';
}

function fillOptions(box, list)
{
	box.options.length = 0;
	for( i = 0; i < list.length; i += 2 )
	{
		box.options[i/2] = new Option(list[i], list[i+1]);
	}
	box.disabled = false;
}

function changeSelected( box, selected )
{
	box.readonly = false;
	for( i = 0; i < box.options.length; i++ )
	{
		if( box.options[i].value == selected )
			box.options[i].selected = 'selected';
	}
}

function clock()
{
	var now = new Date();
	var gun = now.getDate();
	var ay = now.getMonth();
	var yil = now.getYear();

	var saat = now.getHours();
	var dakika = now.getMinutes();
	var saniye = now.getSeconds();

	if (gun <= 9) gun = '0' + gun;
	if (yil <= 1000) yil = 1900 + yil;

	if (saat <= 9) saat = '0' + saat;
	if (dakika <= 9) dakika = '0' + dakika;
	if (saniye <= 9) saniye = '0' + saniye;
	dispDate = gun + ' ' + months[ay] + ' ' + yil;
	dateBox = FindObject('Tarih');
	dateBox.innerHTML = dispDate;
	dispTime = saat + ':' + dakika + ':' + saniye;
	timeBox = FindObject('Saat');
	timeBox.innerHTML = dispTime;

	setTimeout("clock()", 1000);
}

function changeImage( Name, Src )
{
	Object = FindObject(Name);
	if( Object.src )
		Object.src = Src;
}

function findPosX(Name)
{
	Nesne = FindObject(Name);
	var CurLeft = 0;
	if (Nesne.offsetParent)
	{
		while (Nesne.offsetParent)
		{
			CurLeft += Nesne.offsetLeft
			Nesne = Nesne.offsetParent;
		}
	}
	else if (Nesne.x)
		CurLeft += Nesne.x;
	return CurLeft;
}

function findPosY(Name)
{
	Nesne = FindObject(Name);
	var CurTop = 0;
	if (Nesne.offsetParent)
	{
		while (Nesne.offsetParent)
		{
			CurTop += Nesne.offsetTop
			Nesne = Nesne.offsetParent;
		}
	}
	else if (Nesne.y)
		CurTop += Nesne.y;
	return CurTop;
}

function mOver(Nesne)
{
	Nesne.className = Nesne.className + '_over';
	Nesne.style.cursor = 'hand';
	Nesne.onmouseout = function(){mOut(Nesne);}
	return true;
}

function mOut(Nesne)
{
	Nesne.className = Nesne.className.substring( 0, Nesne.className.length - 5 );
	Nesne.style.cursor = 'default';
	return true;
}

function replaceAll( str, bul, deg ) {
    while ( str.indexOf( bul ) != -1 ) {
        str = str.replace( bul, deg );
    }
    return str;
}
function openWindow(url, wname, attr){
	window.open(url,wname,attr);
}
function SetCookie(name,value,hours)
{
	var expire = "";
	expire = new Date((new Date()).getTime() + hours * 3600000);
	expire = "; expires=" + expire.toGMTString();
	document.cookie = name + "=" + escape(value) + expire;
	return true;
}

function GetCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0){
		offset = document.cookie.indexOf(search);
			if (offset != -1){
				offset += search.length;
				end = document.cookie.indexOf(";", offset);
				if (end == -1) end = document.cookie.length;
				cookieValue = unescape(document.cookie.substring(offset, end))
			}
	}
	return cookieValue;
}

function recoverSession(){
	recoverpop = window.open("SessionRecover.html",'SR',"width=500,height=150");
	if(!recoverpop){
		alert('Tarayıcınız açılır pencerelerin (popup) açılmasını engelliyor.\nOturumunuz zaman aşımına uğramak üzere.');
	}
}


function recoverPopupClose(){
	if(recoverpop)
	{
		recoverpop.focus();
		recoverpop.close();
	}
}

function strip_tags(str, allowed_tags) {
    var key = '', allowed = false;
    var matches = [];
    var allowed_array = [];
    var allowed_tag = '';
    var i = 0;
    var k = '';
    var html = '';
    var replacer = function(search, replace, str) {
        return str.split(search).join(replace);
    };
    if (allowed_tags) {
        allowed_array = allowed_tags.match(/([a-zA-Z]+)/gi);
    }
    str += '';
    matches = str.match(/(<\/?[\S][^>]*>)/gi);
    for (key in matches) {
        if (isNaN(key)) {
            continue;
        }
        html = matches[key].toString();
        allowed = false;

        for (k in allowed_array) {
            allowed_tag = allowed_array[k];
            i = -1;

            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}

            if (i == 0) {
                allowed = true;
                break;
            }
        }

        if (!allowed) {
            str = replacer(html, "", str);
        }
    }

    return str;
}