
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/") + 1), 10);
CSIsW3CDOM = ((document.getElementById) && !(IsIE() && CSBVers < 6)) ? true : false;
CSIImg = false;

function IsIE() { return CSAg.indexOf("MSIE") > 0; }

function CSURLPopupShow(formName, popupName, target) {
	var form = (!IsIE() && CSBVers >= 5) ? document.forms[formName] : CSFindElement(formName);
	var popup = form.elements[popupName];
	window.open(popup.options[popup.selectedIndex].value, target);
	popup.selectedIndex = 0;
}

function CSFindElement(n, ly) {
	if (CSBVers < 4) return document[n];
	if (CSIsW3CDOM) { CSInitImgID(); return (document.getElementById(n)); }
	var curDoc = ly ? ly.document : document; 
	var elem = curDoc[n];
	if (!elem) { for (var i = 0; i < curDoc.layers.length; i++) { elem = CSFindElement(n, curDoc.layers[i]); if (elem) return elem; } }
	return elem;
}

function CSInitImgID() {
	if (!CSIImg && document.images) {
		for (var i = 0; i < document.images.length; i++) {
			if (!document.images[i].id) document.images[i].id = document.images[i].name;
		}
		CSIImg = true;
	} 
}

// Slide code

var slideSpeed = 5000;
var slideFadeDuration = 3;
var slidePic = new Array();
var slideUrl = new Array();

slidePic[0] = 'http://sfpride.org/images/ads/1.jpg';
slideUrl[0] = 'http://www.clifthotel.com/';
slidePic[1] = 'http://sfpride.org/images/ads/2.jpg';
slideUrl[1] = 'http://www.handlery.com/sf';
//slidePic[2] = 'http://sfpride.org/images/ads/3.jpg';
//slideUrl[2] = 'http://www.marriott.com/hotels/travel/sfodt-san-francisco-marriott-marquis/?toDate=6/27/11&groupCode=sfpsfpa&fromDate=6/24/11&app=resvlink';
slidePic[2] = 'http://sfpride.org/images/ads/4.jpg';
slideUrl[2] = 'http://www.renoirhotel.com/';
slidePic[3] = 'http://sfpride.org/images/ads/5.jpg';
slideUrl[3] = 'https://reservations.ihotelier.com/areasearch/default.cfm?PortalSymbol=JDV&HotelID=All&promocode=PRIDE';
slidePic[4] = 'http://sfpride.org/images/ads/7.jpg';
slideUrl[4] = 'http://www.hotelwhitcomb.com/';

var slideTimer;
var slideIndex = 0;
var slideCount = slidePic.length;
var slidepreLoad = new Array();
for (slidePos = 0; slidePos < slideCount; slidePos++)
{
	slidepreLoad[slidePos] = new Image();
	slidepreLoad[slidePos].src = slidePic[slidePos];
}
slideTimer = setTimeout('SlideTransition()', slideSpeed);
function SlideTransition()
{
	if (document.images && document.images.indexadd1)
	{
	if (document.all)
	{
	document.images.indexadd1.style.filter="blendTrans(duration=2)";
	document.images.indexadd1.style.filter="blendTrans(duration=slideFadeDuration)";
	document.images.indexadd1.filters.blendTrans.Apply();
	}
	document.images.indexadd1.src = slidepreLoad[slideIndex].src;
	if (document.all) { document.images.indexadd1.filters.blendTrans.Play(); }
	slideIndex = slideIndex + 1;
	if (slideIndex > (slideCount - 1)) slideIndex = 0;
	slideTimer = setTimeout('SlideTransition()', slideSpeed);
	}
}
function SlideClick() {
	var i = slideIndex - 1;
	if (i < 0) i = slideCount - 1;
	if(i >= 0 && slideUrl.length > i && slideUrl[i].length > 0)
		window.open(slideUrl[i],'_blank');
}

