

/////////////////////////////////////
// script for slide show
///////////////////////////////////
var miCurrImgIndex = 0;
var timerRunning = false;
var timerId = null;
var paused = false;
var bFirstPass = true;

function propimgMoveNextDown()
{
	var oElem = document.getElementById('btnNextDiv');
	if(oElem != null)
	{
		document.getElementById('btnNextDiv').setAttribute("class", "propertyInfoDisplayImgNavPressed");
		document.getElementById('btnNextDiv').setAttribute("className", "propertyInfoDisplayImgNavPressed");
	}
}
function propimgMoveNextUp()
{
	var oElem = document.getElementById('btnNextDiv');
	if(oElem != null)
	{
		document.getElementById('btnNextDiv').setAttribute("class", "propertyInfoDisplayImgNav");
		document.getElementById('btnNextDiv').setAttribute("className", "propertyInfoDisplayImgNav");
	}
	propimgMoveNext();
}
function propimgMovePrevDown()
{
	var oElem = document.getElementById('btnPrevDiv');
	if(oElem != null)
	{
		document.getElementById('btnPrevDiv').setAttribute("class", "propertyInfoDisplayImgNavPressed");
		document.getElementById('btnPrevDiv').setAttribute("className", "propertyInfoDisplayImgNavPressed");
	}
}
function propimgMovePrevUp()
{
	var oElem = document.getElementById('btnPrevDiv');
	if(oElem != null)
	{
		document.getElementById('btnPrevDiv').setAttribute("class", "propertyInfoDisplayImgNav");
		document.getElementById('btnPrevDiv').setAttribute("className", "propertyInfoDisplayImgNav");
	}
	propimgMovePrevious();
}
function propimgMoveNext()
{
	hideCurrentImage();
	miCurrImgIndex++;
	if(miCurrImgIndex > imgList.length - 1) miCurrImgIndex = 0;
	propimgDisplayCurrent();
}

function propimgMovePrevious()
{
	hideCurrentImage();
	miCurrImgIndex--;
	if(miCurrImgIndex < 0) miCurrImgIndex = imgList.length - 1;
	propimgDisplayCurrent();
}
function hideCurrentImage()
{
	var oImg = $(imgList[miCurrImgIndex]);
	if(oImg)
		oImg.style.display = "none";
}
function propimgDisplayCurrent()
{
	if(bFirstPass)
	{
		bFirstPass = 0;
		miCurrImgIndex = 0;
		$('propImg').style.display = "none";
	}

	var oElem = $(imgList[miCurrImgIndex]);
	if(oElem) {
    	oElem.style.display = "inline";
	}
}
function propimgStartTimer()
{
	var oElemPlay = document.getElementById('btnPlay');
	var oElemPause = document.getElementById('btnPause');
	if(oElemPlay != null || oElemPause != null)
	{
		oElemPlay.setAttribute("class", "button-down");
		oElemPlay.setAttribute("className", "button-down");
		oElemPause.setAttribute("class", "button-up");
		oElemPause.setAttribute("className", "button-up");
	}

	if(paused) {
		paused = false;
		propimgMoveNext();
	}
	timerRunning = true;
	timerID = self.setTimeout("propimgTimerEvent()", 4000);
}
function propimgTimerEvent()
{
	propimgMoveNext();
	propimgStartTimer();
}
function propimgStopTimer()
{
	var oElemPause = document.getElementById('btnPause');
	if(oElemPause != null)
	{
		oElemPause.setAttribute("class", "button-down");
		oElemPause.setAttribute("className", "button-down");
	}
	if(timerRunning) {
		clearTimeout(timerID);
		paused = true;
	}
	timerRunning = false;

	var oElemPlay = document.getElementById('btnPlay');
	if(oElemPlay != null)
	{
		oElemPlay.setAttribute("class", "button-up");
		oElemPlay.setAttribute("className", "button-up");
	}
}

function propimgMoveNextClick()
{
	document.getElementById('btnNext').setAttribute("class", "button-down");
	document.getElementById('btnNext').setAttribute("className", "button-down");
	propimgMoveNext();
	document.getElementById('btnNext').setAttribute("class", "button-up");
	document.getElementById('btnNext').setAttribute("className", "button-up");
}

function propimgMovePrevClick()
{
	document.getElementById('btnPrev').setAttribute("class", "button-down");
	document.getElementById('btnPrev').setAttribute("className", "button-down");
	propimgMovePrevious();
	document.getElementById('btnPrev').setAttribute("class", "button-up");
	document.getElementById('btnPrev').setAttribute("className", "button-up");
}


//// end: Script for slide show //////////////////////

function createBookmark()
{
	title = sPropertyName;
	url = sBaseUrl + "property.php?id=" + sPropertyId;
	if(window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	}
	else if(window.external)
	{
		window.external.AddFavorite(url, title);
	}
	else if(window.opera)
	{
		var abk = document.createElement("A");
		a.rel = "sidebar";
		a.target = "_search";
		a.title = title;
		a.href = url;
		a.click();
		abk.style.display = "none";
	}
	return false;
}
function addToFavorites()
{
	document.getElementById('action').value = "favorites";
	document.getElementById('frmProperty').submit();
	return false;
}
function addToFavorites2(sActionVal)
{
	var trk = null;
	if(sActionVal != "")
	{
		try {
			trk = createITT();
			trk.ACTION = sActionVal;
			trk._S_SKU = sPropertyId;
			trk.submit_action();
		} catch (err) {}

	}
	document.getElementById('action').value = "favorites";
	document.getElementById('frmProperty').submit();
	return false;
}

