/**
 * njobs JavaScript v1.0.0
 *
 * @copyright 2011 njobs
 */
jQuery(document).ready(function($){

	function ue(c) {
		var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
			while(x<c.length){var m=r.exec(c.substr(x));
  			if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
      		}else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
      		o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}
		return o;
	}

	function gettxt(x) {
		var r = '';
		$.ajax({type: 'GET', url: x, async: false,
			 success: function(d){
			 	r = d;
			 }});
		return r;
	}
	
	var t = ['a','b','c','d','e','f','g'];
	var rf = ue(window.location);
	for(var i=0;i<t.length;i++){
		t[i]=gettxt('data/'+t[i]);
	}
 
	$('input.red, input.red_title').click(function(){
		var at6 = $(this).attr('id').split( '-' );
		if (at6[0]!='njobs' && at6[0]!='njobs_title') {
			return;
		}
		window.open(t[0]+'://'+t[1]+'.'+t[2]+'.'+t[3]+'/'+t[4]+'/'+t[5]+'/'+at6[1]+'?rf='+rf, '_blank');
	});
	
	$('.roll').hover(
		function () {
			$(this).find(".display_desc").fadeTo('fast', 1.0);
		},
		function () {
			$(this).find(".display_desc").stop().hide();
		}
	);
	
	window.doPagin = function (q,p,d) {
		var sp = ','+p;
		var sd = '?'+d;
		if (p==1) sp='';
		if (d=='a') sd='';
		window.location=t[0]+'://'+t[1]+'.'+t[2]+'.'+t[3]+'/'+q+sp+'.html'+sd;
	}
});


