function gif_over(img) {
	img.src=img.src.replace('.gif','r.gif');
} 
function gif_out(img) {
	img.src=img.src.replace('r.gif','.gif');
}
function jpg_over(img) {
	img.src=img.src.replace('.jpg','r.jpg');
} 
function jpg_out(img) {
	img.src=img.src.replace('r.jpg','.jpg');
}
function bg_main_over(td) {
	td.style.backgroundImage="url('../../img/face/linr.gif')";
}

function bg_main_out(td) {
	td.style.backgroundImage="url('../../img/face/lin.gif')";
}


function map_over(id) {
	document.images["map"].src='../img/contacts/'+id+'.gif';	
}
 
function map_out(id) {
	document.images["map"].src='../img/contacts/map.gif';	
}


function prehide(lay){
	eval("document.all."+lay+".style.top=0");
}
function show(lay,el,x,y){
	psx=get_posx(el);
	psy=get_posy(el);
	eval("document.all."+lay+".style.left=psx+x;");
	eval("document.all."+lay+".style.top=psy+y;");
	eval("document.all."+lay+".style.visibility='visible'");
	if(document.layers){
		eval("document.layers['"+lay+"'].visibility='visible'");
	}
}
function hide(lay){
	eval("document.all."+lay+".style.visibility='hidden'");;
	if(document.layers){
		eval("document.layers['"+lay+"'].visibility='hidden'");
	}
}
function get_posx(el) {
	var ipos = 0;
	while (el!=null) {
		ipos+=el["offsetLeft"]
		el = el.offsetParent
	}
	return ipos;
}
function get_posy(el) {
	var ipos = 0;
	while (el!=null) {
		ipos+=el["offsetTop"]
		el = el.offsetParent
	}
	return ipos;
}

function showLayer(layerName) {
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
function hideLayer(layerName) {
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
ns=0;
layerRef="document.all";
styleSwitch=".style";
if (navigator.appName == "Netscape") {
	ns=1;
	layerRef="document.layers";
  	styleSwitch="";
}

function overTd(td1,td2) {
	document.all[td1].style.backgroundColor="D9D4CE";
	document.all[td2].style.backgroundColor="D9D4CE";
};
function outTd(td1,td2) {
	pics=pic.src.substr(pic.src.search("kitchen/")+8);
	pics1=pics.replace("-max.jpg","1");
	pics2=pics.replace("-max.jpg","2");
	document.all[td1].style.backgroundColor="BFB7AE";
	document.all[td2].style.backgroundColor="BFB7AE";
	document.all[pics1].style.backgroundColor="D9D4CE";
	document.all[pics2].style.backgroundColor="D9D4CE";
};
function showBigPic(ids,td1,td2) {
	indexID=ids.replace("-max","");
	indexID=indexID.substring(indexID.length-1,indexID.length);
	ID=document.getElementById('pic').src.substr(document.getElementById('pic').src.search("kitchen/")+8);
	curIndexID=ID.substring(ID.length-8,ID.length-9);
	if (curIndexID!=indexID) {
		if (indexID==8) {
			document.getElementById('forward').src=document.getElementById('forward').src.replace(".jpg","s.jpg");
			document.getElementById('forward').style.cursor="default";
		} else {
			document.getElementById('forward').src=document.getElementById('forward').src.replace("s.jpg",".jpg");
			document.getElementById('forward').style.cursor="hand";
		};
		if (indexID==1) {
			document.getElementById('back').src=document.getElementById('back').src.replace(".jpg","s.jpg");
			document.getElementById('back').style.cursor="default";
		} else {
			document.getElementById('back').src=document.getElementById('back').src.replace("s.jpg",".jpg");
			document.getElementById('back').style.cursor="hand";
		};
		pics=pic.src.substr(pic.src.search("kitchen/")+8);
		pics1=pics.replace("-max.jpg","1");
		pics2=pics.replace("-max.jpg","2");
		pic.src=pic.src.replace(pics,ids+".jpg");
		document.all[pics1].style.backgroundColor="BFB7AE";
		document.all[pics2].style.backgroundColor="BFB7AE";
		document.all.picBig.href=document.all.picBig.href.replace(pics.replace(".jpg","1.jpg"),ids+"1.jpg");
	};
};

function forwardPic() {
	ID=document.getElementById('pic').src.substr(document.getElementById('pic').src.search("kitchen/")+8);
	ID=ID.replace(".jpg","");
	indexID=parseInt(ID.substring(ID.length-4,ID.length-5));
	ID=ID.replace(indexID,indexID+1);
	pics1=ID.substring(0,ID.length-4)+"1";
	pics2=ID.substring(0,ID.length-4)+"2"
	if (indexID<8) {
		showBigPic(ID);
		outTd(pics1,pics2);
	};
};

function backPic() {
	ID=document.getElementById('pic').src.substr(document.getElementById('pic').src.search("kitchen/")+8);
	ID=ID.replace(".jpg","");
	indexID=parseInt(ID.substring(ID.length-4,ID.length-5));
	ID=ID.replace(indexID,indexID-1);
	pics1=ID.substring(0,ID.length-4)+"1";
	pics2=ID.substring(0,ID.length-4)+"2"
	if (indexID>1) {
		showBigPic(ID);
		outTd(pics1,pics2);
	};
};
