function init()
{
explain = document.getElementById("input3");
name = document.getElementById("input");
email = document.getElementById("input2");

var rollover1 = new Image();
rollover1.src = "images/submit.png";
rollover2 = new Image();
rollover2.src = "images/submitover.png";
}


function clearctext()
{
if (document.cform.ctext.value == "Share your vision and we will provide you with free quote as quick as possible. Describe your new website and your ideas here.")
document.cform.ctext.value = "";
}
function clearcmail()
{
if (document.cform.cmail.value == "Your email:")
document.cform.cmail.value = "";
}
function clearcname()
{
if (document.cform.cname.value == "Your name:")
document.cform.cname.value = "";
}
function restorectext()
{
if (document.cform.ctext.value == 0)
document.cform.ctext.value = "Share your vision and we will provide you with free quote as quick as possible. Describe your new website and your ideas here.";
}
function restorecmail()
{
if (document.cform.cmail.value == 0)
document.cform.cmail.value = "Your email:";
}
function restorecname()
{
if (document.cform.cname.value == 0)
document.cform.cname.value = "Your name:";
}



function onmouse()
{
document.getElementById("clickme").style.backgroundImage = 'url("images/submitover.png")';
}
function outmouse() {
document.getElementById("clickme").style.backgroundImage = 'url("images/submit.png")';
}



/* functions in control of the contact form incorporated in each page */

function clearquotetext()
{
if (document.quoteform.quotetext.value == "Share your vision and we will provide you with free quote as quick as possible. Describe your new website and your ideas here.")
document.quoteform.quotetext.value = "";
}
function clearquotemail()
{
if (document.quoteform.quotemail.value == "Your email:" || document.quoteform.quotemail.value == "The email is not valid!")
document.quoteform.quotemail.value = "";
document.quoteform.quotemail.style.color = "";
}

function clearquotename()
{
if (document.quoteform.quotename.value == "Your name:")
document.quoteform.quotename.value = "";
}
function restorequotetext()
{
if (document.quoteform.quotetext.value == 0)
document.quoteform.quotetext.value = "Share your vision and we will provide you with free quote as quick as possible. Describe your new website and your ideas here.";
}
function restorequotemail()
{
if (document.quoteform.quotemail.value == 0)
document.quoteform.quotemail.value = "Your email:";
}
function restorequotename()
{
if (document.quoteform.quotename.value == 0)
document.quoteform.quotename.value = "Your name:";
}

/* functions which display and hide the layers in the sidebar of each page */
/* functions which display and hide the layers in the sidebar of each page */

function Quote() {
if (document.getElementById("quote").style.display == 0)
document.getElementById("quote").style.display = "block";
else
document.getElementById("quote").style.display = "";
}
function consultancy() {
if (document.getElementById("consultancy").style.display == 0)
document.getElementById("consultancy").style.display = "block";
else
document.getElementById("consultancy").style.display = "";
}
function news() {
if (document.getElementById("news").style.display == 0)
document.getElementById("news").style.display = "block";
else
document.getElementById("news").style.display = "";
}

/* functions which hide and display the value in the CONSULTANCY FORM */
/* functions which hide and display the value in the CONSULTANCY FORM */

function restoreconsname()
{
if (document.consform.consname.value == 0)
document.consform.consname.value = "Your name:";
}
function clearconsname()
{
if (document.consform.consname.value == "Your name:")
document.consform.consname.value = "";
}

function restoreconsmail()
{
if (document.consform.consmail.value == 0)
document.consform.consmail.value = "Your email:";
}
function clearconsmail()
{
if (document.consform.consmail.value == "Your email:"  || document.consform.consmail.value == "The email is not valid!")
document.consform.consmail.value = "";
document.consform.consmail.style.color = "";
}

function onmouseCons()
{
document.getElementById("clickmeCons").style.backgroundImage = 'url("images/submitover.png")';
}
function outmouseCons() {
document.getElementById("clickmeCons").style.backgroundImage = 'url("images/submit.png")';
}

/* AJAX functions sending the forms' information to the server */
/* AJAX functions sending the forms' information to the server */

function getRequestBody(oForm) {
var aParams = new Array();

for (var i=0; i < oForm.elements.length; i++) {
var sParam = encodeURIComponent(oForm.elements[i].name);
sParam += "=";
sParam += encodeURIComponent(oForm.elements[i].value);
aParams.push(sParam);
}
return aParams.join("&");
}


function sendQuote() {
            var oForm = document.getElementById('quoteform');
            var sBody = getRequestBody(oForm);

            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("post", "process.php", true);
            oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            oXmlHttp.onreadystatechange = function () {
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        if (oXmlHttp.responseText == 'The email is not valid!')
                        {
                        document.getElementById('quotemail').value = 'The email is not valid!';
                        document.getElementById('quotemail').style.color = "#ff0000";
                        }
                        else if (oXmlHttp.responseText == "ok.sent.") {
                        document.getElementById('quote').innerHTML = '<div id="thanku"><h1>Thank you for contacting Flexibul\'s sales department!</h1><br />Your enquiry has been sent to our sales department and one of our sales representatives will contact you as quick as possible.<br /><br /> Should you have any further questions please contact us at<br /><br /> <a href="mailto:sales@flexibul.com">sales@flexibul.com</a></div>';
                        }
                    }
                }
            };
            oXmlHttp.send(sBody);
            }
            
            function sendCont() {
            var oForm = document.getElementById('contactform');
            var sBody = getRequestBody(oForm);

            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("post", "processcont.php", true);
            oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            oXmlHttp.onreadystatechange = function () {
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        if (oXmlHttp.responseText == 'The email is not valid!')
                        {
                        document.getElementById('contactmail').value = 'The email is not valid!';
                        document.getElementById('contactmail').style.color = "#ff0000";
                        }
                        else if (oXmlHttp.responseText == "ok.sent.") {
                        document.getElementById('about').innerHTML = '<div id="thanku"><h1>Thank you for contacting Flexibul\'s sales department!</h1><br />Your enquiry has been sent to our sales department and one of our sales representatives will contact you as quick as possible. Should you have any further questions please contact us at <a href="mailto:sales@flexibul.com" class="body">sales@flexibul.com</a>.</div>';
                        }
                    }
                }
            };
            oXmlHttp.send(sBody);
            }

function sendConsultancy() {
            var oForm = document.getElementById('consform');
            var sBody = getRequestBody(oForm);

            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("post", "processcons.php", true);
            oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            oXmlHttp.onreadystatechange = function () {
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        if (oXmlHttp.responseText == 'The email is not valid!')
                        {
                        document.getElementById('consmail').value = 'The email is not valid!';
                        document.getElementById('consmail').style.color = "#ff0000";
                        }
                        else if (oXmlHttp.responseText == "ok.sent.") {
                        document.getElementById('consultancy').innerHTML = '<div id="thanku"><h1>Thank you for contacting Flexibul\'s sales department!</h1><br />Your enquiry has been sent to our sales department and one of our sales representatives will contact you as quick as possible.<br /><br /> Should you have any further questions please contact us at<br /><br /> <a href="mailto:sales@flexibul.com">sales@flexibul.com</a></div>';
                        }
                    }
                }
            };
            oXmlHttp.send(sBody);
            }

            /* begining of the contact form in the contact page   */
            /* begining of the contact form in the contact page   */
function clearcontmail()
{
if (document.contactform.contactmail.value == "Your email:" || document.contactform.contactmail.value == "The email is not valid!")
document.contactform.contactmail.value = "";
}
function clearcontname()
{
if (document.contactform.contactname.value == "Your name:")
document.contactform.contactname.value = "";
}
function restorecontmail()
{
if (document.contactform.contactmail.value == 0)
document.contactform.contactmail.value = "Your email:";
}
function restorecontname()
{
if (document.contactform.contactname.value == 0)
document.contactform.contactname.value = "Your name:";
}

function onmouseCont()
{
document.getElementById("clickmeCont").style.backgroundImage = 'url("images/submitover.png")';
}
function outmouseCont() {
document.getElementById("clickmeCont").style.backgroundImage = 'url("images/submit.png")';
}

/* AJAX functions to clear and send the comments on the download page */
/* AJAX functions to clear and send the comments on the download page */
/* AJAX functions to clear and send the comments on the download page */


function clearcommmail()
{
if (document.commentsform.email.value == "Mail:" || document.commentsform.email.value == "The email is not valid!")
document.commentsform.email.value = "";
}
function clearcommname()
{
if (document.commentsform.name.value == "Name:")
document.commentsform.name.value = "";
}
function restorecommmail()
{
if (document.commentsform.email.value == 0)
document.commentsform.email.value = "Mail:";
}
function restorecommname()
{
if (document.commentsform.name.value == 0)
document.commentsform.name.value = "Name:";
}
function clearcommweb()
{
if (document.commentsform.website.value == "Website:")
document.commentsform.website.value = "";
}
function restorecommweb()
{
if (document.commentsform.website.value == 0)
document.commentsform.website.value = "Website:";
}
function clearcomment()
{
if (document.commentsform.comment.value == "Any comments?")
document.commentsform.comment.value = "";
}
function restorecomment()
{
if (document.commentsform.comment.value == 0)
document.commentsform.comment.value = "Any comments?";
}
function onmouseComm()
{
document.getElementById("clickmecomm").style.backgroundImage = 'url("images/submitover.png")';
}
function outmouseComm() {
document.getElementById("clickmecomm").style.backgroundImage = 'url("images/submit.png")';
}

function sendComments() {
            var oForm = document.getElementById('commentsform');
            var sBody = getRequestBody(oForm);

            var oXmlHttp = zXmlHttp.createRequest();
            oXmlHttp.open("post", "postcomment.php", true);
            oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

            oXmlHttp.onreadystatechange = function () {
                if (oXmlHttp.readyState == 4) {
                    if (oXmlHttp.status == 200) {
                        if (oXmlHttp.responseText == 'The email is not valid!')
                        {
                        document.getElementById('email').value = 'The email is not valid!';
                        document.getElementById('email').style.color = "#ff0000";
                        }
                        else if (oXmlHttp.responseText == "ok.sent.") {
                        document.getElementById('dtemplate').innerHTML = "";
                        document.getElementById('downloadhere').style.visibility = "visible";
                        }
                        }
                        }
                        };
                        oXmlHttp.send(sBody);
            }

