﻿var persistmenu="yes" 
var persisttype="sitewide" 

if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function openError(erroid,uname){
	var errwin;
	errwin = window.open('/errorLogin.aspx?err='+erroid + '&uname=' + uname,'login','width=400,height=80,left='+ ((screen.width/2)-200) +',top=250')
if(errwin)
    var popUpsBlocked = false
 else
	alert('Δεν μπορείτε να κάνετε Login στο Betonet.\nΓια να δείτε το σφάλμα απενεργοποιήστε τον pop up blocker για το Betonet.com')

}
function SwitchMenu(obj){
	for (var j=1; j<=4; j++){
		document.getElementById("sub"+j).style.display = "none"; 			
	}
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";

		}else{
			el.style.display = "none";
		}
	}
}
function openforgot(){
	var owin;
	owin = window.open('/forgot.aspx','forgot','width=350,height=200')
}

function openhelp(){
	window.open('http://www.betonet.com/help/betonet.htm')
}
function openstats(id){
	var win;
	win = window.open('/members/stats.aspx?matchid='+id,'stats','width=650,height=600,toolbar=0,scrollbars=0')
}
function openTV(){
		var tvwin;
		tvwin = window.open('tvframes.htm','tvcoupon','width=780,height=540,scrollbars=0,toolbar=0,menubar=0')
}
		
		function showTeamDetails(id,team,p){
		if (id!=''){
			var now = new Date();
			var nIndex = now.getTime();
			document.getElementById("teamsdiv").style.visibility = 'visible';
			document.getElementById("teamsdiv").style.top = (y+5) + 'px';
			document.getElementById("teamsdiv").style.left = (x-250) + 'px';			
			document.getElementById("teamsfr").src = '/members/tools/teamDetails.aspx?matchid=' + id + '&team=' + team + "&p=" + p + '&nocache=' + nIndex
			}	
		}
function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
	if (persistmenu=="yes"){
	var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
	var cookievalue=get_cookie(cookiename)
	if (cookievalue!="")
	document.getElementById(cookievalue).style.display="block"
	}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate


