$.fn.islink=function(c){$(this).css({'cursor':'pointer'}).click(function(){var r=$(this).attr('rel').split(',');var u=(c.url===undefined)?r[1]:c.url;var t=(c.target===undefined)?r[2]:c.target;if(r[3]!==undefined){var p=r[3].split('&');$('body').append($.create('form',{'method':'POST','action':u,'id':'islinkposter'},[]));$.each(p,function(k,v){var a=v.split('=');$('#islinkposter').append($.create('input',{'type':'hidden','name':a[0],'value':a[1]},[]))});$('#islinkposter').submit()}var u=(u===undefined)?'#':u;if(t=='_blank'||t=='blank'){window.open(u)}else{location.href=u}})};$.rand=function(c){if(typeof(c)!='object'||c.min===undefined||c.max===undefined){throw new Error('Warning: rand() expects exactly 2 parameters');}return Math.floor(Math.random()*(c.max-c.min+1))+c.min};$.chq=function(c){if(typeof(c)!='string'||c.length==0){return c}return c.replace('"','&quot;').replace("'",'&#39;').replace("`",'&#96;').replace('<','&lt;').replace('>','&gt;')};$.dechq=function(c){if(typeof(c)!='string'||c.length==0){return c}return c.replace('&quot;','"').replace("&#39;","'").replace("&#96;","`").replace("&acute;","`").replace('&lt;','<').replace('&gt;','>')};$.intval=function(v,b){var x,t=typeof(v);if(t==='boolean'){return(v)?1:0}else if(t==='string'){x=parseInt(v,b||10);return(isNaN(x)||!isFinite(x))?0:x}else if(t==='number'&&isFinite(v)){return Math.floor(v)}else{return 0}};$.is_numeric=function(v){return(typeof(v)==='number'||typeof(v)==='string')&&v!==''&&!isNaN(v)};$.in_array=function(a,b){var c='';for(c in b){if(b[c]==a){return true}}return false};$.isoverlap=function(c){var a=$.intval(c.obj.x),atly=$.intval(c.obj.y),atrx=($.intval(c.obj.x)+$.intval(c.obj.w)),atry=$.intval(c.obj.y),ablx=$.intval(c.obj.x),ably=($.intval(c.obj.y)+$.intval(c.obj.h)),abrx=($.intval(c.obj.x)+$.intval(c.obj.w)),abry=($.intval(c.obj.y)+$.intval(c.obj.h)),btlx=$.intval(c.over.x),btly=$.intval(c.over.y),btrx=($.intval(c.over.x)+$.intval(c.over.w)),btry=$.intval(c.over.y),bblx=$.intval(c.over.x),bbly=($.intval(c.over.y)+$.intval(c.over.h)),bbrx=($.intval(c.over.x)+$.intval(c.over.w)),bbry=($.intval(c.over.y)+$.intval(c.over.h)),tl=false,tr=false,bl=false,br=false,up=false,under=false;if((a>=btlx&&a<=btrx)&&(atly>=btly&&atly<=bbly)){tl=true}if((atrx>=btlx&&atrx<=btrx)&&(atry>=btry&&atry<=bbry)){tr=true}if((ablx>=bblx&&ablx<=bbrx)&&(abry>=btry&&abry<=bbry)){bl=true}if((abrx>=bblx&&abrx<=bbrx)&&(abry>=btry&&abry<=bbry)){br=true}up=(tl===true||tr===true||bl===true||br===true)?true:false;if((btlx>=a&&btlx<=atrx)&&(btly>=atly&&btly<=ably)){under=true}if((btrx>=a&&btrx<=atrx)&&(btry>=atry&&btry<=abry)){under=true}if((bblx>=ablx&&bblx<=abrx)&&(bbry>=atry&&bbry<=abry)){under=true}if((bbrx>=ablx&&bbrx<=abrx)&&(bbry>=atry&&bbry<=abry)){under=true}return{'tl':tl,'tr':tr,'bl':bl,'br':br,'up':up,'under':under}};$.define=function(a,b){if(eval("window."+a.toUpperCase())!==undefined)throw new Error('Warning: global value '+a.toUpperCase()+' already exists');var c=(typeof b=='number'&&isFinite(b))?"window."+a.toUpperCase()+" = "+b+";":"window."+a.toUpperCase()+" = '"+b+"';";eval(c)};$.fn.validate=function(c){c.outputtarget=(c.outputtarget===undefined)?$(this):c.outputtarget;c.output=(c.output===undefined)?'alert':c.output;c.onchange=(c.onchange===undefined)?false:c.onchange;c.defaultmsg=(c.defaultmsg===undefined)?'Form field value error':c.defaultmsg;c.callback=(c.callback===undefined)?false:c.callback;c.sendmsg=(c.sendmsg===undefined)?false:c.sendmsg;var o=$(this);$(this).submit(function(e){var a=new Array(),response,array,form=$(this);$(this).find('input[type!=submit][type!=radio][rel], input[type=radio][rel]:checked, select[rel], textarea[rel]').each(function(){response=$(this).validationtype({});if(response!==true){if(typeof(response)==='object'){a=a.concat(response)}else{a.push(response)}}});if(a.length>0){$.validateoutput({'msg_stack':a,'output':c.output,'target':c.outputtarget})}if(c.callback!==false&&a.length==0){eval(c.callback+';');if(c.sendmsg!==false){form.css({'overflow':'hidden','height':form.height()}).animate({'opacity':0,'height':0},'slow','linear',function(){form.parent().append('<div class="form_succes_msg">'+c.sendmsg+'</div>');form.remove();$.reset()})}return false}else{return(a.length==0)?true:false}});if(c.onchange===true){$(this).find('input[type!=submit][rel], select[rel], textarea[rel]').each(function(){$(this).blur(function(){var a=new Array(),response,array;response=$(this).validationtype({'defaultmsg':c.defaultmsg});if(response!==true){if(typeof(response)==='object'){a=a.concat(response)}else{a.push(response)}}if(a.length>0){$.validateoutput({'msg_stack':a,'output':c.output,'target':c.outputtarget})}})})}};$.validateoutput=function(c){c.msg_stack=(c.msg_stack===undefined||typeof(c.msg_stack)!=='object')?('form field error'):c.msg_stack;c.output=(c.output===undefined)?'alert':c.output;c.target=(c.target===undefined)?$('body').find('div:first'):c.target;var a='';switch(c.output){case'alert':$.each(c.msg_stack,function(i,x){a+='- '+x.msg+"\r\n"});alert(a);break;case'list':if($('#validateoutput').length!=-1){$('#validateoutput').remove()}if(c.target.css('display')=='none'||c.target.css('opacity')==0){c.target.css({'display':'block','opacity':1})}if(c.target.html().length==0){c.target.append($.create('div',{'id':'validateoutput'},[]))}else{c.target.find('*:first').prepend($.create('div',{'id':'validateoutput'},[]))};$.each(c.msg_stack,function(i,x){$('#validateoutput').html($('#validateoutput').html()+x.msg+'<br/>')});break;case'pops':$.each(c.msg_stack,function(i,x){$('body').append($.create('div',{'id':'validateoutput_'+x.name,'class':'validateoutput_cntr'},[$.create('div',{'class':'validateoutput_content'},[]),$.create('div',{'class':'validateoutput_end'},[])]));$('#validateoutput_'+x.name+' > .validateoutput_content').html(x.msg);$('#validateoutput_'+x.name).css({'top':x.pos.top+'px','left':x.pos.left+'px'})});break}};$.fn.validationtype=function(c){var d=($(this).is(':checked'))?'true':'false';var e=new Array();var v;var f;var g;g=$(this);f=($(this).attr('alt').length<=2&&c.defaultmsg!==undefined)?c.defaultmsg:$(this).attr('alt');var h={'name':$(this).attr('name'),'value':$.trim($(this).val()),'rel':$(this).attr('rel'),'alt':f},form;h.rel=(c.forcedrel===undefined)?h.rel:c.forcedrel;$(this).parents().each(function(){if($(this).attr('tagName')=='FORM'){form=$(this)}});pos={'top':$(this).offset().top,'left':(form.offset().left+form.width())};$.each(h.rel.split(','),function(i,x){if(x.indexOf('[')>=0&&x.indexOf(']')>=0){var a=x.split(']'),istrue=false;var b=a[1].split(' then ');c.forcedrel=b[0];a=a[0].replace('[','').replace('if ','');if(x.indexOf('if ')>=0){istrue=true;if($('[name='+a+']').validationtype(c)===true){c.forcedrel=b[1];istrue=g.validationtype(c)}}else{istrue=$('[name='+a+']').validationtype(c)}if(istrue!==true)e.push({'msg':h.alt,'pos':pos,'name':h.name})}else{v=x.split(':'),istrue=false;if(v[0]=='len'){istrue=$.validations().len({'check':v[1],'value':h.value})}else if(v[0]=='val'){istrue=$.validations().val({'check':v[1],'value':h.value})}else if(v[0]=='type'){istrue=$.validations().type({'check':v[1],'value':h.value,'checked':d})}if(istrue===false)e.push({'msg':h.alt,'pos':pos,'name':h.name})}});if($('#validateoutput_'+h.name).length!=-1){$('#validateoutput_'+h.name).remove()}return(e.length>0)?e:true};$.validations=function(){var v;var g;var h;var i;return{len:function(d){if(d.check.match(/[><!=]/g)){g=d.check.substr(0,1)+'=';v=d.check.substr(1)}else{g='==';v=d.check}var a=($.is_numeric(v))?'d.value.length '+g+' '+v:'d.value.length '+g+' "'+v+'"';return(eval(a))?true:false},val:function(d){if(d.check.match(/[><!=]/g)){g=d.check.substr(0,1)+'=';v=d.check.substr(1)}else{g='==';v=d.check}var a=($.is_numeric(v))?'d.value '+g+' '+v:'d.value '+g+' "'+v+'"';return(eval(a))?true:false},type:function(d){if(d.check.indexOf('checkbox')!=-1){i=d.check.split('(');h=i[1].replace(')','');d.check=i[0]}if(d.check.indexOf('zipp')!=-1){i=d.check.split('(');h=i[1].replace(')','');d.check=i[0]}if(d.check.indexOf('file')!=-1){i=d.check.split('(');h=i[1].replace(')','');d.check=i[0]}if(d.check.indexOf('date')!=-1){i=d.check.split('(');h=i[1].replace(')','');d.check=i[0]}switch(d.check){case'tel':return($.validations().len({'check':'>10','value':d.value})!==false&&d.value.match(/[^0-9\s-]/ig)===null)?true:false;break;case'mail':return($.validations().len({'check':'>6','value':d.value})!==false&&d.value.match(/[^@.a-z0-9]/ig)===null&&d.value.match(/[@]/ig)!==null&&d.value.match(/[.]/ig)!==null)?true:false;break;case'checkbox':return(h==d.checked)?true:false;break;case'zipp':var c=true;d.value=d.value.replace(' ','');for(var z=0;z<d.value.length;z++){if(h[z].toLowerCase()=='x'&&d.value[z].match(/[^a-z]/ig)!==null){c=false}else if(h[z].toLowerCase()=='0'&&d.value[z].match(/[^0-9]/ig)!==null){c=false}}return($.validations().len({'check':'='+d.value.length,'value':h})!==false&&c!==false)?true:false;break;case'date':var c=true;d.value=d.value.replace(' ','');for(var z=0;z<d.value.length;z++){if(h!==undefined&&h[z]!==undefined&&h[z].toLowerCase()=='-'&&d.value[z]!='-'){c=false}else if(h[z].toLowerCase()=='x'&&d.value[z].match(/[^0-9]/ig)!==null){c=false;alert('false 0 ')}}return($.validations().len({'check':'='+h.length,'value':d.value})!==false&&c!==false)?true:false;break;case'file':var e=false;var f=d.value.split('.');f=f[f.length-1];$.each(h.split(','),function(a,b){if(b==f.trim().toLowerCase()){e=true}});return($.validations().len({'check':'='+d.value.length,'value':h})!==false&&e===true)?true:false;break}}}};$.urlencode=function(a){a=(a+'').toString();return encodeURIComponent(a).replace(/!/g,'%21').replace(/'/g,'%27').replace(/\(/g,'%28').replace(/\)/g,'%29').replace(/\*/g,'%2A')};$.urldecode=function(a){return decodeURIComponent(a)};$.fn.tool=function(c){c.msg=(c.msg===undefined||c.msg.length==0)?'No text':c.msg;c.margin=(c.margin===undefined)?5:$.intval(c.margin);c.fade=(c.fade===undefined||typeof(c.fade)!='boolean')?true:c.fade;c.track=(c.track===undefined||typeof(c.track)!='boolean')?true:c.track;c.html=(c.html===undefined||c.html.indexOf('%msg%')!=-1)?'<div id="jquerytooltip"><div class="jquerytooltip_top">&nbsp;</div><div class="jquerytooltip_middle"><div class="jquerytooltip_cnt">%msg%</div></div><div class="jquerytooltip_bottom">&nbsp;</div></div>':c.html;$(this).css({'cursor':'pointer'});$(this).mouseenter(function(e){var a=$(this);$('#jquerytooltipcontainer').stop();if($('#jquerytooltipcontainer').length<=0){$('body').append('<div id="jquerytooltipcontainer">&nbsp;</div>')}$('#jquerytooltipcontainer').css({'position':'absolute','top':(e.pageY+a.height()+c.margin)+'px','left':(e.pageX+a.width()+c.margin)+'px','opacity':0,'zIndex':999});content=c.html.replace('%msg%',c.msg);$('#jquerytooltipcontainer').html(content);if(c.fade===true){$('#jquerytooltipcontainer').animate({'opacity':1},'slow')}else{$('#jquerytooltipcontainer').css({'opacity':1})}}).mouseleave(function(e){if(c.fade===true){$('#jquerytooltipcontainer').animate({'opacity':0},'slow','linear',function(){$('#jquerytooltipcontainer').remove()})}else{$('#jquerytooltipcontainer').remove()}});if(c.track===true){$(this).mousemove(function(e){var a=$(this);if($('#jquerytooltipcontainer').length>0){$('#jquerytooltipcontainer').css({'top':(e.pageY+a.height()+c.margin)+'px','left':(e.pageX+a.width()+c.margin)+'px'})}})}};$.decode64=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var c,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,dec="",tmp_arr=[];if(!a){return a}a+='';do{h1=b.indexOf(a.charAt(i++));h2=b.indexOf(a.charAt(i++));h3=b.indexOf(a.charAt(i++));h4=b.indexOf(a.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;c=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64){tmp_arr[ac++]=String.fromCharCode(c)}else if(h4==64){tmp_arr[ac++]=String.fromCharCode(c,o2)}else{tmp_arr[ac++]=String.fromCharCode(c,o2,o3)}}while(i<a.length);dec=tmp_arr.join('');dec=$.decodeutf8(dec);return dec};$.decodeutf8=function(a){var b=[],i=0,ac=0,c1=0,c2=0,c3=0;a+='';while(i<a.length){c1=a.charCodeAt(i);if(c1<128){b[ac++]=String.fromCharCode(c1);i++}else if((c1>191)&&(c1<224)){c2=a.charCodeAt(i+1);b[ac++]=String.fromCharCode(((c1&31)<<6)|(c2&63));i+=2}else{c2=a.charCodeAt(i+1);c3=a.charCodeAt(i+2);b[ac++]=String.fromCharCode(((c1&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}return b.join('')};$.reset=function(){var a=($(document).width()>$(window).width())?$(document).width():$(window).width();var b=($(document).height()>$(window).height())?$(document).height():$(window).height();$('.body').css({'height':b})};$.showform=function(){if($('#frm_rest').height()<30){$('#frm_rest').animate({'height':$('#frm_rest').attr('rel'),'opacity':1},'slow','linear',function(){$.reset();$('#frm_rest').css({'filter':'none'})})}};$.changetitle=function(i,a){var b=[a,"City Wars: Schrijf je snel in!","City Wars: "+$.decode64($('meta[http-equiv=t_msg]').attr('content'))];document.title=b[i];i=(i+1>=b.length)?0:i+1;setTimeout(function(){$.changetitle(i,a)},6000)};$.sendform=function(c,d){var e='';$(c).find('input[type!=submit][type!=radio], input[type=radio]:checked, select, textarea').each(function(){e+=$(this).attr('name')+'='+$(this).val()+'&'});e=e.substr(0,e.length-1);$.ajax({type:'POST',url:d,data:e,dataType:'xml',success:function(a){var b=$(a).find('response').text()}})};$.fn.sprite=function(c){c.start=(c.start===undefined||typeof(c.start)!='object')?false:c.start;c.end=(c.end===undefined||typeof(c.end)!='object')?{}:c.end;c.speed=(c.speed===undefined)?0:$.intval(c.speed);c.interval=(c.interval===undefined)?0:c.interval;c.repeat=(c.repeat===undefined||typeof(c.repeat)!='boolean')?true:c.repeat;var a=$(this);if(c.start!==false){a.css(c.start)}if(c.repeat===true){a.animate(c.end,c.speed,'linear',function(){setTimeout(function(){a.sprite(c)},c.interval)})}else{a.animate(c.css,c.duration)}};$.logofloat=function(c){c.logo=(c.logo===undefined)?false:c.logo;c.origin=(c.origin===undefined)?false:c.origin;c.height=(c.height===undefined)?200:c.height;c.anim=(c.anim===undefined)?false:c.anim;c.cntr=(c.cntr===undefined)?0:c.cntr;c.interval=(c.interval===undefined)?2000:c.interval;if(c.anim===false){$(c.origin).css({'marginTop':c.height+'px'});$(c.logo).each(function(e){var a=$(this);$('body').append($.create('img',{'src':a.attr('src'),'class':a.attr('class'),'rel':a.width()+'x'+a.height(),'id':'logofloatcounter-'+e},[]));a.remove();$('#logofloatcounter-'+e).css({'width':'0px','height':'0px','opacity':0,'position':'absolute','float':'left','zIndex':'200','left':($(c.origin).offset().left+($(c.origin).width()/2))+'px','top':($(c.origin).offset().top-50)+'px'})})}var b=$('#logofloatcounter-'+c.cntr).attr('rel').split('x');$('#logofloatcounter-'+c.cntr).animate({'width':b[0],'height':b[1],'opacity':1,'top':($(c.origin).offset().top-c.height)+'px','left':(($(c.origin).offset().left+($(c.origin).width()/2))-(b[0]/2))+'px'},3000,'linear',function(){$('#logofloatcounter-'+c.cntr).animate({'opacity':0},'slow','linear',function(){$('#logofloatcounter-'+c.cntr).css({'width':'0px','height':'0px','opacity':0,'left':($(c.origin).offset().left+($(c.origin).width()/2))+'px','top':($(c.origin).offset().top-50)+'px'});c.anim=true;c.cntr=(c.cntr<$(c.logo).length-1)?c.cntr+1:0;setTimeout(function(){$.logofloat(c)},c.interval)})})};$(document).ready(function(){if($('#signup').length>0){$('#frm_rest').attr({'rel':$('#frm_rest').height()});$('#frm_rest').css({'height':0,'opacity':0,'overflow':'hidden'});$('[name=signup]').find('input').each(function(){$(this).focus(function(e){$.showform(e)})});$('#signupbtn').click(function(e){e.preventDefault();$('html,body').animate({scrollTop:$('#signup').offset().top},'slow');$.showform()});$('[name=signup]').validate({'callback':"$.sendform('[name=signup]','http://www.citywars.nl/save.php')",'sendmsg':'Je aanvraag is verzonden.'})}$.changetitle(0,document.title);if($('meta[http-equiv=u_name]').length>0){window.U_NAME=$.decode64($('meta[http-equiv=u_name]').attr('content'))}$('#cloud_1').sprite({'end':{'left':($(window).width()+$('#cloud_1').width()+20)+'px'},'speed':80000,'interval':2000,'repeat':true});$('#cloud_2').css({'left':'-300px'});setTimeout(function(){$('#cloud_2').sprite({'start':{'left':'-300px'},'end':{'left':($(window).width()+$('#cloud_1').width()+20)+'px'},'speed':80000,'interval':1000,'repeat':true})},12000);if($('#logosource').length>0){$.logofloat({logo:'.hill-logo',origin:'#logosource',height:300})}$.reset()});
