;(function($){$.fn.serializeObject=function()
{var o={};var a=this.serializeArray();$.each(a,function(){if(o[this.name]){if(!o[this.name].push){o[this.name]=[o[this.name]];}
o[this.name].push(this.value||'');}else{o[this.name]=this.value||'';}});return o;};})(jQuery);;if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());;$("#javascript_check").hide();$(document).ready(function(){$(".fg-button:not(.ui-state-disabled)").hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");if($(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active')){$(this).removeClass("ui-state-active");}
else{$(this).addClass("ui-state-active");}}).mouseup(function(){if(!$(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button')){$(this).removeClass("ui-state-active");}});$("input[id*='link_']").change(function(){var id=this.id.split("_")[1];$("#linked_"+id).show();});$("input[id*='unlink_']").change(function(){var id=this.id.split("_")[1];$("#linked_"+id).hide();});$(".datepicker").datepicker({beforeShow:function checkbirthday(input){if(input.id=='datepicker-birthday'){return{changeYear:true,changeMonth:true,defaultDate:'c-30y',yearRange:'c-60:c+20'};};},numberOfMonths:1,showButtonPanel:true,dateFormat:'yy-mm-dd',buttonImage:'images/calendar.gif',closeText:'X',buttonImageOnly:true,onSelect:function(dateText){var id=this.id.split("-")[1];$("#"+id+"_DIV").html(dateText);var parenttag=$(this).closest('form').attr('id');$("#"+parenttag+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_INFO").html('').removeAttr('class');$("#"+parenttag).closest("td").addClass("border_bm");$("#nullval\\|"+id).toggle();},showOn:'button'});$("input[type=radio]").click(function(){var parenttag=$(this).closest('form').attr('id');$("#"+parenttag+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_INFO").html('').removeAttr('class');$("#"+parenttag).closest("td").addClass("border_bm");});$("input[type=text],input[type=password]").keyup(function(){var parenttag=$(this).closest('form').attr('id');$("#"+parenttag+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_INFO").html('').removeAttr('class');$("#"+parenttag).closest("td").addClass("border_bm");});$("select").change(function(){var parenttag=$(this).closest('form').attr('id');$("#"+parenttag+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parenttag+"_INFO").html('').removeAttr('class');$("#"+parenttag).closest("td").addClass("border_bm");});$("tr[id*=formheader]").click(function(){var name=this.id.split("|")[1];$("#"+name).toggle();var innertext=$("#"+name).attr("style");if(innertext==''||innertext=='display: block;'||innertext=="DISPLAY: block"){$("#"+name+"_EXT").html(CLOSE_DIV+" \u25B2");}
if(innertext=="display: none;"||innertext=="DISPLAY: none"){$("#"+name+"_EXT").html(OPEN_DIV+" \u25BC");}});$("td[id*=formheader]").live('click',function(){var name=this.id.split("|")[1];$("#"+name).toggle();var innertext=$("#"+name).attr("style");if(innertext==''||innertext=='display: block;'||innertext=="DISPLAY: block"){$("#"+name+"_EXT").html("\u25BC");}
if(innertext=="display: none;"||innertext=="DISPLAY: none"){$("#"+name+"_EXT").html("&#9658;");}});$("span[id*='remove_value']").click(function(){var parent=$(this).closest("form").attr("id");var value=this.id.split("|")[1];var where=this.id.split("|")[2];var textholder=this.id.split("|")[3];xajax_REMOVE_VALUE(parent,value,where,textholder);});$(".linked").click(function(){var value=this.id.split("|")[1];window.location.href=value;});$.fn.wait=function(time,type){time=time||1000;type=type||"fx";return this.queue(type,function(){var self=this;setTimeout(function(){$(self).dequeue();},time);});};$(".tabs").tabs();});function set_inner(ID,val){var item=document.getElementById(ID);if(item){item.innerHTML=val;}};function loading(ID){var item=document.getElementById(ID);if(item){item.innerHTML='<img src=images/ajax-loader_circle2.gif alt=loading>';}};function close_dialog(id){$("#"+id).dialog('close');};;$(document).ready(function(){var cache={},lastXhr;$(".search_gm").autocomplete({minLength:4,select:function(event,ui){if(ui.item&&ui.item.id!=undefined){window.location='item.php?cibnr='+ui.item.id+"&click=MORE_INFO|moreinfo|"+ui.item.id;}},source:function(request,response){var term=request.term;if(term in cache){response(cache[term]);return;}
lastXhr=$.getJSON("bin/autocomplete.php?type=gm",request,function(data,status,xhr){cache[term]=data;if(xhr===lastXhr){response(data);}});}});$(".search_gm").click(function(){$(".search_gm").val('').removeClass('grm').die("click");});$("div[id*='search_id']").click(function(){var parent=$(this).closest("form").attr("id");var inputid=this.id.split("|");var oldval=$("#"+parent+"_"+inputid[1]+"_VAL").html();$('#search_id\\|'+inputid).toggle();$("#fake-"+inputid[1]).autocomplete("bin/autocomplete_search.php",{extraParams:{id:1},minChars:2,matchSubset:1,matchContains:1,cacheLength:10,onItemSelect:selectItem,formatItem:formatItem,autoFill:false,selectFirst:true,mustMatch:1});});$("div[id*='search_village2']").click(function(){var parent=$(this).closest("form").attr("id");var inputid=this.id.split("|");var oldval=$("#"+parent+"_"+inputid[1]+"_VAL").html();$(this).hide();$("#"+parent+"_"+inputid[1]+"_VAL").html(oldval+"<br /> <input id=\"fake-"+inputid[1]+"\" name=\"fake_"+inputid[1]+"\" type=\"text\">");$("#fake-"+inputid[1]).autocomplete({autoFocus:true,minLength:3,select:function(event,ui){if(ui.item&&ui.item.id!=undefined){selectItem2(ui,inputid);}},source:function(request,response){var term=request.term;if(term in cache){response(cache[term]);return;}
lastXhr=$.getJSON("bin/autocomplete.php?village2=1",request,function(data,status,xhr){cache[term]=data;if(xhr===lastXhr){response(data);}});}});});$("div[id*='search_country']").click(function(){var parent=$(this).closest("form").attr("id");var inputid=this.id.split("|");var oldval=$("#"+parent+"_"+inputid[1]+"_VAL").html();$(this).hide();$("#"+parent+"_"+inputid[1]+"_VAL").html(oldval+"<br /> <input id=\"fake-"+inputid[1]+"\" name=\"fake_"+inputid[1]+"\" type=\"text\">");$("#fake-"+inputid[1]).autocomplete({autoFocus:true,minLength:2,select:function(event,ui){if(ui.item&&ui.item.id!=undefined){selectItem2(ui,inputid);}},source:function(request,response){var term=request.term;if(term in cache){response(cache[term]);return;}
lastXhr=$.getJSON("bin/autocomplete.php?country=1",request,function(data,status,xhr){cache[term]=data;if(xhr===lastXhr){response(data);}});}});});$("input[id*='lang']").autocomplete("bin/autocomplete_search.php",{extraParams:{language:1},minChars:2,matchSubset:1,matchContains:1,cacheLength:10,showvalue:true,autoFill:true,selectFirst:true,mustMatch:1});$("div[id*='search_']").each(function(){var inputid=this.id.split("|");var parent=$(this).closest("form").attr("id");var oldval=$("#"+parent+"_"+inputid[1]+"_VAL").html();if(oldval==""){$('#'+inputid[0]+'\\|'+inputid[1]).click();};});$("div[id*='del|']").click(function(){var field=this.id.split("|")[1];var type=this.id.split("|")[2];var parent=$(this).closest("form").attr("id");$("input[name='"+field+"']").val("");$("#"+parent+"_"+field+"_VAL").html("");$("#search_"+type+"\\|"+field).click();});});function formatItem(row,i,num,q){keywords=q.split(' ').join('|');return row[0].replace(new RegExp("("+keywords+")","gi"),'<b>$1</b>')+"\n"+row[1].replace(new RegExp("("+keywords+")","gi"),'<b>$1</b>')+"\n";}
function selectItem(li){if(li.extra!=""){var inputid=li.inputid.split("-")[1];$("#search_"+li.stype+"\\|"+inputid).toggle();var parent=$("input[name='"+inputid+"']").closest("form").attr("id");$("#"+parent+"_"+inputid+"_VAL").html(li.selectValue);$("input[name='"+inputid+"']").val(li.extra);$("#"+parent+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parent+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parent+"_INFO").html('').removeAttr('class');$("#"+parent).closest("td").addClass("border_bm");};}
function selectItem2(li,inputid_a){if(li.extra!=""){var inputid=inputid_a[1];$("#search_"+li.stype+"\\|"+inputid).toggle();var parent=$("input[name='"+inputid+"']").closest("form").attr("id");$("#"+parent+"_"+inputid+"_VAL").html(li.item.value);$("input[name='"+inputid+"']").val(li.item.id);$("#"+parent+"_submit").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parent+"_reset").removeAttr('disabled').removeClass('ui-state-disabled');$("#"+parent+"_INFO").html('').removeAttr('class');$("#"+parent).closest("td").addClass("border_bm");};}
function selectGMlink(li){if(li.extra!=""){$("#gm_idlinks_table tbody").append("<tr id="+li.extra+"><td><div onclick=\"$('#"+li.extra+"').remove();\" class=\"hand\"><img title=\"Verwijder\" src=\"images/cancel.png\" /></div><input type=\"hidden\" name=\"links_array[]\" value=\""+li.extra+"\"></td><td>"+li.extra+"</td><td>"+li.selectValue+"</td></tr>");var selected=$("#gm_idlinks_text").val();$("#gm_idlinks_text").val(selected+li.extra+";");$('#REF_ID_ERR').removeClass('ui-state-error ui-corner-all');$('#REF_ID_ERR').html('');};}
function formatItemCountry(row,i,num,q){keywords=q.split(' ').join('|');return"<img src='images/flags/"+row[1].toLowerCase()+".gif'>"+row[0].replace(new RegExp("("+keywords+")","gi"),'<b>$1</b>');}
