function ChangeAllCheckBoxStates(checkState) {
    if (CheckBoxIDs != null) {
        for (var i = 0; i < CheckBoxIDs.length; i++) {
            ChangeCheckBoxState(CheckBoxIDs[i], checkState);
        }
    }
}
function ChangeCheckBoxState(id, checkState) {
    var cb = document.getElementById(id);
    if (cb != null) {
        cb.checked = checkState;
    }
}
function ChangeHeaderAsNeeded() {
    if (CheckBoxIDs != null) {
        for (var i = 1; i < CheckBoxIDs.length; i++) {
            var cb = document.getElementById(CheckBoxIDs[i]);
            if (!cb.checked) {
                ChangeCheckBoxState(CheckBoxIDs[0], false);
                return;
            }
        }
        ChangeCheckBoxState(CheckBoxIDs[0], true);
    }
}
function Mesaj(uri) {
    window.open('IlanMesaj.aspx?mid=' + URLEncode(uri), 'ilanmesaj', 'width=430, height=650, toolbar=no, status=no, resizable=no, location=no, scrollbars=yes, left=' + ((screen.width - 430) / 2) + ', top=' + ((screen.height - 650) / 2))
}


function rg(res)
{
    window.open('TumResimler.aspx?mid=' + URLEncode(res),'makinaResim','width='+screen.width+', height='+screen.height+', location=no, menubar=no, directories=no, scrollbars=yes, left=0, top=0')
}
function linkGoster(obj)
{
    if (document.getElementById(obj).style.display=='')
    {
        document.getElementById(obj).style.display='none';
    }
    else
    {
        document.getElementById(obj).style.display='';
    }
}
function cDegis(obj, yeniSinif)
{
    obj.className=yeniSinif;
}

function simplePopUp(uri, name, width, height)
{
    window.open(uri,name,'directories=no, width='+width.toString()+', height='+height.toLocaleString()+', location=no,menubar=no,resizable=no, scrollbars=no, status=no,toolbar=no, left=' + ((screen.width-width) / 2) + ', top='+((screen.height-height) / 2));
}

function posta(p)
{
    window.open("UyeyeMesajGonder.aspx?posta=" + p,'posta','width=480, height=320, toolbar=no, status=no, resizable=no, location=no, left=' + ((screen.width-480)/2) + ', top=' + ((screen.height-250)/2));
}

function URLEncode( uri )
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = uri;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
}
 
function mDetay()
{
    document.location='MakinaDetay.aspx';
}
function g(uri)
{
    window.open('MakinaDetay.aspx?mid=' + URLEncode(uri),'makinaDetay','status=yes, width=900, height=600, location=no, menubar=no, directories=no, scrollbars=yes, left=' + ((screen.width-900) / 2) + ', top=' + ((screen.height - 600) / 2));
}
function saIlan(uri)
{
    window.open('SahibiniIlanlari.aspx?sahibi=' + URLEncode(uri),'sahibiniIlanlari','status=yes, width=900, height=600, location=no, menubar=no, directories=no, scrollbars=yes, left=' + ((screen.width-900) / 2) + ', top=' + ((screen.height - 600) / 2));
}
function tazeleVeKapat(val, message) {
    alert(message);
    window.opener.location = "/YeniMakina.aspx?mid=" + URLEncode(val);
    window.close();
}