//Following functions are used for scrolling the small image gallery on Vehicle Details page

//Following is used to control speed. The higher the number, the faster it will scroll.
scrollStep=1

timerLeft=""
timerRight=""

function goLeft(id){
  $("#" + id).get(0).scrollLeft=0
}

function scrollDivLeft(id){
  clearTimeout(timerRight) 
  $("#" + id).get(0).scrollLeft += scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}

function scrollDivRight(id){
  clearTimeout(timerLeft)
  $("#" + id).get(0).scrollLeft -= scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function goRight(id){
  $("#" + id).get(0).scrollLeft=document.getElementById(id).scrollWidth
}

function stopScroll(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}
//END SCROLLINIG

function ViewGallery(vehicleId, pageUrl)
{
    url = pageUrl;
    if (url.indexOf('?') == -1)
        url += "?";
    else
        url += "&";
    
    url +=  "vehicleId=" + vehicleId;
    //alert(url);
    var gallery = window.open(url, 'vehicleGallery', 'status=0, toolbar=0, width=525, height=500');
    if (gallery) gallery.focus();
    return false;
}

function BlendImage(largeImageControlId, imageUrl) 
{
    if ($("#" + largeImageControlId).get(0).filters) 
    {
        $("#" + largeImageControlId).get(0).style.filter = "blendTrans(duration=1.5)"
        $("#" + largeImageControlId).get(0).filters.blendTrans.Apply()
        $("#" + largeImageControlId).get(0).style.visibility="visible"
        $("#" + largeImageControlId).get(0).filters.blendTrans.Play()
    }
    $("#" + largeImageControlId).get(0).src = imageUrl
    if ($("#" + largeImageControlId).get(0).filters) 
    {
        $("#" + largeImageControlId).get(0).style.filter = "blendTrans(duration=1.5)"
        $("#" + largeImageControlId).get(0).filters.blendTrans.Apply()
        $("#" + largeImageControlId).get(0).style.visibility="visible"
        $("#" + largeImageControlId).get(0).filters.blendTrans.Play()
    }
}
