	
	
	// Browser selector
	function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
	
	// Main search
	function setSearchOptions(idElement){
		tot_option = 5;
		option		= document.getElementById('option-'+idElement);
		search_option = document.getElementById('searchoption');
		search_form = document.getElementById('search-keyword');
        if(idElement == 2)
            search_form.action='/marketplace/search';
        else if(idElement == 3)
            search_form.action='/classified/search';
        else if(idElement == 4)
            search_form.action='/tender/search';
        else if(idElement == 5)
            search_form.action='/blog/check';
        else
            search_form.action='/marketplace/search';

		for(i=2; i<=5; i++){
			if(i==idElement){
				option.className = 'selected';
				search_option.value=idElement;
			} else {
				document.getElementById('option-'+i).className = '';
			}
		}
	}

	function setCalendarButton(idHrefElement, idRadioElement){
        document.getElementById(idRadioElement).checked = true;
        var arr = document.getElementsByTagName("a");
            for (i = 0; i < arr.length; i++) {
               if(arr[i].className == 'eventSel') arr[i].className = 'event';
        }
        document.getElementById(idHrefElement).className = 'eventSel';
    }

	// Blur & Focus in search field
	function changeKeyword(obj){
		if (obj.value == "- Enter keyword -")
		{
			obj.value = "";
		}
				
		else if (obj.value.length < 1)
		{
			obj.value = "- Enter keyword -";
		}
	}
	
	function changeMinPrice(obj){
		if (obj.value == "- Min Price -")
		{
			obj.value = "";
		}
				
		else if (obj.value.length < 1)
		{
			obj.value = "- Min Price -";
		}
	}
	
	function changeMaxPrice(obj){
		if (obj.value == "- Max Price -")
		{
			obj.value = "";
		}
				
		else if (obj.value.length < 1)
		{
			obj.value = "- Max Price -";
		}
	}
	
	$(document).ready(function(){
						
		// Dropdown quick menu
		$("#quick-menu li a.expand").hover(function() {
			$(this).parent().next().stop().slideDown("fast").show("fast", function(){
				$(this).height("auto");
			});
		});
		
		$("#quick-menu li").hover(function() {
			if ( $(this).find("ul.dropdown").length > 0 ) {
			}
			} ,function () {
			$(this).find("ul.dropdown").slideUp("fast");
		});
				
		$('#category').sSelect({ddMaxHeight: '188px'});
		$('#status_id').sSelect({ddMaxHeight: '188px'});
		$('#category_id').sSelect({ddMaxHeight: '188px'});
		/*$('#country_id').sSelect({ddMaxHeight: '359px'});
		$('#city_id').sSelect({ddMaxHeight: '151px'});*/
		
		// Show &amp; hide company details
		$('.cdetails').hide();
		$('.toggle_details').click(function(){
			$(this).toggleClass('hd');
			$(this).text($(this).text() == 'Show Details' ? 'Hide Details' : 'Show Details');
			$(this).siblings('.cdetails').slideToggle(500);
		});
	});
