


function changeLanguage()
{

url=window.location.toString();
if (url.indexOf("/gr/") > -1)
	url=url.replace("/gr/","/en/");
else
	url=url.replace("/en/","/gr/");
window.location=url;
/*
alert("English version is under construction.");
*/
}



function popImages(img,w,h)
{
popwin = window.open("","","scrollbar=no,width="+w+",height="+h);
popwin.document.open();
popwin.document.write("<html><head><TITLE>Εμμ. Τζιρτζιλάκης - Εικονογραφία</TITLE>");
popwin.document.write("<link rel='stylesheet' href='../common/iconography_pop.css' type='text/css'></head>");
popwin.document.write("<body><table width='100%' height='100%'><tr><td style='text-align: center; vertical-align: middle;'>");
popwin.document.write("<img src='../pics-big/" + img + "' class='pop'>");
popwin.document.write("</td></tr></table></body></html>");
popwin.document.close();
popwin.focus();
}

function popImagesEN(img,w,h)
{
popwin = window.open("","","scrollbar=no,width="+w+",height="+h);
popwin.document.open();
popwin.document.write("<html><head><TITLE>Emm. Tzirtzilakis - Iconography</TITLE>");
popwin.document.write("<link rel='stylesheet' href='../common/iconography_pop.css' type='text/css'></head>");
popwin.document.write("<body><table width='100%' height='100%'><tr><td style='text-align: center; vertical-align: middle;'>");
popwin.document.write("<img src='../pics-big/" + img + "' class='pop'>");
popwin.document.write("</td></tr></table></body></html>");
popwin.document.close();
popwin.focus();
}

function pop (img)
{
url=window.location.toString();

if (url.indexOf("/gr/") > -1)
	popImages(img,600,450);
else 
	popImagesEN(img,600,450);
}


/*
function pop (img)
{
popImages(img,600,450);
}
*/



function popWallpaper800 (img)
{
popImages("../pics-big/wallpapers/"+img+"_800.jpg",820,620);
}


function popWallpaper1024 (img)
{
popImages("../pics-big/wallpapers/"+img+"_1024.jpg",1044,788);
}

function pop500 (img)
{
popImages(img,520,510);
}


function ValidateContactForm() 
{
var flag=0;
var strtxt="Παρακαλούμε συμπληρώστε τα παρακάτω πεδία:\r\n";

if (document.contactForm.firstName.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Όνομα\r\n";
	}

if (document.contactForm.lastName.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Επώνυμο\r\n";
	}
		
if (document.contactForm.phone.value=="")
	{
	flag=1;
	strtxt=strtxt + "- Τηλέφωνο\r\n";
	}		
		
if (document.contactForm.email.value =="")
	{
	flag=1;
	strtxt=strtxt + "- E-mail\r\n";
	}
										
if (document.contactForm.subject.value =="")
	{
	flag=1;
	strtxt=strtxt + "- Θέμα\r\n";
	}

if (!isEmail(document.contactForm.email.value))
	{
	flag=1;
	strtxt=strtxt + "To email που συμπληρώσατε δέν είναι έγκυρο. Παρακαλούμε ξαναδοκιμάστε.\r\n";
	}

if (flag==1)
	{
	alert(strtxt);
	flag=0;
	return false;
	}
else
	return true;
} 



function ValidateContactFormEN() 
{
var flag=0;
var strtxt="Please fill in the following fields:\r\n";

if (document.contactForm.firstName.value == "")
	{
	flag=1;
	strtxt=strtxt + "- First Name\r\n";
	}

if (document.contactForm.lastName.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Second Name\r\n";
	}
		
if (document.contactForm.phone.value=="")
	{
	flag=1;
	strtxt=strtxt + "- Telephone\r\n";
	}		
		
if (document.contactForm.email.value =="")
	{
	flag=1;
	strtxt=strtxt + "- E-mail\r\n";
	}
										
if (document.contactForm.subject.value =="")
	{
	flag=1;
	strtxt=strtxt + "- Message\r\n";
	}

if (!isEmail(document.contactForm.email.value))
	{
	flag=1;
	strtxt=strtxt + "The e-mail you are trying to send is not valid. Please try again.\r\n";
	}

if (flag==1)
	{
	alert(strtxt);
	flag=0;
	return false;
	}
else
	return true;
} 





function isEmail(strValue)
{
var objRegExp = /^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
return objRegExp.test(strValue);
}



function setimage()
{
//Set image name in hidded input
document.carddata.selectedimg.value = document.images["ImageSpot"].src
}



function validateEcardForm()
{
                        
var flag=0;
var strtxt="Παρακαλούμε συμπληρώστε τα παρακάτω πεδία:\r\n";

if (document.carddata.sendname.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Όνομα\r\n";
	}

if (document.carddata.sendemail.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Επώνυμο\r\n";
	}

if (document.carddata.recname.value=="")
	{
	flag=1;
	strtxt=strtxt + "- Τηλέφωνο\r\n";
	}		
		
if (document.carddata.recemail.value =="")
	{
	flag=1;
	strtxt=strtxt + "- email διεύθυνση\r\n";
	}
										
if (document.carddata.messagesub.value =="")
	{
	flag=1;
	strtxt=strtxt + "- Θέμα\r\n";
	}	

if (!isEmail(document.carddata.sendemail.value))
	{
	flag=1;
	strtxt=strtxt + "- To email αποστολέα που συμπληρώσατε δέν είναι έγκυρο. Παρακαλούμε ξαναδοκιμάστε.\r\n";
	}

if (!isEmail(document.carddata.recemail.value))
	{
	flag=1;
	strtxt=strtxt + "- To email παραλήπτη που συμπληρώσατε δέν είναι έγκυρο. Παρακαλούμε ξαναδοκιμάστε.\r\n";
	}	

if (flag==1)
	{
	alert(strtxt);
	flag=0;
	return false;
	}
else
	{
	return true;
	}
       
} 





function validateEcardFormEN()
{
                        
var flag=0;
var strtxt="Please fill in the following fields:\r\n";

if (document.carddata.sendname.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Your Name\r\n";
	}

if (document.carddata.sendemail.value == "")
	{
	flag=1;
	strtxt=strtxt + "- Your e-mail\r\n";
	}

if (document.carddata.recname.value=="")
	{
	flag=1;
	strtxt=strtxt + "- Recipient Name\r\n";
	}		
		
if (document.carddata.recemail.value =="")
	{
	flag=1;
	strtxt=strtxt + "- Recipient e-mail\r\n";
	}
										
if (document.carddata.messagesub.value =="")
	{
	flag=1;
	strtxt=strtxt + "- Message Title\r\n";
	}	

if (!isEmail(document.carddata.sendemail.value))
	{
	flag=1;
	strtxt=strtxt + "- Your email address is incorrect. Please fill in a valid address.\r\n";
	}

if (!isEmail(document.carddata.recemail.value))
	{
	flag=1;
	strtxt=strtxt + "- Recipient email is incorrect. Please fill in a valid address.\r\n";
	}	

if (flag==1)
	{
	alert(strtxt);
	flag=0;
	return false;
	}
else
	{
	return true;
	}
       
} 





function ecardsSwapImage(imagenum)
{
document.images["ImageSpot"].src = "../images/clear.gif";
maxcards=6;
for (i=1; i<=maxcards; i++)
	eval("document.img"+i).className='ecardsUnselected';
eval("document.img"+imagenum).className='ecardsSelected';
if (imagenum<10) 
	imagenum="0"+imagenum;
document.images["ImageSpot"].src = "../pics-big/ecards/ecard"+imagenum+".jpg";
document.carddata.selectedimg.value = "http://www.iconography.gr/pics-big/ecards/ecard"+imagenum+".jpg";
}
