var t;

function void1(){
	var s='';
}
mv_list = {
	sort: 'name',
	sort_order: 0,
	page:1,
	showResults: function (){
		// if all is selected uncheck the rest

		// now check which one is selected and send the request to the server
		var params = 'cmd=getPrev';
		params += '&program_id='+$('program_id').value;

		// save the event position;
//		getMousePosition(e);

		// show the waiting message window
		//showSpinnerWindow();

		new Ajax.Updater('udetails','/index.php',{
			asynchronous: true,
			evalScripts: true,
			method: 'post',
			postBody: params
			});

	}
};

function repeat(){
	mv_list1.showResults();
	t = setTimeout('repeat();',10000);
}

mv_list1 = {
	sort: 'name',
	sort_order: 0,
	page:1,
	showResults: function (){
		// if all is selected uncheck the rest

		// now check which one is selected and send the request to the server
		var params = 'cmd=getNext';
		params += '&program_id='+$('program_id').value;
		// save the event position;
//		getMousePosition(e);

		// show the waiting message window
		//showSpinnerWindow();

		new Ajax.Updater('udetails','/index.php',{
			asynchronous: true,
			evalScripts: true,
			method: 'post',
			postBody: params
			});

	}
};

function validateDedicatiiForm(){
	var lang = document.dedicationForm.lang.value, err = 0;

	if(document.dedicationForm.name.value == ''){
		err = 1;
		document.dedicationForm.name.style.border = '1px solid red';
	}else{
		document.dedicationForm.name.style.border = '1px solid #827f7f';
	}

	if(document.dedicationForm.email.value == ''){
		err = 1;
		document.dedicationForm.email.style.border = '1px solid red';
	}else{
		document.dedicationForm.email.style.border = '1px solid #827f7f';
	}

	if(document.dedicationForm.dedication.value == ''){
		err = 1;
		document.dedicationForm.dedication.style.border = '1px solid red';
	}else{
		document.dedicationForm.dedication.style.border = '1px solid #827f7f';
	}

	if(document.dedicationForm.verif_code.value == ''){
		err = 1;
		document.dedicationForm.verif_code.style.border = '1px solid red';
	}else{
		document.dedicationForm.verif_code.style.border = '1px solid #827f7f';
	}

	if(err == 1){
		if(lang == 'ro')
			alert('Vă rugăm completaţi toate câmpurile!');
		else if(lang == 'hu')
			alert('Kérjük töltse ki az összes mezőt!');
		else if(lang == 'de')
			alert('Bitte füllen Sie alle Felder!');
		return false;
	}else{
		if(!validate_email('dedicationForm', 'email')){
			document.dedicationForm.email.style.border = '1px solid red';

			if(lang == 'ro')
				alert('Adresă de e-mail invalidă!');
			else if(lang == 'hu')
				alert('Helytelen e-mail cím!');
			else if(lang == 'de')
				alert('Ungültige E-Mail-Adresse!');

			return false;
		}else{
			document.dedicationForm.email.style.border = '1px solid #827f7f';
		}

		var ins_cap = document.dedicationForm.verif_code.value;
		var correct_cap = document.dedicationForm.capchcode.value;

		if(ins_cap != correct_cap){
			document.dedicationForm.verif_code.style.border = '1px solid red';

			if(lang == 'ro')
				alert('Cod de verificare invalid!');
			else if(lang == 'hu')
				alert('Helytelen ellenőrző kód!');
			else if(lang == 'de')
				alert('Ungültige Bestätigungscode!');

			return false;
		}else{
			document.dedicationForm.verif_code.style.border = '1px solid #827f7f';
		}
	}
	return true;
}

function validate_email(form_name,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = eval('document.'+form_name+'.'+email+'.value');

   if(reg.test(address) == false) {
      return false;
   }
   return true;
}
