
function deleteListingConfirm(listingID) {
	var agree=confirm("Are you sure you wish to delete this listing permanently from your account?")
	if (agree){
		parent.location="./deletelisting.php?ID=" + listingID;
		//parent.location="./index.php?" + listingID;
	}else{
		return false; 
	}
}

function showFAQ(faqNUM) { 
	document.getElementById(faqNUM).style.display = '';
}
function hideFAQ(faqNUM) { 
	document.getElementById(faqNUM).style.display = 'none';
}

function openWindow(contentURL,windowName, windowWidth, windowHeight, status, toolbar, scrollbars, resizable) {
		
	var winLeft, winTop
	
	winLeft=screen.availWidth/2
	winTop=screen.availHeight/2
	winLeft=parseInt(winLeft - (windowWidth/2))
	winTop=parseInt(winTop - (windowHeight/2))
	if (winLeft < 1) {winLeft = 100}
	if (winTop < 1) {winTop = 100}
	widthHeightStatus = 'height=' + windowHeight + ',width=' + windowWidth + ',toolbar=' + toolbar + ',status=' + status + ',resizable=' + resizable + ',scrollbars=' + scrollbars + ',left=' + winLeft + ',top=' + winTop ;
	childWindow=window.open(contentURL,windowName,widthHeightStatus);
	childWindow.focus();
	}
//_________________________________________________________________________________________

function openWin3(url,w,h,title)
{
	aWindow=window.open(url,title,"toolbar=no,width="+w+",height="+h+",status=no,scrollbars=yes,resize=no,menubars=no");
	aWindow.focus();
}
//_________________________________________________________________________________________

function showPopup(elementId) {
	popup = document.getElementById(elementId);
	if (popup.style.display == "block") {
		popup.style.display = "none";
	} else {
		popup.style.display = "block";
	}
}
//_________________________________________________________________________________________
function SetAllCheckBoxes(obj,formname,fieldname, CheckValue){
		if(document.forms[formname].elements[fieldname+"[]"].length){
			for (i = 0; i < document.forms[formname].elements[fieldname+"[]"].length; i++){
				document.forms[formname].elements[fieldname+"[]"][i].checked = CheckValue;
			}
		}else{
			document.forms[formname].elements[fieldname+"[]"].checked = CheckValue;
		}
}

function confirmdelete() {
	var checkBoxes = false;
	var FormName = "myFavourites";
	var FieldName = "pid";
	// Make sure at least 1 checkbox is checked
	if(document.forms[FormName].elements[FieldName+"[]"].length){
		for (i = 0; i < document.forms[FormName].elements[FieldName+"[]"].length; i++) {
			if (document.forms[FormName].elements[FieldName+"[]"][i].checked == true){
				checkBoxes = true;
			}
		}
	}else{
		if (document.forms[FormName].elements[FieldName+"[]"].checked){
			checkBoxes = true;
		}
	}
	
	if (checkBoxes == true) {
		var agree=confirm("Are you sure you wish to remove the selected properties from your short list?");
		if (agree){
			document.forms[FormName].submit();
		}else{
			return ;
		}
	}else{
		alert("There are no selected properties to remove");
		return ;
	}
}

		function viewInfo(postcode) {	
			window.open("http://www.upmystreet.com/local/l/" + postcode + ".html");
		}
		
		
		function viewMap(postcode) {
			window.open("http://www.multimap.com/map/browse.cgi?client=public&search_result=&db=pc&cidr_client=none&lang=&keepicon=true&pc=" + postcode + "&advanced=&addr2=&quicksearch=" + postcode + "&addr3=&addr1=")
		}
		
	function selectPicture(name){
		document.images.bigPicture.src = "rental/upimg/" + name + "";
	}
	
			function getBrochure(listing) {
			window.open("brochure.php?ID=" + listing)
		}