function setNewLocale(){
	f = document.forms["form_locale"];
	if(window.location.search == ""){
		f.action = "index.php";
	}
	f.submit();
}

function changeNewsCategory(url){
	window.location = url;
}

function showNews(num){
	var loc = window.location;
	var prefix = (String(loc).indexOf("?") > -1 ? "&" : "?");
	//alert(String(loc).indexOf("?"));
	window.location = loc + prefix + "news_id=" + num; 
}

function returnToAllNews(newsNum){
	var loc = String(window.location);
	loc = loc.replace("&news_id=" + newsNum, "");
	loc = loc.replace("?news_id=" + newsNum, "");
	window.location = loc;
}

function doSearch(){
	var sStr = document.getElementById("searchInp").value;
	if(sStr == "" || sStr == " "){
		return;
	}
	var sSelect = document.getElementById("sSelect");
	sSelect = sSelect.options[sSelect.selectedIndex].value;
	while(sStr.indexOf("&") > -1){
		sStr = sStr.replace("&", "");
	}
	var loc = String(window.location);
	if(loc.indexOf("search") > 0){
		loc = loc.substr(0, loc.indexOf("search")-1);
	}
	var prefix = (String(loc).indexOf("?") > -1 ? "&" : "?");
	if(loc.indexOf("index.php") < 0){
		prefix = "index.php" + prefix;
	}
	window.location = loc + prefix + "search=" + sStr + "&sSelect=" + sSelect; 
}

function removeMessages(){
	return;
	var d = document.getElementById('messageDiv');
	if(!d){
		return;
	}
	//alert(d.style.opacity)
	//d.filters.Alpha.opacity = 50;
	for(var i = 0; i < 11; i++){
		var t = i*300;
		var op = (10-i)/10;
		//alert(op);
		setTimeout('setElementOpacity("messageDiv", ' + op + ')', t);
	}
	//setElementOpacity('messageDiv', 50);
	//alert(1);
}


function setElementOpacity(sElemId, nOpacity)
{
//alert(nOpacity)  ;
var opacityProp = getOpacityProperty();
  var elem = document.getElementById(sElemId);
	//alert(elem);
  if (!elem || !opacityProp) return; // Если не существует элемент с указанным id или браузер не поддерживает ни один из известных функции способов управления прозрачностью
  
  if (opacityProp=="filter")  // Internet Exploder 5.5+
  {
    nOpacity *= 100;
	
    // Если уже установлена прозрачность, то меняем её через коллекцию filters, иначе добавляем прозрачность через style.filter
   // try{
    	var oAlpha = elem.filters['DXImageTransform.Microsoft.alpha'] || elem.filters.alpha;
	    if (oAlpha) oAlpha.opacity = nOpacity;
	    else elem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")"; // Для того чтобы не затереть другие фильтры используем "+="
    //}
    //catch(e){
    	//oAlpha = elem.style.opacity;
    	//alert(e.message);
    //}
  }
  else // Другие браузеры
    elem.style[opacityProp] = nOpacity;
}

function getOpacityProperty()
{
  if (typeof document.body.style.opacity == 'string') // CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9, IE7)
    return 'opacity';
  else if (typeof document.body.style.MozOpacity == 'string') // Mozilla 1.6 и младше, Firefox 0.8 
    return 'MozOpacity';
  else if (typeof document.body.style.KhtmlOpacity == 'string') // Konqueror 3.1, Safari 1.1
    return 'KhtmlOpacity';
  else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) // Internet Exploder 5.5+
    return 'filter';

  return false; //нет прозрачности
}


function checkPNGImages(){
	try{
	var imColl = document.getElementsByTagName('img');
	for(var i = 0; i < imColl.length; i++){
		var img = imColl[i];
		if(img.className == 'png'){
			enableAlphaImages(img);
		}
	}
	}catch(e){}
}

function enableAlphaImages(img){
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
		isDOM = document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
		isOpera = isOpera5 = window.opera && isDOM //Opera 5+
		isMSIE = document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
		isMSIE5 = isDOM && isMSIE //MSIE 5+
		if(!rslt){
			return;
		}
		//var img = document.images[name];
		//img_name = img.src;
		/*
		isDOM = document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
		isOpera = isOpera5 = window.opera && isDOM //Opera 5+
		isMSIE = document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
		isMSIE5 = isDOM && isMSIE //MSIE 5+
		*/
		if (isMSIE5)
		{
			img_name = img.src;
			img.src			 = "http://dizzain.com/_images/null.gif";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img_name + "', sizingMethod='crop')";

		}
	}
