function changeNews (id) {
	
	$.ajax({
		type: "POST",
		url: "ajax/ajaxNewsSwap.php",
		data: "table="+id+"&id="+id,
		success: function(resp){
					$("#imageContener").html(resp);
		},
		complete: function() {
			document.getElementById("imageContener").style.backgroundImage=document.getElementById("hiddenFoto").value;
			/*if (id+1==8) newidr = 0; else newidr = id+1;
			if (id-1==-1) newidl = 7; else newidl = id-1;
			$("#newsLArr").attr("onclick","changeNews("+newidl+")");
			$("#newsRArr").attr("onclick","changeNews("+newidr+")");*/
		}
		
	});
	
}

function swapJobPanel (clicked) {
	
	if(clicked == "n") {
		$("#searchSend").slideUp("fast");
		$("#job-offers").slideDown("fast");
		
	}
	else {
		$("#job-offers").slideUp("fast");
		$("#searchSend").slideDown("fast");
	}
	
}

function nextJob(id) {
	//alert(id);
	$("#job"+(id-1)).removeClass("jobs-row-shown");
	$("#job"+(id-1)).addClass("jobs-row");
	if (id == 11) id = 1;
	$("#job"+id).removeClass("jobs-row");
	$("#job"+id).addClass("jobs-row-shown");
	
}

function prevJob(id) {
	$("#job"+(id+1)).removeClass("jobs-row-shown");
	$("#job"+(id+1)).addClass("jobs-row");
	if (id == 0) id = 10;
	$("#job"+id).removeClass("jobs-row");
	$("#job"+id).addClass("jobs-row-shown");
}

function timedChange (id,max) {
	
	if (id == (max+1)) id = 1;
	$("#np"+id).fadeIn("slow",function(){
	
		var t=setTimeout("$('#np"+id+"').fadeOut('slow',function(){timedChange("+(id+1)+","+max+")});",7000);
		
	});
	
}

function setMessageStyle( text, textwidth ) {
	
	document.getElementById("flashTextLoad").innerHTML = text;
	document.getElementById("flashTextLoad").style.width= textwidth+"px";
	document.getElementById("flashMessage").style.top= ((screen.availHeight/2) - 200 )+"px";
	document.getElementById("flashMessage").style.left= ((screen.availWidth/2)-150)+"px";
	
}


function displayMessage( text,time, textwidth) {
	
	$("body").append('<div id="flashMessage"><div id="flashTextLoad">'+text+'</div></div>');
	setMessageStyle( text, textwidth );
	$("div#flashMessage").fadeIn("slow");
	var t=setTimeout('$("div#flashMessage").fadeOut("slow")',time);

}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name) {
	if (document.cookie.length > 0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}
