function swapFlagImage(imName) {
	var flagImg;
	
	flagImg = "flag"+imName;
	
	if (document.images[flagImg].src.match('button_flag.gif')) {
		MM_swapImage(flagImg,'','/images/listings/button_unflag.gif',0);	
	} else if (document.images[flagImg].src.match('button_unflag.gif')) {
    	document.images[flagImg].src='/images/listings/button_flag.gif';
	}
}

function FlagClick(ListingClassID, ImID, ListingID, UserSessionID) {

    var itemId;
    var rateHref;
    var rateWindow;
	var FLAG_SET_PAGE 
	FLAG_SET_PAGE = "/flag_listing.asp";
    // Update the saved state of the listing and the image display
	rateHref = "?flaglistingtype="+ListingClassID+"&flaglistingid="+ListingID+"&guid="+UserSessionID;
    rateHref = FLAG_SET_PAGE + rateHref +"&url=" + escape(window.location.href);
	
    window.setTimeout("swapFlagImage('"+ImID+"')", 400);

    // Try to use a 204 No Content response.
    if (1) {
        window.location.href = rateHref
                               + "&ncok=true";
		
        return void(0);
    }
    // Try to use an IFRAME.
    if (window.callback_iframe) {
        window.callback_iframe.location.href = rateHref+"&iframe=t";
        // Return special value to leave this window alone
		
        return void(0);
    }
    // If that failed, try using a pop-up window.
    rateWindow =
        window.open("",
                    "nf_gauge_set",
                    "resizable=no,dependent=yes,width=1,height=1,screenX="
                    +window.screenX+",screenY="+window.screenY
                    +",top="+window.screenX+",left="+window.screenY);
    if (rateWindow && ! rateWindow.closed) {
        //rateWindow.blur();
        rateWindow.location.href = rateHref+"&js=t";
        //self.focus();
		
        return void(0);
    }
    // If that failed, run in this window.
    window.location.href = rateHref;
	
	
    return void(0);

}

function swapFlagDet(imName) {
	var flagImg;
	flagImg = "flag"+imName;

	if (document.images[flagImg].src.match('button_flag_det.gif')) {
		MM_swapImage(flagImg,'','/images/listings/button_unflag_det.gif',0);	
	} else if (document.images[flagImg].src.match('button_unflag_det.gif')) {
    	document.images[flagImg].src='/images/listings/button_flag_det.gif';
	}
	
}

function FlagClickDet(ListingClassID, ImID, ListingID, UserSessionID) {

    var itemId;
    var rateHref;
    var rateWindow;
	var FLAG_SET_PAGE 
	FLAG_SET_PAGE = "flag_listing.asp";
    // Update the saved state of the starbar and the display
	rateHref = "?flaglistingtype="+ListingClassID+"&flaglistingid="+ListingID+"&guid="+UserSessionID;
    rateHref = FLAG_SET_PAGE + rateHref +"&url=" + escape(window.location.href);
	
    window.setTimeout("swapFlagDet('"+ImID+"')", 400);

    // Try to use a 204 No Content response.
    if (1) {
        window.location.href = rateHref
                               + "&ncok=true";
		
        return void(0);
    }
    // Try to use an IFRAME.
    if (window.callback_iframe) {
        window.callback_iframe.location.href = rateHref+"&iframe=t";
        // Return special value to leave this window alone
		
        return void(0);
    }
    // If that failed, try using a pop-up window.
    rateWindow =
        window.open("",
                    "nf_gauge_set",
                    "resizable=no,dependent=yes,width=1,height=1,screenX="
                    +window.screenX+",screenY="+window.screenY
                    +",top="+window.screenX+",left="+window.screenY);
    if (rateWindow && ! rateWindow.closed) {
        //rateWindow.blur();
        rateWindow.location.href = rateHref+"&js=t";
        //self.focus();
		
        return void(0);
    }
    // If that failed, run in this window.
    window.location.href = rateHref;
	
	
    return void(0);

}



