//<!--


var im1=new Image();
var im2=new Image();
im1.src="images/yellow.gif";
im2.src="images/gray.gif";

var im3=new Image();
var im4=new Image();
im3.src="images/largegray.gif";
im4.src="images/largeyellow.gif";

function changeMenuIcon(id1, n){
	if (n==1) document.getElementById(id1).src=im1.src;
	else document.getElementById(id1).src=im2.src;
	}
	
function changeLargeMenuIcon(id1, n){
	if (n==1) document.getElementById(id1).src=im4.src;
	else document.getElementById(id1).src=im3.src;
	}


var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs){
	var imageSeparator = imageFiles.indexOf(";");
	var nextImage = imageFiles.substring(0,imageSeparator);
	if (document.all){
		document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
		document.getElementById(pictureName).filters.blendTrans.Apply();
	}
	document.getElementById(pictureName).src = nextImage;
	if (document.all){
		document.getElementById(pictureName).filters.blendTrans.Play();
	}
	var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
		+ ';' + nextImage + '';
	setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
		displaySecs*1000);
 	imageSeparator = futureImages.indexOf(";");
	nextImage = futureImages.substring(0,imageSeparator);
	if (slideCache[nextImage] == null) {
		slideCache[nextImage] = new Image;
		slideCache[nextImage].src = nextImage;
	}
}



//---------------------------------popup window-------------------------------


function popup(url, w, h)
{
if (w==undefined) w=880;
if (h==undefined) h=650;

var nom=Math.round(500*Math.random());
var myWin=window.open(url, 'fanjara'+nom, 'width='+w+',height='+h+',scrollbars=yes,toolbar=no,titlebar=yes,menubar=no,statusbar=yes,resizable=yes');
}


//-----------------------------full popup window--------------------------


function popup2(url)
{
var nom=Math.round(500*Math.random());
var myWin=window.open(url, 'fanjara'+nom, 'location=yes,scrollbars=yes,toolbar=yes,titlebar=yes,menubar=yes,statusbar=yes,resizable=yes');
}


//---------------------kalatashi archeuli saqonelis fasis naxva-------------------


function priceSumary(url)
{
document.getElementById("shForm1").target='_blank';
document.getElementById("shForm1").action=url;

document.getElementById("shForm1").submit();
}


//-----------------kalatashi archeuli saqonelis shedarebis gilaki-----------------


function compareAd(url)
{
document.getElementById("shForm1").action=url;

document.getElementById("shForm1").submit();
}


//-------------------simboloebis shezgudva textarea-shi-------------------


function shezgudva(e, tid, n)
{
if (document.getElementById(tid).value.length>n) return false;
return qartulze(e, tid);
}


//-----------------------Shezgudva gaqartulebis gareshe-----------------------


function simple_shezgudva(tid, n)
{
if (document.getElementById(tid).value.length>n) return false;
}


//----------------------------dalageba----------------------------------------


function changeLocation(id1, id2, id3, urli, veli, ind, quan, lang)
{
var order=document.getElementById(id1).value;
var dir;
if (document.getElementById(id3).checked) dir='desc';
else dir='asc';

var a=urli+'&veli='+veli+'&ind='+ind+'&quan='+quan+'&order='+order+'&dir='+dir+'&lang='+lang;
location.href=a;
}


//-------------------------------Danomvra-------------------------------


function changeR(id1, i)
{
document.getElementById(id1).value=i;
document.numForm.submit();
}


//--------------------------Check (Uncheck All)---------------------------------


function checkboxes(b)
{
for (var i=0; i<document.shForm.elements.length; i++){
	e=document.shForm.elements[i];
	if (e.type=='checkbox' && e.checked!=b) e.checked=b;
	}
}



//---------------------------------Check Fields------------------------------------


function checkFields(id1, id2, error1, error2)
{
if (!document.getElementById(id1).value){
	alert(error1);
	document.getElementById(id1).focus();
	return false;
	}

if (!document.getElementById(id2).value){
	alert(error2);
	document.getElementById(id2).focus();
	return false;
	}

return true;
}


var shown_id=0;
//------------------------ubnebis selectebis gamochena------------------------------


function showSubSelect(sid, qve_id)
{
if (shown_id){
	document.getElementById(shown_id).style.display="none";
	document.getElementById(qve_id).value="";
	}

var n=document.getElementById(sid).value;
var qid="qve"+n;

if (document.getElementById(qid)!=undefined){
	document.getElementById(qid).style.display="block";
	shown_id=qid;
	}
}


function minicheba(id1, id2)
{
document.getElementById(id1).value=document.getElementById(id2).value;
}


//----------------------------------------------------------------


function makeDefault(element, url)
{
element.style.behavior='url(#default#homepage)'; 
element.setHomePage(url);
}


//----------------------------------------------------------------


function addBookmark() {
  if (window.external)
    external.AddFavorite(location.href)
  else
    alert("Your browser doesn't support this feature.");
}


//----------------------------Delete Favorites----------------------------


function deleteFavorites(url)
{
document.shForm.action=url;
document.shForm.submit();
}


//-------------------------------Qartulze Gadayvana---------------------------


var eng=new Array(97, 98, 103, 100, 101, 118, 122, 84, 105, 107, 108, 109, 110, 111, 112,
	74, 114, 115, 116, 117, 102, 113, 82, 121, 83, 67, 99, 90, 119, 87, 120, 106, 104);

var geo=new Array(4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315,
	 4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329,
	 4330, 4331, 4332, 4333, 4334, 4335, 4336);

var len=eng.length

function qartulze(e, tid)
{
if (document.getElementById('q1')==undefined) return;
if (!document.getElementById('q1').checked) return;

if (e.keyCode && document.getElementById(tid).selectionStart!=undefined)
	for (var i=0; i<len; i++)
		{
		if (e.keyCode==eng[i])
			{
			var b1=document.getElementById(tid).selectionStart;
			var b2=document.getElementById(tid).selectionEnd;
			var str=document.getElementById(tid).value		
			document.getElementById(tid).value=str.substring(0,b1)+String.fromCharCode(geo[i])+str.substring(b2);
			document.getElementById(tid).setSelectionRange(b1+1, b1+1);
			document.getElementById(tid).focus();
			return false
			}	
		}

if (e.keyCode)
	for (var i=0; i<len; i++)
		{
		if (e.keyCode==eng[i])
			{
			e.keyCode=geo[i]
			return true
			}
		}
else
if (e.charCode)
	for (var i=0; i<len; i++)
		{
		if (e.charCode==eng[i])
			{
			var b1=document.getElementById(tid).selectionStart;
			var b2=document.getElementById(tid).selectionEnd;
			var str=document.getElementById(tid).value		
			document.getElementById(tid).value=str.substr(0,b1)+String.fromCharCode(geo[i])+str.substr(b2);
			document.getElementById(tid).setSelectionRange(b1+1, b1+1);
			document.getElementById(tid).focus();
			return false
			}
		}

return true
}



//-->