function switchButtonState(itemId, path) {
    document.getElementById(itemId).src = path;
}        
function switchLinkState(itemId, className) {
    document.getElementById(itemId).className = className;
}
var imagesArray = new Array("/Custom/Images/menu_about_top.gif","/Custom/Images/menu_about_top_active.gif","/Custom/Images/menu_services_top.gif","/Custom/Images/menu_services_top_active.gif","/Custom/Images/menu_portfolio_top.gif","/Custom/Images/menu_portfolio_top_active.gif","/Custom/Images/menu_contact_top.gif","/Custom/Images/menu_contact_top_active.gif","/Custom/Images/menu_home_top.gif","/Custom/Images/menu_home_top_active.gif", "/Custom/images/send_button_over.gif", "/Custom/images/send_button.gif", "/Custom/Images/search_button_over.png");
var preloadArray = new Array();
for(var i=0; i!=imagesArray.length; i++) {
    preloadArray[i] = new Image;
    preloadArray[i].src = imagesArray[i];
}
function submitQuickContact() {
    var textBoxEmail = document.getElementById('quickContactEmail');
    if(textBoxEmail.value == "" || textBoxEmail.value == getDefaultMessage('quickContactEmail')) {
        return;
    }
    if(!/\S+@\S+\.\S+/.test(textBoxEmail.value)) {
        var validator = document.getElementById('quickContactValidator');  
        validator.className = "validatorEnabled";
        return;
    }
    var textBoxMessage = document.getElementById('quickContactMessage');
    if(textBoxMessage.value == "" || textBoxMessage.value == getDefaultMessage('quickContactMessage')) {
        return;
    }
    var form = document.forms[0];
    form.quickContact.value = "sendQuickMessage";
    form.customPostBack.value = "true";
    form.submit();
}

function submitSearch() {
    var textBox = document.getElementById('textBoxSearch');
    if(textBox.value == "" || textBox.value == getDefaultMessage('textBoxSearch')) {
        return;
    }
    var form = document.forms[0];
    form.searchButton.value = "search";
    form.customPostBack.value = "true";
    form.submit();
}

function onTextBoxFocus(id) {
    var textBox = document.getElementById(id);
    if(textBox.value== getDefaultMessage(id)) {
        textBox.value="";
    }
}
function onTextBoxBlur(id) {
    var textBox = document.getElementById(id);
        if(textBox.value== "") {
            textBox.value= getDefaultMessage(id);
        }
}        
function getDefaultMessage(id) {
    if(id=="quickContactEmail")
        return "type your e-mail";
    if(id=="quickContactMessage")
        return "type your message";
    if(id=="textBoxSearch")
        return "search on sky.netix";                
}      
function onSearchTextboxPressKey(evt){         
    evt=(evt)?evt:event; 
    charCode=(evt.which)?evt.which:evt.keyCode; 
    if(charCode==13) {
        submitSearch(); 
        return false;
    }
}
function onQuickContactTextboxPressKey(evt){
    evt=(evt)?evt:event; 
    charCode=(evt.which)?evt.which:evt.keyCode; 
    if(charCode==13) {
        return false;
    }
    var textBoxEmail = document.getElementById('quickContactEmail');
    if(/\S+@\S+\.\S+/.test(textBoxEmail.value + String.fromCharCode(charCode))) {
        var validator = document.getElementById('quickContactValidator');  
        validator.className = "validatorDisabled";
    }
}
function submitContactForm() {
    if  (Page_ClientValidate()) {
        var form = document.forms[0];
        form.contactFormSend.value = "sendContactForm";
        form.customPostBack.value = "true";
        form.submit();
    }
} 
