function euro(id,sum,k){
	$("#"+id).empty().html(sum*k+"€");
}
var siusta1 = true;
var siusta2 = true;
var siusta3 = true;
	function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		
		if (str.indexOf(at)==-1){
		   return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}
		if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
		    return false;
		}
		if (str.indexOf(" ")!=-1){
		    return false;
		}
		return true;
	}

function change(id,val){
	if(val==1){
		document.getElementById("chk"+id+"1").style.display="";
		document.getElementById("chk"+id+"2").style.display="";
	} else {
		document.getElementById("chk"+id+"1").style.display="none";
		document.getElementById("chk"+id+"2").style.display="none";
	}
}
function mailer3(){
	var first = $('#first').val();  
	var last = $('#last').val();  
	var email = $('#email').val();  
	var email2 = $('#email2').val();  
	if(first==""){
		alert("Please enter yout First Name."); return false;
	}
	if(last==""){
		alert("Please enter yout Last Name."); return false;
	}
	if(echeck(email)==false){
		alert("Invalid E-mail."); return false;
	}
	if(email!=email2){
		alert("E-mails do not match."); return false;
	}
	
	if(siusta3){
		var list = {
			chk1: $('#chk1').attr("checked"),
			chk2: $('#chk2').attr("checked"),
			chk3: $('#chk3').attr("checked"),
			d1: $('#date1').val(),
			d2: $('#date2').val(),
			d3: $('#date3').val(),
			d1s: $('#date1s').val(),
			d2s: $('#date2s').val(),
			d3s: $('#date3s').val(),
			p1: $('#pers1').val(),
			p2: $('#pers2').val(),
			p3: $('#pers3').val(),
			first: first, 
			last: last,
			email: email
		};
		$("#error_msg").empty().html("Please wait...");
		$.post("email.php?t=3", list,  
			function(result){ 
				if(result.length<"5"){
					$("#mform").hide();
					$("#pirminis").hide();
					$("#fferor").show();
					siusta3 = false;
				} else {
					$("#error_msg").empty().html(result);
				}
			}
		);  
	}else{
		alert("You've already send a message, to send another, please reload a page!");
	}
	return false;
}
function mailer(){
	var body = $('#f1_body').val();  
	if(body==""){
		alert("Please enter a message."); return false;
	}
	if(siusta1){
		$.post("email.php?t=1", { body: body },  
			function(result){ 
				if(result=="1"){
					alert("Thank you, your message has been sent!");
					siusta1 = false;
				} else {
					alert(result);
				}
			}
		);  
	}else{
		alert("You've already send a message, to send another, please reload a page!");
	}
	return false;
}
function mailer2(){
	if(!siusta2){
		alert("You've already send a CV, to send another, please reload a page!");
		return false;
	} else return true;
}
function startCallback() {
	return true;
}
function completeCallback(response) {
	if(response=="1"){
		alert("Thank you, your CV has been sent!");
		siusta2 = false;
	} else {
		alert(response);
	}
}
function clearField(where, what){
	if(where.value == what)
		where.value = "";
}
function writeField(where, what){
	if(where.value == "")
		where.value = what;
}
function selectAll(obj) {
	obj.focus();
	obj.select();
}
function extram_o(){
	$(this).css({"width": "250px"});
	$(this).css({"height": "260px"});
	$(this).css({"background-position": "0px 275px"});
	$(this).css({"margin-left": "0px"});
	$(this).css({"margin-top": "0px"});
}
function extram_a(id){
	$(this).css({"width": "196px"});
	$(this).css({"height": "196px"});
	$(this).css({"background-position": "0px 0px"});
	$(this).css({"margin-left": "25px"});
	$(this).css({"margin-top": "0px"});
}

$(document).ready(function(){
	$(".hoveris").bind('mouseover', extram_o);
	$(".hoveris").bind('mouseout', extram_a);
});

