edmarks=new String;
edmarks='';
edmnum='';
function edshowhide3(id,url2send) {
	a=document.getElementById(id);
	edtheauthuserx=document.getElementById('edtheauthuser').innerHTML;
	if(edtheauthuserx=='realuser') { }
	else {
		//return confirm('Что бы получить SMS с результатом матча введите логин и пароль или зарегистрируйтесь');
		//return false;
		myLightWindow.activateWindow({
			href: 'http://www.sportonmobile.ru/&link=users&action=login_popup&with_err=1',
			width: 400,
			height: 270,
			type: 'external',
			title: ''
		});
		return false;
	}
	if(document.getElementById('edtheauthuser2').innerHTML=='0') {
//		a=confirm('Ваш номер телефона не проверен. Перейти на страницу для подтверждения номера телефона?');
//		if(a) {
//			window.location.href='http://www.sportonmobile.ru/users/confirm_form/';
//			return false;
//		}
//		else return false;
		myLightWindow.activateWindow({
			href: 'http://sportonmobile.ru/not_confirmed.htm',
			width: 400,
			height: 250,
			type: 'external',
			title: ''
		});
		return false;
	}
	//alert(a.style.fontStyle);
	//<div style="display:none;" id="edprice_f">5.00</div> - price things
	//alert(a.src);
	thebalance=document.getElementById('edthebalance').innerHTML;
	thebalance=thebalance*1.0;
	if(a.src.indexOf('resultred.gif')!=-1 || a.src.indexOf('no.gif')!=-1) {//subscribe on switch
		//get price

		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		//	alert(thebalance);
		//document.getElementById(id).style.fontStyle='italic';
		//document.getElementById(id).style.color='#777777';
		if(a.src.indexOf('resultred.gif')!=-1)
		document.getElementById(id).src='/newbutt/resultgrey.gif';
		if(a.src.indexOf('no.gif')!=-1)
		document.getElementById(id).src='/newbutt/ok.gif';
		edmarks=edmarks+"/1"+id.substring(4);
		document.getElementById('edmnum').innerHTML++;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0+price;
		if(t>thebalance) {
			document.getElementById('edmnum').innerHTML--;
			//document.getElementById(id).style.fontStyle='';
			//document.getElementById(id).style.color='#000000';
			if(a.src.indexOf('resultgrey.gif')!=-1)
			document.getElementById(id).src='/newbutt/resultred.gif';
			if(a.src.indexOf('ok.gif')!=-1)
			document.getElementById(id).src='/newbutt/no.gif';

			myLightWindow.activateWindow({
			href: 'http://sportonmobile.ru/no_money.htm',
			width: 400,
			height: 250,
			type: 'external',
			title: ''
		});
		return false;
		}
		document.getElementById('edmcost').innerHTML=t;
document.getElementById('yourmoney').innerHTML='Ваш счет: '+(thebalance-t)+' руб.';
		//document.getElementById('edsubs').style.display='';

	}
	else {
		//get price
		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		//document.getElementById(id).style.fontStyle='';
		//document.getElementById(id).style.color='#000000';
		if(a.src.indexOf('resultgrey.gif')!=-1)
		document.getElementById(id).src='/newbutt/resultred.gif';
		if(a.src.indexOf('ok.gif')!=-1)
		document.getElementById(id).src='/newbutt/no.gif';
		edmarks=edmarks+"/0"+id.substring(4);
		document.getElementById('edmnum').innerHTML--;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0-price;
		document.getElementById('edmcost').innerHTML=t;
document.getElementById('yourmoney').innerHTML='Ваш счет: '+(thebalance-t)+' руб.';

		//document.getElementById('edsubs').style.display='';
	}
	t='<table width="100%"><tr><td style="color:white;font-size:14px;" align="center">';
	t=t+'&nbsp;';
	edmnum=document.getElementById('edmnum').innerHTML;

	if(edmnum<0) edmnum=-1*edmnum;
    t=t+'Вы выбрали '+document.getElementById('edmnum').innerHTML;
    if(edmnum==0) t=t+' матчей';
    if(edmnum>4) t=t+' матчей';
    if(edmnum==1) t=t+' матч';
    if(edmnum>1 && edmnum<5) t=t+' матча';
    t=t+'. ';
    t=t+'Стоимость подписки '+document.getElementById('edmcost').innerHTML+' руб. ';
    t=t+'</td><td>';
    t=t+'<a href="#" onclick="return edgoredirect();" id="edsubs">';
    t=t+'<img border=0  src="/newbutt/'+id.substring(4,5)+'.gif" valign="center">';
    t=t+'</a>';
    t=t+'&nbsp;';
    t=t+'</td></tr></table>';
    document.getElementById('subsbar').innerHTML=t;
    document.getElementById('subsbar0').innerHTML=t;
url2sendU=url2send.href;
jQuery.get(url2sendU+'&ajaxrequest=1', function(data) {
if(url2sendU.indexOf('unsubscribe')!=-1)  {
document.getElementById(id).src='/newbutt/resultred.gif';
url2send.href=url2send.href.replace('unsubscribe','subscribe');
}
else {
document.getElementById(id).src='/newbutt/ok.gif';
url2send.href=url2send.href.replace('subscribe','unsubscribe');
}


});
	return false;
}

function edshowhide2(id) {
	a=document.getElementById(id);
	edtheauthuserx=document.getElementById('edtheauthuser').innerHTML;
	if(edtheauthuserx=='realuser') { }
	else {
		return confirm('Что бы получить SMS с результатом матча введите логин и пароль или зарегистрируйтесь');
		//return false;
	}
	//alert(a.style.fontStyle);
	//<div style="display:none;" id="edprice_f">5.00</div> - price things
	//alert(a.src);
	if(a.src.indexOf('resultred.gif')!=-1 || a.src.indexOf('no.gif')!=-1) {//subscribe on switch
		//get price
		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		thebalance=document.getElementById('edthebalance').innerHTML;
		thebalance=thebalance*1.0;
		//	alert(thebalance);
		//document.getElementById(id).style.fontStyle='italic';
		//document.getElementById(id).style.color='#777777';
		if(a.src.indexOf('resultred.gif')!=-1)
		document.getElementById(id).src='/newbutt/resultgrey.gif';
		if(a.src.indexOf('no.gif')!=-1)
		document.getElementById(id).src='/newbutt/ok.gif';
		edmarks=edmarks+"/1"+id.substring(4);
		document.getElementById('edmnum').innerHTML++;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0+price;
		if(t>thebalance) {
			document.getElementById('edmnum').innerHTML--;
			//document.getElementById(id).style.fontStyle='';
			//document.getElementById(id).style.color='#000000';
			if(a.src.indexOf('resultgrey.gif')!=-1)
			document.getElementById(id).src='/newbutt/resultred.gif';
			if(a.src.indexOf('ok.gif')!=-1)
			document.getElementById(id).src='/newbutt/no.gif';
			alert('На Вашем счету недостаточно средств. Пополните любым удобным для Вас способом');
			return false;
		}
		document.getElementById('edmcost').innerHTML=t;
		document.getElementById('edsubs').style.display='';
	}
	else {
		//get price
		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		//document.getElementById(id).style.fontStyle='';
		//document.getElementById(id).style.color='#000000';
		if(a.src.indexOf('resultgrey.gif')!=-1)
		document.getElementById(id).src='/newbutt/resultred.gif';
		if(a.src.indexOf('ok.gif')!=-1)
		document.getElementById(id).src='/newbutt/no.gif';
		edmarks=edmarks+"/0"+id.substring(4);
		document.getElementById('edmnum').innerHTML--;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0-price;
		document.getElementById('edmcost').innerHTML=t;
		document.getElementById('edsubs').style.display='';
	}
	return false;
}


function edshowhide(id) {
	a=document.getElementById(id);
	edtheauthuserx=document.getElementById('edtheauthuser').innerHTML;
	if(edtheauthuserx=='realuser') { }
	else {
		return confirm('Что бы получить SMS с результатом матча введите логин и пароль или зарегистрируйтесь');
		//return false;
	}
	//alert(a.style.fontStyle);
	//<div style="display:none;" id="edprice_f">5.00</div> - price things
	if(a.style.fontStyle=='') {//subscribe on switch
		//get price
		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		thebalance=document.getElementById('edthebalance').innerHTML;
		thebalance=thebalance*1.0;
		//	alert(thebalance);
		document.getElementById(id).style.fontStyle='italic';
		document.getElementById(id).style.color='#777777';
		// document.getElementById(id).style.fontWeight='bold';
		edmarks=edmarks+"/1"+id.substring(4);
		document.getElementById('edmnum').innerHTML++;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0+price;
		if(t>thebalance) {
			document.getElementById('edmnum').innerHTML--;
			document.getElementById(id).style.fontStyle='';
			document.getElementById(id).style.color='#000000';
			alert('На Вашем счету недостаточно средств. Пополните любым удобным для Вас способом');
			return false;
		}
		document.getElementById('edmcost').innerHTML=t;
		document.getElementById('edsubs').style.display='';
	}
	else {
		//get price
		price=id.substring(4,5);
		price='edprice_'+price;
		price=document.getElementById(price).innerHTML;
		price=price*1.0;
		document.getElementById(id).style.fontStyle='';
		document.getElementById(id).style.color='#000000';
		edmarks=edmarks+"/0"+id.substring(4);
		document.getElementById('edmnum').innerHTML--;
		t=document.getElementById('edmcost').innerHTML;
		t=t*1.0-price;
		document.getElementById('edmcost').innerHTML=t;
		document.getElementById('edsubs').style.display='';
	}
	return false;
}
function edgoredirect() {
	//alert(edmarks);
	var loc = window.location.href;
	var i = loc.indexOf( "#" );
	if( i != -1) loc=loc.substring(0,i);
	i = loc.indexOf( "?" );
	a=window.location;
	if( i == -1 ) a=loc+'?'+'action=subscribe&idd='+edmarks;
	else a=loc+'&'+'action=subscribe&idd='+edmarks;
	//alert(a);return false;
	window.location=a;
	return false;
}

function ActSM(num){
	var divs = document.getElementById('cd2').getElementsByTagName('div');
	for(var i=0; i<divs.length; i++){
		if(divs[i].id.substr(0,3) == 'cdm'){
			divs[i].style.display = 'none';
		}
	}
	document.getElementById('cdm'+num).style.display='block';
	return;
}
function bookmark( url,title) {
	if (title == undefined)
	title = document.title;
	// то же самое и с URL-ом
	if (url == undefined)
	url = top.location.href;
	if (window.sidebar) {
		// Firefox
		window.sidebar.addPanel(title, url, '');
	} else if (window.opera && window.print) {
		// Opera
		var t = document.createElement('a');
		t.setAttribute('rel', 'sidebar');
		t.setAttribute('href', url);
		t.setAttribute('title', title);
		t.click();
	} else {
		// IE
		window.external.AddFavorite(url, title);
	}
	return false;
}
var doc = '';
function ajax() {
	// Make a new XMLHttp object
	if (typeof window.ActiveXObject != 'undefined' ) doc = new ActiveXObject("Microsoft.XMLHTTP");
	else doc = new XMLHttpRequest();
}

function UpdateRegion(id_country, divname, template){
//	ajax();
//	if (doc){
//		doc.open("GET", '/location.php?sel=region&id_country='+id_country+'&template='+template, false);
//		doc.send(null);
//		document.getElementById(divname).innerHTML = doc.responseText;
//	}
	document.getElementById('edcountry').value=edctr[id_country];
}
function UpdateCity(id_region, divname, template){
	ajax();
	if (doc){
		doc.open("GET", '/location.php?sel=city&id_region='+id_region+'&template='+template, false);
		doc.send(null);
		document.getElementById(divname).innerHTML = doc.responseText;
	}
}


//open window
var Opened = false;
function ow(PageSrc,Width,Height)
{
	Features="top=118,left=255,width="+Width+",height="+Height+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=auto,resizable=yes";
	if ((!Opened) || (NewWin.closed))
	{
		Opened = true;
		NewWin = window.open(PageSrc,null,Features);
		NewWin.focus();
		var w = (window.document.body.offsetWidth)?window.document.body.offsetWidth - 4:window.document.innerWidth;
		var h = (window.document.body.offsetHeight)?window.document.body.offsetHeight - 4:window.document.innerHeight;
		if ((w != Width) || (h != Height)) {NewWin.resizeTo(Width + 10, Height + 29);}
	}
	else
	{
		if ((Opened) || (!NewWin.closed))
		{
			NewWin.location=PageSrc;
			NewWin.focus();
		}
	}
}

//open block
var BOpened = false;
function ob(PageSrc,Width,Height)
{
	Features="top=118,left=255,width="+Width+",height="+Height+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=auto,resizable=yes";
	if ((!Opened) || (NewWin.closed))
	{
		Opened = true;
		NewWin = window.open(PageSrc,null,Features);
		NewWin.focus();
		var w = (window.document.body.offsetWidth)?window.document.body.offsetWidth - 4:window.document.innerWidth;
		var h = (window.document.body.offsetHeight)?window.document.body.offsetHeight - 4:window.document.innerHeight;
		if ((w != Width) || (h != Height)) {NewWin.resizeTo(Width + 10, Height + 29);}
	}
	else
	{
		if ((Opened) || (!NewWin.closed))
		{
			NewWin.location=PageSrc;
			NewWin.focus();
		}
	}
}

//Из index.tpl
ggg56=new Array();
function min_off2(){
s=document.getElementsByTagName('blink');
for(var i=0; i < s.length; i++)
if(s[i].innerHTML.indexOf('!!!')!=-1) {
 s[i].innerHTML="&nbsp;&nbsp;&nbsp;";
 ggg56[i]=1;
}
else {
 s[i].innerHTML="&nbsp;";
 ggg56[i]=2;
}
setTimeout('min_on2()',1000);
}
function min_on2(){
s=document.getElementsByTagName('blink');
for(var i=0; i < s.length; i++)
if(ggg56[i]==1) {
 s[i].innerHTML='<b>ГОЛ!!!</b>';
}
else {
 s[i].innerHTML="'";
}

setTimeout('min_off2()',1000);
}

