var $j = jQuery.noConflict();
$j(document).ready(function($) {
		$j('#chromemenu li').hover(function(event){
			
			$j('img', this).show();
			pos = $j('a', this).offset();
			
			if($j('a', this).attr('rel') != ''){
				menu = $j('#'+ $j('a', this).attr('rel'));
				leftextra = ($j.browser.mozilla) ? 2 : 3;
				rightextra = ($j.browser.mozilla) ? 100 : 101;
				topextra = ($j.browser.msie) ? 3 : 0;
				
				if($j('a', this).attr('rel') == 'Toerisme'){
					menu.css({ left: (pos.left-rightextra)+'px', top: (pos.top+29+topextra)+'px' });
					$j('.dropdownbottom').css({ left: (pos.left-rightextra)+'px', top: ((pos.top+49+topextra) + menu.height())+'px' });
				}else{
					menu.css({ left: (pos.left-leftextra)+'px', top: (pos.top+29+topextra)+'px' });
					$j('.dropdownbottom').css({ left: (pos.left-leftextra)+'px', top: ((pos.top+49+topextra) + menu.height())+'px' });
				}
				$j('.dropdownbottom').show();
				menu.show();
			}
		}, function(event){
			
			if( navigator.userAgent.match(/Android/i) ||
				navigator.userAgent.match(/webOS/i) ||
				navigator.userAgent.match(/iPhone/i) ||
				navigator.userAgent.match(/iPod/i)
			){
				// do nothing
			}
			else
			{
				$j('img', this).hide();
				if($j('a', this).attr('rel') != ''){
					menu = $j('#'+ $j('a', this).attr('rel'));
					target = ($j.browser.msie) ? event.toElement.id : event.relatedTarget.id;
					if(target != $j('a', this).attr('rel')){
						menu.hide();
						$j('.dropdownbottom').hide();
						$j('a', this).removeClass('activemenu');
					} else {
						$j('img', this).show();
						$j('a', this).addClass('activemenu');
					}
				}			
			}
		});
		
		$j('.menuleftcornerimg, .menurightcornerimg').hover(function(){
			$j(this).siblings('a').addClass('activemenu')
		}, function(){
			$j('a.activemenu').removeClass('activemenu');
		})
				
		$j('.dropmenudiv').mouseout(function(event){
			if(!$j(event.relatedTarget).hasClass('menuopt')){
				$j('.menuleftcornerimg, .menurightcornerimg').hide();
				$j('a.activemenu').removeClass('activemenu');
				$j('.dropdownbottom').hide();
				$j(this).hide();
			}
		});
		
		//cssdropdown.startchrome("chromemenu")
		//$j("#entry_L img").lazyload({
		//	effect: "fadeIn"
		//});
		
		//goto detail
		$j(".list_object").click(function(){
			$j("#goto_detail").attr("action",$j(this).attr("rel"));
			$j("#goto_detail").submit();
		});
		
		//goto bekeken_link detail
		$j(".bekeken_link").click(function(){
			$j("#goto_detail_bekeken").attr("action",$j(this).attr("rel"));
			$j("#goto_detail_bekeken").submit();
		});
		
		//contact sectie
		$j('.yourmessage').keyup(function(){
			$j('#sendmessage').val($j('.yourmessage').val());
		});
		
		//home-offers
		$j(".aanbiedingen_object").click(function(){
			window.location=$j(this).attr('rel');
		});
		
		$j('.kenmerken').css('cursor','pointer');
        $j('.kenmerken').click(function(){
          //alert('.'+$(this).attr('id')+'_con');
          if($j('.'+$j(this).attr('id')+'_con').css('display')=='none'){
            $j('.'+$j(this).attr('id')+'_con').slideDown();
          }else
          {
            $j('.'+$j(this).attr('id')+'_con').slideUp();
          }
        });
        $j('.kenmerken_con').hide();
});	

function switch_bekeken_filter(xvar,xvar2){
	if($j('#'+xvar).css("display")=="none"){
		$j('#'+xvar2).fadeOut("slow");
		$j('#'+xvar2).slideUp("slow", function() { setTimeout("$j('#"+xvar+"').slideDown('slow')", 300) } );
		
	}else
	{
		$j('#'+xvar).fadeOut("slow");
		$j('#'+xvar).slideUp("slow", function() { setTimeout("$j('#"+xvar2+"').slideDown('slow')", 300) } );
		
	}
}

function adv_search_off(){
    txt="<div onclick=\"adv_search_show();\" id=\"uitgebreid_zoeken\">&nbsp;</div>";
	$j('#adv_search_form').slideUp("slow",function(){
		$j('#adv_search_form').html(txt);$j('#adv_search_form').fadeIn("slow");
	});	
}

function addbookmark(url_path, shortname) {
	bookmarkurl = url_path;
	bookmarktitle="Uphill - " + shortname;
	if (window.sidebar) {
	window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
	} else if (window.external) {
	window.external.AddFavorite(bookmarkurl,bookmarktitle);
	} else {
	return true;
	}
}

function adv_search_show(){
  load_data(jQuery('#adv_search_show_txt').html(),"adv_search_show");
}
