jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};

var LastSearchUrl;
var Zoek = [];
var map = null;
var geocoder = null;
var markers=new Array(15);
var ClickDisabled = false;
var LastClicked   = 0;
var count         = 0;


var positions = [];

$(document).ready(function(){

    
    
    
    
SetResSize();

$(window).bind("resize", resizeWindow);   


                       GetPositions(); 
                      SetAbsolute();  

      $(".seloption").hide(); 
        
     $(".optselected").mouseover(
      function () { 
       $(this).parent().find(".seloption").slideToggle('fast').show();
       $("#" + $(this).attr('name')).addClass("shadow");
     }); 
     
        
        $(".extraoptie").hover(function() {
        $(this).parent().find(".seloption").stop(true, true);
        }, function(){
           $(this).parent().find(".seloption").delay(5).queue(function () {
           $(this).slideUp('fast').hide();
           $("#" + $(this).parent().find(".optie").attr('name')).removeClass("shadow");
           
                         $(".extraoptie").each(function (i) {
                         $(this).show();   
                        
                        });
           
  
           });
              
             

        });                        


}); 





function GetPositions()
{
    
                             $(".extraoptie").each(function (i) {
                            
                                 var offset = $(this).offset();
                                 offset.id  = $(this).attr('id');
                                 offset.w   = $(this).width()+10;
                                 
                                 if($(this).attr('id') == 'sort')
                                 {
                                  offset.left-=91;   
                                 }

                                 positions[i] = offset;
                                 $(this).css("z-index", 2000-i);
				 
				 
				 if($(this).attr('id') == 'zoekcri')
                                 {
                                  $(this).css("z-index", 10);   
                                 }
                        });
                                                
}

function SetNormal()
{
  $.each(positions, function(k, pos)
  {
   if($("#" + pos.id).css("position") == 'absolute')
   {   
    $("#" + pos.id).css("position", "relative"); 
    $("#" + pos.id).removeAttr("style");
    
    
   }
});   
    
}



function SetAbsolute()
{
  $.each(positions, function(k, pos)
  {                                     
   $("#" + pos.id).css("width", pos.w + "px");
                          
                                 if($(this).attr('id') == 'sort')
                                 {
                                  $("#" + pos.id).css("z-index", 1000);
                                  
                                  $("#" + pos.id).offset({ top: $("#zoekoptiesbv").height()+126, left: pos.left+91-185});   
                                 }
                                 else
                                 {
                                   $("#" + pos.id).offset({ top: pos.top, left: pos.left });  
                                 }
                                 
   $("#" + pos.id).css("position", "absolute");
   

});
            
    
}

function resizeWindow(e)
{
 
 
 SetNormal();
 $("#zoekres").css("width", "685px");
 GetPositions();
 
 SetResSize();
 
 SetAbsolute();
}         
function SetResSize()
{
    //$("#zoekres").css("width", ($("#zoekres").width()- 205) + "px");
    
    $("#zoekoptiesbv").css("height", ($("#stdata2").height()+25) + "px"); 
}


function ShowReclame()
{
 $.get("/classes/class.reclame.php", {plaatsnaam:Zoek['plaats'],l:Zoek['l'],kohubo:Zoek['kohubo']},
  function(data){
    $(".reclameclass").html(data);
  });
  
   $.get("/classes/class.reclamerank1.php", {plaatsnaam:Zoek['plaats'],l:Zoek['l'],kohubo:Zoek['kohubo']},
  function(data){
    $(".reclameclassrank1").html(data);
  });
  
}

function isset(  ) {
    var a=arguments; var l=a.length; var i=0;
    
    if (l==0) { 
        throw new Error('Empty isset'); 
    }
    
    while (i!=l) {
        if (typeof(a[i])=='undefined' || a[i]===null) { 
            return false; 
        } else { 
            i++; 
        }
    }
    return true;
}

 
setInterval("ShowReclame()",10000);
