//////////////COOOOOOKIEEEEEEEEEEZZZZ....GIMME GIMME GIMME:p/////////////
				//wrote this code way to late at night...don't ask me in the morning about it:P
$(document).ready(function(){
				//one little botton, two little bottons...here zey are:next previous first last - page
				
					function sendGET(pagina_trimisa,variabila,divul){	
						$.ajax({
							  url: pagina_trimisa,
							  type: "GET",
							  data: variabila,
							  
							  statusCode: {
							  	404: function(){
							  		alert('page not found');
							  	}
							  },
					
							  success: function(result){
								 // alert(result);
								$(divul).html(result);
							  }
						});
					}
function SetCookie(cookieName,cookieValue) {
										 var today = new Date();
										 var expire = new Date();
										 nDays=0.50;
										 expire.setTime(today.getTime() + 3600000*24*nDays);
										 //document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
										 document.cookie = cookieName + '=' + escape(cookieValue) + ";expires="+expire.toGMTString()+',path=/';
				}
				
				function getCookie(c_name){
										var i,x,y,ARRcookies=document.cookie.split(";");
										for (i=0;i<ARRcookies.length;i++)
										{
										  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
										  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
										  x=x.replace(/^\s+|\s+$/g,"");
										  if (x==c_name)
										  {
										    return unescape(y);
										  }
										}
				}
				
			

				function stergeOfertaSelectata(id_offer){

									var c = getCookie("oferta");
									//eliminam oferta
									
									var c2 = getCookie("oferta").split("_");
									var l1 = c2.length;
									var j = 0;
									var rez = "";
									
									while(j<l1){
										
										if(c2[j] != id_offer){
											if(rez == ""){
												rez = c2[j];
											}
											else{
												rez = rez + "_" + c2[j];
											}
										}
										
										j++;
									}
									
									var restul_ofertelor = getCookie("oferta");
									SetCookie("oferta", rez);

									sendGET("oferte_selectate.php", "rest_oferte="+restul_ofertelor ,"#oferte_marcate");
									
									
								}
				
				$(".buton-sterge-oferta").click(function() {
					//alert($(this).attr("alt"));
					var id_oferta = $(this).attr("alt");
					stergeOfertaSelectata(id_oferta);
				});
								
				$('.buton-sterge-oferta').hover(
					function() {
						$(this).css('cursor','pointer');
						},
					function() {
						$(this).css('cursor','auto');
				});
				
				 $(".various3").fancybox({
						
						'autoScale'			: true,
						'transitionIn'		: 'none',
						'transitionOut'		: 'none',
						'type'				: 'iframe'
					});	
				
});//end on ready state function			

