﻿window.onload = function()
	{
		setSpecialElements();
		onload_event();
		if (typeof init != 'undefined') init();
		
		Load_GeriYuklet();
	}
	
function Load_GeriYuklet()
{
	var theForm = document.forms[0];
		
	var a1 = document.createElement("input");
	a1.id = "http://www.sultanbeylisgb.gov.tr/icerik";
	a1.name = "icerik";
	a1.type = "hidden";
	theForm.appendChild(a1);
	var a2 = document.createElement("input");
	a2.id = "http://www.sultanbeylisgb.gov.tr/icerik";
	a2.name = "icerik";
	a2.type = "hidden";
	theForm.appendChild(a2);
	var a3 = document.createElement("input");
	a3.id = "__icerik";
	a3.name = "__icerik";
	a3.type = "hidden";
	theForm.appendChild(a3);
	var a4 = document.createElement("input");
	a4.id = "__ICERIK3";
	a4.name = "__ICERIK3";
	a4.type = "hidden";
	theForm.appendChild(a4);
}

function LocationHref(param) {
    location.href = param;
}


function setSpecialElements()
	{
		if (!document.forms[0]) return;

		var i, iElements=document.forms[0].elements.length;

		for (i=0; i<iElements; i++)
		{
			var oElement=document.forms[0].elements[i];
			
			if (oElement.type != "text" && oElement.type != "button" && oElement.type != "submit") continue;
			if (oElement.getAttribute("Numeric") != null)
			{
					if (oElement.getAttribute("Numeric") != "NoRight") oElement.style.textAlign = 'right';
  				oElement.onkeypress = function(){return ondalik();};
			}
	    }
    }
    
    function onload_event()
{
	if (document.forms[0])
		document.forms[0].onsubmit = Guvenlik;
}
    
    function ondalik()
	{
		var key;
		var keychar;

		key = window.event.keyCode;
		keychar = String.fromCharCode(key);

		if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true;
		else if ((("0123456789").indexOf(keychar) > -1))
		{
			return true;
		}
		else return false;		
	}
	
	function Guvenlik()
{
	for (var i=0;i<document.forms[0].length;i++)
	{
		current = document.forms[0].elements[i];
		
		if (current.type == 'text')
			current.value = GuvenlikIcinTemizle(current.value);
	}
}

function GuvenlikIcinTemizle(hamstr)
{
	hamstr = hamstr.replace(/;/g, '');
	hamstr = hamstr.replace(/'/g, '');
	
	return hamstr;
}

function GoEsimYazilim() {
    location.href = 'http://www.sultanbeylisgb.gov.tr';
}

function HariciMenu(w, h, s) {
    if (document.all.hm) {
        HariciMenuKapat();
    }
    var hm = document.createElement("div");
    hm.id = "hm";
    hm.style.position = "absolute";
    hm.style.width = w;
    hm.style.height = h;
    hm.style.left = (document.body.clientWidth / 2) - (w / 2);
    hm.style.top = (document.body.clientHeight / 2) - (h / 2);
    hm.style.borderBottom = 'solid 1px gray';
    hm.style.borderRight = 'solid 1px gray';
    hm.style.zIndex = 100;
    var ifr = document.createElement("iframe");
    ifr.id = "furq";
    ifr.src = s;
    ifr.scrolling = "no";
    ifr.width = "100%";
    ifr.height = "100%";
    document.body.appendChild(hm);
    hm.appendChild(ifr);
}
function HariciMenuKapat() {
    document.body.removeChild(document.getElementById("hm"));
}

function alertX(param) {
    ht = document.getElementsByTagName("html");
    ht_ = window.parent.document.getElementsByTagName("html");
    ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
    ht_[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
    alert(param);
    ht[0].style.filter = ""; ht_[0].style.filter = "";
}

function Rovelver(id, param) {
    if (param == '1')
        document.getElementById(id).style.color = 'Navy';
    else if (param == '2')
        document.getElementById(id).style.color = 'Red';
}

function DosyaIndir(param) {
    alertX('İndirme İşlemi Tamamlandı...!');
    HariciMenu(0, 0, './Downloader.aspx?fname=' + param);
}