
function displayButtons(targetElement, view){
		var perde = document.getElementById('perde');
	if(view){
		var d=document.createElement('div');
		d.setAttribute('id', 'btnBar');
		d.setAttribute('class', 'btnBar');
		d.className = 'btnBar';

		var a=document.createElement('a');
		a.setAttribute('href','#');

		var iN=document.createElement('img');
		iN.setAttribute('src','css/images/next.gif');

		var iP=document.createElement('img');
		iP.setAttribute('src','css/images/prevOver.gif');

		a.appendChild(iP);
		a.appendChild(iN);
		d.appendChild(a);

		targetElement.insertBefore(d, targetElement.childNodes[0]);
		targetElement.onmouseover = function(){};
		targetElement.style.zIndex = 99;
		perde.style.visibility="visible";
		perde.onmouseover = function(){displayButtons(targetElement, false); return false;};
	}else{
		var d = document.getElementById('btnBar');
		targetElement.removeChild(d);
		targetElement.onmouseover = function(){displayButtons(targetElement, true); return false;};
		targetElement.style.zIndex = 0;
		perde.style.visibility="hidden";
		perde.onmouseover = function(){};
	}
}


var imageSlide = {
	imgList:Array(),
	imgBox:'',
	imgCount:'',
	curImg:0,
	boxSize:'',
	thumbSize:'',
	saveLink:'',
	isWeek:false,
	init:function(){
		this.imgBox = document.getElementById('viewNewsImageBox');
		this.imgCount = document.getElementById('newsImageCount');
		this.saveLink = document.getElementById('galSaveFile');
		if(this.isWeek)
			this.saveLink.href = '/saveFile/weekPhoto/'+this.imgList[this.curImg][0];
		else
			this.saveLink.href = '/saveFile'+this.imgList[this.curImg];
	},
	n:function(e){
		if(e=='p'){
			if(this.curImg == 0 )
				this.curImg = this.imgList.length-1;
			else
				this.curImg--;

		}else if(e=='n'){
			if(this.curImg == this.imgList.length-1)
				this.curImg = 0;
			else
				this.curImg++;
		}else{
			this.curImg = e;
		}
		if(this.isWeek){
			this.imgBox.style.backgroundImage = 'url("/weekPhoto/'+this.boxSize+'/'+this.imgList[this.curImg][0]+'")';
			this.imgCount.innerHTML = this.curImg+1+' / '+this.imgList.length;
			this.saveLink.href = '/saveFile/weekPhoto/'+this.imgList[this.curImg][0];
			document.getElementById('viewNewsHead').innerHTML = this.imgList[this.curImg][1];
			document.getElementById('topHeadlineDate').innerHTML = this.imgList[this.curImg][2];
		}else{
			this.imgBox.style.backgroundImage = 'url("/files/'+this.boxSize+''+this.imgList[this.curImg]+'")';
			this.imgCount.innerHTML = this.curImg+1+' / '+this.imgList.length;
			this.saveLink.href = '/saveFile'+this.imgList[this.curImg];
		}
	},
	viewGalery:function(ContentId, LangNo){
		window.open('/'+LangNo+'//viewGalery/'+ContentId, ContentId+'Galery', 'width=560,height=560,menubar=no,scrollbars=yes'); 
	},
	viewWeekGalery:function(LangNo){
		window.open('/'+LangNo+'//viewWeekGalery', LangNo+'Galery', 'width=560,height=560,menubar=no,scrollbars=yes'); 
	}

}

function showAdvenced(){
	var b = str = document.getElementById('advancedSearchBox');
	if(b.style.display == 'block'){
		b.style.display	= 'none';
		document.getElementById('searchInput').focus();
	}else{
		b.style.display	= 'block';
		document.getElementById('adCatNo').focus();
	}
}

function searchContent(){
	var str = document.getElementById('searchInput');
	if(str.value.length > 2){
		
	}else{
		alert('Aranacak kelime 2 harften fazla olmalı');
		return false;
	}
}

function openPopup(link, popupid, pargs){
	window.open(link, popupid, pargs);
}


function Clock(idd){
	this.dt = new Date();
	this.idd = idd;
	this.i = '';
	this.upStat=true;
	this.timer='';
	this.upTime = function(){
		this.dt = new Date();
	}
	this.Siwtch=function(){
		this.upStat == true?this.Stop():this.Start();
	}
	this.Stop=function(){
		clearInterval(this.timer);
		this.upStat=false;
	 }
	 this.Start = function(){
		this.upStat=true;
		var se = this;
		this.timer= setInterval(function (){ 
				se.upTime(); 
				se.idd.innerHTML = se.z(se.dt.getDate())+'/'+se.z(se.dt.getMonth()+1)+'/'+se.dt.getFullYear()+' '+se.z(se.dt.getHours())+':'+se.z(se.dt.getMinutes())+':'+se.z(se.dt.getSeconds());
			}, 1000);
	}
	 this.init=function(){
		this.idd.innerHTML = this.z(this.dt.getDate())+'/'+ this.z(this.dt.getMonth()+1)+'/'+this.dt.getFullYear()+' '+this.z(this.dt.getHours())+':'+this.z(this.dt.getMinutes())+':'+this.z(this.dt.getSeconds());
		this.Start();
	 }
	 this.z = function(str){
		return (str < 10?'0':'')+str;
	 }
}

function pageUpdate(idd){
	this.sec = 180;
	this.idd = idd;
	this.Start = function(){
		this.upStat=true;
		var se = this;
		this.timer= setInterval(function (){ 
				if(se.sec == 0)	
					window.location.reload(true);
				se.sec--;
				if(se.sec >= 0)
					se.idd.innerHTML = se.sec;
			}, 1000);
	}
	this.z = function(str){
		return (str < 10?'0':'')+str;
	}
	this.init=function(){
		this.idd.innerHTML = this.sec;
		this.Start();
	}
}