/*********************************************************/
/* Check browser                                         */
/*********************************************************/

if (document.layers) window.captureEvents(Event.KEYPRESS | Event.KEYUP | Event.KEYDOWN);
var browserIE = (document.getElementById && document.all);
var browserNS = (document.getElementById && !(document.all));

/*********************************************************/
/* Enable accesskeys in IE                               */
/*********************************************************/

var jsAccessKeyEnabled = true;

function jsUseAccessKey (evt) {
	if (jsAccessKeyEnabled == true) {
		if (event.altKey) {
			event.srcElement.click();
		}
	} else {
		event.srcElement.blur();
		jsAccessKeyEnabled = true;
	}
}

function jsReleaseAccessKey() {
	if (jsAccessKeyEnabled == false) {
		jsAccessKeyEnabled = true;
	}
}

function jsInitAccessKey() {
	if (browserIE) {
		for (i=0;i<document.all.length;i++) {
			a = document.all(i);
			if (a.tagName == 'A' && a.accessKey != '') {
				a.blur();
				a.onfocus = jsUseAccessKey;
			}
		}
		if (event.altKey) {
			jsAccessKeyEnabled = false;
			document.onkeyup = jsReleaseAccessKey;
			setTimeout ('jsReleaseAccessKey()', 100);
		}
	}
}

/*********************************************************/
/* General functions                                     */
/*********************************************************/

function jsFindObj(n, d) { 
	var p,i,x;
	if (!d) d=document;
	if ((p=n.indexOf("?"))>0 && parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if (!(x=d[n]) && d.all) x=d.all[n];
	for (i=0; !x && i<d.forms.length;i++)
		x = d.forms[i][n];
	for (i=0; !x && d.layers && i<d.layers.length; i++)
		x = jsFindObj(n,d.layers[i].document);
	if (!x && document.getElementById)
		x=document.getElementById(n);
	return x;
}

function jsCopyClipboard(obj) {
	obj = jsFindObj(obj);
	if (obj) window.clipboardData.setData('Text', obj.value);
}

function jsSetTextOfLayer(objName, newText) {
	while (obj = document.getElementById(objName)) {
		with (obj)
			if (document.layers) {document.write(unescape(newText)); document.close();}
			else innerHTML = unescape(newText);
		obj.id = '';
	}
}

function jsShowLayer(obj) { 
	if (obj.style) 
		obj=obj.style; 
	obj.display = 'block'
}

function jsHideLayer(obj) { 
	if (obj.style) 
		obj=obj.style; 
	obj.display = 'none'
}

/*********************************************************/
/* Printing functions                                    */
/*********************************************************/

function jsPrintLeftMarginMod(n,w) {
	if (!(w) || w=='') w = 50;
	var im=document.getElementById('marginimg');
	if (im)	{
		var ow=parseInt(im.style.width);
		if (n==0) {var nw=w;}
		else if (n<0) {var nw=ow-10<20?20:ow-10;}
		else if (n>0) {var nw=ow+10>100?100:ow+10;}
		im.style.width=nw+'px'; im.title=nw;
	}
	return false;
}

/*********************************************************/
/* Window opening functions                              */
/*********************************************************/

function jsOpenWindow(theURL, winName, features) {
  window.open(theURL,winName,features);
  return false;
}

function jsOpenPopup(pUrl, pName, pWidth, pHeight, pPos, pScroll) {
	if (!(pName) || pName=='') pName = 'PopupWin_'+Math.round(Math.random()*100000);
	if (!(pWidth)) pWidth = screen.availwidth-200;
	if (!(pHeight)) pHeight = screen.availheight-100;
	if (!(pPos)) pPos = '';
	if (pPos == 'LT') {
		pLeft = 0;
		pTop = 0;
	} else if (pPos == 'RT') {
		pLeft = (screen.availwidth-pWidth)-10;
		pTop = 0;
	} else {
		pLeft = (screen.availwidth-pWidth)/2;
		pTop = (screen.availheight-pHeight)/2;
	}
	pScroll = ((pScroll) ? pScroll.toString() : '0');
	var PopWin = window.open(pUrl,pName,'left='+pLeft+',top='+pTop+',width='+pWidth+',height='+pHeight+',scrollbars='+pScroll+',resizable=1,status=0,menubar=0,toolbar=0,location=0');
	PopWin.resizeTo(pWidth+10,pHeight+30);
	PopWin.focus();
}

/*********************************************************/
/* Highlight effect                                      */
/*********************************************************/

function jsRowOver(obj) {
	if (obj.style.backgroundColor != '#fde18e')
		obj.style.backgroundColor='#daffda';
}

function jsRowOut(obj,color) {
	if (obj.style.backgroundColor != '#fde18e')
		obj.style.backgroundColor=color;
}

function jsRowClick(obj,color) {
	obj.style.backgroundColor = obj.style.backgroundColor=='#fde18e' ? color : '#fde18e';
}

/*********************************************************/
/* Misc                                                  */
/*********************************************************/

function LinkNotActive() { alert('Örnek ilan için sadece Baskı önizleme fonksiyonu aktiftir.'); }
function fauth() { alert('Bu fonksiyonu sisteme giriş yapmış olan ve\ngeçerli bir servis paketine sahip abonelerimiz kullanabilmektedir.\n\nEğer abonemiz iseniz kullanıcı adınız ve şifrenizle sisteme giriş yapınız.\n\nEğer sisteme giriş yaptığınız halde bu fonksiyonu kullanamıyorsanız,\ngeçerli bir servis paketine sahip değilsiniz veya servis paketinizin süresi dolmuş demektir.\n\nEğer abonemiz değilseniz, güvenli bağlantı üzerinden sunduğumuz\nonline başvuru formumuz vasıtasıyla hemen bir abonelik hesabı açtırabilir veya\nabonemiz iseniz hesabınıza servis paketinin eklenmesini sağlayabilirsiniz.'); }
function dauth() { alert('Maskelenmiş verileri sisteme giriş yapmış olan ve\ngeçerli bir servis paketine sahip abonelerimiz görebilmektedir.\n\nEğer abonemiz iseniz kullanıcı adınız ve şifrenizle sisteme giriş yapınız.\n\nEğer sisteme giriş yaptığınız halde verileri göremiyorsanız,\ngeçerli bir servis paketine sahip değilsiniz veya servis paketinizin süresi dolmuş demektir.\n\nEğer abonemiz değilseniz, güvenli bağlantı üzerinden sunduğumuz\nonline başvuru formumuz vasıtasıyla hemen bir abonelik hesabı açtırabilir veya\nabonemiz iseniz hesabınıza servis paketinin eklenmesini sağlayabilirsiniz.'); }
function nosvc() { return confirm('Bir servis, aşağıda gösterilen muhtemel sebeplerden\nbiri dolayısıyla kullanımınıza kapalı olabilir:\n\n- Servis paketi satın almamışsınız veya\n- Servis paketinin kullanım süresi bitmiş veya\n- Servis paketi site yönetimi tarafından kilitlenmiş.\n\nServis paketlerinizi hemen şimdi kontrol etmek ister misiniz?'); }

