<!-- Vignette V/5 Tue Feb 09 12:59:40 2010 -->


var userlogin = getCookie("login");

if (!userlogin) {
} else {
}

function openGalanisGame(no) {
	var w = 800;
	var h = 550;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	//a = window.open('http://www.galanissportsdata.com/basketball/online/onlinegamepgs.asp?game='+no,'game'+no,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a = window.open('http://www.galanissportsdata.com/basketball/mena1/season2004_05/a1game.asp?game='+no,'game'+no,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}
function openGalanisGame2005(no) {
	var w = 800;
	var h = 550;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	a = window.open('http://www.galanissportsdata.com/basketball/mena1/season2005_06/a1tblgame.asp?game='+no,'game'+no,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}
function openGalanisGame2006(no) {
	var w = 800;
	var h = 550;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	a = window.open('http://www.galanissportsdata.com/basketball/mena1/season2006_07/a1tblgame.asp?game='+no,'game'+no,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}
function openGalanisPoints() {
	var w = 800;
	var h = 550;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	a = window.open('http://www.galanissportsdata.com/basketball/mena1/season2004_05/a1rank.asp','points','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}


function openGalanisGameTemp(no) {
	var w = 550;
	var h = 550;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	a = window.open('http://www.galanissportsdata.com/basketball/online/onlinegamepgs.asp?game='+no,'game'+no,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}


function openGalanisGameStats(no) {
	var w = 400;
	var h = 250;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;	
	a = window.open(''+'/gamesStatistics/0,4863,'+no+',00.html','gamestats','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
	a.focus()
}

function openPStats() {
	var w = 780;
	var h = 400;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	window.open('/playerStatistics/0,4815,,00.html','pbcphoto','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
}

function openPhotoshoot(url) {
	var w = 630;
	var h = 340;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	window.open(url,'pbcphoto','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
}

function openPhotoshootFlash(no) {
	var w = 630;
	var h = 340;
	var x = (screen.availWidth)? ((screen.availWidth - w) / 2): 100;
	var y = (screen.availHeight)? ((screen.availHeight - h) / 3):10;
	window.open(''+'/articleDetail/0,4798,'+no+',00.html','pbcphoto','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width='+w+',height='+h+',resizable=no,top='+y+',left='+x);
}


function jump(obj) {          
	if (obj.jumpsite.options[obj.jumpsite.selectedIndex].value!='dead'){
    	window.open(obj.jumpsite.options[obj.jumpsite.selectedIndex].value,'sites','scrollbars=yes,menubar=yes,location=yes,toolbar=yes,resizable=yes,status=yes')
		obj.jumpsite.options[obj.jumpsite.selectedIndex].value='dead'
	}
}

function openWindow(curl, name, w, h) {
	mywin = window.open(curl,name,'toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width=' + w + ',height=' + h + ',resizable=no')
}


function mailArticle(curl) {
	mywin = window.open(curl,'mailarticle','toolbar=no,status=no,directories=no,location=no,scrollbars=yes,width=400,height=300,resizable=no')
}

function tdOver(src,clrOver) {
	if (!src.contains(event.fromElement)) {
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
}

function tdOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
		src.style.cursor = 'default';
		src.bgColor = clrIn;
	}
}

function tdClick(src) {
	if ((event.srcElement.tagName=='TD') || (event.srcElement.tagName=='SPAN')) {
		src.children.tags('A')[0].click();
	}
}


function getCookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function setCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

function deleteCookie(name,path,domain) {
    if (getCookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function isCookieEnabled() {
   if (document.all) return navigator.cookieEnabled;
   setCookie('testcookie',today.getTime());
   var tc = getCookie('testcookie');
   deleteCookie('testcookie');
   return (tc == today.getTime());
}


// --- validate forms

		function emailCheck (emailStr) {
		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		var emailPat=/^(.+)@(.+)$/;
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
			alert("Please enter a valid email address");
		return false;
		}
		var user=matchArray[1];
			var domain=matchArray[2];
		for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
		alert("Ths username contains invalid characters.");
		return false;
		   }
		}
		for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ths domain name contains invalid characters.");
		return false;
		 }
		}
			if (user.match(userPat)==null) {
			alert("The username doesn't seem to be valid.");
		return false;
		}
		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		alert("Destination IP address is invalid!");
		return false;
	   }
	}
	return true;
		}
		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
			for (i=0;i<len;i++) {
			if (domArr[i].search(atomPat)==-1) {
			alert("The domain name does not seem to be valid.");
		return false;
		}
	}
		if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
	return false;
	}
		if (len<2) {
			alert("This address is missing a hostname!");
		return false;
		}
	return true;
	}	

	function y2k(number) { 
			return (number < 1000) ? number + 1900 : number; 
		}
	
		function isDate (day,month,year) {
    		var today = new Date();
    		year = ((!year) ? y2k(today.getYear()):year);
    		month = ((!month) ? today.getMonth():month-1);
    			if (!day) {return false}
    			var test = new Date(year,month,day);
    		if ( (y2k(test.getYear()) == year) &&   (month == test.getMonth()) && (day == test.getDate()) )
    	    		return true;
	 		   else
	       			return false;
			}

		function validate(object){
			if (object.username.value==''){
					alert('Πρεπει να δώσετε username'); 
					object.username.focus();
					return false;
			}
			if (object.password.value=='' || ((object.password.value.length)<5)) {
					alert('Πρεπει να δώσετε password \nκαι πρέπει να είναι μεγαλύτερο των 4 χαρακτήρων'); 
					object.password.focus();
					return false;
			}
			if (object.password.value!=object.repassword.value){
					alert('H επαλήθευση του password δεν είναι σωστή'); 
					object.password.value=''; object.repassword.value='';
					object.password.focus();
					return false;
			}
			if (object.sex[0].checked==false && object.sex[1].checked==false){
					alert('Πρεπει να δώσετε γένος'); return false;
			}
			if (isDate(object.birthday.value,object.birthmonth.value,'19'+object.birthyear.value)==false){
				alert('Η ημερομηνία Γεννήσεως δεν είναι σωστή'); return false;
			}	
			if (emailCheck(object.email.value)==false){ return false; }
		}