//<!--
function fncJumpTo(objDdlJumpTo){
	document.location.href = '#dept' + objDdlJumpTo.options[objDdlJumpTo.selectedIndex].value;
}
													
function confirmMessageSelect(objSelect,anchor,strText,option){
		
	if(objSelect.value == '')
		return false;
	var disText
	var current = objSelect.selectedIndex;
	selectText = objSelect.options[current].text;
	
	if(option=='delete'){
		disText = strText + selectText;
	}
	else
		disText = strText;
		
	if(strText!=null){
		if(window.confirm(disText)){
			return true;
		}
		else
			return false;
	}
	if(anchor!=null && anchor!=''){
		document.form1.action = '?' + anchor;
	}
}

function clearBox(objSearch){
	if (objSearch.value=='Enter Keyword' || objSearch.value=='ID' || objSearch.value=='Keyword' || objSearch.value=='Area Code' || objSearch.value=='Enter City')
		objSearch.value = ''
}

function confirmMessage(strText){

	if(window.confirm(strText)){
		return true;
	}
	else
		return false;
}

function checkAll(objCheck){

	//if only single box exists length of objCheck will be null
	if(objCheck.length==null)
		objCheck.checked=true;
	else{
		for (i = 0; i < objCheck.length; i++)
		objCheck[i].checked = true ;
	}
}

function uncheckAll(objCheck){

	//if only single box exists length of objCheck will be null
	if(objCheck.length==null)
		objCheck.checked=false;
	else{
		for (i = 0; i < objCheck.length; i++)
		objCheck[i].checked = 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;
}

function changeListType(strUrl){
	var listType1 = window.document.form1.listType1.value;
	var listType2 = window.document.form1.listType2.value;
	var listType1s = window.document.form1.listType1.checked;
	var listType2s = window.document.form1.listType2.checked;
	var listType = window.document.form1.listtp.value;
	
	if(listType==listType2 && listType1s == true)
	{
		window.location.href = strUrl + '?listtp=' + listType1;
	}
	if(listType==listType1 && listType2s == true)
	{
		window.location.href = strUrl + '?listtp=' + listType2;
	}
}

function sentType(){
	var intType = window.document.frmAddListing.ddlCountry.selectedIndex;
	
	switch(intType){
	
		case 1:
			with (window.document.frmAddListing.ddlState){
				options.length=14;
				options.length=14;
				options[0].text = 'Please Select';
				options[0].value = '';
				options[1].text = 'Alberta';
				options[1].value = 'AB';
				options[2].text = 'British Columbia';
				options[2].value = 'BC';
				options[3].text = 'Manitoba';
				options[3].value = 'MB';
				options[4].text = 'New Brunswick';
				options[4].value = 'NB';
				options[5].text = 'New Foundland';
				options[5].value = 'NF';
				options[6].text = 'Northwest Territories';
				options[6].value = 'NT';
				options[7].text = 'Nova scotia';
				options[7].value = 'NS';
				options[8].text = 'Nunavut';
				options[8].value = 'NU';
				options[9].text = 'Ontario';
				options[9].value = 'ON';
				options[10].text = 'Prince Edward Island';
				options[10].value = 'PE';
				options[11].text = 'Quebec';
				options[11].value = 'QC';
				options[12].text = 'Saskatchewan';
				options[12].value = 'SK';
				options[13].text = 'Yukon';
				options[13].value = 'YT';
			}
			break
		case 2:
			with (window.document.frmAddListing.ddlState){
				options.length=52;
				options[0].text = 'Please Select';
				options[0].value = '';
				options[1].text = 'Alabama';
				options[1].value = 'AL';
				options[2].text = 'Alaska';
				options[2].value = 'AK';
				options[3].text = 'Arizona';
				options[3].value = 'AZ';
				options[4].text = 'Arkansas';
				options[4].value = 'AR';
				options[5].text = 'California';
				options[5].value = 'CA';
				options[6].text = 'Colorado';
				options[6].value = 'CO';
				options[7].text = 'Connecticut';
				options[7].value = 'CT';
				options[8].text = 'Delaware';
				options[8].value = 'DE';
				options[9].text = 'District of Columbia';
				options[9].value = 'DC';
				options[10].text = 'Florida';
				options[10].value = 'FL';
				options[11].text = 'Georgia';
				options[11].value = 'GA';
				options[12].text = 'Hawaii';
				options[12].value = 'HI';
				options[13].text = 'Idaho';
				options[13].value = 'ID';
				options[14].text = 'Illinois';
				options[14].value = 'IL';
				options[15].text = 'Indiana';
				options[15].value = 'IN';
				options[16].text = 'Iowa';
				options[16].value = 'IA';
				options[17].text = 'Kansas';
				options[17].value = 'KS';
				options[18].text = 'Kentucky';
				options[18].value = 'KY';
				options[19].text = 'Louisiana';
				options[19].value = 'LA';
				options[20].text = 'Maine';
				options[20].value = 'ME';
				options[21].text = 'Maryland';
				options[21].value = 'MD';
				options[22].text = 'Massachusetts';
				options[22].value = 'MA';
				options[23].text = 'Michigan';
				options[23].value = 'MI';
				options[24].text = 'Minnesota';
				options[24].value = 'MN';
				options[25].text = 'Mississippi';
				options[25].value = 'MS';
				options[26].text = 'Missouri';
				options[26].value = 'MO';
				options[27].text = 'Montana';
				options[27].value = 'MT';
				options[28].text = 'Nebraska';
				options[28].value = 'NB';
				options[29].text = 'Nevada';
				options[29].value = 'NV';
				options[30].text = 'New Hampshire';
				options[30].value = 'NH';
				options[31].text = 'New Jersey';
				options[31].value = 'NJ';
				options[32].text = 'New Mexico';
				options[32].value = 'NM';
				options[33].text = 'New York';
				options[33].value = 'NY';
				options[34].text = 'North Carolina';
				options[34].value = 'NC';
				options[35].text = 'North Dakota';
				options[35].value = 'ND';
				options[36].text = 'Ohio';
				options[36].value = 'OH';
				options[37].text = 'Oklahoma';
				options[37].value = 'OK';
				options[38].text = 'Oregon';
				options[38].value = 'OR';
				options[39].text = 'Pennsylvania';
				options[39].value = 'PA';
				options[40].text = 'Rhode Island';
				options[40].value = 'RI';
				options[41].text = 'South Carolina';
				options[41].value = 'SC';
				options[42].text = 'South Dakota';
				options[42].value = 'SD';
				options[43].text = 'Tennessee';
				options[43].value = 'TN';
				options[44].text = 'Texas';
				options[44].value = 'TX';
				options[45].text = 'Utah';
				options[45].value = 'UT';
				options[46].text = 'Vermont';
				options[46].value = 'VT';
				options[47].text = 'Virginia';
				options[47].value = 'VA';
				options[48].text = 'Washington';
				options[48].value = 'WA';
				options[49].text = 'West Virginia';
				options[49].value = 'WV';
				options[50].text = 'Wisconsin';
				options[50].value = 'WI';
				options[51].text = 'Wyoming';
				options[51].value = 'WY';
			}
			break
		default:
			with (window.document.frmAddListing.ddlState){
				options.length=1;
				options[0].text = '';
			}
	}
}
//-->