	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/gallery/" + splitquery(querystring);
}

function getArray(npindex){
	maxImages = arrPhoto.length; 	
	if(arrPhoto.length >= npindex) photoGal.src = "../images/gallery/" + 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("tkv-1.jpg","tkv-2.jpg","tkv-3.jpg","tkv-4.jpg","tkv-5.jpg","tkv-6.jpg","tkv-7.jpg","tkv-8.jpg","tkv-9.jpg","tkv-10.jpg","tkv-11.jpg","tkv-12.jpg","tkv-13.jpg","tkv-14.jpg");
	}else
	if(category[1] == "chandrathara"){
		arrPhoto = new Array("chandrathara-plan.jpg");
	}else
	if(category[1] == "pallimala"){
		arrPhoto = new Array("siteplan.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];

}

/*
if(isNaN(imgNum)){
	imgNum = 1;
}

nextNum = imgNum + 1;
prevNum = imgNum - 1;

if(prevNum <= 0) {
	prevNum = maxImages;
}
if(nextNum > maxImages) {
	nextNum = 1;
}

nextImage = new Image();
prevImage = new Image();
nextImage.src = "../image/" + nextNum + "_b.jpg";
prevImage.src = "../image/" + prevNum + "_b.jpg";

function getImage(imgNumber) {
	//alert(imgNumber);
	photoGal.src = "../image/" + imgNumber + "_b.jpg";
}

function showPhoto(pageUrl,winHeight) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 600;
	//winHeight = 618;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	pageUrl = "popup.html?" + pageUrl
	//window.location.href = pageUrl;
	window.open(pageUrl, "photogallery", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=0,resizable=0");
	return;
}
*/

function showPhoto(arr,index,winHeight){
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 950;
	winHeight = 600;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	pageUrl = "html/07phot.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;	
}

/*
function delineate(str){
	theleft = str.indexOf("=") + 1;
	theright = str.lastIndexOf("&");
	return(str.substring(theleft, theright));
}
*/


