function hideFormText() {
	var _inputs = document.getElementsByTagName('input');
	var _txt = document.getElementsByTagName('textarea');
	var _value = [];

	if (_inputs) {
		for(var i=0; i<_inputs.length; i++) {
			if (_inputs[i].type == 'text' || _inputs[i].type == 'password') {

				_inputs[i].index = i;
				_value[i] = _inputs[i].value;

				_inputs[i].onfocus = function(){
					if (this.value == _value[this.index])
						this.value = '';
				}
				_inputs[i].onblur = function(){
					if (this.value == '')
						this.value = _value[this.index];
				}
			}
		}
	}
	if (_txt) {
		for(var i=0; i<_txt.length; i++) {
			_txt[i].index = i;
			_value['txt'+i] = _txt[i].value;

			_txt[i].onfocus = function(){
				if (this.value == _value['txt'+this.index])
					this.value = '';
			}
			_txt[i].onblur = function(){
				if (this.value == '')
					this.value = _value['txt'+this.index];
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", hideFormText, false);
else if (window.attachEvent)
	window.attachEvent("onload", hideFormText);



function initNav() {
	initNavIndexes();
}
function initNavIndexes()
{
	var nav = document.getElementById("add-nav");
	if(nav) {
		var lis = nav.getElementsByTagName("li");
		for (var i=0; i<lis.length; i++) {
			//lis[i].style.zIndex = i+1;
			lis[i].style.zIndex = lis.length-i;
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initNav, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initNav);

ddsmoothmenu.init({
	mainmenuid: "top-nav-container", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})


function mycarousel_initCallback(carousel)
{
	carousel.buttonPrev.hide();
	carousel.buttonNext.hide();

	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('mouseover', function() {
		carousel.buttonNext.show();
		carousel.buttonPrev.show();
	});

	carousel.buttonNext.bind('mouseover', function() {
		carousel.buttonNext.show();
		carousel.buttonPrev.show();
	});

	carousel.clip.bind('mouseover', function() {
		carousel.buttonNext.show();
		carousel.buttonPrev.show();
	});

	carousel.clip.bind('mouseout', function() {
		carousel.buttonNext.hide();
		carousel.buttonPrev.hide();
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

jQuery(document).ready(function() {
	jQuery('#primarylistingcarousel').jcarousel({
		wrap: 'circular',
		vertical: true,
		itemFallbackDimension: 351,
		auto: 3,
		scroll: 1,
		initCallback: mycarousel_initCallback
	});
});
jQuery(function(){
	jQuery('.y-slide-out-div').tabSlideOut({
		tabHandle: '.handle',                     //class of the element that will become your tab
		pathToTabImage: '/legacy/shared/images/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
		imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
		imageWidth: '40px',                       //width of tab image            //Optionally can be set using css
		tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
		speed: 300,                               //speed of animation
		action: 'click',                          //options: 'click' or 'hover', action to trigger animation
		topPos: '200px',                          //position from the top/ use if tabLocation is left or right
		leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
		fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
	});
});
