function SelectDetailList( selectParams, source, key, orig_key, orig_val ) {
	var html = '\n	<select ' + selectParams + '>';
	var i = 0;
	for (x in source) {
		if (source[x][0] == key) {
			var selected = '';
			if ((orig_key == key && orig_val == source[x][1]) || (i == 0 && orig_key != key)) {
				selected = 'selected="selected"';
			}
			html += '\n		<option value="'+source[x][1]+'" '+selected+'>'+source[x][2]+'</option>';
		}
		i++;
	}
	html += '\n	</select>';

	document.writeln( html );
}

function PrepareDetailList( listname, source, key, orig_key, orig_val ) {
	var list = eval( 'document.adminForm.' + listname );

	// empty the list
	for (i in list.options.length) {
		list.options[i] = null;
	}
	i = 0;
	for (x in source) {
		if (source[x][0] == key) {
			opt = new Option();
			opt.value = source[x][1];
			opt.text = source[x][2];

			if ((orig_key == key && orig_val == opt.value) || i == 0) {
				opt.selected = true;
			}
			list.options[i++] = opt;
		}
	}
	list.length = i;
}

function checkAll( n, fldName ) {
  if (!fldName) {
     fldName = 'cb_';
  }
	var f = document.formcontent;
	var c = f.toggle.checked;
	var n2 = 0;
	for (i=0; i < n; i++) {
		cb = eval( 'f.' + fldName + '' + i );
		if (cb) {
			cb.checked = c;
			n2++;
		}
	}
	if (c) {
		document.formcontent.boxchecked.value = n2;
	} else {
		document.formcontent.boxchecked.value = 0;
	}
}


function liste(link,t,l,h,w) {
	vWinCal = window.open(link, "Listemiz", 
		"width="+ w + ",height=" + h + ",scrollbars=yes,status=no,resizable=yes,top=" + t + ",left=" + l);
	vWinCal.opener = self;
	ggWinCal = vWinCal;
}

function hasOptions(obj){
	if(obj!=null && obj.options!=null){
		return true;
	}
	return false;
}

function WriteTextSelectedOptions(from,to){
	var options = new Object();

	if(!hasOptions(from)){
		return;
	}
	
	for(var i=0;i<from.options.length;i++){
		var o = from.options[i];
		if(o.selected){
			if(options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text){
				to.value = o.text;
			}
		}
	}
}

function getElementsByClassName(clss, prnt, tg) 
{
    var elements = new Array();
    tg = tg || '*';
    prnt = prnt || 

document;
    var list = prnt.getElementsByTagName(tg);
    for (var i = 0; i < list.length; ++i) {
        if 

(list[i].className == clss) {
            elements.push(list[i]);
        }
    }
	return elements;
}

var ScrollReg 

= new scrollers();
var scrollStat = new Array ('pasif','aktif','ustunde');
var scrollRight = new Array();
var scrollLeft 

 = new Array();
for(i=0;i<scrollStat.length;i++)
{
	scrollRight[i] = new Image();
	scrollLeft[i]  = new Image();

	

scrollRight[i].src = 'templates/hkaya/images/roll_r.gif'
	scrollLeft[i].src  = 

'templates/hkaya/images/roll_l.gif'
}

function scrollers ()
{
	var sarr = new Array()
	

this.add = add
	this.get = get

	function add(scr) {
		sarr.push(scr)
	}

	function get(id) {
		

for(i=0;i<sarr.length;i++) {
			if(sarr[i].id == id) {
				return sarr[i]
			

}
		}
	}
}

function nso () {
	var me = this
	this.id = ''
	this.dir = 0
	this.pos = 0
	

this.offset = 0
	this.max = 6
	this.view = 3
	this.cpos = 0
	this.moving = false
	this.interval = ''
	// 

//this.movearray = new Array ( 1, 2, 3, 5, 8, 12, 17, 10, 31, 23, 17, 12, 8, 5, 3, 2, 1 );

//this.movearray = new Array ( 1, 2, 3, 5, 8, 12, 15, 18, 21, 18, 15, 12, 8, 5, 3, 2, 1 );
//this.movearray = new Array ( 1, 2, 3, 5, 8, 12, 17, 23, 31, 23, 17, 12, 8, 5, 3, 2, 1 );
  this.movearray = new Array ( 1, 3, 3, 4, 8, 10, 13, 15, 17, 15, 13, 10, 8, 4, 3, 3, 1 );


	this.getStatus = getStatus
	this.updateIcons = 

updateIcons

	function getStatus(side)
	{
		if(side==0)
		{
			

if(me.cpos==0)
				return 0
			return 1
		}

		

if(side==1)
		{
			if( (me.cpos+me.view) < me.max)
				return 1
	

		return 0
		}

	}

	function updateIcons(hover,side)
	{
		if(hover)
	

	{
			if(side&1 && getStatus(0))
			

document.getElementById('scrollleft_'+me.id).src = scrollLeft[2].src
			if(side&2 && getStatus(1))
		

	document.getElementById('scrollright_'+me.id).src = scrollRight[2].src
		} else {
			

if(side&1)
			document.getElementById('scrollleft_'+me.id).src = scrollLeft[getStatus(0)].src
		

	if(side&2)
			document.getElementById('scrollright_'+me.id).src = scrollRight[getStatus(1)].src
	

	}
	}

}

function initScrollers()
{

	var scrollers = getElementsByClassName('scrollamatic', 

document.getElementById('scroll-wrap'), 'div')
	for(i=0;i<scrollers.length;i++)
	{

		var scr = 

scrollers[i]
		var scid = scr.id

		var sc = document.getElementById( 'scrollcontent_'  + scid )

		

var sob = new nso();
		sob.id = scid
		if(sc.style.left != '')
		{
			

sob.offset = parseInt(sc.style.left);
		}

		// count children
		sob.max = 

getElementsByClassName('scrollPromoBox',document.getElementById('scrollshell_'+scid),'div').length
		

sob.updateIcons(false,3)
		ScrollReg.add(sob)
	}
}


function singleScroll(unit,scid)
{

	var sob = 

ScrollReg.get(scid)
	sob.dir = unit
	
	if(  !sob.moving && ( (sob.dir>0 && (sob.cpos+sob.view)<sob.max )  ||  

(sob.dir<0 && sob.cpos>0) ) )
	{
		sob.moving = true
		sob.cpos += sob.dir
		if(sob.dir 

> 0)
		{
			sob.updateIcons(false,1)
		} else {
			

sob.updateIcons(false,2)
		}
		if(sob.getStatus(0) == 0)
			

sob.updateIcons(false,1)
		if(sob.getStatus(1) == 0)
			sob.updateIcons(false,2)
		

sob.interval = setInterval(function () { unitScroller(sob) },10)
	}
}

function unitScroller(sob)
{

	var sc = 

document.getElementById( 'scrollcontent_'  + sob.id )

	if(sob.pos == sob.movearray.length)
	{
		sob.pos = 

0
		clearInterval(sob.interval)
		sob.moving = false
		return
	}

	sob.offset += ((-1 * sob.dir) * sob.movearray[sob.pos])
	sc.style.left = sob.offset + 'px'
//alert(sob.offset);
	sob.pos++

}


/* =onload functions
-------------------= */

function init() {	
    // quit if this function has already been called
	if (arguments.callee.done) {
	    return;
	}
		
	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
		
	// kill the timer
	if (_timer) {
	    clearInterval(_timer);
		_timer = null;
	}
	
		
	if(typeof(Ninbar) != "undefined") {
	    ninbar = new Ninbar();
		if(ninbar.headlineTicker != null) {
		    setTimeout("ninbar.headlineTicker.nextHeadline(1, 0)", 300 );
		}
	}
	

	
	if(typeof(initScrollers) != "undefined") {
	    initScrollers();
	}
	
	if(typeof(cycloMaticInit) != "undefined") {
	    if (typeof TOTAL_IMAGES != "undefined") {
	        if(TOTAL_IMAGES > 0) {
	            cycloMaticInit();
	        }
	    }
	}
	
	if(typeof(extInit) != "undefined") {
	    extInit();
	}

	if(typeof(addBookmarkLink) != "undefined") {
        addBookmarkLink();
    }
	
};
	
/* for Mozilla */
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, null);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)></script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			init(); // call the onload handler
		}
	};
/*@end @*/
	
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 10);
}

/* for other browsers */
window.onload = function() {
init();
/*@cc_on @*/
/*@if (@_win32)
    
	if(typeof(initScrollers) != "undefined") {
	    initScrollers();
	}
	
	if(typeof(addBookmarkLink) != "undefined") {
        addBookmarkLink();
    }
	

	/*@end @*/
}

function LTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      var j=0, i = s.length;
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;
      s = s.substring(j, i);
   }
   return s;
}


function RTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

      var i = s.length - 1;       // Get length of string
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;

      s = s.substring(0, i+1);
   }
   return s;
}

function Trim(str)
{
   return RTrim(LTrim(str));
}
function sf(){document.f.query.focus();}
function c(p,l,e){var f=document.f;if (f.action && document.getelementbyid) {var hf=document.getelementbyid("hf");if (hf) {var t = "<input type=hidden name=tab value="+l+">";hf.innerhtml=t;}f.action = 'http://'+p;e.cancelbubble=true;f.submit();return false;}return true;}

function submitCheck() 
{
	
	var str = Trim(document.f.query1.value)
	if (str == 'Arþiv Arama')
	{
		alert ("Lütfen arama yapmak için bir kelime yazýn")
		return false
	}
	else
	{

		if (str.length < 3)
		{
			alert ("En az üç harfli bir kelime girmelisiniz")
			return false
		}
		else
		{
			document.f.submit()	
			return true
		}
	}
}
function press( field) {
	query1 = document.f.query1.value
	document.f.query.value = escape(query1)
}





// Roll-overlarda Form alanlarýný gizler
function DOLBNR_show()
{
document.h.hiz.style.visibility = 'visible';
}
function DOLBNR_hide()
{
document.h.hiz.style.visibility = 'hidden';
// Roll-overlarda Form alanlarýný gizler
}

setInterval('blinkIt()',500)
function blinkIt() {
 if (!document.all) return;
 else {
   for(i=0;i<document.all.tags('blink').length;i++){
      s=document.all.tags('blink')[i];
      s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
   }
 }
}
