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

var RowOverColor = '#c5f0f5';
var RowClickedColor = '#aaeecc';

function jsRowOver(obj) {
	if (obj.style.backgroundColor != RowClickedColor)
		obj.style.backgroundColor=RowOverColor;
}

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

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

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

/*********************************************************/
/* Display/Hide Box IDs                                  */
/*********************************************************/

function SwTBox() {
	var BD = null;
	if (document.TBoxIds) BD = document.TBoxIds;
	else if (document.all) BD = document.all['TBoxIds'];
	else if (document.layers) BD = document.layers['TBoxIds'];
	else if (document.getElementById) BD = document.getElementById('TBoxIds');
	if (BD && BD.style) { BD.style.display = (BD.style.display=='none') ? '' : 'none'; }
}

function SwRBox() {
	var BD = null;
	if (document.RBoxIds) BD = document.RBoxIds;
	else if (document.all) BD = document.all['RBoxIds'];
	else if (document.layers) BD = document.layers['RBoxIds'];
	else if (document.getElementById) BD = document.getElementById('RBoxIds');
	if (BD && BD.style) { BD.style.display = (BD.style.display=='none') ? '' : 'none'; }
}

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

function fauth() { alert('Bazı fonksiyonları sisteme giriş yapmış olan ve\nabonelik süresi devam eden 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 bazı fonksiyonları kullanamıyorsanız,\nabonelik süreniz dolmuş demektir. Abonelik hesabınızı yenileyerek\ntüm fonksiyonları kullanmaya devam edebilirsiniz.\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ırabilirsiniz.'); }
function dauth() { alert('Maskelenmiş olan bilgileri sisteme giriş yapmış olan ve\nabonelik süresi devam eden 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 bazı bilgileri göremiyorsanız,\nabonelik süreniz dolmuş demektir. Abonelik hesabınızı yenileyerek\ntüm bilgilere kısıtlama olmaksızın erişmeye devam edebilirsiniz.\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ırabilirsiniz.'); }
