/**
 * JS for special price site
 * @author:		Mario Diaz
 * created:		2009-02-17
 */


/**
 * shows large button for one icon on right side
 * @param int iNo
 * @param bool bVisible
 * @return void
 */
function showBookButton (iNo, bVisible) {
	oLayer = document.getElementById('large_button_book');
	oButton = document.getElementById('icon_booking_' + iNo);
	aTmp = findPos(oButton);
	if (bVisible) {
		// msie6 bug again...
		if (bMsie6) {
			aTmp[1] -= 9;
		}
		oLayer.style.top = aTmp[1] + 'px';
		oLayer.style.left = (aTmp[0] - oLayer.offsetWidth) + 'px'
		oLayer.style.visibility = 'visible';
		oButton.src = 'upload/zimages/icon_zum_angebot.gif';
	} else {
		oLayer.style.visibility = 'hidden';
		oButton.src = 'upload/zimages/icon_zum_angebot_grau.gif';
	}
}


/**
 * sorting with JS because of no multiple indexing (search engines)
 * @param int iIdcat
 * @param int iIdart
 * @param string sSortBy
 * @param string sSortDir
 * @param int iStartAt
 * @return void
 */
function sortSpecials (iIdcat, iIdart, sSortBy, sSortDir, iStartAt) {
	sBaseHref = document.getElementsByTagName('base')[0].href;	// msie again and again...
	location.href = sBaseHref + 'index.html?idcat=' + iIdcat + '&idart=' + iIdart + '&sort_by=' + sSortBy + '&sort_dir=' + sSortDir + '&start_at=' + iStartAt;
}


/**
 * looks very dirty, but ie6 didn't give me a choice!!! I tried everything to use relative elements...
 * this function positions the hotellist buttons. 
 * return void 
 */
function correctMsie6 () {
	iCounter = 0;
	while (document.getElementById('special_list_button_' + iCounter)) {
		oCurrEl = document.getElementById('special_list_button_' + iCounter);
		aTmp = findPos(document.getElementById('special_list_button_pos_' + iCounter));
		iTmp = (bMsie6) ? 1 : 11;
		iTmp2 = (bMsie6) ? -18 : 2;
		oCurrEl.style.top = (aTmp[1] + iTmp) + 'px';
		oCurrEl.style.left = (aTmp[0] + 403 + iTmp2) + 'px';
		oCurrEl.style.visibility = 'visible';
		iCounter++;
	}
}


// and now for some msie6 stuff
window.onload = correctMsie6;


