/** ÀÂÒÎÐÈÇÀÖÈß (ÊÓÊÈ) **/
function setCookie(name, value, expires, path, domain, secure) 
{
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "")
	if ((name + "=" + escape(value)).length <= 4000)
	document.cookie = curCookie
	else
	if (confirm("Cookie ïðåâûøàåò 4KB è áóäåò âûðåçàí"))
	document.cookie = curCookie
}

function getCookie(name) 
{
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1) return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(name, path, domain) 
{
	if (getCookie(name)) {
	document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"
 	}
}

/**  ÎÒÎÁÐÀÆÅÍÈÅ ÔÎÐÌÛ ÏÎÈÑÊÀ **/
function showSearchForm(formId, unrollId, rollId)
{
	formId = document.getElementById(formId);
	rollId = document.getElementById(rollId);
	unrollId = document.getElementById(unrollId);
	
	if(unrollId.style.display == 'block')
	{
		unrollId.style.display = 'none';	
		rollId.style.display = 'inline';
		formId.style.display = 'block'; 
	}
	else	
	{
		unrollId.style.display = 'block';	
		rollId.style.display = 'none';
		formId.style.display = 'none';
	}

	return false;
}

/** ÇÀÃÐÓÇÊÀ ÔÎÒÎÊ **/
function insertImage114() 
{
	currentImage++;
	var currrow;
	currow = document.getElementById('imageTable114').rows.length; 
	document.getElementById('imageTable114').insertRow(currow); 
	
	if (Math.floor(currentImage/2)!=Math.ceil(currentImage/2)) 
		bgcolor="E0E0E0";
	else 
		bgcolor="FFFFFF";
	
	html='<div style="border:0px;  margin-bottom:0px; ">';
	html+='<input type="hidden" name="gallery" value="750:750:less:300:300:less:0">';
	html+='<input type="hidden" name="gallery_title['+currentImage+']"  style="width:50%;"> <input type=file name="gallery_images['+currentImage+']" size="38"></div>';
	
	document.getElementById('imageTable114').rows[currow].insertCell(0); 
	document.getElementById('imageTable114').rows[currow].cells[0].innerHTML = html; 
}
