/* Vis og skjul pil */

function ShowPicture(pictureID){
    
    try{
        var e = document.getElementById(pictureID);
        e.src = '/images/layout/arrow_big.gif';
    }
    catch(err){
        alert(err);
    }
}

function ShowPictureSmall(pictureID){
    try{
        var e = document.getElementById(pictureID);
        e.src = '/images/layout/arrow_small.gif';
    }
    catch(err){
        alert(err);
    }
}

function HidePicture(pictureID){
    try{
        var e = document.getElementById(pictureID);
        e.src = '/images/elements/blank.gif';
    }
    catch(err){
        alert(err);
    }
}

function client_validation(elements){
    try{
        var i;
        var j;
        for (i=0; i < elements.length; i++){
            var element = document.getElementById(elements[i]);
            if(element){
                if(element.value==""){
                    alert("Felterne med stjerne skal udfyldes");
                    return false;
                    break;
                }
            }
            else{
                var elementName = document.getElementsByName(elements[i]);
                
                if(elementName){
                    for(j=0; j<elementName.length; j++){
                        if(elementName[j].value==""){
                            alert("Felterne med stjerne skal udfyldes");
                            return false;
                            break;
                        }
                    }
                }
            }
        }
        return true;
    }
    catch(e){
        alert(e);
        return false;
    }    
}

function CloseWindow(){
    try{
                window.close();
        }
        catch(e){
                alert(e);
        }
}

function popup(file,header,width,height,scrollbars,style){
        scrollbars = scrollbars == null ? "yes" : scrollbars;
    var popupWindow=document.open(file,header,'width='+width+',height='+height+',left='+Math.round((screen.availWidth-width)/2)+',top='+Math.round((screen.availHeight-height)/2)+',location=no,directories=no,menubar=no,scrollbars=' + scrollbars + ',status=no'+style);
    popupWindow.window.focus();
}

function BilledGalleri(id, width, height){
        popup("/popups/picturegallery.asp?id=" + id,"Billedgalleri",641,435,"no");
}

function Form(id, width, height, scrollbars){
        popup("/popups/form.asp?id=" + id,"Formular",651,height,scrollbars);
}
