﻿/*
 * (c) Kainos Software Ltd, 2008
 * EVENTELEPHANT CUSTOM LIBRARY FUNCTIONS
 */
 
// Toggle More Search Options
var moreOptsHidden = true;
function toggleMoreOpts() {
    if ( moreOptsHidden ) {
        $("#more-search-opts").show("medium");
        document.getElementById("more-opts-arrow").src = "/images/adv-min.gif";
        moreOptsHidden = false;
    } else {
        $("#more-search-opts").hide("medium");
        document.getElementById("more-opts-arrow").src = "/images/adv-plus.gif";
        moreOptsHidden = true;
    }
}

$(function() {
if ($("select#ctl00_MainBodyContent_ddSearchType") !=null){
	$("select#ctl00_MainBodyContent_ddSearchType").change(function() {
	    var value = $("select#ctl00_MainBodyContent_ddSearchType").val();
	    
	    if (value != "") {
	        $.getJSON("/js/eventtypes.aspx", { id: $(this).val() }, function(j) {
	            var selVal = $("select#ctl00_MainBodyContent_ddSearchType option:selected").text();
	            var options = '<option value="">-- Any ' + selVal + ' --</option>';
		        for (var i = 0; i < j.length; i++) {
				    options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
		        }
		        $("#ddSubType").html(options);
		        $('#ddSubType option:first').attr('selected', 'selected');
	        })
	    } else {
	        $("#ddSubType").html('<option value="">-- Any --</option>');
	    }
    })
}
})

/*
 * CSS Browser Selector v0.2.7
 * Rafael Lima (http://rafael.adm.br)
 * http://rafael.adm.br/css_browser_selector
 * License: http://creativecommons.org/licenses/by/2.5/
 * Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
var css_browser_selector = function() {
	var 
		ua = navigator.userAgent.toLowerCase(),
		is = function( t ) { return ua.indexOf( t ) != -1; },
		h = document.getElementsByTagName( 'html' )[0],
		b = ( !(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ('ie ie' + RegExp.$1 ) : is('gecko/') ? 'gecko' : is('opera/9') ? 'opera opera9' : /opera (\d)/.test(ua) ? 'opera opera' + RegExp.$1 : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko':'',
		os = ( is('x11') || is('linux') ) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win':'';
	var c = b + os + ' js';
	h.className += h.className ? ' ' + c : c;
}();

function handleSpotlight(loc) {
    location.href = "/" + loc;
}


  

