function show(id)
{
    if(document.getElementById(id) != null) {
        document.getElementById(id).style.visibility="visible";
        document.getElementById(id).style.display="block";
    }
}

function hide(id)
{
    if(document.getElementById(id) != null) {
        document.getElementById(id).style.visibility="hidden";
        document.getElementById(id).style.display="none";
    }
}

function swap(id){
    if(document.getElementById(id) != null) {
        if (document.getElementById(id).style.visibility == "visible")
            hide(id);
        else
            show(id);
    }
}

function frame(name, src, div){
    if(document.getElementById(div) != null) {
        if (document.getElementById(div).style.visibility != "visible")
        {
            document.getElementById(name).src = src;
            show(div);
        }
        else
        {
            hide(div);
        }
    }
}
/*not tried*/
function changetext(destination, source) {
    document.getElementById(destination).innerHTML = document.getElementById(source).innerHTML;
}

function addtext(destination, text) {
    document.getElementById(destination).innerHTML = document.getElementById(destination).innerHTML+text;
}

/*changing text from polish o english to ita*/
function changeHomeText(language)
{
    if(language=='polish') {
        if(document.getElementById('short_description') != null)
            document.getElementById('short_description').innerHTML="<tt>Studia na Warszawskiej ASP na wydziale malarstwa w pracowniach Michała Byliny i Jacka Sienickiego. Dyplom z wyróżnieniem w 1979 roku.<br />Udział w licznych wystawach indywidualnych i zbiorowych sztuki polskiej w kraju i za granicą.</tt>";
    /*if(document.getElementById('info') != null)
document.getElementById('info').innerHTML="<a href='http://picasaweb.google.com/ziaja.anna/Wernisa6Maja200802'>Wystawa 6 V - 1 VI 2008<br />Centrum Olimpijskie, Wybrzeże Gdyńskie 4, Warszawa</a>";*/
    }
    if(language=='english') {
        if(document.getElementById('short_description') != null)
            document.getElementById('short_description').innerHTML="<tt>She studied at the Warsaw Academy of Fine Arts at the faculty of painting by prof Michał Bylina and Jacek Sienicki. Studies ended in the 1979 with honour diploma.<br />She toke part in many exhibitions both personal and group ones in Poland and abroad.</tt>";
    /*if(document.getElementById('info') != null)
		document.getElementById('info').innerHTML="<a href='http://picasaweb.google.com/ziaja.anna/Wernisa6Maja200802'>Exhibition 6 V - 1 VI 2008<br />Centrum Olimpijskie, Wybrzeże Gdyńskie 4, Warszawa</a>";*/
    }
    if(language=='italiano') {
        if(document.getElementById('short_description') != null)
            document.getElementById('short_description').innerHTML="<tt>Studi presso Academia delle Belle Arti di Varsavia alla facolta' di pittura nello studio prima del prof. Michał Bylina e poi prof. Jacek Sienicki. Laureata nel 1979 con il diploma d'onore.<br />Ha partecipato a molte mostre sia personali che di gruppo in Polonia e all'estero.</tt>";
    /*if(document.getElementById('info') != null)
document.getElementById('info').innerHTML="<a href='http://picasaweb.google.com/ziaja.anna/Wernisa6Maja200802'>La mostra 6 V - 1 VI 2008<br />Centrum Olimpijskie, Wybrzeże Gdyńskie 4, Warszawa</a>";*/
    }
}

function changeGalleryText(language)
{
    if(language=='polish'){
        document.getElementById('gallerydescription').innerHTML="Reprodukowane tutaj prace to obszerny zestaw malarstwa wykonanego w technice akrylu na płótnie oraz zestaw prac graficznych wykonanych w technice: akwaforty, akwatinty, suchej igły i miękkiego werniksu.";
    }
    if(language=='english'){
        document.getElementById('gallerydescription').innerHTML="The online gallery shows only a part of the paintings of Anna Ziaja.";
    }
    if(language=='italiano'){
        document.getElementById('gallerydescription').innerHTML="Le foto su questo sito rappresentano solo una parte della pittura di Anna Ziaja.";
    }
}
/*VALIDATION OF THE EMAIL*/
function valid(form) {
    var field = form.email; // email field
    var str = field.value; // email string
    var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
    var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
    if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
        alert("Thank your for your feedback."); // this is optional
        return true;
    }
    alert("\"" + str + "\" is an invalid e-mail!"); // this is also optional
    field.focus();
    field.select();
    return false;
}

/*PRELOAD OF THE INITIAL IMAGE
load_img = new Image();
load_img2 = new Image();

load_img.src="images/face.jpg";
load_img2.src="images/new.jpg";

function replace_img()
{
	if (load_img.complete && load_img2.complete && document['target_img'] != null)
	{
		document['target_img'].src=load_img.src;
		document['target_img2'].src=load_img2.src;
		clearInterval(timerid);
    }
}
timerid = setInterval("replace_img()", 500);*/

