/// jQuery IntelliSense
/// <reference path="jquery-1.4.2.min.js" />

// JScript File


//<procname>launchHelp(helpWindowUrl) { </procname>
//<summary>
// Opens the help window
//</summary>
//<param name="helpWindowUrl">The url to the help page to open including ?ResourceKey querystring</param>
//<history>
//<entry date="2005-06-22" name="Merrick Chaffer" action="Created" />
//</history>

function Hover__Element(element)
{
    AddClass__CssFriendlyAdapters(element, "Hover");
}
function Unhover__Element(element)
{
    RemoveClass__CssFriendlyAdapters(element, "Hover");
}
function launchHelp(helpWindowUrl)
{     
    var helpWindow = window.open(helpWindowUrl, 'Help', 'height=380,width=350,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,locationbar=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0');       
}     
function launchTermsAndConditions(windowUrl)
{     
    var termsAndConditionsWindow = window.open(windowUrl, 'TermsAndConditions', 'height=640,width=800,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,locationbar=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0');       
}     

function displayConditionImage(url) 
{
    var conditionImageWindow = window.open(url, 'KipperDiagram', 'height=495,width=650,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,locationbar=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0');
    conditionImageWindow.focus();
}     

function launchPopup(url)
{       
    var newWindow = window.open(url, 'NewWindow', 'fullscreen=yes,location=no,locationbar=no,resizable=yes,scrollbars=yes,status=no ,toolbar=no,directories=no,copyhistory=no');
} 

function openLotAdmin(saleid)
{     
    var lotAdminWindow = window.open( 'AdministerLots.aspx?SaleId=' + saleid, 'LotAdmin', 'height=702,width=1024,channelmode=no,dependent=no,directories=no,fullscreen=no,locationbar=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');       
}

function displayEnquiryAdministration()
{     
    var enquiriesWindow = window.open( '/Enquiries', 'EnquiryAdmin', 'height=750,width=1050,channelmode=no,dependent=no,directories=no,fullscreen=no,locationbar=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');       
}

function openLotAdminForTheLot(saleid,lotId)
{     
    var lotAdminWindow = window.open( '../Admin/AdministerLots.aspx?SaleId=' + saleid + '&LotId=' + lotId, + 'LotAdmin', 'height=702,width=1024,channelmode=no,dependent=no,directories=no,fullscreen=no,locationbar=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');       
}

function openScheduledBidWindow(saleid,lotid,rowindex) {
    var helpWindow = window.open('AdminScheduledBid.aspx?SaleId=' + saleid + '&LotId=' + lotid + '&RowIndex=' + rowindex, 'PlaceScheduledBidAdmin', 'height=240,outerHeight=320,width=350,outerWidth=360,channelmode=no,dependent=no,directories=no,fullscreen=no,location=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
}

function openScheduledBidEditWindow(saleid,lotid,scheduleid) {
    var helpWindow = window.open('AdminEditScheduledBid.aspx?SaleId=' + saleid + '&LotId=' + lotid + '&ScheduleId=' + scheduleid, 'ScheduledBidEditAdmin', 'height=240,outerHeight=320,width=350,outerWidth=360,channelmode=no,dependent=no,directories=no,fullscreen=no,location=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
}

function openFinalBidWindow(saleid, lotid) {
    var helpWindow = window.open('AdminFinalBid.aspx?SaleId=' + saleid + '&LotId=' + lotid, 'PlaceScheduledBidAdmin', 'height=240,outerHeight=320,width=350,outerWidth=360,channelmode=no,dependent=no,directories=no,fullscreen=no,location=no,locationbar=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
}

function openViewLotWindow(VehId, LotId, R, ApplicationType) {
    if (ApplicationType == 'PEEP') {
        var newWindow = window.open('../Pages/ViewLot.aspx?VehId=' + VehId + '&LotId=' + LotId + '&R=' + R, 'ViewLot', 'fullscreen=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=yes');
    } else {
        var newWindow = window.open('/Results/LotDetail/null?VehId=' + VehId , 'ViewLot', 'fullscreen=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=yes');
    }
}

function openXbidVehicleListWindow(saleid) {
    var newWindow = window.open('../Pages/SearchStock.aspx?Search=Salevehicles&saleId=' + saleid + '&xbid=true', 'XBidVehicleList', 'fullscreen=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=yes');
}   

function SetButtonEnablementFromCheckbox(buttonId, checkboxId)
{
   var button = document.getElementById(buttonId);
   var chkbox = document.getElementById(checkboxId);
   
   if (button && chkbox)
   {
      button.disabled = !chkbox.checked;
      // TODO - see Nat about disabled style
  }
}

function displayTranslationLookup() {
    var transWindow = window.open('/Translations', 'TranslationLookup', 'height=800,width=1050,channelmode=no,dependent=no,directories=no,fullscreen=no,locationbar=no,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
    transWindow.focus();
}

function ShowDescriptionPanel(popupId, parentId, leftOffset, topOffset) {
    if ($(popupId) != null) {
        $(popupId).css({
        "visibility":"visible"
    });
    
    var parentPos = $(parentId).position();
    $(popupId).css({
    'left': (parentPos.left + leftOffset) + 'px',
    'top': (parentPos.top + topOffset - $(popupId).height()) + 'px'
    });

    // display popup
    $(popupId).fadeIn('fast');
    }
}
function HideDescriptionPanel(popupId) {
    $(popupId).css({
    "visibility": "hidden"
    });
}