//<!--
function confirmMessage(strText){

	if(window.confirm(strText)){
		return true;
	}
	else
		return false;
}

function newWindow(url, windowWidth, windowHeight, scroll, resize){

	var h = windowHeight;
	var w = windowWidth;
	var disScroll, disResize;
	
	if(scroll=='bars')
		disScroll = 'yes';
	else
		disScroll = 'no';

	if(resize=='resize')
		disResize = 'yes';
	else
		disResize = 'no';

	if(screen.width){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	}else{winl = 0;wint =0;}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';

	win = window.open(url , '' , settings + ', scrollbars=' + disScroll + ', menubars=no, toolbars=no, resizable=' + disResize);
	win.window.focus();
}

function changePage(perPage, pageOn, pageFrom, pageCount, pageLimit, itemCount, urlGoing, ckeOn, strName1, strValue1, strName2, strValue2, strName3, strValue3, strName4, strValue4, strName5, strValue5, strName6, strValue6){
	//Change page v.2
	var urlGoing;
	var count;

	pageTotal = itemCount - ((pageOn - 1) * perPage);
	//change value to positive
	pageTotal = pageTotal + (pageTotal * -2 )
	//shift page if current page use is on will have no records
	//left on it after a new 'per page' is selected
	shiftPage = 0
	if (pageTotal >= 0){
		shiftPage = 1
		counter = 0
		for(count = 0;count < pageTotal; count++){
			counter++;
			if(counter >= perPage){
				shiftPage++
				counter = 0
			}
		}
	}
	//calculate new 'from' page depending on new 'on' page shifted to
	intLastNum = 0
	for(count=1; count <= pageCount; count = count + parseInt(pageLimit)){
		if (count > (parseInt(pageOn)-shiftPage)){
			pageFrom = intLastNum;
			break;
		}
		intLastNum = count;
	}
	//create url and send user there
	urlGoing = urlGoing + '?pageon=' + (parseInt(pageOn)-shiftPage);
	if(pageFrom != '')
		urlGoing += '&pagefrom=' + intLastNum;
	urlGoing += '&pageper=' + perPage;
	//general querystring addition for extra values not included
	if(strName1 != null && (strValue1 != null && strValue1 != ''))
		urlGoing += '&' + strName1 + '=' + strValue1;
	if(strName2 != null && (strValue2 != null && strValue2 != ''))
		urlGoing += '&' + strName2 + '=' + strValue2;
	if(strName3 != null && (strValue3 != null && strValue3 != ''))
		urlGoing += '&' + strName3 + '=' + strValue3;
	if(strName4 != null && (strValue4 != null && strValue4 != ''))
		urlGoing += '&' + strName4 + '=' + strValue4;
	if(strName5 != null && (strValue5 != null && strValue5 != ''))
		urlGoing += '&' + strName5 + '=' + strValue5;
	if(strName6 != null && (strValue6 != null && strValue6 != ''))
		urlGoing += '&' + strName6 + '=' + strValue6;
	//if set cookie to remember pageper on frontend
	if(ckeOn == 'on')
		document.cookie = "pageper=" + perPage
	window.location.href = urlGoing;
}
//-->
