/*********************************************************/
/* 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'
}

/*********************************************************/
/* 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';
}

function jsRowNonBubble() {
	if (event.stopPropagation) 
		event.stopPropagation(); 
	else 
		event.cancelBubble = true; 
}

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

function fauth() { alert('Bazı fonksiyonlar sadece abonelerimiz için sunulmuştur.\n\nAbonemizseniz sisteme giriş (login) yapınız.\n\nSisteme giriş yaptığınız halde hala fonksiyonu kullanamıyorsanız,\naboneliğinizin süresi bitmiş demektir. Abonelik hesabınızı yenileyip\nfonksiyonu tekrar kullanmaya başlayabilirsiniz.\n\nEğer abonelik hesabınız yoksa, güvenli iletişim kanalımız üzerinden\nsunduğumuz abonelik formları vasıtasıyla başvuruda bulunabilirsiniz.'); }
function dauth() { alert('Bazı detay bilgilere sisteme giriş (login) yapmış olan ve\nabonelik süresi bitmemiş abonelerimiz erişebilmektedir.\n\nAbonemizseniz sisteme giriş (login) yapınız.\n\nSisteme giriş yaptığınız halde bazı detaylara erişemiyorsanız,\naboneliğinizin süresi bitmiş demektir. Abonelik hesabınızı yenileyip\ntüm detaylara sınırsız olarak erişmeye devam edebilirsiniz.\n\nEğer abonelik hesabınız yoksa, güvenli iletişim kanalımız üzerinden\nsunduğumuz abonelik formları vasıtasıyla başvuruda bulunabilirsiniz.'); }
