var selectedMenus = new Array();
var cycleSettings = { timeout: 2000, speed: 'slow' };

/** rotate images for hp **/
$(document).ready(function() {
	PreloadImages();
    // set the menu items to the over src that are in the selected menus array
    $(selectedMenus).each(function(i, image) {
        imgSelector = 'img[src$="images/' + image + '"]';
        if ($(imgSelector).length > 0) {
            newSrc = $(imgSelector).attr('current') ? $(imgSelector).attr('current') : $(imgSelector).attr('over');
            $(imgSelector).attr('src', newSrc).removeAttr('over').removeAttr('current');
        }
    });

    $('#featureImg').cycle(cycleSettings);
    aLightBox = $('a.lightbox');
    if (aLightBox.length > 0) aLightBox.prettyPhoto();
});

/** image roll over **/
function PreloadImages() {
	$('img[over], input[over]').each(function() {
		$('<img />').attr('src', $(this).attr('over'));
		$(this).mouseover(function() {
			$(this).attr('out', $(this).attr('src'));
			$(this).attr('src', $(this).attr('over'));
		});
		$(this).mouseout(function() {
			$(this).attr('src', $(this).attr('out'));
		});
	});
}

/** search field **/
function SearchClicked() {
	if ($('#searchField').val() == 'Search') $('#searchField').val('');
}

function SearchLeft() {
	if ($('#searchField').val() == '') $('#searchField').val('Search');
}

/** ads **/
function AdUrl(a, id, url) {
    $(a).attr('href', '/url.php?a=' + id + '&b=' + url).attr('target', '_blank');
    return false;
}
