function show(img, w, h) {
  var ew = w, eh = h, dw = 0, dh = 0;
  if (ew > 800) { ew = 800; dh = 16; }
  if (eh > 600) { eh = 600; dw = 16; }
  var ww = window.open('','Image','width='+(ew + dw)+',height='+(eh + dh)+',scrollbars='+(w > 800 || h > 600 ? 'on' : 'no'));
  ww.document.open();
  ww.document.writeln("<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><img src=\""+img+"\" width="+w+" height="+h+" onClick='window.close()'>");
  ww.document.close();
}
function hide(id) {
  var el = document.getElementById(id);
  if (el) el.style.display = 'none';
}
function toggle(id) {
  var el = document.getElementById(id);
  if (el) {
    el.style.display = el.style.display == 'none' ? '' : 'none';
    if (el.style.display == '') el.focus();
  }
}
function popup(s) {
  window.open(s, '', 'width=680,height=670,scrollbars=1');
  //window.location.href=s;
}


function startclock(ticker)
{
var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
//if(nmins.length==1) nmins="0"+nmins;
var nsecn=thetime.getSeconds();
//if(nsecn.length==1) nsecn="0"+nsecn;
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";


if (nhours<10)
 nhours="0"+nhours;
if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

var ndaynumber = nday;
 if (nday==0)
  nday="Pazar";
if (nday==1)
  nday="Pazartesi,";
if (nday==2)
  nday="Sal&#305;";
if (nday==3)
  nday="&#199;ar&#351;amba";
if (nday==4)
  nday="Per&#351;embe";
if (nday==5)
  nday="Cuma";
if (nday==6)
  nday="Cumartesi";

nmonth+=1;

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;


document.getElementById("saat").innerHTML = " "+nday+" "+ntoday+"/"+nmonth+"/"+nyear+ " " +nhours+ticker+nmins;

if(ticker==':'){ ticker = ' '; }
else{ ticker = ':'; }
//document.all.clockspot.value="Mon Jan 30 , 07:04:35  2006";
setTimeout('startclock("'+ticker+'")',1000);

}



/* ------------------ */
/*
function return_true() { return true; }
function return_false() { return false; }
function handle_click_ns(e) { return (e.which < 2 || e.which > 3); }
function handle_select_ns(e) { return false; }

if (document.all) { 
  document.oncontextmenu = return_false;
  document.onselectstart = return_false;
}
else if (document.layers || document.getElementById) {
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = handle_click_ns;
  } else {
    document.onmouseup = handle_click_ns;
    document.oncontextmenu = return_false;
  }
  if (window.sidebar){
    document.onmousedown = handle_select_ns;
    document.onclick = return_true();
  }
}
*/

function swap_most_box(selection)
{
    document.getElementById("most_read_news").style.display = "none";
    document.getElementById("most_commented_news").style.display = "none";

    document.getElementById("left").style.backgroundColor = "#EBEBEB";
    document.getElementById("right").style.backgroundColor = "#EBEBEB";
    
    if(selection=="topcomments")
    {
        document.getElementById("most_commented_news").style.display = "inline";
        document.getElementById("right").style.backgroundColor = "#424242";
        document.getElementById("right_link").style.color = "#FFFFFF";
        document.getElementById("left_link").style.color = "#000000";
    }
    else
    {
        document.getElementById("most_read_news").style.display = "inline";
        document.getElementById("left").style.backgroundColor = "#424242";
        document.getElementById("right_link").style.color = "#000000";
        document.getElementById("left_link").style.color = "#FFFFFF";
    }

}


var text="content of text here";
var delay=50;
var currentChar=1;
var destination="[not defined]";

function type()
{
  if (document.getElementById)
  {
    var dest=document.getElementById(destination);
    if (dest)
    {
      dest.innerHTML=text.substr(0, currentChar);
      currentChar++
      if (currentChar>text.length)
      {
        currentChar=1;
        setTimeout("type()", 5000);
      }
      else
      {
        setTimeout("type()", delay);
      }
    }
  }
}
function startTyping(textParam, delayParam, destinationParam)
{
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  type();
}

function toggle_items(visible_id,hide_id,visible_container,hide_container)
{
	document.getElementById(visible_id).style.display = 'block';
	document.getElementById(hide_id).style.display = 'none';
	document.getElementById(visible_container).setAttribute("className", "a");
	document.getElementById(hide_container).setAttribute("className", "unselected");
	document.getElementById(visible_container).setAttribute("class", "a");
	document.getElementById(hide_container).setAttribute("class", "unselected");
}

function set_latest_display(cat,value)
{
	var maxi = parseInt(value);
	var i=1;
	for(i=1;i<maxi;i++)
	{
		var new_id = cat+"_"+i;
		document.getElementById(new_id).style.display = "inline";
	}
	for(i=maxi;i<999;i++)
	{
		var new_id = cat+"_"+i;
		code = document.getElementById(new_id).style.display = "none";
		try { eval(code); } catch (e) { continue; }

	}
}
