function hideall(){
document.getElementById("aboutus").style.display = "none";
document.getElementById("rates").style.display = "none";
document.getElementById("clients").style.display = "none";
document.getElementById("contact").style.display = "none";
document.getElementById("quotes").style.display = "none";
}
function hideme(id) {
document.getElementById(id).style.display = "none";
}
function showme(id) {
 hideall();
 document.getElementById(id).style.display = "block";
 }

function changeme(id, action) {
if (action=="hide") {
            document.getElementById(id).style.display = "none";
       } else {
            document.getElementById(id).style.display = "block";
       }
}

//Fadein experiment
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 


function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
}

$(function(){ $('.fadein img:gt(0)').hide(); setInterval(function(){$('.fadein :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein');}, 3000); });

function validateForm001fr()
{
    strNom=document.getElementById('strNom');
    strCourriel=document.getElementById('strCourriel');
    strQuantity=document.getElementById('strQuantity');
    strTerritory=document.getElementById('strTerritory');
    
    document.getElementById('strNomError').style.display='none';
    document.getElementById('strCourrielError').style.display='none';
    document.getElementById('strQuantityError').style.display='none';
    document.getElementById('strTerritoryError').style.display='none';
    
    strNom.style.borderColor='#717171';
    strCourriel.style.borderColor='#717171';
    strQuantity.style.borderColor='#717171';
    strTerritory.style.borderColor='#717171';
    
    if(strNom.value=='')    
    {
        strNom.style.borderColor='#7d0210';
        $("#strNomError").fadeOut("100000000");
        document.getElementById('strNomError').innerHTML='(Requis)';
        $("#strNomError").fadeIn("slow");
        document.getElementById('strNom').focus();
        return false;
    }
    
    if(strCourriel.value=='')
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Requis)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(!isValidEmail(strCourriel.value))
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Invalide)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(strQuantity.value=='')
    {
        strQuantity.style.borderColor='#7d0210';
        $("#strQuantityError").fadeOut("100000000");
        document.getElementById('strQuantityError').innerHTML='(Requis)';
        $("#strQuantityError").fadeIn("slow");
        document.getElementById('strQuantity').focus();
        return false;
    }
    
    if(strTerritory.value=='')
    {
        strTerritory.style.borderColor='#7d0210';
        $("#strTerritoryError").fadeOut("100000000");
        document.getElementById('strTerritoryError').innerHTML='(Requis)';
        $("#strTerritoryError").fadeIn("slow");
        document.getElementById('strTerritory').focus();
        return false;
    }    
        
    return true;
}

function validateForm002fr()
{
    strNom=document.getElementById('strNom');
    strCourriel=document.getElementById('strCourriel');
    strSujet=document.getElementById('strSujet');
    
    document.getElementById('strNomError').style.display='none';
    document.getElementById('strCourrielError').style.display='none';
    document.getElementById('strSujetError').style.display='none';
    
    strNom.style.borderColor='#717171';
    strCourriel.style.borderColor='#717171';
    strSujet.style.borderColor='#717171';
    
    if(strNom.value=='')    
    {
        strNom.style.borderColor='#7d0210';
        $("#strNomError").fadeOut("100000000");
        document.getElementById('strNomError').innerHTML='(Requis)';
        $("#strNomError").fadeIn("slow");
        document.getElementById('strNom').focus();
        return false;
    }
    
    if(strCourriel.value=='')
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Requis)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(!isValidEmail(strCourriel.value))
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Invalide)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(strSujet.value=='')
    {
        strSujet.style.borderColor='#7d0210';
        $("#strSujetError").fadeOut("100000000");
        document.getElementById('strSujetError').innerHTML='(Requis)';
        $("#strSujetError").fadeIn("slow");
        document.getElementById('strSujet').focus();
        return false;
    }
    
    return true;
}

function validateForm001en()
{
    strNom=document.getElementById('strNom');
    strCourriel=document.getElementById('strCourriel');
    strQuantity=document.getElementById('strQuantity');
    strTerritory=document.getElementById('strTerritory');
    
    document.getElementById('strNomError').style.display='none';
    document.getElementById('strCourrielError').style.display='none';
    document.getElementById('strQuantityError').style.display='none';
    document.getElementById('strTerritoryError').style.display='none';
    
    strNom.style.borderColor='#717171';
    strCourriel.style.borderColor='#717171';
    strQuantity.style.borderColor='#717171';
    strTerritory.style.borderColor='#717171';
    
    if(strNom.value=='')    
    {
        strNom.style.borderColor='#7d0210';
        $("#strNomError").fadeOut("100000000");
        document.getElementById('strNomError').innerHTML='(Required)';
        $("#strNomError").fadeIn("slow");
        document.getElementById('strNom').focus();
        return false;
    }
    
    if(strCourriel.value=='')
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Required)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(!isValidEmail(strCourriel.value))
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Invalid)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(strQuantity.value=='')
    {
        strQuantity.style.borderColor='#7d0210';
        $("#strQuantityError").fadeOut("100000000");
        document.getElementById('strQuantityError').innerHTML='(Required)';
        $("#strQuantityError").fadeIn("slow");
        document.getElementById('strQuantity').focus();
        return false;
    }
    
    if(strTerritory.value=='')
    {
        strTerritory.style.borderColor='#7d0210';
        $("#strTerritoryError").fadeOut("100000000");
        document.getElementById('strTerritoryError').innerHTML='(Required)';
        $("#strTerritoryError").fadeIn("slow");
        document.getElementById('strTerritory').focus();
        return false;
    }    
        
    return true;
}

function validateForm002en()
{
    strNom=document.getElementById('strNom');
    strCourriel=document.getElementById('strCourriel');
    strSujet=document.getElementById('strSujet');
    
    document.getElementById('strNomError').style.display='none';
    document.getElementById('strCourrielError').style.display='none';
    document.getElementById('strSujetError').style.display='none';
    
    strNom.style.borderColor='#717171';
    strCourriel.style.borderColor='#717171';
    strSujet.style.borderColor='#717171';
    
    if(strNom.value=='')    
    {
        strNom.style.borderColor='#7d0210';
        $("#strNomError").fadeOut("100000000");
        document.getElementById('strNomError').innerHTML='(Required)';
        $("#strNomError").fadeIn("slow");
        document.getElementById('strNom').focus();
        return false;
    }
    
    if(strCourriel.value=='')
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Required)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(!isValidEmail(strCourriel.value))
    {
        strCourriel.style.borderColor='#7d0210';
        $("#strCourrielError").fadeOut("100000000");
        document.getElementById('strCourrielError').innerHTML='(Invalid)';
        $("#strCourrielError").fadeIn("slow");
        document.getElementById('strCourriel').focus();
        return false;
    }
    
    if(strSujet.value=='')
    {
        strSujet.style.borderColor='#7d0210';
        $("#strSujetError").fadeOut("100000000");
        document.getElementById('strSujetError').innerHTML='(Required)';
        $("#strSujetError").fadeIn("slow");
        document.getElementById('strSujet').focus();
        return false;
    }
    
    return true;
}

function isValidEmail(str) {return(str.lastIndexOf(".")>2)&&(str.indexOf("@")>0)&&(str.lastIndexOf(".")>(str.indexOf("@")+1))&&(str.indexOf("@")==str.lastIndexOf("@"));}
