function onSilverlightError(sender, args) {
  
      var appSource = "";
      if (sender != null && sender != 0) {
          appSource = sender.getHost().Source;
      } 
      var errorType = args.ErrorType;
      var iErrorCode = args.ErrorCode;
      
      var errMsg = "Unhandled Error in Silverlight 2 Application " +  appSource + "\n" ;

      errMsg += "Code: "+ iErrorCode + "    \n";
      errMsg += "Category: " + errorType + "       \n";
      errMsg += "Message: " + args.ErrorMessage + "     \n";

      if (errorType == "ParserError")
      {
          errMsg += "File: " + args.xamlFile + "     \n";
          errMsg += "Line: " + args.lineNumber + "     \n";
          errMsg += "Position: " + args.charPosition + "     \n";
      }
      else if (errorType == "RuntimeError")
      {           
          if (args.lineNumber != 0)
          {
              errMsg += "Line: " + args.lineNumber + "     \n";
              errMsg += "Position: " +  args.charPosition + "     \n";
          }
          errMsg += "MethodName: " + args.methodName + "     \n";
      }

      throw new Error(errMsg);
}

 


function sendVote(){
	for (var j=0;j<frmVote.iChoiseID.length;j++){if (frmVote.iChoiseID[j].checked) {frmVote.action='/svc/vote/doVote.asp'; frmVote.submit(); return; }}	
	alert('Για να ψηφίσετε επιλέξτε μιά από τις παραπάνω επιλογές.')	
}

function PrintMe(){
	var sLink = document.location.href
	if (sLink.indexOf('?')<0){sLink = sLink + '?'} else {sLink = sLink + '&'}
	var wndPrint = window.open(sLink+'mode=print', '_blank');
}
function EmailMe(){
	document.location.href='/svc/send/?title=' + document.title + '&url=' + document.location
}
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 doSendFriends(){
document.getElementById('txtName').value = Trim(document.getElementById('txtName').value)
document.getElementById('txtEmail').value = Trim(document.getElementById('txtEmail').value)
document.getElementById('txtEmails').value = Trim(document.getElementById('txtEmails').value)

if (document.getElementById('txtName').value.length<3) {alert('Πρέπει να συμπληρώσετε το όνομά σας.'); document.getElementById('txtName').focus(); return}
if (!blnValidEmail(document.getElementById('txtEmail').value)) {alert('Το e-mail σας δεν είναι σωστό.'); document.getElementById('txtEmail').focus(); return}
if (document.getElementById('txtEmails').value.length<5) {alert('Πρέπει να συμπληρώσετε τα email των φίλων σας.'); document.getElementById('txtEmails').focus(); return}

document.getElementById('btnSubmit').disabled=true;
document.getElementById('frmUI').submit();

}

function displayImage(oImgEl){window.open(oImgEl.src.replace('_s.jpg', '_b.jpg'));}



function strJsEraseFromQString(strQueryString, strQSKeysArray) {
	var strKeys = new Array()
	var strBase
	var j
	var objRegExp
	strKeys = strQSKeysArray.split(';')
	for (j=0; j< strKeys.length; j++) {
		strBase = strKeys[j] + "=[^&]*";		
		strBase = "(^" + strBase + "&*)|(&+" + strBase + ")"
		objRegExp = new RegExp(strBase, "i")
		strQueryString = strQueryString.replace(objRegExp, "");	
	}
	return strQueryString;
}
function strJsAddToQString(strQueryString, strQueryStringKey, strQueryStringValue) {
	var j
	var strKeys = new Array()
	var strVals = new Array()
	strQueryStringValue = strQueryStringValue + ""
	strKeys = strQueryStringKey.split(';')
	strVals = strQueryStringValue.split(';')
	for (j=strVals.length; j< strKeys.length; j++) {
		strVals[j] = "";
	}
	for (j=0; j< strKeys.length; j++) {
		if (strVals[j].length!=0){
			if (strQueryString.length==0){
				strQueryString = strKeys[j] + "=" + strVals[j]
			} else {
				strQueryString = strQueryString + "&" + strKeys[j] + "=" + strVals[j]
			}
		}
	}
	return strQueryString;
}
function strJsReplaceQString(strQueryString, strQueryStringKey, strQueryStringValue) {
	if (strQueryString.length!=0) {	strQueryString = strJsEraseFromQString(strQueryString, strQueryStringKey)}
	strQueryString = strJsAddToQString(strQueryString, strQueryStringKey, strQueryStringValue)
	return strQueryString;
}
function doFilterRegion(oS){
	if (oS.value>0){document.location.href='/accommodation.asp?' + strJsReplaceQString(document.getElementById('sQS').value, 'catId', oS.value)}
}

function doFilterClass(oS){
	var sURL
	if (oS.checked){
		sURL = strJsEraseFromQString(document.getElementById('sQS').value, 'fc' + oS.value)
	} else {
		sURL = strJsReplaceQString(document.getElementById('sQS').value, 'fc' + oS.value, '0')
	}
	document.location.href='/accommodation.asp?' + sURL
}
function doFilterName(){
	var sFN = document.getElementById('filterName').value
	if (sFN!=''){
		sURL = strJsReplaceQString(document.getElementById('sQS').value, 'fn', sFN)
	} else {
		sURL = strJsEraseFromQString(document.getElementById('sQS').value, 'fn')
	}
	document.location.href='/accommodation.asp?' + sURL
}
function doFilterType(oS){
	var sURL
	if (oS.checked){
		sURL = strJsEraseFromQString(document.getElementById('sQS').value, 'ft' + oS.value)
	} else {
		sURL = strJsReplaceQString(document.getElementById('sQS').value, 'ft' + oS.value, '0')
	}
	document.location.href='/accommodation.asp?' + sURL
}
function doBookHotel(){
	document.getElementById('frmBookHotel').action="/svc/bookhotel/index.asp"
	document.getElementById('frmBookHotel').submit();
}
function doContactHotel(){
	document.getElementById('frmBookHotel').action="/svc/contacthotel/index.asp"
	document.getElementById('frmBookHotel').submit();
}
function doReviewHotel(){
	document.getElementById('frmContactHotel').action="/svc/reviewhotel/index.asp"
	document.getElementById('frmContactHotel').submit();
}
function doAsk(){
	document.getElementById('frmASk').submit();
}
function imgShowMe(oImg){
	
	document.getElementById('imgIGShowRoomCnt').style.display='block'
	document.getElementById('imgIGShowRoom').src=oImg.src.replace('_s.jpg', '_m.jpg')
	document.getElementById('imgIGShowRoomHref').href=oImg.src.replace('_s.jpg', '_b.jpg')
}

function vidShowMe(videoFile){
	
	document.getElementById('incVideoIframe').src = '/ast/inc/incVideoIframe.asp?videoFile=' + videoFile
	
}

function windowShowBigMap(xLon, yLat, sName)
{
	window.open("http://www.diakopes.gr/gmap/hotelBig.asp?x=" + xLon + "&y=" + yLat + '&s=' + sName, 'mapWindow','toolbar=no,width=600,height=500,scrollbars=no, resizable=yes');
}



function submitCompetition(){
	var bDoSubmit = true;
	document.getElementById('txtFullName').value = Trim(document.getElementById('txtFullName').value)
	document.getElementById('txtEmail').value = Trim(document.getElementById('txtEmail').value)
	document.getElementById('txtBirthDate').value = Trim(document.getElementById('txtBirthDate').value)
	document.getElementById('txtPhone').value = Trim(document.getElementById('txtPhone').value)


	

	if (!document.getElementById('txtAccept1').checked){
			bDoSubmit = false;
			alert('Δεν μπορείτε να λάβετε μέρος στον διαγωνισμό χωρίς να αποδέχεστε τους όρους συμμετοχής.'); 
			document.location.href='/'
	}
	if (bDoSubmit && document.getElementById('txtFullName').value.length<3 ){
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το ονοματεπώνυμό σας.'); 
			document.getElementById('txtFullName').focus(); 		
	}

	if (bDoSubmit && document.getElementById('txtEmail').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το email σας.'); 
			document.getElementById('txtEmail').focus(); 
	}

	if (bDoSubmit && document.getElementById('txtPhone').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το τηλέφωνό σας.'); 
			document.getElementById('txtPhone').focus(); 
	}

	if (bDoSubmit && document.getElementById('txtBirthDate').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε την ημερομηνία γέννησής σας.'); 
			document.getElementById('txtBirthDate').focus(); 
	}
	
	
	if (bDoSubmit){
		document.getElementById('frmMain').action="/svc/competition/";
		document.getElementById('btnSubmit').disabled=true;
		document.getElementById('frmMain').submit()
	}
}	



function submitCompetitionAdvanced(){
	var bDoSubmit = true;
	document.getElementById('txtFullName').value = Trim(document.getElementById('txtFullName').value)
	document.getElementById('txtEmail').value = Trim(document.getElementById('txtEmail').value)
	document.getElementById('txtBirthDate').value = Trim(document.getElementById('txtBirthDate').value)
	document.getElementById('txtPhone').value = Trim(document.getElementById('txtPhone').value)


	document.getElementById('txtAddress').value = Trim(document.getElementById('txtAddress').value)
	document.getElementById('txtZipCode').value = Trim(document.getElementById('txtZipCode').value)

	if (!document.getElementById('txtAccept1').checked){
			bDoSubmit = false;
			alert('Δεν μπορείτε να λάβετε μέρος στον διαγωνισμό χωρίς να αποδέχεστε τους όρους συμμετοχής.'); 
			document.location.href='/'
	}
	if (bDoSubmit && document.getElementById('txtFullName').value.length<3 ){
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το ονοματεπώνυμό σας.'); 
			document.getElementById('txtFullName').focus(); 		
	}

	if (bDoSubmit && document.getElementById('txtEmail').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το email σας.'); 
			document.getElementById('txtEmail').focus(); 
	}

	if (bDoSubmit && document.getElementById('txtPhone').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε το τηλέφωνό σας.'); 
			document.getElementById('txtPhone').focus(); 
	}
	
	if (bDoSubmit && document.getElementById('txtAddress').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε τη διεύθυνσή σας.'); 
			document.getElementById('txtAddress').focus(); 
	}
	
	if (bDoSubmit && document.getElementById('txtZipCode').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε τον ταχυδρομικό σας κώδικα.'); 
			document.getElementById('txtZipCode').focus(); 
	}

	if (bDoSubmit && document.getElementById('txtBirthDate').value.length<3) {
			bDoSubmit = false;
			alert('Πρέπει να συμπληρώσετε την ημερομηνία γέννησής σας.'); 
			document.getElementById('txtBirthDate').focus(); 
	}
	
	
	if (bDoSubmit){
		document.getElementById('frmMain').action="/svc/competition/indexAdvacned.asp";
		document.getElementById('btnSubmit').disabled=true;
		document.getElementById('frmMain').submit()
	}
}

function DSlctCmpDt(iIndex){
	document.getElementById('compSlctr'+iIndex).checked=true;
}