//Carica le immagini
function preloadimages() {
	var pictures = new Array();
	pictures[0] = "imgs/disegno01.jpg";
	pictures[1] = "imgs/disegno02.jpg";
	pictures[2] = "imgs/disegno03.jpg";
	pictures[3] = "imgs/disegno04.jpg";
	pictures[4] = "imgs/disegno05.jpg";
	pictures[5] = "imgs/disegno06.jpg";
	pictures[6] = "imgs/disegno07.jpg";
	pictures[7] = "imgs/disegno08.jpg";
	pictures[8] = "imgs/disegno09.jpg";
	pictures[9] = "imgs/disegno10.jpg";
	pictures[10] = "imgs/disegno11.jpg";
	pictures[11] = "imgs/disegno12.jpg";
	pictures[12] = "imgs/draft01.jpg";
	pictures[13] = "imgs/draft02.jpg";
	pictures[14] = "imgs/draft03.jpg";
	pictures[15] = "imgs/dies01.jpg";
	pictures[10] = "imgs/dies02.jpg";
	pictures[11] = "imgs/dies03.jpg";
	pictures[12] = "imgs/dies04.jpg";
	pictures[13] = "imgs/disegno01.gif";
	pictures[14] = "imgs/disegno02.gif";
	pictures[15] = "imgs/disegno03.gif";
	pictures[16] = "imgs/disegno04.gif";
	pictures[17] = "imgs/disegno05.gif";
	pictures[18] = "imgs/disegno06.gif";
	pictures[19] = "imgs/disegno07.gif";
	pictures[20] = "imgs/disegno08.gif";
	pictures[21] = "imgs/disegno09.gif";
	pictures[22] = "imgs/disegno10.gif";
	pictures[23] = "imgs/disegno11.gif";
	pictures[24] = "imgs/disegno12.gif";
	pictures[25] = "imgs/draft01.gif";
	pictures[26] = "imgs/draft02.gif";
	pictures[27] = "imgs/draft03.gif";
	pictures[28] = "imgs/dies01.gif";
	pictures[29] = "imgs/dies02.gif";
	pictures[30] = "imgs/dies03.gif";
	pictures[31] = "imgs/dies04.gif";
	
	var images;
	for(i = 0; i < pictures.length; i++) {
		images = new Image();
		images.src = pictures[i];
	}
}

//ora sulla barra di stato (copertina)
function time() {
window.setTimeout("time()",1000);
oggi = new Date();
self.status = oggi.toLocaleString(); 
}

//giorno a data aggiornati con messaggio di benvenuto a seconda dell'orario (Home)
var Today=new Date();
var ThisDay=Today.getDay();
var ThisDate=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();  //included if you wish to insert the year
function DayTxt (DayNumber) {
var Day=new Array();
Day[0]="Sunday";
Day[1]="Monday";
Day[2]="Tuesday";
Day[3]="Wednesday";
Day[4]="Thursday";
Day[5]="Friday";
Day[6]="Saturday";
return Day[DayNumber];
}
var DayName=DayTxt(ThisDay);
function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="Jun";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}
var MonthName=MonthTxt(ThisMonth);
var d = new Date();
var h = d.getHours();

function todayis() {
	document.write("<TABLE BORDER=0 WIDTH=70 HEIGHT=85 align=left>"+"<TD>"+"<p align=center>"+"<font size=-2 >"+DayName+"&nbsp;"+"<font color=orangered size=+2 >"+ThisDate+"</font>"+"&nbsp;"+MonthName+"&nbsp;"+ThisYear+"</b>"+"</font>"+"</p>"+"</TD>"+"</TD>"+"</TR>"+"</TABLE>");
}

function welcome() {
	if (h < 4) document.write("<br>"+"<p><table border=0><tr><td width=150>"+"<font size=3>"+"<b>"+"Good Night ... "+"</td><td align=right>"+"<img src=bear_bedtime_hole.gif>"+"</td></tr></table>");
	else if (h < 12) document.write("<br>"+"<p><table border=0><tr><td width=150>"+"<font size=3>"+"<b>"+"Good Morning ... "+"</td><td align=right>"+"<img src=bear_sunshine_hole.gif>"+"</td></tr></table>");
	else if (h < 18) document.write("<br>"+"<p><table border=0><tr><td width=150>"+"<font size=3>"+"<b>"+"Good Afternoon ... "+"</td><td align=right>"+"<img src=bear_flowers_hole.gif>"+"</td></tr></table>");
	else if (h < 22) document.write("<br>"+"<p><table border=0><tr><td width=150>"+"<font size=3>"+"<b>"+"Good Evening ... "+"</td><td align=right>"+"<img src=bear_star_hole.gif>"+"</td></tr></table>");
	else document.write("<br>"+"<p><table border=0><tr><td width=150>"+"<font size=3>"+"<b>"+"Good Night ... "+"</td><td align=right>"+"<img src=bear_bedtime_hole.gif>"+"</td></tr></table>");
}

//conto alla rovescia (home)
function getRemaining() {
  today = new Date();
  targetdate = new Date("December 31, 2007"); 
  targetdate.setYear(today.getYear()); 
  milliseconds = (24 * 60 * 60 * 1000);
  remaining = ((targetdate.getTime() - today.getTime()) / milliseconds)+1; 
  remaining = Math.round(remaining);
}

//aprire l'immagine in una nuova finestra (My Works)
function previewImage(whichone) {
	self.document.picture.src=whichone;
	self.status=" ";
}

function nomore() {
	self.document.picture.src="../imgs/sheet.gif";
	self.status=" ";
}

function zoomImage(towhat) {
	self.status=" ";
	f=window.open("","","width=480 height=674");
	f.document.open();
	f.document.writeln("<meta http-equiv='imagetoolbar' content='no'>");
	f.document.writeln("<title>");
	f.document.writeln("Loredana e-Book");
	f.document.writeln("</title>");
	f.document.writeln("<body topmargin='1' leftmargin='1' oncontextmenu='return false' onselectstart='return false' ondragstart='return false'>");
	f.document.writeln("<pre>");
	f.document.writeln("<img border='0' width='480' name='myframe'>");	
	f.document.myframe.src=towhat;
	f.document.writeln("</pre>");
	f.document.writeln("</body>");
	f.document.close();
	f.status="Made by Loredana";
}

//aprire i collegamenti in una nuova finestra (My Works)
var link = new Array(5);
//link[0] = 'http://www.drnaeem.co.nr';
link[0] = 'http://www.ecom.prophp.us';
link[1] = 'http://projectsnsamples.110mb.com';
link[2] = 'http://arteorafa.1111mb.com';
link[3] = 'http://avdjlee.1111mb.com'; // 75.126.15.44
function opentheLink(no) {
	self.status=" ";
	f1=window.open(link[no],"","height=590,resizable=yes,scrollbars=yes,location=no,menubar=no,status=yes,toolbar=yes");
	f1.status="Made by Loredana";
}

function donotshow() {
	self.status=" ";
}

//aprire l'immagine in una nuova finestra da flash (Portfolio)
function openNewWindow(URLtoOpen, windowName, windowFeatures, fileName) { 
  newWindow=window.open(URLtoOpen, windowName, windowFeatures);

	newWindow.document.open();
	newWindow.document.writeln("<meta http-equiv='imagetoolbar' content='no'>");
	newWindow.document.writeln("<title>");
	newWindow.document.writeln("Loredana e-Book");
	newWindow.document.writeln("</title>");
	newWindow.document.writeln("<body topmargin='1' leftmargin='1' oncontextmenu='return false' onselectstart='return false' ondragstart='return false'>");
	newWindow.document.writeln("<pre>");
	newWindow.document.writeln("<img width='480' border='0' name='myframe'>");	
	newWindow.document.myframe.src=fileName;
	newWindow.document.writeln("</pre>");
	newWindow.document.writeln("</body>");
	newWindow.document.close();
	newWindow.status="Made by Loredana";
}

//Aprire i collegamenti in una nuova finestra da flash (Portfolio)
function openLink(URLWebSite, winName, winFeatures) { 
	newWin=window.open(URLWebSite, winName, winFeatures);
	newWin.status="Made by Loredana";
}

//imposta la variabile indirizzo e-mail (Guestbook)
function emailaddress() {
	var username = "loredana9";
	var hostname = "hotmail.co.uk";
	document.write("<input type='hidden' name='recipients' value='"+username+"@"+hostname+"'>");
}

//controlla i campi di selezione lingua del form (estimate)
function checkInput() {
	if (document.estimateForm.sourceLang.options.selectedIndex==1 && document.estimateForm.desiredLang.options.selectedIndex==1) {
		alert("Please select a valid input option");
		document.estimateForm.sourceLang.options.selectedIndex=0;
		document.estimateForm.desiredLang.options.selectedIndex=0;
		document.estimateForm.rate.value="Rate";
		document.estimateForm.currency.options.selectedIndex=0;
	}
	if (document.estimateForm.sourceLang.options.selectedIndex==2 && document.estimateForm.desiredLang.options.selectedIndex==2) {
		alert("Please select a valid input option");
		document.estimateForm.sourceLang.options.selectedIndex=0;
		document.estimateForm.desiredLang.options.selectedIndex=0;
		document.estimateForm.rate.value="Rate";
		document.estimateForm.currency.options.selectedIndex=0;
	}
	if (document.estimateForm.sourceLang.options.selectedIndex==3 && document.estimateForm.desiredLang.options.selectedIndex==3) {
		alert("Please select a valid input option");
		document.estimateForm.sourceLang.options.selectedIndex=0;
		document.estimateForm.desiredLang.options.selectedIndex=0;
		document.estimateForm.rate.value="Rate";
		document.estimateForm.currency.options.selectedIndex=0;
	}
//cambia il prezzo in base alla lingua di origine e quella di destinazione
	if ((document.estimateForm.sourceLang.options.selectedIndex==2 && document.estimateForm.desiredLang.options.selectedIndex==1) || (document.estimateForm.sourceLang.options.selectedIndex==3 && document.estimateForm.desiredLang.options.selectedIndex==1)) {
		document.estimateForm.rate.value="20.00";
		document.estimateForm.currency.options.selectedIndex=1;
	}
	if ((document.estimateForm.sourceLang.options.selectedIndex==1 && document.estimateForm.desiredLang.options.selectedIndex==2) || (document.estimateForm.sourceLang.options.selectedIndex==1 && document.estimateForm.desiredLang.options.selectedIndex==3)) {
		document.estimateForm.rate.value="22.00";
		document.estimateForm.currency.options.selectedIndex=1;
	}
	if ((document.estimateForm.sourceLang.options.selectedIndex==2 && document.estimateForm.desiredLang.options.selectedIndex==3) || (document.estimateForm.sourceLang.options.selectedIndex==3 && document.estimateForm.desiredLang.options.selectedIndex==2)) {
		document.estimateForm.rate.value="22.00";
		document.estimateForm.currency.options.selectedIndex=1;
	}
}

//converte il prezzo in base alla valuta selezionata
function convert() {
	if (document.estimateForm.currency.options.selectedIndex==2) {
		if(document.estimateForm.rate.value=="20.00") {
			document.estimateForm.rate.value="13.50";
		}
		if(document.estimateForm.rate.value=="22.00") {
			document.estimateForm.rate.value="15.00";
		}
		if(document.estimateForm.additional.value=="0.00") {
			document.estimateForm.additional.value="0.00";
		}
		if(document.estimateForm.additional.value=="10.50") {
			document.estimateForm.additional.value="10.50";
		}
		if(document.estimateForm.additional.value=="15.00") {
			document.estimateForm.additional.value="10.50";
		}
	}
	if (document.estimateForm.currency.options.selectedIndex==1) {
		if(document.estimateForm.rate.value=="13.50") {
			document.estimateForm.rate.value="20.00";
		}
		if(document.estimateForm.rate.value=="15.00") {
			document.estimateForm.rate.value="22.00";
		}
		if(document.estimateForm.additional.value=="0.00") {
			document.estimateForm.additional.value="0.00";
		}
		if(document.estimateForm.additional.value=="15.00") {
			document.estimateForm.additional.value="15.00";
		}
		if(document.estimateForm.additional.value=="10.50") {
			document.estimateForm.additional.value="15.00";
		}
	}
}

//autorizza solo l'ingresso di valori numerici
function onlyno() {
var noOnly = document.estimateForm.noChars.value;
	if (isNaN(noOnly)) {
		alert("please enter a valid input value");
		document.estimateForm.noChars.value="";
	}
//determina il numero di cartelle
	if (noOnly <= 2000) {
		document.estimateForm.noFolder.value=1;
	}
	if (noOnly > 2000) {
		document.estimateForm.noFolder.value=noOnly/2000;
	}
}

//imposta costo aggiuntivo se richiesto lavoro di urgenza
function addPrice() {
	if(document.estimateForm.deadline.options.selectedIndex==0) {
		document.estimateForm.additional.value="0.00";
	}
	if(document.estimateForm.deadline.options.selectedIndex==1) {
		if(document.estimateForm.currency.options.selectedIndex==1) {
			document.estimateForm.additional.value="15.00";
		}
		if(document.estimateForm.currency.options.selectedIndex==2) {
			document.estimateForm.additional.value="10.50";
		}
	}
}

//calcola il totale
function summup() {
var add = parseFloat(document.estimateForm.additional.value);
var cart = parseFloat(document.estimateForm.noFolder.value);
var imp = parseFloat(document.estimateForm.rate.value);
		document.estimateForm.totale.value= (imp*cart)+add;
}

//disabilita il campo non selezionato
function enableField() {
	if (document.estimateForm.opzione[0].checked==false) {
		document.estimateForm.doc.disabled=true;
		document.estimateForm.website.disabled=false;
	}
	if (document.estimateForm.opzione[1].checked==false) {
		document.estimateForm.doc.disabled=false;
		document.estimateForm.website.disabled=true;
	}
}

//controlla che vengano riempiti tutti i campi del form
function validateForm() {
var modulo = document.estimateForm;
	if (modulo.doc.disabled == false) {
		if (modulo.doc.value == "") {
			alert("Please upload the document you wish to have translated.");
			modulo.doc.focus();
			return (false);
		}
		else {
			var ext = modulo.doc.value;
			var ext = ext.substring(ext.length-3,ext.length);
			if ((ext != 'doc') && (ext != 'txt')) {
				alert("Please select a .doc or a .txt file to be sent");
				return (false);
			}
		}
	}
	if (modulo.website.disabled == false) {
		if ((modulo.website.value == "http://") || (modulo.website.value == "")) {
			alert("Please enter the website's address you wish to have translated.");
			modulo.website.focus();
			return (false);
		}
	}
	if (modulo.nome.value=="") {
		alert("Please enter your full name");
		modulo.nome.focus();
		return (false);
	}
	if (modulo.email.value=="") {
		alert("Please enter an email address to enable us to contact you");
		modulo.email.focus();
		return (false);
	}
	if ((modulo.email.value.indexOf('@') == -1) || (modulo.email.value.indexOf('.') == -1) || (modulo.email.value.indexOf('%') >= 0) || (modulo.email.value.indexOf(' ') >= 0)) {
		alert("Please enter a valid email address");
		modulo.email.value="";
		modulo.email.focus();
		return (false);
	}
	if (modulo.country.value == "") {
		alert("Please select your Country");
		modulo.country.options.selectedIndex=0;
		modulo.country.focus();
		return (false);
	}
	if (isNaN(modulo.totale.value)) {
		alert("Please check your quote");
		modulo.totale.focus();
		return (false);
	}
	if (modulo.read.checked == false){
		alert("Please tick the box to confirm you have read and understood the Terms & Conditions");
		modulo.read.focus();
		return (false);
	}
//imposta l'applicazione appropriata alla trasmissione dei dati
	if (modulo.doc.disabled == false) {
		modulo.action = "php_submit.php";
	}
	if (modulo.website.disabled == false) {
		modulo.action = "php_submit_plain.php";
	}
	else
		return (true);
}

//apre una nuova finestra (estimate)
function apri() {
	self.status=" ";
	window.open("terms.html","","width=660 height=690 scrollbars=yes");
}

//inserisce il codice relativo a ogni singolo smiley nel campo messaggio (guestbook)
function addsmiley(code) {  
    var pretext = document.sign_form.message.value;      
    this.code = code;  
    document.sign_form.message.value = pretext + code;  
}  

//definisce il numero massimo di caratteri per il campo messaggio (guestbook)
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}
	else {
		countfield.value = maxlimit - field.value.length;
	}
}

//controlla che vengano riempiti tutti i campi obbligatori del form (guestbook)
function check_review_form() {  
	if(document.sign_form.guestname.value == '') {  
		alert('Please enter your name');  
		document.sign_form.guestname.focus();  
		return false;  
	}  
	if((document.sign_form.guestcountry.value == '') || (document.sign_form.guestcountry.value == 'your country')) {  
		alert('Please enter your country');  
		document.sign_form.guestcountry.focus();  
		return false;  
	}  
	if(document.sign_form.gothere.value == '') {  
		alert('Please tell us how you have found this website');  
		document.sign_form.gothere.focus();  
		return false;  
	}  
	if(document.sign_form.rating.value == '') {  
		alert('Please express your rating for this website');  
		document.sign_form.rating.focus();  
		return false;  
	}  
	if(document.sign_form.message.value == '') {  
		alert('Please leave a message');  
		document.sign_form.message.focus();  
		return false;  
	}  
	if(document.sign_form.random.value == '') {  
		alert('You are required to re-enter the validation code!');  
		document.sign_form.random.focus();  
		return false;  
	}  
	else {  
		return true;  
	}  
} 

//Disabilita il form per gli utenti aventi un determinato indirizzo ip
function disable_form() {
	ip_addr = new Array("222.107.34.", "221.238.105.", "220.173.107.", "220.49.103.", "218.4.93.", "217.162.184.", "217.144.192.", "217.77.223.", "216.244.65.", "216.224.124.", "213.46.138.", "213.5.", "212.235.", "212.178.", "212.117.175.", "212.95.54.", "212.42.236.", "208.100.43.", "208.53.", "207.194.87.", "204.124.182.", "200.35.150.", "195.216.197.", "195.191.54.", "195.88.33.", "195.3.146.", "194.84.0.", "194.8.", "193.105.210.", "192.251.226.", "188.92.", "188.72.227.", "178.162.135.", "178.93.", "178.49.253.", "174.34.155.", "173.242.112.", "173.212.232.", "173.79.123.", "138.199.", "124.160.67.", "123.160.181.", "123.125.156.", "123.101.53.", "120.28.64.", "119.70.40.", "109.196.18.", "99.41.198.", "98.143.144.", "97.89.157.", "95.215.0.", "95.211.", "95.134.", "95.48.212.", "95.28.209.", "95.24.149.", "94.178.", "94.165.113.", "94.142.", "94.102.51.", "94.136.16.", "93.185.193.", "93.174.93.", "92.244.96.", "92.241.165.", "92.115.199.", "92.114.149.", "92.62.52.", "92.47.231.", "92.46.17.", "91.214.44.", "91.212.226.", "91.209.162.", "91.207.98.", "91.206.183.", "91.198.227.", "91.124.", "91.121.79.", "89.248.172.", "89.218.12.", "88.212.201.", "88.198.57.", "88.191.109.", "88.85.", "88.70.205.", "87.118.", "85.238.111.", "85.214.71.", "85.10.209.", "83.233.38.", "83.29.", "83.28.", "83.27.112.", "83.4.188.", "82.207.74.", "82.178.", "81.90.22.", "81.25.54.", "79.185.", "78.26.187.", "77.92.95.", "76.18.234.", "72.14.182.", "71.3.", "70.241.", "68.207.212.", "68.196.183.", "66.232.124.", "66.230.230.", "66.90.", "65.183.151.", "64.203.255.", "64.50.164.", "62.141.", "61.90.230.", "18.246.2.");
        for (i = 0; i <= ip_addr.length; i++) {
		if(document.getElementById("ip").value.indexOf(ip_addr[i]) != -1) { 
			if(document.getElementById("ip").value.substring(0,ip_addr[i].length) == ip_addr[i]) {
				for(e = 0; e < document.getElementsByTagName("input").length; e++) {
					document.getElementsByTagName("input")[e].disabled = true;
				}
				for(e = 0; e < document.getElementsByTagName("select").length; e++) {
					document.getElementsByTagName("select")[e].disabled = true;
				}
				for(e = 0; e < document.getElementsByTagName("textarea").length; e++) {
					document.getElementsByTagName("textarea")[e].disabled = true;
				}
			}
		} 
	} 
}

//controlla che vengano riempiti tutti i campi obbligatori del form (contact me)
function check_contact_form() {  
	if(document.SampleForm.realname.value == '') {  
		alert('Please enter your name');  
		document.SampleForm.realname.focus();  
		return false;  
	}  
	if(document.SampleForm.email.value == '') {  
		alert('Please enter your email');  
		document.SampleForm.email.focus();  
		return false;  
	}  
	if ((document.SampleForm.email.value.indexOf('@') == -1) || (document.SampleForm.email.value.indexOf('.') == -1) || (document.SampleForm.email.value.indexOf('%') >= 0) || (document.SampleForm.email.value.indexOf(' ') >= 0)) {
		alert("Please enter a valid email address");
		document.SampleForm.email.value="";
		document.SampleForm.email.focus();
		return false;
	}
	if(document.SampleForm.mesg.value == '') {  
		alert('You do not want to send an empty message, do you?');  
		document.SampleForm.mesg.focus();  
		return false;  
	}  
	else if ((document.SampleForm.mesg.value.indexOf('href') != -1) || (document.SampleForm.mesg.value.indexOf('http') != -1)) {
		document.SampleForm.realname.value = "";
		document.SampleForm.email.value = "";
		document.SampleForm.mesg.value = "";
		document.SampleForm.random.value = "";
		return false;
	}
	if(document.SampleForm.random.value == '') {  
		alert('Do not forget to enter the validation code!');  
		document.SampleForm.random.focus();  
		return false;  
	}  
	else {  
		return true;  
	}  
}  

//sudoku
sauve="";
sauve3 = new Array();

function drawcase() {
	tmp = sauve.id.split("-");
	mem = sauve3[tmp[0]*9+tmp[1]]+""; 
	if(mem == "undefined") {
		mem="";
	}
	if(mem == "") {
		tmp2 = "&nbsp;";
	}
	else {
		if(mem.length == 1) {
			tmp2 = "<font color=maroon>"+mem+"</font>";
		}
		else {
			tmp2 = "<table cellspacing=0 cellpadding=0 border=0>";
			for(i = 0; i < 2; i++) {
				tmp2 += "<tr>";
				for(j = 0; j < 4; j++) {
					t = i*4+j;
					tmp2 += "<td class=box>"+String.fromCharCode(mem.charCodeAt(t))+"</td>";
				}
				tmp2 += "</tr>";
			}
			tmp2 += "</table>";
		}
	}
	sauve.innerHTML = tmp2;
}

function drawgrid() {
	tmp = sauve.id.split("-");
	mem = sauve3[tmp[0]*9+tmp[1]]+""; 
	if(mem=="undefined") {
		mem="";
	}
	for(i=1;i<10;i++) {
		ch = String.fromCharCode(i+48);
		if(mem.indexOf(ch)>=0) {
			document.getElementById("j"+i).style.background="#eeeeee";
		}
		else {
			document.getElementById("j"+i).style.background="";
		}
         }
}

function soluce() {
	tmp = sauve.id.split("-");
	sauve3[tmp[0]*9+tmp[1]]=sauve.s;
	drawcase();
	drawgrid();
}

function joue(lacase) {
	if(sauve!="") {
		sauve.style.background="";
	}
	sauve = lacase;
	lacase.style.background = "#eeeeee";
	lejeu = document.getElementById("jeu");
	tmp = sauve.id.split("-");
	mem = sauve3[tmp[0]*9+tmp[1]]+"";
	if(mem=="undefined") {
		mem="";
	}
	drawgrid();
	lejeu.style.visibility = "visible";
}

function store(n) {
	tmp = sauve.id.split("-");
	ch = String.fromCharCode(n+48);
	mem = sauve3[tmp[0]*9+tmp[1]]+"";
	if(mem=="undefined") {
		mem="";
	}
	t = mem.indexOf(ch);
	if(t>=0) { 
		t2 = mem.split("");
		t2[t]="";
		mem = t2.join(""); 
	}
	else {
		mem += ch;
	}
	sauve3[tmp[0]*9+tmp[1]] = mem;
	drawcase();
	drawgrid();
}