var bigImageArray = new Array('', 'baby_calm_B.jpg', 'romi_B.jpg', 'lili_design_B.jpg', 'wandertali_B.jpg', 'nowcomholdings_B.jpg', 'space_B.jpg', 'redwin_B.jpg', 'omnot_B.jpg', 'nowlight_B.jpg', 'subzero_B.jpg', 'dudpro_B.jpg', 'canastel_B.jpg', 'simnoa_B.jpg', 'fun-time_B.jpg', 'el_natan_B.jpg', 'dr-erik_B.jpg', 'digital-kitchen_B.jpg', 'israelink_B.jpg', 'baameahava_B.jpg', 'avrtravel_B.jpg', 'neurotech_B.jpg', 'anathayat_B.jpg', 'agel_B.jpg');
var smallImageArray = new Array('', 'baby_calm_S.jpg', 'romi_S.jpg', 'lili_design_S.jpg', 'wandertali_S.jpg', 'nowcomholdings_Sjpg.jpg', 'space_S.jpg', 'redwin_S.jpg', 'omnot_S.jpg', 'nowlight_S.jpg', 'subzero_S.jpg', 'dudpro_S.jpg', 'canastel_S.jpg', 'simnoa_S.jpg', 'fun-time_S.jpg', 'el_natan_S.jpg', 'dr-erik_S.jpg', 'digital-kitchen_S.jpg', 'israelink_S.jpg', 'baameahava_S.jpg', 'avrtravel_S.jpg', 'neurotech_S.jpg', 'anathayat_S.jpg', 'agel_S.jpg');
var linkArray = new Array('', 'http://baby-calm.com/', 'http://romigallery.com/', 'http://www.lilidesign.co.il/','http://www.wandertali.com/', 'http://nowcomholdings.com/', 'http://space-design.co.il/','http://ruralconnectivity.com/', 'http://artbuilding.co.il/', 'http://nowlight.co.il/', 'http://www.subzero.co.il/', 'http://dudpro.co.il/', 'http://www.canastel.co.il/','http://simnoa.ezoteric.com/', 'http://fun-time.org.il/', 'http://el-natan.co.il/', 'http://dr-erik.com/', 'http://www.digital-kitchen.co.il/', 'http://israelink.co.il/', 'http://baameahava.com/', 'http://www.avrtravel.co.il/', 'http://neurotech.co.il/', 'http://anathayat.com/', 'http://e-zoteric.com/agel/');

var startPos = Math.round(bigImageArray.length/2);
var lastOffset=startPos;
var totalPicToDisplay = 5
var activeObj, lastObj
function initGallery(){
	document.getElementById('mainImg').src = '/gallery/' + bigImageArray[lastOffset+2];
	document.getElementById('mainLink').href = linkArray[lastOffset+2];
	document.getElementById('galleryThumbs').innerHTML = '';
	for(i=lastOffset;i<lastOffset+totalPicToDisplay;i++){
		addStyle = "margin-right: 3px; cursor: pointer;"
		addclick = "displayBigPic(" + i +");"
		if(i==lastOffset+totalPicToDisplay){addStyle=""}
		if(i==lastOffset+2){
			addStyle +="border:2px solid #3E526B;"
			lastObj = lastOffset+2; 
		}else{
			addStyle +="border: 2px solid #ffffff; filter:gray;"
		}
	
		document.getElementById('galleryThumbs').innerHTML += '<img src="/gallery/' + smallImageArray[i] + '" id="pic'+i+'" style="' + addStyle + '" onmouseover="setBorder('+ i +')" width="63" heigth="64" onClick="'+ addclick +'" />';
	}
}	

function shiftGallery(steps){
	lastOffset = lastOffset + steps;
	if(lastOffset>bigImageArray.length-totalPicToDisplay){lastOffset = bigImageArray.length-totalPicToDisplay}
	if(lastOffset<1){lastOffset = 1}
	initGallery();
}

function displayBigPic(place){
	document.getElementById('mainImg').src = '/gallery/' + bigImageArray[place];
	document.getElementById('mainLink').href = linkArray[place];
	

}

function setBorder(activeObj){
	document.getElementById('pic' + lastObj).style.border = '2px solid #ffffff';
	document.getElementById('pic' + activeObj).style.border = '2px solid #3E526B';
	document.getElementById('pic' + lastObj).style.filter='gray'
	document.getElementById('pic' + activeObj).style.filter=''
	lastObj = activeObj;
}
function hide(){
	document.getElementById("Msg").innerHTML = '';
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}




