
function getSWF(swWidth, swHeight, swFile, swWmode)
{
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+swWidth+'  height='+swHeight+'>';
	str += ' <param name="movie" value="'+swFile+'" ';
	str += ' <param name="quality" value="high" ';
	str += ' <param name="wmode" value="'+swWmode+'" ';
	str += ' <embed src='+swFile+' width='+swWidth+' height='+swHeight+' quality="high" pluginspage="http://www .macromedia.com/go/getflashplayer" type="application/x-shoc kwave-flash" wmode="transparent"></embed> ';
	str += ' </object> ';
	document.write(str);
}
function SysError()
{
	return true;
}
function whichBrowser()
{
	var agt = navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1)
		return 'Opera';
	if (agt.indexOf("staroffice") != -1)
		return 'Star Office';
	if (agt.indexOf("webtv") != -1) 
		return 'WebTV';
	if (agt.indexOf("beonex") != -1)
		return 'Beonex';
	if (agt.indexOf("chimera") != -1)
		return 'Chimera';
	if (agt.indexOf("netpositive") != -1)
		return 'NetPositive';
	if (agt.indexOf("phoenix") != -1)
		return 'Phoenix';
	if (agt.indexOf("firefox") != -1)
		return 'Firefox';
	if (agt.indexOf("safari") != -1)
		return 'Safari';
	if (agt.indexOf("skipstone") != -1)
		return 'SkipStone';
	if (agt.indexOf("msie") != -1)
		return 'MSIE';
	if (agt.indexOf("netscape") != -1)
		return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1)
		return 'Mozilla';
	if (agt.indexOf('\/') != -1)
	{
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') 
		{
			return navigator.userAgent.substr(0,agt.indexOf('\/'));
		}
		else
			return 'Netscape';
	}
	else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
	else
		return navigator.userAgent;
}
function isMobile()
{
	var agt = navigator.userAgent.toLowerCase();
	
	res = agt.indexOf('nokia') != -1 
		|| agt.indexOf('symbian') != -1
		|| agt.indexOf('nokia') != -1
		|| agt.indexOf('samsung') != -1
		|| agt.indexOf('mobile') != -1
		|| agt.indexOf('windows ce') != -1
		|| agt.indexOf('epoc') != -1
		|| agt.indexOf('opera mini') != -1
		|| agt.indexOf('nitro') != -1
		|| agt.indexOf('j2me') != -1
		|| agt.indexOf('midp-') != -1
		|| agt.indexOf('cldc-') != -1
		|| agt.indexOf('netfront') != -1
		|| agt.indexOf('mot') != -1
		|| agt.indexOf('up.browser') != -1
		|| agt.indexOf('up.link') != -1
		|| agt.indexOf('audiovox') != -1
		|| agt.indexOf('blackberry') != -1
		|| agt.indexOf('ericsson,') != -1
		|| agt.indexOf('panasonic') != -1
		|| agt.indexOf('philips') != -1
		|| agt.indexOf('sanyo') != -1
		|| agt.indexOf('sharp') != -1
		|| agt.indexOf('sie-') != -1
		|| agt.indexOf('portalmmm') != -1
		|| agt.indexOf('blazer') != -1
		|| agt.indexOf('avantgo') != -1
		|| agt.indexOf('danger') != -1
		|| agt.indexOf('palm') != -1
		|| agt.indexOf('series60') != -1
		|| agt.indexOf('palmsource') != -1
		|| agt.indexOf('pocketpc') != -1
		|| agt.indexOf('smartphone') != -1
		|| agt.indexOf('rover') != -1
		|| agt.indexOf('ipaq') != -1
		|| agt.indexOf('au-mic,') != -1
		|| agt.indexOf('alcatel') != -1
		|| agt.indexOf('ericy') != -1
		|| agt.indexOf('up.link') != -1
		|| agt.indexOf('vodafone/') != -1
		|| agt.indexOf('wap1.') != -1
		|| agt.indexOf('wap2.') != -1
		|| false;
	return res;
}


function onlyNumber()
{
	if (event.keyCode < 48 || event.keyCode> 57) event.returnValue = false;
}
function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		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 heightOptimizer()
{
	var tmp = window.location.href;
	var page = 0;
	
	if(tmp.indexOf("php") == -1 && tmp.indexOf("html") == -1)
		page = 1;
	else if(tmp.indexOf("index.php") != -1)
		page = 1;
	else
		page = 0;
	
	if(page)
		_h = -550;
	else
		_h = 0;
	
	var _height = document.getElementById('base_middle').offsetHeight;
	
	if(_height < document.getElementById('base_right').offsetHeight)
		_height = document.getElementById('base_right').offsetHeight;
		
	if(_height < document.getElementById('base_left').offsetHeight + _h)
		_height = document.getElementById('base_left').offsetHeight + _h;
	
	document.getElementById('base').style.height = (_height - _h) + "px";
	document.getElementById('base_left').style.height = (_height - _h) + "px";
	document.getElementById('base_middle').style.height = (_height) + "px";
	document.getElementById('base_right').style.height = (_height) + "px";
}
function mostlyPage(type, page)
{
	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=UTF-8');
    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_" + type).innerHTML = mostly_items;
	changeMostly(type, 0);
}
function changeMostly(type, idx)
{
	eval('elm = mostly_data_' + type);
	
	if(typeof(window['elm']) == "undefined")
		return;
	
	document.getElementById("mostly_image_" + type).src = 'http://netkulis.com/images/news/' + elm[idx]['image'] + '.jpg';
	document.getElementById("mostly_title_" + type).innerHTML = '<a href="' + elm[idx]['_link'] + '">' + elm[idx]['title'] + '</a>';
	//document.getElementById("mostly_short_content_" + type).innerHTML = '<a href="' + elm[idx]['_link'] + '">' + elm[idx]['short_content'] + '</a>';
	document.getElementById("mostly_link_" + type).href = elm[idx]['_link'];
}

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			version = "WIN 6,0,21,0";

			axo.AllowScriptAccess = "always";

			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
function GetSwfVer()
{
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

function compareFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			tempArray         = versionStr.split(" ");
			tempString        = tempArray[1];
			versionArray      = tempString.split(",");
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function submitSearchForm(F)
{
	if(F.ss1.checked)
		window.location = baseURL + "search_result.php?submit=Ara&search_key=" + F.sbi.value;
	else if(F.ss2.checked)
		window.location = "http://netkulis.com/search_result.php?submit=Ara&search_key=" + F.sbi.value;
	else if(F.ss3.checked)
		window.location = "http://netkulis.com/videolar.php?string=" + F.sbi.value;
	else if(F.ss4.checked)
		return true;
	else if(F.ss5.checked)
		window.location = baseURL + "galeri/arama-sonuclari.htm?keyword=" + F.sbi.value;
	return false;
}