function heightOptimizer()
{
	var tmp = window.location.href;
	var page = 0;
	var _h = 0;
	
	if(tmp.indexOf("php") == -1 && tmp.indexOf("htm") == -1)
		page = 1;
	else if(tmp == '')
		page = 1;
	else
		page = 0;
	
	var _height = document.getElementById('base_middle').offsetHeight;
	
	//if(_height < document.getElementById('base_left').offsetHeight + _h)
	//	_height = document.getElementById('base_left').offsetHeight + _h;
		
	if(_height < document.getElementById('base_right').offsetHeight)
		_height = document.getElementById('base_right').offsetHeight;
	
	document.getElementById('base').style.height = (_height - _h) + "px";
	document.getElementById('base_right').style.height = (_height) + "px";
	document.getElementById('base_middle').style.height = (_height) + "px";
	//document.getElementById('base_left').style.height = (_height - _h) + "px";
}

function openPopUp_520x390(href, target)
{
	window.open(href, target, 'width=520, height=390, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
function openPopUp_600x450(href, target)
{
	window.open(href, target, 'width=600, height=450, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
function openPopUp_670x500(href, target)
{
	window.open(href, target, 'width=670, height=500, top=0, toolbar=0, location=0, directories=0, status=1, menuBar=0, scrollBars=1, resizable=0');
	return false;
}
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';
		}
	}
}
function SymError()
{
	return true;
}
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
function Get_Cookie( name )
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 )
		return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 )
		end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function Delete_Cookie( name, path, domain )
{
	if ( Get_Cookie( name ) )
		document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
	{
		if(tmp[i].href.indexOf(baseURL) == -1 || tmp[i].href.indexOf('http://') == -1)
			tmp[i].target = "_blank";
	}
}
function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
	Set_Cookie('text_size', _size, 30, '', '', '');
}
function clearItems(elm)
{
	tmp = elm.getElementsByTagName("table");
	for(i=0; i<tmp.length; i++)
	{
		document.getElementById('advert').style.display = 'none';
		break;
	}
}
function goGazette(idx)
{
	if(idx == "")
		return false;
	
	window.open("gazeteler/" + idx + ".htm", "", "");
	return false;
}

function mostlyPage(type, page)
{
    mostly_type = type;
	var xmlHttpReq = false;
    var self = this;
    var strURL = 'x_mostly.php?type=' + type + '&page=' + page;
    
    if (window.XMLHttpRequest)
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-javascript; charset=iso-8859-9');
    self.xmlHttpReq.onreadystatechange = function()
    {
        if (self.xmlHttpReq.readyState == 4)
        {
        	mostlyLoad(type, self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send('');
    return false;
}

function mostlyLoad(type, str)
{
	eval(str);
	
	document.getElementById("mostly_items_data").innerHTML = mostly_items;
	changeMostly(type, 0);
}

function changeMostly(type, idx, seo_link, seo_title)
{

	eval('elm = mostly_data_' + type);
	
	if(typeof(window['elm']) == "undefined")
		return;

	document.getElementById("mostly_image_1").src = './images/news/116x62/' + elm[idx]['image'] + '.jpg';
	document.getElementById("mostly_title_1").innerHTML = '<a href="' + seo_link + '" title="' + seo_title + '">' + elm[idx]['title'] + '</a>';
	document.getElementById("mostly_short_content_1").innerHTML = '<a href="' + seo_link + '" title="' + seo_title + '">' + elm[idx]['short_content'] + '</a>';
}

function photoVideo(type)
{
	if(type == 1)
	{
		document.getElementById("content_1").style.display = 'inline';
		document.getElementById("content_2").style.display = 'none';
		document.getElementById("others_link").href= "foto-galeri/";
		document.getElementById("iv_foto").style.fontWeight= "bold";
		document.getElementById("iv_video").style.fontWeight= "normal";
		
	}
	else
	{
		document.getElementById("content_1").style.display = 'none';
		document.getElementById("content_2").style.display = 'inline';
		document.getElementById("others_link").href= "video-galeri/";
		document.getElementById("iv_video").style.fontWeight= "bold";
		document.getElementById("iv_foto").style.fontWeight= "normal";
	}
	document.getElementById("vi_content").innerHTML = str;
}


function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		tmp[i].target = "_blank";
}

function getSWF(_WIDTH, _HEIGHT, _SRC, _ID, _VARS)
{
	document.write('<div style="width: ' + _WIDTH + 'px; height: ' + _HEIGHT + 'px; z-index: ' + _ZINDEX + ';">');
	document.write('<object id="' + _ID + '" width="' + _WIDTH + '" height="' + _HEIGHT + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0">');
	document.write('<param name="FlashVars" value="' + _VARS + '">');
	document.write('<param name="movie" value="' + _SRC + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="scale" value="1">');
	document.write('<param name="allowScriptAccess" value="always">');
	document.write('<embed name="' + _ID + '" FlashVars="' + _VARS + '" style="z-index: ' + _ZINDEX + ';" src="' + _SRC + '" width="' + _WIDTH + '" height="' + _HEIGHT + '" scale="exactfit" quality="high" wmode="transparent" allowScriptAccess="sameDomain" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
	document.write('</object>');
	document.write('</div>');
	_ZINDEX += 1;
}

function getFlashMovie(flash) {
	return (isIE) ? window[flash] : document[flash];
}

function weatherChange(name, image_code, detail_str)
{
	var _detail;
	_detail = detail_str.split("|");
	document.getElementById("weather_city").innerHTML = '<a href="hava-durumu.htm">' +  name  + '</a>';
	document.getElementById("weather_degree").innerHTML = _detail[0] + ' &deg;C <br> ' + _detail[1];
	document.getElementById("items_1").innerHTML = '<div style="float:left; width: 90px;"><b>Hissedilen</b></div>' + _detail[2] + ' &deg;C';
	document.getElementById("items_2").innerHTML = '<div style="float:left; width: 90px;"><b>Nem Oranı</b></div>' + _detail[3] + ' %';
	document.getElementById("items_3").innerHTML = '<div style="float:left; width: 90px;"><b>Basınç</b></div>' + _detail[4] + 'kpa';
	document.getElementById("items_4").innerHTML = '<div style="float:left; width: 90px;"><b>Rüzgar Hızı</b></div>' + _detail[5] + 'km/s';
	document.getElementById("items_5").innerHTML = '<div style="float:left; width: 90px;"><b>Rüzgar Yönü</b></div>' + _detail[6];	
	getFlashMovie("weatherIcon").sendAUtoFlash(image_code);
}

function changeMenuBckColor(menu, stat)
{
	if(stat == 'on')
	{
		menu.style.backgroundImage = 'url(images/today_news.png)'; 
		menu.style.backgroundRepeat = 'repeat-x';
	}
	else
	{
		menu.style.backgroundImage = ''; 
		menu.style.backgroundRepeat = 'no-repeat';
	}
}