var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function decode64(a){var b="";var c,chr2,chr3="";var d,enc2,enc3,enc4="";var i=0;var e=/[^A-Za-z0-9\+\/\=]/g;if(e.exec(a)){alert("There were invalid base64 characters in the input text.\n"+"Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n"+"Expect errors in decoding.")}a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d=keyStr.indexOf(a.charAt(i++));enc2=keyStr.indexOf(a.charAt(i++));enc3=keyStr.indexOf(a.charAt(i++));enc4=keyStr.indexOf(a.charAt(i++));c=(d<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;b=b+String.fromCharCode(c);if(enc3!=64){b=b+String.fromCharCode(chr2)}if(enc4!=64){b=b+String.fromCharCode(chr3)}c=chr2=chr3="";d=enc2=enc3=enc4=""}while(i<a.length);return unescape(b)}

$(document).ready(function () {
	$('img._popup').each(function () {
		var rel = '';
		
		var arel = '';
		if ($(this).attr('rel'))
			arel = $(this).attr('rel'); 
			
		if (arel.length > 0)
			rel = ' rel="'+arel+'"';
		
		var html = '<a href="'+$(this).attr('src')+'" class="lightbox"'+rel+' title="'+$(this).attr('alt')+'"></a>';
		$(this).wrap(html);
	});

	$(document).ready(function(){
		$(".lightbox").lightbox();
	});
	
	$('#cmscontent a').bind('click', function () {
		var href = $(this).attr('href');
		if (href.substring(0,6) == 'media/') {
			var player = $('#mpl');player=player[0];
			var file = 'files/'+decode64(href.substring(6));
			
			player.sendEvent('LOAD', file);
			player.sendEvent('PLAY', true);

			return false;
		}
	});
	
	if ($('#vacancyScroller').length > 0) {
		var div = $('#vacancyScroller');
//		div.empty();
		
		var url = 'index.php?page=carerix_listing';
		$.get(url, function (html) {
			var newhtml = '';
		    newhtml += '<marquee scrolldelay="120" onmouseover="this.stop()" onmouseout="this.start()">';

			$('.cx_listTdJobTitle', html).each(function () {
				newhtml += $(this).html()+' &nbsp; | &nbsp; ';
			});
			
			newhtml += '</marquee>';
			div.html(newhtml);
		});
	}
});
