/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

//http://www.featureblend.com/license.txt
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";

function endintro() {
	$('.skip').fadeOut();
	$('#intro').delay(100).fadeOut();
	/*$('#border').fadeIn();*/
	/*$('#footer').fadeIn();*/
	$('#inner').fadeIn();
}

var _images = ["/img/sign.gif","/img/kulistrich.gif","/img/navi_0.gif","/img/navi_1.gif","/img/navi_2.gif","/img/navi_3.gif","/img/navi_4.gif","/img/navi_5.gif","/img/navi_6.gif","/img/navi_7.gif","/img/navi_8.gif","/img/navi_9.gif","/img/marker.png","/img/marker_on.png","/img/navi_bindestrich.gif","/img/navi_links.gif","/img/navi_rechts.gif",];
var gotime = _images.length;

$(document).ready(function() {
	//$(document)[0].oncontextmenu = function() {return false;}
	$('.skip').click(function() {
		return false;
	});			   
						   
	$.each(_images,function(e) {
		$(new Image()).load(function() {
			if (--gotime < 1) begin();
		}).attr('src',this);
	});
	
	function begin() {
		$("body").delay(300).fadeIn(300);
	}
	
	var so = new SWFObject("/img/intro.swf", "workerflash", "960", "620", "9", "#FFFFFF");
	so.addParam("allowscriptaccess", "always");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.write("intro");
	
	if(!FlashDetect.installed){
		endintro();
	}
});

$(function() {
	var activenum = 'navi_0';
	var activsenum;
	var pageshowed = true;
	var activesub;
	var activecontent = '/newsblog/';
	
	initModules();
	
	$('#imprint').click(function() {
		getContent(this);
		return false;
	});
	
	for (i = 0; i <= 10; i++) {
		
		$('.navi_' + i +' a').attr('id','navi_' + i).hover(function() {
			if (activenum != $(this).attr('id')) {
				$(this).css('background','url(/img/marker_on.png) no-repeat');
				
				$(this).css('background-size','100% 100%');
				
				$(this).css('-webkit-background-size','100% 100%');
				$(this).css('-moz-background-size','100% 100%');
				$(this).css('-khtml-background-size','100% 100%');
				$(this).css('-o-background-size','100% 100%');
			}
		},function() {
			if (activenum != $(this).attr('id')) {
				$(this).css('background','none');
			}
		});
		
		$('.navi_' + i +' a').attr('id','navi_' + i).click(function() {
			activsenum = "";
			
			if (activenum) {
				$('.' + activenum +' a').css('background','none');
			}
			
			$(this).css('background','url(/img/marker.png) no-repeat');
			
			$(this).css('background-size','100% 100%');
			
			$(this).css('-webkit-background-size','100% 100%');
			$(this).css('-moz-background-size','100% 100%');
			$(this).css('-khtml-background-size','100% 100%');
			$(this).css('-o-background-size','100% 100%');
			
			getid = $(this).parent().attr('id');
			getid = getid.split("_");
			
			activenum = $(this).attr('id');
			
			var position = $(this).position();
			
			for (i = 0; i <= 10; i++) {
				$('.subnavi_' + i +' a').css('background','none');
			}
			
			if (activesub != getid[1]) {
				$("#subnavi").css('display','none');
				$("#subnavi").css('top','102px');
				
				getSubnavi(getid[1], getid[2], position);
			}
			getContent(this);
			
			return false;
		});
	}
	
	function getContent(o) {
		var _Href = $(o).attr('href');
		//alert(_Href);
		var _Title = $(o).attr('title');
		//alert(_Title);
		if (activecontent != _Href) {
			if (!pageshowed) {
				/*$('#content').css('overflow','auto');*/
				$.ajax({
					type: 'GET',
					url: _Href + '/?use=ajax',
					cache: false,
					success: function(html) {
						$("#content").html(html);
						activecontent = _Href;
						$("#content").fadeIn(400,function() {
							pageshowed = true;
						});
						
						initModules();
						
						document.title = 'buergerclever - ' + _Title;
					},
					error: function() {
						window.location = _Href;
					}
				});
			} else {
				$("#content").stop().fadeOut('fast',function() {
					pageshowed = false;
					getContent(o);
				});
			}
		}
	}
	
	function getSubnavi(id, lng, position) {
		if (activesub != id) {
			$.ajax({
				type: 'GET',
				url: '/getsub/?id=' + id + '&lng=' + lng + '&use=ajax',
				cache: false,
				success: function(html) {
					initSubnavi(html, position);
					activesub = id;
				}
			});
		}
	}
	
	function initSubnavi(html, position) {
		$("#subnavi").html(html);
		$("#subnavi").delay(50).animate({"top": "106px","opacity": "show"}, "fast");
		
		var getp = Math.round(position.left);
		
		$("#subnavi").css('left', getp + 65);
		
		var getactiveid;
		
		for (i = 0; i <= 10; i++) {
			if ($('.subnavi_' + i +' a').attr('class') == 'active') {
				getactiveid = '.subnavi_' + i + ' a';
			}
			$('.subnavi_' + i +' a').attr('id','subnavi_' + i).hover(function() {
				if ($(this).attr('class') != 'active') {
					if (activsenum != $(this).attr('id')) {
						$(this).css('background','url(/img/marker_on.png) no-repeat');
						
						$(this).css('background-size','100% 100%');
						
						$(this).css('-webkit-background-size','100% 100%');
						$(this).css('-moz-background-size','100% 100%');
						$(this).css('-khtml-background-size','100% 100%');
						$(this).css('-o-background-size','100% 100%');
					}
				}
			},function() {
				if ($(this).attr('class') != 'active') {
					if (activsenum != $(this).attr('id')) {
						$(this).css('background','none');
					}
				}
			});
			
			$('.subnavi_' + i +' a').attr('id','subnavi_' + i).click(function() {
				if ($(this).attr('class') != 'active') {
					$(getactiveid).removeClass();
				}
				
				if (activsenum) {
					$('.' + activsenum +' a').css('background','none');
				}
			
				$(this).css('background','url(/img/marker.png) no-repeat');
				
				$(this).css('background-size','100% 100%');
				
				$(this).css('-webkit-background-size','100% 100%');
				$(this).css('-moz-background-size','100% 100%');
				$(this).css('-khtml-background-size','100% 100%');
				$(this).css('-o-background-size','100% 100%');
			
				getid = $(this).parent().attr('id');
				getid = getid.split("_");
							
				activsenum = $(this).attr('id');
				
				getContent(this);
			
				return false;
			});
		}
		
	}
	
	function initModules() {
		initNewsblog();
		initWorker();
		initCustomer();
	}
	
	function initCustomer() {
		
		var firstload = 'true';
		var activeserviceid;
		var serviceshowed = true;
		var serviceimageshowed = true;
			
		$("ul.thumb li a").hover(function() {
			$(this).css({'z-index' : '4000'});
			$(this).find('img').stop().animate({marginLeft:'-10px', width: '180px',	height: '68px',	padding: '0'}, 200);
		} , function() {
			$(this).css({'z-index' : '0'});
			$(this).find('img').stop().animate({marginLeft:'0', width: '160px', height: '60px', padding: '0'}, 400);
		});
		
		
		$("ul.thumb li a").click(function() {
			getcid = $(this).attr('id');
			getcid = getcid.split("_");
			
			$('#content').fadeOut('fast',function() {
				getCustomer(getcid[1],getcid[2], getcid[3]);
			});
						
			return false;
		});
		
		function getCustomer(id, l, t) {
			pageshowed = false;
			activecontent = '/customer/';
			/*$('#content').css('overflow','visible');*/
			$.ajax({
				type: 'GET',
				url: '/getcustomer/?id=' + id + '&lng=' + l + '&use=ajax',
				cache: false,
				success: function(html) {
					$("#content").html(html);
					
					if (t == 1) {
						firstload = false;
					} else if (firstload) {
						$('.servicedata_0').css('background','url(/img/marker.png) no-repeat');
						
						$('.servicedata_0').css('background-size','100% 100%');
						
						$('.servicedata_0').css('-webkit-background-size','100% 100%');
						$('.servicedata_0').css('-moz-background-size','100% 100%');
						$('.servicedata_0').css('-khtml-background-size','100% 100%');
						$('.servicedata_0').css('-o-background-size','100% 100%');
						
						getsid = $('.servicedata_0').attr('id');
						getsid = getsid.split("_");
						
						activeserviceid = getsid[1];
					
						getService(getsid[1], id, l, firstload);
						firstload = false;
					}
					
					$("#content").fadeIn(400,function() {
						pageshowed = true;
					});
				}
			});
		}
		
		function getService(sd, ii, l, f) {
			
			$('.clist a').click(function() {
				
				$('.servicedata_0').css('background','none');
				
				$(this).css('background','url(/img/marker.png) no-repeat');
				
				$(this).css('background-size','100% 100%');
				
				$(this).css('-webkit-background-size','100% 100%');
				$(this).css('-moz-background-size','100% 100%');
				$(this).css('-khtml-background-size','100% 100%');
				$(this).css('-o-background-size','100% 100%');
										 
				getaid = $(this).attr('id');
				getaid = getaid.split("_");
								
				$('#servicedata_' + activeserviceid + '_' + l).css('background','none');
				
				activeserviceid = getaid[1];
				
				f = 1;
				serviceshowed = true;
				
				getServiceData(getaid[1], l, f);
				getSerivceImg(getaid[1], l, f);
				
				return false;
			});
			
			$('.clist a').hover(function() {
				getaid = $(this).attr('id');
				getaid = getaid.split("_");
				if (activeserviceid != getaid[1]) {
					$(this).css('background','url(/img/marker_on.png) no-repeat');
					
					$(this).css('background-size','100% 100%');
					
					$(this).css('-webkit-background-size','100% 100%');
					$(this).css('-moz-background-size','100% 100%');
					$(this).css('-khtml-background-size','100% 100%');
					$(this).css('-o-background-size','100% 100%');
				}
			},function() {
				getaid = $(this).attr('id');
				getaid = getaid.split("_");
				if (activeserviceid != getaid[1]) {
					$(this).css('background','none');
				}
			});
			
			if (firstload) {
				getServiceData(sd, l, f);
				getSerivceImg(sd, l, f);
			}
		}
		
		function getServiceData(sd, l, f) {
			if (f == 'true' || serviceshowed == false) {
				$.ajax({
					type: 'GET',
					url: '/getservicedata/?id=' + sd + '&f=' + f + '&=lng' + l + '&use=ajax',
					cache: false,
					success: function(html) {
						$("#servicedata").html(html);
						$("#sdata").fadeIn('fast',function() {
							serviceshowed = true;
						});
						initSelectButtons(sd, l);
					}
				});
			} else {
				$("#sdata").fadeOut('fast',function() {
					serviceshowed = false;
					getServiceData(sd ,l, f);
				});
			}
		}
		
		function initSelectButtons(sd, l) {
			$('#snumbers .next').click(function() {
				getpid = $('#snumbers').attr('class');
				getpid = getpid.split("_");
				
				getServiceData(sd, l, (parseInt(getpid[1]) + 1));
				return false;
			});
			$('#snumbers .prev').click(function() {
				getpid = $('#snumbers').attr('class');
				getpid = getpid.split("_");
				
				getServiceData(sd, l, (parseInt(getpid[1]) - 1));
				return false;
			});
		}
		
		function getSerivceImg(img, l, f) {
			//alert(f + " : " + serviceimageshowed);
			//if (f == 'true' || serviceimageshowed == false) {
				$.ajax({
					type: 'GET',
					url: '/getserviceimg/?id=' + img + '&=lng' + l + '&use=ajax',
					cache: false,
					success: function(html) {
						$("#serviceimg").html(html);
						/*
						$("#serviceimg").fadeIn('fast',function() {
							serviceimageshowed = true;
						});
						*/
					}
				});
			//} else {
				//$("#serviceimg").fadeOut('fast',function() {
					//serviceimageshowed = false;
					//getSerivceImg(sd ,l, f);
				//});
			//}
		}
	}
	
	function initNewsblog() {
		var glng;
		var page;
		/*
		$('#newsentries').jScrollPane({scrollbarWidth:20, scrollbarMargin:10, animateTo:true});
		$(".jScrollPaneTrack").fadeIn('fast');
		$(".jScrollPaneDrag").fadeIn('fast');
		*/	
		//$('#newsentries').scrollTo(200);
		
		function validEmail(email) {
			var strReg = "^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
			var regex = new RegExp(strReg);
			return(regex.test(email));
		}
		
		function initCommentform(p) {
			
			getComments('load');
			
			$(".back").click(function() {
				$(this).fadeOut('fast');
				
				getNewsBlog(p);
								
				return false;
			});
			/*
			function getNewsBlog(page) {
				$.ajax({
					type: 'GET',
					url: '/getnewsblog/?page=' + page +'&lng=' + glng + '&get=newsblog&use=ajax',
					cache: false,
					success: function(html) {
						$("#newsentries").scrollTo(0,0);
						//$("#newsentries").fadeOut(200);
						$("#newsentries").html(html);
						
						$('#newsentries').fadeIn('fast',function() {
							initNewsblog();
						});
						//});
					}
				});
			}*/
			
			$("#commentform").submit(function() {
				var name = $("#name").attr('value');
				var email = $("#email").attr('value');
				var comment_txt = $("#comment_txt").attr('value');
				var newsid = $("#newsid").attr('value');
				
				var error = 0;
				var errormsg = new Array();
				var allerrors = "";
				
				errormsg.push("Es fehlen folgende Angaben:\n\n");
				
				if (name.length < 2) {
					errormsg.push("Name fehlt\n");
					error = 1;
				}
				if (email.length > 1) {
					if (!validEmail(email)) {
						errormsg.push("E-Mail Adresse ungültig\n");
						error = 1;
					}
				}
				if (comment_txt.length < 2) {
					errormsg.push("Kommentar fehlt\n");
					error = 1;
				}
				if (error == 1) {
					errormsg.push("\nBitte korrigieren Sie diese!\nVielen Dank.");
					
					for (var i = 0; i < errormsg.length; i++) {
						allerrors += errormsg[i];
					}
					alert(allerrors);
				} else {
					$.ajax({
						type: 'POST',
						timeout: 7000,
						data: {name: name, email: email, comment_txt: comment_txt, newsid: newsid},
						url: '/postcomment/',
						success: function(result) {
							document.getElementById('submitcomment').disabled = true;
							if (result != "true") {
								document.getElementById('commentstatus').innerHTML= '<span style="color: #CC0000;">Kommentar wurde nicht eingetragen!</span>';
							} else {
								getComments('add');
								document.getElementById('commentstatus').innerHTML= 'Danke für Ihren Kommentar!';							
							}
						}
					});
				}
				return false;
			});
		}
		
		function getComments(t) {
			var newsid = $("#newsid").attr('value');
			
			$.ajax({
				type: 'GET',
				url: '/getcomments/?id=' + newsid + '&use=ajax',
				cache: false,
				success: function(html) {
					$("#commentlist").html(html);
					
					if (t == "add") {
						$("#newsentries").scrollTo('#endline',300);
					}
					//$("#newsentries").scrollTo("#commentlist",0);
					
					/*
					$('#newsentries').jScrollPane({scrollbarWidth:20, scrollbarMargin:10, animateTo:true});
					$(".jScrollPaneTrack").fadeIn('fast');
					$(".jScrollPaneDrag").fadeIn('fast');
					*/
				}
			});
		}
		
		function getNewsBlog(page) {
				glng = 'de';
				$.ajax({
					type: 'GET',
					url: '/getnewsblog/?page=' + page +'&lng=' + glng + '&get=newsblog&use=ajax',
					cache: false,
					success: function(html) {
						$("#newsentries").scrollTo(0,0);
						//$("#newsentries").fadeOut(200);
						$("#newsentries").html(html);
						
						$('#newsentries').fadeIn('fast',function() {
							initNewsblog();
						});
						//});
					}
				});
			}
		
		for (i = 0; i <= 15; i++) {
			$('.news_' + i).click(function() {				
				//document.getElementById("#newsentries").scrollTop(0,0);
				
				//alert('JO');
				
				getid = $(this).attr('id');
				getid = getid.split("_");
				
				getuid = $(this).attr('ref');
				
				getNews(getid[1],getid[2],getuid,getid[3]);
				
				return false;
			});
			if (i == 15) {
				$("a.numlinks").click(function() {
					getpage = $(this).attr('href');
					getpage = getpage.split('=');
					
					
					page = getpage[1];
					
					getNewsBlog(getpage[1]);
					
					return false;
				});
			}
		}
		
		function getNews(id, lng, uid,p) {
			glng = lng;
			var p = p;
			
			$.ajax({
				type: 'GET',
				url: '/getnews/?id=' + id + '&lng=' + lng + '&use=ajax',
				cache: false,
				success: function(html) {
					//$("#newsentries").scrollTo(0,10).fadeOut('fast',function() {
						$("#newsentries").scrollTo(0,0);
						//$("#newsentries").fadeOut(200);
						$("#newsentries").html(html);
						
						$('.back').fadeIn('fast');
						$("#newsentries").fadeIn('fast',function() {
							initCommentform(p);
						});
					//});
				}
			});
		}
	}
	
	function initWorker(l) {
		var activeworker;
		var workershowed = false;
		
		$(".wback").click(function() {
		    $("#worker").fadeIn('fast');
			$("#workercontent").fadeOut('fast');
			$(this).fadeOut('fast');
			workershowed = false;
			$('.worker_' + activeworker).css('background','none');
			activeworker = '';
			//getNewsBlog();
			return false;
		});
		
		function getWorker(id, lng, uid) {
			if (activeworker != uid) {
				if (!workershowed) {
					$.ajax({
						type: 'GET',
						url: '/getworker/?id=' + id + '&lng=' + lng + '&use=ajax',
						cache: false,
						success: function(html) {
							/*$('#content').css('overflow','visible');*/
							$(".wback").fadeIn('fast');
							$("#workercontent").html(html);
							/*
							$('#workercontent').addClass('scroll-pane').jScrollPane({scrollbarWidth:20, scrollbarMargin:10, animateTo:true});
							$(".jScrollPaneTrack").delay(150).fadeIn(400);
							$(".jScrollPaneDrag").delay(150).fadeIn(400);
							*/
							$("#workercontent").delay(150).fadeIn(400,function() {
								workershowed = true;
							});
							activeworker = uid;
						}
					});
				} else {
					//$(".jScrollPaneTrack").fadeOut('fast');
					//$(".jScrollPaneDrag").fadeOut('fast');
					
					$("#workercontent").fadeOut('fast',function() {
						workershowed = false;
						getWorker(id,lng,uid);
					});
				}
			}
		}
		
		for (i = 0; i <= 1; i++) {
			$('.worker_' + i).attr('ref',i).hover(function() {
				if (activeworker != $(this).attr('ref')) {
					$(this).css('background','url(/img/marker_on.png) no-repeat');
					
					$(this).css('background-size','100% 100%');
					
					$(this).css('-webkit-background-size','100% 100%');
					$(this).css('-moz-background-size','100% 100%');
					$(this).css('-khtml-background-size','100% 100%');
					$(this).css('-o-background-size','100% 100%');
				}
			},function() {
				if (activeworker != $(this).attr('ref')) {
					$(this).css('background','none');
				}
			});
			
			$('.worker_' + i).attr('ref',i).click(function(i) {
				getid = $(this).attr('id');
				getid = getid.split("_");
				
				$(this).css('background','url(/img/marker.png) no-repeat');
				
				$(this).css('background-size','100% 100%');
				
				$(this).css('-webkit-background-size','100% 100%');
				$(this).css('-moz-background-size','100% 100%');
				$(this).css('-khtml-background-size','100% 100%');
				$(this).css('-o-background-size','100% 100%');
				
				getuid = $(this).attr('ref');
				
				$('.worker_' + activeworker).css('background','none');
				
				$("#worker").fadeOut('fast');
				
				getWorker(getid[1],getid[2],getuid);
				return false;
			});
		}
	}
});

