	var nextNum, prevNum, maxImages, arrPhoto;
	//	imgNum = parseInt(window.location.search.substring(1), 10);
	var querystring, category, arrindex, q1;
	querystring = window.location.search.substring(1);

function getImage(){
	if(querystring.length > 0) photoGal.src = "../images/photos/" + splitquery(querystring);
}

function getArray(npindex){
	maxImages = arrPhoto.length; 	
	if(arrPhoto.length >= npindex) photoGal.src = "../images/photos/" + arrPhoto[npindex];
	
	nextNum = parseInt(npindex) + 1;
	
	if(npindex == 0){
		prevNum = maxImages - 1;
	}else{
		prevNum = parseInt(npindex) - 1;
	}
	if(nextNum >= maxImages){
		nextNum = 0;
	}	
}

function splitquery(str){
	var catr, ind, maxImages;
	q1 = querystring.split('&');
	
	category = q1[0].split('=');
	arrindex = q1[1].split('=');
	catr	=	category[1];
	ind		=	arrindex[1];
	
	if(category[1] == "floors"){
		arrPhoto = new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg","9.jpg","10.jpg");
	}

	maxImages	=	arrPhoto.length;
	nextNum 	= 	parseInt(ind) + 1;
	prevNum 	= 	parseInt(ind) - 1;
	
	if(prevNum <= 0){
		prevNum = maxImages - 1;
	}
	if(nextNum >= maxImages - 1){
		nextNum = 0;
	}	

	return arrPhoto[ind];

}


function showPhoto(arr,index,winHeight){
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 783;
	winHeight = 576;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	pageUrl = "html/popup.htm?arr=" + arr + "&index=" + index;
	window.open(pageUrl, "photogallery", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
	return;	
}


