// redirect to www.ozeldersbu.com
/*
var version = parseInt( navigator.appVersion );
if ( version >= 4 ) {
	x = screen.width ; y = screen.height
	if ( document.layers ) {
		if ( (x >= 800 ) && ( x <= 1028 ) ) {x = 1028}
		if ( (y >= 600 ) && ( y <= 780 ) )  {y = 780}
		if ( (x >= 640 ) && ( x <= 800 ) )  {x = 800}
		if ( (y >= 480 ) && ( y <= 600 ) )  {y = 600}
		if ( x <= 640 ) {x = 640}
		if ( y <= 480 ) {y = 480}
	}
	if ( x < 750 && y < 550 ) {
		document.location.href = "http://www.ozeldersbu.com";
	}
}
*/

var user_agent = navigator.userAgent;
var isOpera = user_agent.indexOf("Opera") >= 0;
var isFirefox = user_agent.indexOf("Firefox") >= 0;
var isWin32up = user_agent.indexOf("Win32") >= 0 
	|| user_agent.indexOf("Win64") >= 0
	|| user_agent.indexOf("Windows NT") >= 0;

// disallow Opera faking IE
var isIE = !isOpera && user_agent.indexOf("MSIE") >= 0;
var isIE55up = isIE && isWin32up && user_agent.match(/MSIE ((5\.5)|[6789])/);
var isIE70up = isIE && isWin32up && user_agent.match(/MSIE ([789])/);
var isIE55dn = isIE && !isIE55up;
var browser = "other";

if (isFirefox)
	browser = "firefox";
else if (isOpera) 
	browser = "opera";
else if (isIE55up) 
	browser = "ie55p";
else if (isIE55dn) 
	browser = "ie55d";

function setHomePage2(ths, url) {
	ths.style.behavior='url(#default#homepage)';
	ths.setHomePage(url);
}

function popup2(url, window_name, width, height) {
	var left = parseInt((screen.width - width) / 2);
	var top = parseInt((screen.height - height) / 2);
	
	var wnd = window.open(url, 
		window_name, 
		'status=1, toolbar=0, menubar=0, scrollbars=no, resizable=0, ' +
		'left=' + left + ', top=' + top + ', ' +
		'width=' + width + ', height=' + height);

	wnd.focus();
	return wnd;
}

function popup_sizeable(url, window_name, width, height) {
	var left = parseInt((screen.width - width) / 2);
	var top = parseInt((screen.height - height) / 2);
	
	var wnd = window.open(url, 
		window_name, 
		'status=1, toolbar=0, menubar=0, scrollbars=yes, resizable=1, ' +
		'left=' + left + ', top=' + top + ', ' +
		'width=' + width + ', height=' + height);

	wnd.focus();
	return wnd;
}

function doHaberYazdir(haber_id) {
	window.print();
}

id = 1;
function RpopUp( URL, W, H, L, T ) {
	id = id + 1;
	popup_sizeable(URL, id, W, H);
}



function popupBizeUlasin(haber_id) {
	var url = "/bize_ulasin";
	if (haber_id != null && haber_id != "")
		url += "," + haber_id;
	url += ".html";
	popup_sizeable(url,'bizeulasin', 510, 690);
}

function popupEditorEposta(haber_id) {
	var url = "/editore_eposta";
	if (haber_id != null && haber_id != "")
		url += "," + haber_id;
	url += ".html";
	popup_sizeable(url,'bizeulasin', 510, 690);
}

function popupYorumYap(haber_id) {
	var url = "/yorum," + haber_id + ".html";
	popup_sizeable(url,'haber_yorum', 510, 690);
}



function popupHesapla() {
	var url = "/oks_sonuc_hesapla.php";
	popup_sizeable(url,'oks', 510, 690);
}

function popupHavaHarita(resim_adi, isDunya) {
	var wid, hgt;
	
	if (isDunya != null && isDunya) {
		// dunya haritalarinin boyutu degisik
		wid = 700;
		hgt = 700;
	} else {
		wid = 768;
		hgt = 576;
	}
	wid += 40;
	hgt += 200;
	var url = "hava_popup," + resim_adi + ".html";
	popup_sizeable(url, 'hava_popup', wid, hgt);
}

function popupKapakGuzeliOylama() {
	var url = '/kapakguzeli/index.php';
	popup_sizeable(url, 'kapakguzeli_oylama', 530, 600);
}

function getWindowClientSize() {
	var CScreenWidth;
	var CScreenHeight;

	// if (typeof(window.innerWidth) != "undefined") {
	if (window.innerWidth) {
		CScreenWidth = window.innerWidth;
		CScreenHeight = window.innerHeight;
	} else if (document.body.clientWidth) {
		CScreenWidth = document.body.clientWidth;
		CScreenHeight = document.body.clientHeight;
	} else {
		CScreenWidth = 0;
		CScreenHeight = 0;
	}
	return {width: CScreenWidth, height: CScreenHeight};
}

function video_popup(args) {
	var url = "/video_popup," + args + ".html";
	var screenW = screen.width;
	var screenH = screen.height;
	popup_sizeable(url,'video_popup', screenW, screenH);
}

function video_pclose(args) {
	var url = "/video_detay," + args + ".html";
	window.opener.location.href = url;
	window.open('','_parent','');
	window.close();
}

function video_getvideo(args) {
	var url = "/video_detay," + args + ".html";
	document.location.href = url;
}

// IE icin "anasayfam yap"
function linkHomePage(url) {
	if (isIE) {
		document.write("<span class=\"atvgununtarihi\">&nbsp;&nbsp;|&nbsp;&nbsp;</span>" +
			"<a href=\"javascript:;\" onClick=\"setHomePage2(this, '" + url + "');\" class=\"atvgirissayfam\">Giriş sayfam yap</a>");
	}
}

function navigateOpener(url) {
	if (window.opener)
		window.opener.document.location.href = url;
	else
		self.location.href = url;
}

function WriteSWF(width, height, movie, wmode) {
	if (wmode == null) wmode = "transparent";
	var ht = '';
	ht += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '"  style="position: absolute; left: 0px; top: 0px;">';
	ht += '<param name=movie value="' + movie + '">';
	ht += '<param name=wmode value="' + wmode + '">';
	ht += '<param name="Quality" value="High">';
	ht += '<embed src="' + movie + '" quality=high ';
	ht += ' wmode="' + wmode + '" name="flashad" swLiveConnect="TRUE" width="' + width + '" height="' + height + '"';
	ht += ' type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" >';
	ht += '</embed>';
	ht += '</object>';
	document.write(ht);
}

function writeVideoPlayer(stream_url, width, height, showTracker) {
	var trackerVal = (showTracker != null && showTracker) ? "1" : "0";
	
	var playerObj = 
	"<object id=\"TVVideoPlay\" width=\"" + width + "\" height=\"" + height + "\"" +
	"  classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\"" +
	"  codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"" +
	"  standby=\"Loading Microsoft Windows Media Player components...\"" +
	"  type=\"application/x-oleobject\">" +
	"          <param name=\"FileName\" value=\"" + stream_url + "\">" +
	"          <param name=\"AutoStart\" value=\"0\">" +
	"          <param name=\"AutoSize\" value=\"0\">" +
	"          <param name=\"Volume\" value=\"-200\">" +
	"          <param name=\"ShowControls\" value=\"1\">" +
	"          <param name=\"ShowDisplay\" value=\"0\">" +
	"          <param name=\"ShowStatusBar\" value=\"0\">" +
	"          <param name=\"ShowGotoBar\" value=\"0\">" +
	"          <param name=\"ShowTracker\" value=\"" + trackerVal + "\">" +
	"          <param name=\"ShowPositionControls\" value=\"0\">" +
	"          <param name=\"EnablePositionControls\" value=\"0\">" +
	"          <param name=\"EnableContextMenu\" value=\"0\">" +
	"          <embed type=\"application/x-mplayer2\" " +
	"  pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/download/default.asp\" " +
	"  src=\"" + stream_url + "\" " +
	"  filename=\"" + stream_url + "\" " +
	"  name=\"TVVideoPlay\" " +
	"  AutoStart=\"0\"" +
	"  AutoSize=\"0\"" +
	"  Volume=\"-200\"" +
	"  ShowControls=\"1\"" +
	"  ShowDisplay=\"0\"" +
	"  ShowStatusBar=\"0\" " +
	"  ShowGotoBar=\"0\" " +
	"  ShowTracker=\"" + trackerVal + "\" " +
	"  ShowPositionControls=\"0\" " +
	"  EnablePositionControls=\"0\" " +
	"  EnableContextMenu=\"0\" " +
	"  width=\"" + width + "\" height=\"" + height + "\"></embed>" +
	"</object>";
	document.write(playerObj);
}

function writeOnDemandPlayer(stream_url, width, height) {
	writeLivePlayer(stream_url, width, height, true);
}


function writeSWFVideoPlayer(xml_params, width, height) {
	var playerObj = getSWFVideoPlayer(xml_params, width, height);
	document.write(playerObj);
}

// haber icine veya video sayfasina video koyar
function writeSWFVideoPlayer2(video_id, width, height, add_border) {
	if (width == null || width == "") width = 364;
	if (height == null || width == "") height = 318;
	// add_border default is false
	add_border = add_border != null && add_border;
	width = parseInt(width);
	height = parseInt(height);
	if (width < 200 || height < 190) {
		width = 200;
		height = 190;
	}
	
	var padding = 5;
	var outer_width = width + 2 * padding + 2;
	var outer_height = height + 2 * padding + 2;
	
	var xml_params = video_id + "&amp;fscrn=false&amp;__siteref=" + escape(document.location.href);
	var ht = "";
	if (add_border) ht +=
		"<div align=\"center\"><div style=\"width: " + outer_width + "px; height: " + outer_height + "px;\">" + 
		"<div style=\"border: solid 1px #ACACAC; padding: " + padding + "px;\">";
	ht += getSWFVideoPlayer(xml_params, width, height);
	if (add_border) ht +=
		"</div></div></div>";
	
	document.write(ht);
}

function writeSWFVideoPlayerFullScreen(video_id) {
	var xml_params = video_id + "&amp;fscrn=true&amp;__siteref=" + escape(document.location.href);
	writeSWFVideoPlayer(xml_params, "100%", "100%");
}

function setInnerHTML(elementID, HTML) {
	var targetElement = document.getElementById(elementID);
	if (targetElement != null)
		targetElement.innerHTML = HTML;
}



function writeNewsSoundPlayer(audio_link, width, audio_duration) {
	var playerObj = getNewsSoundPlayer(audio_link, width, audio_duration, "haberin");
	document.write(playerObj);
}

function setNewsSoundBlock(audio_duration, audio_link) {
	var width = 198;
	var playerObj = getNewsSoundPlayer(audio_link, width, audio_duration, "haberin");

	var ht = '<div style="color:#71ad20; padding:5px 0px 0px 10px;" class="kalin ari11">Haberi Dinle</div>' +
		"<div>" + playerObj + "</div>";
	setInnerHTML("divHaberDinle", ht);
}

function setYazarSoundBlock(audio_duration, audio_link) {
	var width = 190;
	var playerObj = getNewsSoundPlayer(audio_link, width, audio_duration, "yazının");

	var ht = 
		'<div style="color:#71ad20; padding:5px 0px 0px 10px;" class="kalin ari11">Yazıyı Dinle</div>' + 
		"<div>" + playerObj + "</div>";
	setInnerHTML("divHaberDinle", ht);
}

/** returns a browser specific alpha image layer.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImg(width, height, imgPNG, imgGIF, alt, title) {
	var imgSpacer = I_URL + "sp.gif";
	var html;
	var alt_title;
	
	if (alt != null)
		alt_title = " alt=\"" + alt + "\"";
	else
		alt_title = " alt=\"\"";

	if (title != null)
		alt_title += " title=\"" + title + "\"";

	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = '<img src="' + imgPNG + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else if (isIE55up) {
		// use directX filters
		html = '<img style="width: ' + width + 'px; height: ' + height + 'px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');\" src="' + imgSpacer + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	} else {
		// use failsafe GIF images
		html = '<img src="' + imgGIF + '" width="' + width + '" height="' + height + '"' + alt_title + '>';
	}
	
	document.write(html);
}

/** returns a browser specific alpha image background.
* - imgPNG - PNG with alpha channel
* - imgGIF - failsafe transparent GIF image
*/
function alphaImgBG(imgPNG, imgGIF) {
	var html;
	
	if (isIE70up || isOpera || isFirefox) {
		// use PNGs directly
		html = 'background-image: url(' + imgPNG + ');';
	} else if (isIE55up) {
		// use directX filters
		html = 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPNG + '\',sizingMethod=\'scale\');';
	} else {
		// use failsafe GIF images
		html = 'background-image: url(' + imgGIF + ');';
	}
	
	return html;
}

function loginKeyPress(evt) {
	var keyValue;

	if (evt.which)
		keyValue = evt.which;
	else
		keyValue = window.event.keyCode;

	if (keyValue == 13) 
		validateLogin();
}

function PopUpFixed( URL, name, W, H, L, T ) {
	var wnd = window.open(URL, name, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + W + ',height=' + H + ',left='+L+',top='+T);
	wnd.focus();
}

function strICompare(str1, str2) {
	if (str1.toLocaleUpperCase) {
		str1 = str1.toLocaleUpperCase();
		str2 = str2.toLocaleUpperCase();
	} else {
		str1 = str1.toUpperCase();
		str2 = str2.toUpperCase();
	}
		
	if (str1 < str2)
		return -1;
	else if (str1 > str2)
		return 1;
	else
		return 0;
}




/*****************************************************/
/******** Home Page & Add To Favorites ***************/
/*****************************************************/

function setHomePage2(ths, url) {
	ths.style.behavior='url(#default#homepage)';
	ths.setHomePage(url);
}

function add2Favorites(ths, url, title) {
	if (isIE && window.external != null) {
		window.external.AddFavorite(url,title);
	} else if (isFirefox && window.sidebar && window.sidebar.addPanel) {
		window.sidebar.addPanel(title, url, '');
	} else if (isOpera) {
		ths.rel = "sidebar";
		ths.title = title
		ths.href = url;
	}
}

// IE icin "anasayfam yap"
function linkHomePage(url, cssClass) {
	cssClass = (cssClass == null || cssClass == "") ? "" : " class=\"" + cssClass + "\"";
	
	if (isIE) {
		return ("<a" +
			cssClass +
			" href=\"javascript:;\"" +
			" onclick=\"setHomePage2(this, '" + url + "');\"" +
			">Ana Sayfam Yap</a>");
	}
	
	return "";
}

// IE icin "Sık Kullanılanlara ekle"
function linkFavorites(url, title, cssClass) {
	cssClass = (cssClass == null || cssClass == "") ? "" : " class=\"" + cssClass + "\"";

	if (isIE || isFirefox || isOpera) {
		return ("<a" +
			cssClass +
			" href=\"javascript:;\"" +
			" onclick=\"add2Favorites(this, '" + url + "', '" + title + "');\"" +
			">Favorilerime Ekle</a>");
	}
	
	return "";
}

function ozeldersbuFavorites() {
	// render only on known browsers
	if (!(isIE || isFirefox || isOpera))
		return;

	var url = "http://www.ozeldersbu.com/";
	var title = "ozeldersbu";
	var link_class = "ver10 sol_widget_renk";

	var lnkFav = linkFavorites(url, title, link_class);
	var lnkHome = linkHomePage(url, link_class);
	
	if (lnkFav == "" && lnkHome == "")
		return;

	document.write(
	"<table width='88' border='0' cellpadding='0' cellspacing='0'>"
	);
	
	if (lnkFav != "") {
		document.write("<div style='width: 88px; padding-top: 4px; padding-bottom: 4px;'>" + lnkFav + "</div>");
	}
	if (lnkHome != "") {
		var brdr = (lnkFav != "") ? " border-top: solid 1px #DBDBDB;" : "";
		document.write("<div style='width: 88px; padding-top: 4px; padding-bottom: 4px;" + brdr + "'>" + lnkHome + "</div>");
	}

	document.write(
	"</table>"
	);
}

// IE icin "anasayfam yap" ozeldersbu_v2
function linkHomePage_v2(url) {
	if (isIE) {
		return ('<a href="javascript:;" onclick="setHomePage2(this, \'' + url + '\');"' +
                '><img src="' + I_URL + 'addhomeMETAL.jpg" width="31" height="31" alt="Anasayfam Yap!" title="Anasayfam Yap!"></a>');
	}
	
	return "";
}

// IE icin "Sık Kullanılanlara ekle" ozeldersbu_v2
function linkFavorites_v2(url, title) {
	if (isIE || isFirefox || isOpera) {
		return ('<a href="javascript:;" onclick="add2Favorites(this, \'' + url + '\', \'' + title + '\');"' +
                ' style="margin-right: 5px;"><img src="' + I_URL + 'ADDfovaritesMETAL.jpg" width="31" height="31" alt="Favorilerime Ekle!" title="Favorilerime Ekle!"></a>');
	}
	
	return "";
}

function ozeldersbuFavorites_v2() {
	var url = "http://www.ozeldersbu.com/";
	var title = "ozeldersbu";

	var lnkFav = linkFavorites_v2(url, title);
	var lnkHome = linkHomePage_v2(url);
	document.write(lnkFav + lnkHome);
}

function MM_jumpMenu(selObj,restore){ //v3.1
	document.location.href=selObj.options[selObj.selectedIndex].value;
	if (restore == null || restore) selObj.selectedIndex=0;
}

