// JavaScript Document
function popwindow_ac(sayfa){
	var popup; 
	popup = window.open(sayfa,'popup','scrollbars=yes,width=500,height=580,left=100,top=100'); if(popup) popup.focus();
	//return true; 
}


function getId(id){
//var layer = (nn4) ? document.layers[id] : (ie) ? document.all[id] : document.getElementById(id) ; 
var layer = document.getElementById(id) ; 
return layer; 
}



function newsPopup(id)
{
	popup = window.open('/haber_popup.php?id='+id,'popup','scrollbars=yes,width=580,height=550,left=250,top=250');
	if(popup)
	{
		popup.focus();
	} 
}

function divopenclose(div)
{
	display = document.getElementById(div).style.display;
	if(display == 'none' || display == '')
	{
		document.getElementById(div).style.display = 'block';
	}
	else
	{
		document.getElementById(div).style.display = 'none';
	}
}



function createBookmarkLink(title,url) {

	if (window.sidebar) 
	{ // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} 
	else if( window.external ) 
	{ // IE Favorite
		window.external.AddFavorite( url, title); 
	}
	else if(window.opera && window.print) 
	{ // Opera Hotlist
		return true; 
	}
 }

function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}


var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
		listEvents.push(arguments);
	},
	flush : function(){
	var i, item;
	for(i = listEvents.length - 1; i >= 0; i = i - 1){
	item = listEvents[i];
		if(item[0].removeEventListener){
			item[0].removeEventListener(item[1], item[2], item[3]);
		};
		if(item[1].substring(0, 2) != "on"){
			item[1] = "on" + item[1];
		};
		if(item[0].detachEvent){
			item[0].detachEvent(item[1], item[2]);
		};
		item[0][item[1]] = null;
	};
	}
	};
}();



function achievement_detail_show(type,id) {
	if(type=="Open") {
		contentDivId = getId('achievementDetail'+id); 
		contentOpenerId = getId('achievementDetailOpener'+id); 
		contentDivId.style.display='block';
		contentOpenerId.style.display='none';
		
		
		
	} else if(type=="Close") {

		contentDivId = getId('achievementDetail'+id); 
		contentOpenerId = getId('achievementDetailOpener'+id); 
		contentDivId.style.display='none';
		contentOpenerId.style.display='block';
	
	}
}


function formSelectRadioButton(id,numOfValue,value) {
	for (i=0; i<numOfValue; i++){
		radioId = id+i+'radio'; 
		containerId = id+i; 
		if(getId(radioId).value==value) {
			getId(containerId).className='selected';
			getId(radioId).checked=true;
		} else {
			getId(containerId).className='noselected';
			getId(radioId).checked=false;
		}
	} 
	
} 


