function disableIt(obj)
{
	obj.disabled = !(obj.disabled);
	var z = (obj.disabled) ? 'disabled' : 'enabled';
	//alert(obj.type + ' now ' + z);
}


// ---------------------------------------- Кукисы + фавориты
var cookieName="ObjList";
var cookieDel="ObjDel";

function getCookie(key){
   var ck = document.cookie;
   if (typeof(ck) == "undefined"){
      return "";
   }
		
   var i = ck.indexOf(key + "=");
   var j = ck.indexOf(";", i);
   var st;
   if (i < 0){
      return "";
   }
   
   if (j < 0){
      return ck.substring(i + key.length + 1);
   } 
   else {
      return ck.substring(i + key.length + 1, j);
   }
}

function setCookie(key, value){
   if (value.length == 0){
      document.cookie = key + "=" + expires(-1) + ";path=/;domain="+cookieDomain;
   }
   else{
      document.cookie = key + "=" + value + expires(365*24*60*60*1000) + ";path=/;domain="+cookieDomain;
   }
}

function expires(d){
   var expiry = new Date();
   expiry.setTime (expiry.getTime() + d);
   return "; expires=" + expiry.toGMTString();
}

function add (postingID) {

	var ObjList;
	var inList=false;
	var str;
	var s = getCookie(cookieName);
	ObjList = s.split(".");

	// Ищем объект в массиве
	   for (var id in ObjList)
	   {
	   if (ObjList[id]==postingID) {inList=true; 
												//ObjList.splice (id,1);
												}
		}
	
			if (inList==false)
			{
				setCookie(cookieName, s+'.'+postingID);
			}
			else 
				{
				// Чистим пустые
				   for (var id in ObjList)
				   {
				   if (!ObjList[id]) {ObjList.splice (id,1);}
					}
					str = ObjList.join(".");
					setCookie(cookieName, str);

		}

	setCookie(cookieDel,'');

}

function delObj(postingID) {

	var ObjList;
	var inList=false;
	var str;
	var s = getCookie(cookieName);
	var d = getCookie(cookieDel);
	ObjList = s.split(".");
	DelList = d.split(".");

// Пишем  на удаление
	setCookie(cookieDel, d+'.'+postingID);

	// Ищем объект в массиве
	   for (var id in ObjList)
	   {
			if (ObjList[id]==postingID) 
			{
			inList=true; 
			ObjList.splice (id,1);
			}
		}
	
	if (inList==false)
		{
		}
		else 
			{
			// Чистим пустые
			   for (var id in ObjList)
				  {
				  if (!ObjList[id]) {ObjList.splice (id,1);}
				  }
					str = ObjList.join(".");
					setCookie(cookieName, str);
				}



}


// ---------------------------------------- Показать/скрыть слои
	function toggle_show(id) 
	{
    document.getElementById(id).style.display = document.getElementById(id).style.display == 'none' ? 'block' : 'none';
	}

function toggle_showN(id,group,num) 
{
	for(j=1;j<=num;j++)
	{
	var myArray = document.getElementsByName('u_checks-all[]');
		if(j != id) 
		{
	    document.getElementById(group+j).style.display = document.getElementById(group+j).style.display == 'none' ? 'none' : 'none';
		}
	}
	    document.getElementById(group+id).style.display = document.getElementById(group+id).style.display == 'none' ? 'block' : 'none';
}
// -------------------------------------- Работа с изображениями

	// Просмотр в объявлении
   function LookImage(imageSrc){
      document['mainImage'].src=imageSrc;
      return false;
   }