// JavaScript Document//
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function redirect(urlik)
{ window.location.href=urlik;}
function OpenWingmd (linkAddress,w,h)
{ window.open(linkAddress, "Betting","width="+w+",height="+h+",status=0");}
function OpenWingmd2 (linkAddress,w,h)
{ window.open(linkAddress, "Betting","width="+w+",height="+h+",status=0");}
function OpenWingmd3 (linkAddress,w,h)
{ window.open(linkAddress, "Betting","width="+w+",height="+h+",status=0,scrollbars");}
function OpenWindow(linkAddress)
{ window.open(linkAddress, "Betting", "width=600,height=470,scrollbars");}
function OpenWindow2(linkAddress)
{ window.open(linkAddress, "Betting", "width=700,height=590,scrollbars");}
function wuwu() { window.name = 'sporting_bet_top2'; window.open(sSecUrlPrefix + 'content/account/sendreminder.asp','login','width=400,height=315,left=430,top=230,screenX=450,screenY=250,scrollbars=1');}
function MM_findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x;}
function MM_showHideLayers() { var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;}
obj.visibility=v;}
}
var timeout = 340;
for( var i = 0; i < 100; i++ )
{
    eval("var timeoutli" + i + " = false;");
}
function initMenu()
{ if ( browser.isDOM1
&& !( browser.isMac && browser.isIE )
&& !( browser.isOpera && browser.versionMajor < 7 )
&& !( browser.isIE && browser.versionMajor < 5 ) )
{ var menu = document.getElementById('menu'); var lis = menu.getElementsByTagName('li'); menu.className='menu'; for ( var i=0; i<lis.length; i++ )
{ if ( lis.item(i).getElementsByTagName('ul').length > 0 )
{ if ( browser.isIE )
{ addAnEvent(lis.item(i),'keyup',show);}
addAnEvent(lis.item(i),'mouseover',show); addAnEvent(lis.item(i),'mouseout',timeoutHide); addAnEvent(lis.item(i),'blur',timeoutHide); addAnEvent(lis.item(i),'focus',show); lis.item(i).setAttribute( 'id', "li"+i ); lis.item(i).getElementsByTagName('a')[0].className = 'menuIndicateur';}
}
}
}
function addAnEvent( target, eventName, functionName )
{ if ( browser.isIE )
{ eval('target.on'+eventName+'=functionName');}
else
{ target.addEventListener( eventName , functionName , true );}
}
function timeoutHide()
{ eval( "timeout" + this.id + " = window.setTimeout('hideUlUnder( \"" + this.id + "\" )', " + timeout + " );");}
function hideUlUnder( id )
{ document.getElementById(id).getElementsByTagName('ul')[0].style['visibility'] = 'hidden';}
function show()
{ this.getElementsByTagName('ul')[0].style['visibility'] = 'visible'; eval ( "clearTimeout( timeout"+ this.id +");" ); hideAllOthersUls( this );}
function hideAllOthersUls( currentLi )
{ var ul = currentLi.parentNode; for ( var i=0; i<ul.childNodes.length; i++ )
{ if ( ul.childNodes[i].id && ul.childNodes[i].id != currentLi.id )
{ hideUlUnderLi( ul.childNodes[i] );}
}
}
function hideUlUnderLi( li )
{ var uls = li.getElementsByTagName('ul'); for ( var i=0; i<uls.length; i++ )
{ uls.item(i).style['visibility'] = 'hidden';}
}
function BrowserDetectLite() { var ua = navigator.userAgent.toLowerCase(); this.isGecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1); this.isMozilla = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length); this.isNS = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) ); this.isIE = ( (ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) ); this.isSafari = (ua.indexOf('safari') != - 1); this.isOpera = (ua.indexOf('opera') != -1); this.isKonqueror = (ua.indexOf('konqueror') != -1 && !this.isSafari); this.isIcab = (ua.indexOf('icab') != -1); this.isAol = (ua.indexOf('aol') != -1); this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE); this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla); this.versionMinor = parseFloat(navigator.appVersion); if (this.isNS && this.isGecko) { this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );}
else if (this.isIE && this.versionMinor >= 4) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );}
else if (this.isMozilla) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );}
else if (this.isSafari) { this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );}
else if (this.isOpera) { if (ua.indexOf('opera/') != -1) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );}
else { this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );}
}
else if (this.isKonqueror) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );}
else if (this.isIcab) { if (ua.indexOf('icab/') != -1) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );}
else { this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );}
}
this.versionMajor = parseInt(this.versionMinor); this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 ); this.isDOM1 = (document.getElementById); this.isDOM2Event = (document.addEventListener && document.removeEventListener); this.mode = document.compatMode ? document.compatMode : 'BackCompat'; this.isWin = (ua.indexOf('win') != -1); this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) ); this.isMac = (ua.indexOf('mac') != -1); this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
this.isLinux = (ua.indexOf('linux') != -1); this.isNS4x = (this.isNS && this.versionMajor == 4); this.isNS40x = (this.isNS4x && this.versionMinor < 4.5); this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7); this.isNS4up = (this.isNS && this.versionMinor >= 4); this.isNS6x = (this.isNS && this.versionMajor == 6); this.isNS6up = (this.isNS && this.versionMajor >= 6); this.isNS7x = (this.isNS && this.versionMajor == 7); this.isNS7up = (this.isNS && this.versionMajor >= 7); this.isIE4x = (this.isIE && this.versionMajor == 4); this.isIE4up = (this.isIE && this.versionMajor >= 4); this.isIE5x = (this.isIE && this.versionMajor == 5); this.isIE55 = (this.isIE && this.versionMinor == 5.5); this.isIE5up = (this.isIE && this.versionMajor >= 5); this.isIE6x = (this.isIE && this.versionMajor == 6); this.isIE6up = (this.isIE && this.versionMajor >= 6); this.isIE4xMac = (this.isIE4x && this.isMac);}
var browser = new BrowserDetectLite(); window.onload = initMenu; sFirstTextLine = "Печелите заложената сума при коефициент <price> , ако <team> <condition>."
sSecondTextLine = "Печелите половината от заложената сума при коефициент  <price> ако <team> <condition>."
sThirdTextLine = "Губите половината от заложената сума, ако  <team> <condition>."
sFourthTextLine = "Заложената сума ще ви бъде върната, ако <team> <condition>."
sFifthTextLine = "Губите заложената сума, ако <team> <condition>."
function getAsianWinLine(nHandicap) { if (nHandicap == null) return null; if (nHandicap < 0) return Math.floor((Math.abs(nHandicap) + 1)); else return -Math.ceil(nHandicap - 1);}
function getAsianDrawLine(nHandicap) { if (nHandicap == null) return null; if (nHandicap - Math.floor(nHandicap) > 0) return null; else return -nHandicap;}
function getAsianLoseLine(nHandicap) { if (nHandicap == null) return null; if (nHandicap < 0) return Math.ceil((Math.abs(nHandicap) - 1)); else return -Math.floor(nHandicap + 1);}
function getAsianWinCondition(nWin1, nWin2) { var nHlp; if (nWin2 != null) { if (nWin1 > nWin2) nHlp = nWin1; else nHlp = nWin2;} else { nHlp = nWin1;}
if (nHlp < -1) return "ПОБЕДИ, ЗАВЪРШИ НАРАВНО, или ЗАГУБИ с   " + (-nHlp) + " гола или по-малко"; if (nHlp == -1) return "ПОБЕДИ, ЗАВЪРШИ НАРАВНО, или ЗАГУБИ с 1 гол"; if (nHlp == 0) return "ПОБЕДИ или ЗАВЪРШИ НАРАВНО "; if (nHlp == 1) return "ПОБЕДИ"; if (nHlp > 1) return "ПОБЕДИ с " + nHlp + " гола или повече";}
function getAsianLoseCondition(nLose1, nLose2) { var nHlp; if (nLose2 != null) { if (nLose1 > nLose2) nHlp = nLose2; else nHlp = nLose1;} else { nHlp = nLose1;}
if (nHlp < -1) return "ЗАГУБИ с " + (-nHlp) + " гола или повече"; if (nHlp == -1) return "ЗАГУБИ"; if (nHlp == 0) return "ЗАВЪРШИ НАРАВНО или ЗАГУБИ"; if (nHlp == 1) return "ЗАГУБИ, ЗАВЪРШИ НАРАВНО или ПОБЕДИ с 1 гол"; if (nHlp > 1) return "ЗАГУБИ, ЗАВЪРШИ НАРАВНО или ПОБЕДИ с " + nHlp + " гола или по-малко";}
function getAsianDrawCondition(nDraw) { var nHlp; if (nDraw != null) { nHlp = nDraw;} else { return "";}
if (nHlp < -1) return "ЗАГУБИ с " + (-nHlp) + " гола"; if (nHlp == -1) return "ЗАГУБИ с 1 гол"; if (nHlp == 0) return "ЗАВЪРШИ НАРАВНО"; if (nHlp == 1) return "ПОБЕДИ с 1 гол"; if (nHlp > 1) return "ПОБЕДИ с " + nHlp + " гола";}
function getNotNullValue(nPar1, nPar2) { var nHlp; if (nPar1 == null) nHlp = nPar2; else nHlp = nPar1; return nHlp;}
function generateAsianLineHelp(sTeam, nFirstHandicap, nSecondHandicap, sPrice) { var sHlp1, sHlp2, sHlp3; sHlp1 = sFirstTextLine.replace("<price>", sPrice); sHlp1 = sHlp1.replace("<team>", sTeam); sHlp1 = sHlp1.replace("<condition>", getAsianWinCondition(getAsianWinLine(nFirstHandicap), getAsianWinLine(nSecondHandicap))); var sHlp; if (nSecondHandicap != null) { if (getAsianWinLine(nFirstHandicap) == getAsianDrawLine(nSecondHandicap) || getAsianWinLine(nSecondHandicap) == getAsianDrawLine(nFirstHandicap)) { sHlp = sSecondTextLine;} else { sHlp = sThirdTextLine;}
} else { sHlp = sFourthTextLine;}
if (getAsianDrawLine(nFirstHandicap) != null || nSecondHandicap != null) { sHlp2 = sHlp.replace("<price>", sPrice); sHlp2 = sHlp2.replace("<team>", sTeam); sHlp2 = sHlp2.replace("<condition>", getAsianDrawCondition( getNotNullValue(getAsianDrawLine(nFirstHandicap), getAsianDrawLine(nSecondHandicap))));} else { sHlp2 = "";}
sHlp3 = sFifthTextLine.replace("<team>", sTeam); sHlp3 = sHlp3.replace("<condition>", getAsianLoseCondition(getAsianLoseLine(nFirstHandicap), getAsianLoseLine(nSecondHandicap))); var xMax = 800, yMax=600; var nWidth = 500, nH = 350; var msgWindow; if (document.all) var xMax = screen.width, yMax = screen.height; else if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight; var xOffset = (xMax - nWidth)/2, yOffset = (yMax - nH)/2; terms=window.open(sDirsDown + "content/betnav/asianhandicapinfo.asp?firstline=" + escape(sHlp1) + "&secondline=" + escape(sHlp2) + "&thirdline=" + escape(sHlp3), "Info", "width=450,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,screenX="+xOffset+",screenY="+yOffset+",top="+yOffset+",left="+xOffset+"");}
function generateAsianHandicapHelpInfo(sTeam, nHandicap, sPrice) { var nHlp = Math.abs(nHandicap); var sHandicapSign; if (nHandicap < 0) sHandicapSign = "-"; else sHandicapSign = ""; var nHlpFloor = Math.floor(nHlp); var nHlpDiff = nHlp - nHlpFloor; if (nHlpDiff == 0 || nHlpDiff == 0.5) { generateAsianLineHelp(sTeam, nHandicap, null, sPrice); return;}
if (nHlpDiff > 0 && nHlpDiff < 0.5) { generateAsianLineHelp(sTeam, eval(sHandicapSign + nHlpFloor), eval(sHandicapSign + (nHlpFloor + 0.5)), sPrice); return;}
if (nHlpDiff > 0.5 && nHlpDiff < 1) { generateAsianLineHelp(sTeam, eval(sHandicapSign + (nHlpFloor + 1)), eval(sHandicapSign + (nHlpFloor + 0.5)), sPrice); return;}
}


	function na_preload_img()
	{ 
	  var img_list = na_preload_img.arguments;
	  if (document.preloadlist == null) 
		document.preloadlist = new Array();
	  var top = document.preloadlist.length;
	  for (var i=0; i < img_list.length; i++) {
		document.preloadlist[top+i] = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	  } 
	}
	
	function na_change_img_src(name, nsdoc, rpath, preload)
	{ 
	  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	  if (name == '')
		return;
	  if (img) {
		img.altsrc = img.src;
		img.src    = rpath;
	  } 
	}
	
	function na_restore_img_src(name, nsdoc)
	{
	  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	  if (name == '')
		return;
	  if (img && img.altsrc) {
		img.src    = img.altsrc;
		img.altsrc = null;
	  } 
	}
