//fpSelector
function fpsSelectCol(){
	document.getElementById('oFPSel').innerHTML = document.getElementById('oFPSelCol').innerHTML;
}
function fpsSelectTop(){
	if (document.getElementById('oFPSelCol').innerHTML.length<10) {document.getElementById('oFPSelCol').innerHTML = document.getElementById('oFPSel').innerHTML};
	document.getElementById('oFPSel').innerHTML = document.getElementById('oFPSelTop').innerHTML;
}
function fpsSelectFGA(){
	if (document.getElementById('oFPSelCol').innerHTML.length<10) {document.getElementById('oFPSelCol').innerHTML = document.getElementById('oFPSel').innerHTML};
	document.getElementById('oFPSel').innerHTML = document.getElementById('oFPSelFGA').innerHTML;
}
//SCROLLER
iScrollDEfaultAmount=5;
sScrollDirection='left';
iScrollAmount=iScrollDEfaultAmount;
function scrollerClickLeft(){if (sScrollDirection == 'left') {if (iScrollAmount<15) iScrollAmount = iScrollAmount + 3;} else {iScrollAmount = iScrollAmount - 3;if (iScrollAmount<0){iScrollAmount = 1;sScrollDirection = 'left'}}	scrollerApplyValues();}
function scrollerClickRight(){if (sScrollDirection == 'right') {if (iScrollAmount<15) iScrollAmount = iScrollAmount + 3;} else {iScrollAmount = iScrollAmount - 3;if (iScrollAmount<0){iScrollAmount = 1;	sScrollDirection = 'right'}	}	scrollerApplyValues();}
function scrollerStop(){document.getElementById("scroller").scrollAmount = 0}
function scrollerApplyValues(){document.getElementById("scroller").scrollAmount = iScrollAmount;document.getElementById("scroller").direction = sScrollDirection;}
function scrollerTogle(){if (document.getElementById("scroller").scrollAmount == 0){scrollerApplyValues();} else {document.getElementById("scroller").scrollAmount = 0}}

//VARIOUS
function closePopUpWindow(){try{window.close();} catch (error){}}
function imgLoaded(oImg, iMW, iMH){if (oImg.width>iMW){oImg.width=iMW}; if (oImg.height>iMH){oImg.height=iMH};}
function Trim(strInputString){
	strInputString = strInputString + ' '
	objRegExp = /(^ +)|( +$)/g
	return strInputString.replace(objRegExp, "");
}
function blnValidEmail(strInputString){
	var objRegExp = /(^[^@]+@[^@]+\..+$)/gi
	if (objRegExp.test(strInputString)) {return true;} else {return false;}
}
function blnValidLatinString(strInputString){
	var objRegExp = /(^[a-z0-9]+$)/gi
	if (objRegExp.test(strInputString)) {return true;} else {return false;}
}
function viewHistoryByDay(oSel){document.location.href='?dDaySelector=' + oSel.options[oSel.options.selectedIndex].value;}
function goTo(sURL){document.location.href  = sURL;}
function SelectOption(objMe){document.location.href = '/' + objMe.options[objMe.selectedIndex].value;}
function wsBetoto(){try{window.status='Betoto.com, τo Eλληνικό στοίχημα στο Internet!'; return true;} catch (error){}}
function wsSport24(){try{window.status='Sport24.gr, η αρχική σας σελίδα στην αθλητική ενημέρωση!'; return true;} catch (error){}}
function gotoBetoto(){document.location.href='https://adserver.itsfogo.com/click.aspx?zoneid=8329'}
//ARTICLE FUNCTIONS
function doDubmitSendArticle(){
	document.frmMain.txtFullName.value = Trim(document.frmMain.txtFullName.value)
	document.frmMain.txtEmail.value = Trim(document.frmMain.txtEmail.value)
	document.frmMain.txtMessage.value = Trim(document.frmMain.txtMessage.value)
	
	document.frmMain.txtEmail_1.value = Trim(document.frmMain.txtEmail_1.value)
	document.frmMain.txtEmail_2.value = Trim(document.frmMain.txtEmail_2.value)
	document.frmMain.txtEmail_3.value = Trim(document.frmMain.txtEmail_3.value)
	document.frmMain.txtEmail_4.value = Trim(document.frmMain.txtEmail_4.value)
	
	if (!blnValidEmail(document.frmMain.txtEmail_1.value)) {alert('Το πρώτο e-mail των φίλων σου δεν είναι σωστό.'); document.frmMain.txtEmail_1.focus(); return}
	if (document.frmMain.txtEmail_2.value!='') {if (!blnValidEmail(document.frmMain.txtEmail_2.value)) {alert('Το δεύτερο e-mail των φίλων σου δεν είναι σωστό.'); document.frmMain.txtEmail_2.focus(); return}}
	if (document.frmMain.txtEmail_3.value!='') {if (!blnValidEmail(document.frmMain.txtEmail_3.value)) {alert('Το τρίτο e-mail των φίλων σου δεν είναι σωστό.'); document.frmMain.txtEmail_3.focus(); return}}
	if (document.frmMain.txtEmail_4.value!='') {if (!blnValidEmail(document.frmMain.txtEmail_4.value)) {alert('Το τέταρτο e-mail των φίλων σου δεν είναι σωστό.'); document.frmMain.txtEmail_4.focus(); return}}

	if (document.frmMain.txtFullName.value=='') {alert('Παρακαλούμε συμπληρώστε το όνομά σας.'); document.frmMain.txtFullName.focus();	return;}
	if (!blnValidEmail(document.frmMain.txtEmail.value)) {alert('Το e-mail σας δεν είναι σωστό.'); document.frmMain.txtEmail.focus(); return}
	document.frmMain.btnSubmit.disabled=true;
	document.frmMain.submit()
}
function doPrintArticle(entID){
	var sURL = document.location.href.toLowerCase()
	window.open(sURL.replace('.asp', '.print.asp'))
}
function doSendArticle(entID){
	try {
	document.location.href = '/svc/send/?entID='+entID + '&entTitle=' + document.getElementById('aTit').value
	} catch (error) { alert('Δεν είναι δυνατή η αποστολή της είδησης. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function doSaveArticle(entID, vortalID){
	try {
	document.location.href = '/svc/my/save.asp?entID='+entID + '&vortalID=' + vortalID
	} catch (error) { alert('Δεν είναι δυνατή η αποθήκευση της είδησης. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function doSetFontBigger(){
	var iCurSize = parseInt(document.getElementById("articleBody").style.fontSize)
	if (isNaN(iCurSize)) {iCurSize = 11}
	document.getElementById("articleBody").style.fontSize = iCurSize + 1
}
function doSetFontSmaller(){
	var iCurSize = parseInt(document.getElementById("articleBody").style.fontSize)
	if (isNaN(iCurSize)) {iCurSize = 11}
	document.getElementById("articleBody").style.fontSize = iCurSize - 1
}
function doSetFont(iSize){
	document.getElementById("articleBody").style.fontSize = iSize
}
function fSeeGame(sURL, oElement){
	if (sURL!=''){
		window.open(sURL);
		try{oElement.selectedIndex=0} catch (error){}
	}
}
//SERVICES
function DoVote(){
	for (var j=0;j<frmVote.iChoiseID.length;j++){if (frmVote.iChoiseID[j].checked) {frmVote.action='/ast/inc/manageVote.asp'; frmVote.submit(); return; }}	
	alert('Είναι απαραίτητο να επιλέξετε μία απάντηση από τη λίστα για να μπορέσετε να ψηφίσετε.')
}

function submitContact(iLanguageID){
	document.frmMain.txtFullName.value = Trim(document.frmMain.txtFullName.value)
	document.frmMain.txtEmail.value = Trim(document.frmMain.txtEmail.value)
	document.frmMain.txtAddress.value = Trim(document.frmMain.txtAddress.value)
	document.frmMain.txtPhone.value = Trim(document.frmMain.txtPhone.value)
	document.frmMain.txtMessage.value = Trim(document.frmMain.txtMessage.value)
	if (document.frmMain.selCategory.value=='') { alert('Παρακαλούμε επιλέξτε το θέμα που σας ενδιαφέρει.'); document.frmMain.selCategory.focus(); return}
	if (document.frmMain.txtFullName.value=='') {alert('Παρακαλούμε συμπληρώστε το όνομά σας.'); document.frmMain.txtFullName.focus();	return;}
	if (document.frmMain.txtEmail.value!='') { if (!blnValidEmail(document.frmMain.txtEmail.value)) {alert('Το e-mail σας δεν είναι σωστό.'); document.frmMain.txtEmail.focus(); return}	}
	document.frmMain.btnSubmit.disabled=true;
	document.frmMain.submit()
}

//PHOTO STORY

function wPhotoStoryOLD(sURL){
	
	document.location.href=sURL
	try {
//	if ( sURL.indexOf('?', 1)<1) {sURL = sURL + '?tp=pu'} else {sURL = sURL + '&tp=pu'}
//	var iTop = (screen.height-600)/2
//	var iLeft = (screen.width-550)/2	
//	window.open(sURL, '_blank', 'top=' + iTop + ', left=' + iLeft + ', width=600, height=550, scrollbars=no, location=no')
	} catch (error) { alert('Δεν είναι δυνατή η εμφάνιση του φωτορεπορτάζ. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function wPhotoStory(sURL){
	try {
	if ( sURL.indexOf('?', 1)<1) {sURL = sURL + '?tp=pu'} else {sURL = sURL + '&tp=pu'}
	var iTop = (screen.height-575)/2
	var iLeft = (screen.width-860)/2	
	sURL = sURL.replace('.asp', '.popUp.asp');
	window.open(sURL, '_blank', 'top=' + iTop + ', left=' + iLeft + ', width=860, height=575, scrollbars=no, location=no')
	} catch (error) { alert('Δεν είναι δυνατή η εμφάνιση του φωτορεπορτάζ. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}

function wndPhotoStory(sURL){
	try {
	if ( sURL.indexOf('?', 1)<1) {sURL = sURL + '?tp=pu'} else {sURL = sURL + '&tp=pu'}
	var iTop = (screen.height-575)/2
	var iLeft = (screen.width-860)/2	
	sURL = sURL.replace('.asp', '.popUp.asp');
	window.open(sURL, '_blank', 'top=' + iTop + ', left=' + iLeft + ', width=860, height=575, scrollbars=no, location=no')
	} catch (error) { alert('Δεν είναι δυνατή η εμφάνιση του φωτορεπορτάζ. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}

//NPC
function wCover(dtm, cid){
	try {
	var iWidth	= 720;
		if (iWidth>screen.availWidth) {iWidth	= screen.availWidth-10}
	var iHeight = 1000
		if (iHeight>screen.availHeight) {iHeight	= screen.availHeight-25}
	var iTop	= (screen.availHeight-iHeight)/2
		if (iTop<50) {iTop = 0}
	var iLeft	= (screen.availWidth-iWidth)/2
		if (iLeft<50) {iLeft = 1}
	var wnpCov = window.open('/svc/npc/cover.asp?dtmDate=' + dtm + '&cid=' + cid, 'npCover', 'top=' + iTop + ', left=' + iLeft + ', width=' + iWidth + ', height=' + iHeight + ', location=no, scrollbars=yes')
	wnpCov.focus();
	} catch (error) { alert('Δεν είναι δυνατή η εμφάνιση της σελίδας. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function npcSetDate(iSetCID){
	var sSetDate = document.getElementById("dtmCstDate").value
	document.location.href='?dtmDate=' + sSetDate + '&cid=' + iSetCID;
}
function npcSetCover(iExistID){
	var iSetCID  = document.getElementById("iSetCID").value;
	if (iExistID==iSetCID){return}
	if (iSetCID.length<1){return}
	var sSetDate = document.getElementById("dtmCstDate").value;
	document.location.href='?dtmDate=' + sSetDate + '&cid=' + iSetCID;
}



function selMonthYear(oSel){
	document.location.href='' + oSel.value
}
function selNextMonth(){
	if (document.getElementById('iSelMonthYear').selectedIndex+1<document.getElementById('iSelMonthYear').length) {
		document.getElementById('iSelMonthYear').selectedIndex = document.getElementById('iSelMonthYear').selectedIndex + 1
		selMonthYear(document.getElementById('iSelMonthYear'))
	} else {
		alert('This is the maximum future date allowed!');
	}
}

function selPrevMonth(){
	if (document.getElementById('iSelMonthYear').selectedIndex>0) {
		document.getElementById('iSelMonthYear').selectedIndex = document.getElementById('iSelMonthYear').selectedIndex - 1
		selMonthYear(document.getElementById('iSelMonthYear'))
	} else {
		alert('This is the minimum past date allowed!');
	}
}
function dofixPSImage(oImg){
var iW = oImg.width
var iH = oImg.height
	if (iW>iH) {oImg.width=450}
}

function selPrev(){
	var oSel = document.getElementById('evMonth');
	if (oSel.selectedIndex>0) {
		oSel.selectedIndex=oSel.selectedIndex-1
		document.location.href=oSel.value
	}	else {
		alert('Βλέπετε ήδη τον πρώτο μήνα για αυτή την εκδήλωση')
	}
}
function selMonth(oSel){
	document.location.href=oSel.value
}
function selNext(){
	var oSel = document.getElementById('evMonth');
	if (oSel.selectedIndex+1<oSel.length) {
		oSel.selectedIndex=oSel.selectedIndex+1
		document.location.href=oSel.value
	}	else {
		alert('Βλέπετε ήδη τον τελευταίο μήνα για αυτή την εκδήλωση')
	}
}

function doSearchVideos(){
	var sLink = '';
	sLink = '?f=' + document.getElementById('vdDtmFrom').value + '&t=' + document.getElementById('vdDtmTo').value + '&catId=' + document.getElementById('vdCatId').value;
	document.location.href=sLink;
}

function suggestVideo(){
	document.frmMain.txtFullName.value = Trim(document.frmMain.txtFullName.value)
	document.frmMain.txtEmail.value = Trim(document.frmMain.txtEmail.value)
	document.frmMain.txtAddress.value = Trim(document.frmMain.txtAddress.value)
	document.frmMain.txtMessage.value = Trim(document.frmMain.txtMessage.value)
	if (document.frmMain.txtFullName.value=='') {alert('Παρακαλούμε συμπληρώστε το όνομά σας.'); document.frmMain.txtFullName.focus();	return;}
	if (document.frmMain.txtEmail.value!='') { if (!blnValidEmail(document.frmMain.txtEmail.value)) {alert('Το e-mail σας δεν είναι σωστό.'); document.frmMain.txtEmail.focus(); return}	}
	if (document.frmMain.txtAddress.value=='') {alert('Παρακαλούμε συμπληρώστε το Link του Video.'); document.frmMain.txtAddress.focus();	return;}
	document.frmMain.btnSubmit.disabled=true;
	document.frmMain.submit()
}

function wRADIO24Evocation(){
	var wListenRADIO24;
			wListenRADIO24 = window.open('http://www.radio24.gr/play.asp', 'wListenRADIO24', 'left=100, top=100, width=819, height=431')
			wListenRADIO24.focus();
}

function wListenRADIO24(){
	var wListenRADIO24;
			wListenRADIO24 = window.open('http://www.radio24.gr/play.asp', 'wListenRADIO24', 'left=100, top=100, width=819, height=431')
			wListenRADIO24.focus();
}
function doSendVideo(iMode, entID, entTitle){
	try {
		if (iMode==1){
			document.location.href = '/svc/sendVideo/?entID='+entID + '&entTitle=' + entTitle
		} else {
			var wSendVideo = window.open('/svc/sendVideo/?entID='+entID + '&entTitle=' + entTitle, '_blank');
			wSendVideo.focus();
		}
	} catch (error) { alert('Δεν είναι δυνατή η αποστολή της είδησης. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function doSuggestVideo(iMode){
	try {
		if (iMode==1){
			document.location.href = '/svc/sendVideo/suggest.asp'
		} else {
			var wSendVideo = window.open('/svc/sendVideo/suggest.asp');
			wSendVideo.focus();
		}
	} catch (error) { alert('Δεν είναι δυνατή η αποστολή της είδησης. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}
function wVIDEO(sURL){
	try {
	var iTop = (screen.height-650)/2
	var iLeft = (screen.width-780)/2	
	window.open(sURL, '_blank', 'top=' + iTop + ', left=' + iLeft + ', width=780, height=650, scrollbars=no, location=no')
	} catch (error) { alert('Δεν είναι δυνατή η εμφάνιση του video. Ελέγξτε τις ρυθμίσεις scrpting του browser σας και δοκιμάστε ξανά');}
}

function fbs_click() {
		u=location.href;
		t=document.title;
		window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
		return false;
}