// --------------------------------------------------------------------------------------
// popup window
function openwinOnCentre(url, w, h){
	window.open(url,'_blank','top='+(window.screen.height-h)/2+',left='+(window.screen.width-w)/2+',height='+h+',width='+w+',status = no,toolbar = no,scrollbars = no,titlebar=no,directories=no,resizable=no menubar=no,location=no');
	return;
}

function openwinWin(url){
	window.open(url,'_blank');
	return;
}

function gen_link(url,trg){
	window.open(url,trg);
	return;
}
// --------------------------------------------------------------------------------------


// --------------------------------------------------------------------------------------
// change images on activate cursor

	function menuOver(id){
		//alert('sffds');
		window.document.getElementById(id).src="../images/design/point_sel.gif";
		//o.src="../images/design/pugovka_over_icon.gif";
	}
	function menuOut(id){
		
		window.document.getElementById(id).src="../images/design/point_menu_icon.gif";
		//o.src="../images/design/pugovka_icon.gif";
	}
	
// --------------------------------------------------------------------------------------


// --------------------------------------------------------------------------------------
// function replacement of string (for replace tags internals)

function replace_all(s, subs, repl)
{
	res=s;
	while((res.search(subs))!=-1)
		res=res.replace(subs,repl);
	return res;
}

// --------------------------------------------------------------------------------------


// --------------------------------------------------------------------------------------
// function work with menu and sub-menu of 1 level

var cur=-1, timer;



function menu_sel(num) {
	
	//alert(num);
clearTimeout(timer);
if (cur!=num && cur!=-1 && timer) {
	if (document.all('div'+cur)) eval("div"+cur+".style.display='none'");
	if (document.all('m'+cur)) eval("m"+cur);
}
if (document.all('div'+num) && cur!=num) {
	ofsL = 0;
	ofsT = 0;
	obj2 = document.getElementById('m'+num);
	//alert(obj2.id);
	while(obj2.tagName != 'DIV') //DIV - должен стоять как контейнер, куда вставляется ../pr/menu.php {Нужно проэксперементировать с TABLE и TD и пр тэгами}
		{
		if ( obj2.tagName == 'TD')
			{
			ofsL += obj2.offsetLeft
			//alert(ofsL);
			ofsT += obj2.offsetTop
			//alert(ofsT);
			}
		obj2 = obj2.parentNode;
		//alert(obj2.tagName);
		}
		//alert(ofsL);
	eval("div"+num+".style.display='block'");		
	eval("div"+num+".style.left="+(ofsL+15)); //Относительные координаты слева
	eval("div"+num+".style.top="+(ofsT+162));//Относительные координаты сверху
	}
cur=num;
}

function menu_unsel(num) {
s_code="";
if (document.all('div'+num)) s_code+="div"+num+".style.display=\"none\"; ";
s_code+="m"+num+";";
s="eval('"+s_code+"cur=-1;')";
timer=setTimeout(s,100);
}

function div_sel(num) {
if (timer) clearTimeout(timer);
}

function div_unsel(num) {
s="eval('div"+num+".style.display=\"none\"; m"+num+"; cur=-1;')";
timer=setTimeout(s,150);	
}

function sub_sel(obj) {
obj.style.background='#b5bfe8'; //Фон подменю при наведении
}
	
function sub_unsel(obj) {
obj.style.background='#f3f4f9';//Фон подменю неактивный
}

// ---------------------------------------------------------------------------------------------
////Script - change images
	var banners = new Array();
	var current = 0;
	
banners[0] = '<a href="http://www.softdrinks.kz" target="_blank"><img src="../images/content/arctic_banner site-1.gif" alt="Баннеры партнеров" width="139" height="104" /  class="ban_img"></a>';
banners[1] = '<a href="http://www.softdrinks.kz" target="_blank"><img src="../images/content/arctic_banner site-2.gif" alt="Баннеры партнеров" width="139" height="104" /  class="ban_img"></a>';
banners[2] = '<a href="http://www.poltina.kz" target="_blank"><img src="../images/content/poltina_banner site.gif" alt="Баннеры партнеров" width="139" height="104" /  class="ban_img"></a>';

	function changeTopBanner()
	{
		var obj1 	= document.getElementById('partn_banner');
		obj1.innerHTML 	= banners[current];
		current++;
		
		if (current >= banners.length) {
			current = 0;
		}
	}
	
	// ---------------------------------------------------------------------------------------------
	
// ------------- map selection of current points	
	function map_sel(id) {
		
		//alert(id);
		document.getElementById('t'+id).style.display='block';
	
}

	function map_unsel(id) {
		document.getElementById('t'+id).style.display='none';
	
}

// ------------- 

		// ---------------------------------------------------------------------------------------------
		
		
		
function flashDiv(div) {
	//alert(div.id);
	var clsdiv='s-'+div.id;
	sdo=document.getElementById(clsdiv);
	//alert(clsdiv);
	if(sdo.className=="divHide" ){
		sdo.className="divShow";
		
	}
	else {
		sdo.className="divHide";
	}
	return sdo.className=="divShow"; 
}

function flashDivId(id) {
	//alert(div.id);
	var clsdiv='s-'+id;
	sdo=document.getElementById(clsdiv);
	//alert(clsdiv);
	if(sdo.className=="divHide" ){
		sdo.className="divShow";
		
	}
	else {
		sdo.className="divHide";
	}
	return sdo.className=="divShow"; 
}

// ------------- 


function getBrowserName() {
  var ua = navigator.userAgent.toLowerCase();
  // Определим Internet Explorer
  if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
    return "msie"
  }
  // Opera
  if (ua.indexOf("opera") != -1) {
    return "opera"
  }
  // Gecko = Mozilla + Firefox + Netscape
  if (ua.indexOf("gecko") != -1) {
    return "gecko";
  }
  // Safari, используется в MAC OS
  if (ua.indexOf("safari") != -1) {
    return "safari";
  }
  // Konqueror, используется в UNIX-системах
  if (ua.indexOf("konqueror") != -1) {
    return "konqueror";
  }
  return "unknown";
}



	function show_description(id){
		el = document.getElementById('menu_description_'+id);
		if(el.style.display == 'block') el.style.display = 'none';
		else el.style.display = 'block';
	}
	function show_img(id){
		el = document.getElementById('menu_img_'+id);
		if(el.style.display == 'block') el.style.display = 'none';
		else el.style.display = 'block';
	}
	
	
	
	function usubscribe(){
		
//alert(document.getElementById('rsubs_s').checked)
//alert(document.getElementById('rsubs_u').checked)
if (document.getElementById('subscribe_mail').value) {

if (document.getElementById('rsubs_s').checked) {
xajax_subscribe(1,document.getElementById('subscribe_mail').value);	
}

else if (document.getElementById('rsubs_u').checked) {
xajax_subscribe(-1,document.getElementById('subscribe_mail').value);		
	
}

} 

else {
	alert ('Вы не ввели e-mail')
}

	}	
