var currentimage = 0;

if(window.name!="mainframe"){
    var url = document.location
	var win = top;
    win.location.replace("http://www.stoneaudio.co.uk/default.asp?redirect="+url); 
}

function SelectImage(img, alt){
    var imgVwr = getObjectById("ImageViewer");
    imgVwr.src = img;
    imgVwr.alt = alt;
    imgVwr.title = alt;
    return false;
}

function NextImage(){
    if(currentimage>=1){
        currentimage = 0;
    }
    else{
        currentimage = 1;
    }
    var pimg = getObjectById("productImage");
    var psel = getObjectById("ImgSelector");
    if(pimg!=null){
        var path = "http://www.stoneaudio.co.uk/resources/products/image"+(currentimage+1)+"/"+pimages[currentimage];
        pimg.src=path;
    }
    if(psel!=null){
        
        if(currentimage==0){
            psel.nodeValue = "Next Image";
            
        }
        else{
            psel.nodeValue = "Previous Image";
        }
        
        //psel.firstChild.nodeValue="Next Image"}else{psel.firstChild.nodeValue="Previous Image"}

    }

}


//[2DO: Not yet implemented]
function SetStatus(msg){
    top.window.status = msg;
}
function browse(str){

    var srchstr = getObjectById("search")
    var srchrng = getObjectById("searchrange")
    var srchmde = getObjectById("searchmode")
    
    if(srchstr.value.length>0){
        str+="&search="+srchstr.value;
        str+="&searchrange="+srchrng.value;
        str+="&searchmode="+srchmde.value;
        
    }
window.navigate(str); 
      
return false;
         
}
function debug(){
window.open(window.location+"&amp;debug=true");
}

function HighlightRow(row){
    if(row.className!="sa_selected"){
        row.className="sa_highlight";
    }
}

function RemoveHighlight(object){
    if(object.className!="sa_selected"){
        object.className="";
    }
}



function Preload(){
 
    var obj1 = getObjectById("ProgressBar");
    var obj2 = getObjectById("Ldr4");
    if(obj1!=null){
       obj1.style.visibility = "hidden";
    }
    if(obj2!=null){
       obj2.style.visibility = "hidden";
    }
}

function Unload(){
    var obj = getObjectById("ProgressBar");
    if(obj!=null){
        obj.style.visibility = "visible";
        Status = "Please Wait...";
    }
}


function getImageById(id){
    var obj = null;
    if(document.images){
    return document.images.item(id);
    }
    return obj;
}

