<!-- Vignette V/5 Sat Mar 13 00:40:15 2010 -->
var userlogin = getCookie("login");

if (!userlogin) {

} else {

}


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 todayInHistory() {
	window.open('/todayInHistory/','today','toolbar=no,status=no,directories=no,location=no,scrollbars=no,width=170,height=280,resizable=no')
}
function openPharmacies(aid){
if (aid!='none'){
	window.open('/pharmacies/0,4872,'+ aid +',00.html ','ph','toolbar=no,status=no,directories=no,location=no,scrollbars=no,width=550,height=350,resizable=no')
	}
}
function elections() {
	window.open('http://news.antenna.gr/elections2004/homeDetail/','elections','toolbar=no,status=no,directories=no,location=no,scrollbars=no,width=780,height=480,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 (navigator.appName.indexOf('Microsoft') != -1) {
	if (!src.contains(event.fromElement)) {
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
 }	
}

function tdOut(src,clrIn) {
if (navigator.appName.indexOf('Microsoft') != -1) {
	if (!src.contains(event.toElement)) {
		src.style.cursor = 'default';
		src.bgColor = clrIn;
	}
}	
}

function tdClick(src) {
if (navigator.appName.indexOf('Microsoft') != -1) {
	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; }
		}

function clock() {
		if (!document.layers && !document.all) return;
		var digital = new Date();
		var hours = digital.getHours();
		var minutes = digital.getMinutes();
		var seconds = digital.getSeconds();
		var amOrPm = "πμ";
		if (hours > 11) amOrPm = "μμ";
		if (hours > 12) hours = hours - 12;
		if (hours == 0) hours = 12;
		if (minutes <= 9) minutes = "0" + minutes;
		if (seconds <= 9) seconds = "0" + seconds;
		dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
		if (document.layers) {
		document.layers.pendule.document.write(dispTime);
		document.layers.pendule.document.close();
	}
		else
			if (document.all.pendule)
			pendule.innerHTML = dispTime;
	setTimeout("clock()", 1000);
	}		

function openchickens(){
	var win;
	win = window.open('/chicken/','chicks','width=780,height=550,scrollbars=1')
}	
function elections2006(){
     var win;
     win = window.open('http://news.antenna.gr/elections2006/elections.aspx','elections','width=775,height=600')
}