/*function download(id){
    document.open("dF","/Downloads?downloadId="+id+"&ssq="+Math.random());
}*/
function getComboboxValue(id){
    var dropdownIndex = document.getElementById(id).selectedIndex;
    return document.getElementById(id)[dropdownIndex].text;
}
function getComboboxV(id){
    var dropdownIndex = document.getElementById(id).selectedIndex;
    return document.getElementById(id)[dropdownIndex].value;
}
var fId  = null;
function showFragment(url,fragmentId)
{
    fId = fragmentId;
    AjaxRequest("GET",url+"ssq="+Math.random(),fragmentResult);
}

function fragmentResult() 
{   
    if (xmlHttp.readyState==4)
        { 
            if(fId!=null){
                
                document.getElementById(fId).innerHTML= xmlHttp.responseText;
                fId = null;
            }  
        }
    }
    
    
    var rF = null;
    function showSubPageC(contents,receiverF)
    {
        rF=receiverF;
        AjaxRequest("GET",contents+"ssq="+Math.random(),subpageChanged);
    }
    
    function showSubPage(contents)
    { 
        AjaxRequest("GET",contents+"ssq="+Math.random(),subpageChanged);
    }
    
    function subpageChanged() 
    { 
        if (xmlHttp.readyState==4)
            { 
                document.getElementById("subPage").innerHTML= xmlHttp.responseText;
                if(rF!=null){
                    rF();
                    rF=null;
                }
            }
        }
        
        function onPopOut(id){
            document.getElementById(id).style.display = "none";
        }
        function onPopOver(id){
            onPopOut("messages");
            onPopOut("orders");
            document.getElementById(id).style.display = "block";
        }
        function checkEnter(e) {
            var code;
            if (window.event) {
                code=event.keyCode;
            }
            else {
                code= e.which;
            }
            if (code == 13) {
                login();
            }
        }
        function checkUsername(){
            var s = document.getElementById("username").value;
            AjaxRequest("GET","/registration?task=check&username="+s+"&ssq="+Math.random(),checkUsernameResult);
        }
        
        function checkUsernameResult() 
        { 
            if (xmlHttp.readyState==4)
                { 
                    document.getElementById("usernameCheck").innerHTML= xmlHttp.responseText;
                }
            }
            function login(){
                if((document.getElementById("emailAdd").value!="")&&(document.getElementById("password").value!="")){
                    setUpdate(true);
                    showPage("login?task=login&emailAdd="+document.getElementById("emailAdd").value+"&password="+document.getElementById("password").value+"&");
                }else{
                document.getElementById("errorMessage").innerHTML= "Email Address or password is not filled.";
            }
        } 
        function clear(){
            document.getElementById('emailAdd').value="";
            document.getElementById('password').value="";
        }
        
        function logout(){
            setUpdate(true);
            showPage("login?task=logout&");
        }
        
