function changeElementText(id, newText) {
    element = document.getElementById(id);
    element.innerHTML = newText;
}


function setQuickOverview(index){ 
    alarmText = document.getElementById("list_alarm_" + index).name;
    changeElementText("alarm", alarmText);
    buzzerText = document.getElementById("list_buzzer_" + index).name;
    changeElementText("buzzer", buzzerText);
    keynumberText = document.getElementById("list_keynumber_" + index).name;
    changeElementText("keynumber", keynumberText);
    presstoenterText = document.getElementById("list_presstoenter_" + index).name;
    changeElementText("presstoenter", presstoenterText);
    ownernameText = document.getElementById("list_ownername_" + index).name;
    changeElementText("ownername", ownernameText);
    phoneText = document.getElementById("list_phone_" + index).name;
    changeElementText("phone", phoneText);
    faxText = document.getElementById("list_fax_" + index).name;
    changeElementText("fax", faxText);
    mlsnumberText = document.getElementById("list_MLSID_" + index).name;
    changeElementText("MLSID", mlsnumberText);
    
    document.filenamepicture.src = document.getElementById("list_filenamepicture_" + index).href;
}

var progressWindow;

function openProgressWindow(){
    progressWindow = window.open('./Progress.html','progressWindow','width=400,height=200');
    progressWindow.focus();
}

function DoClose() {
	progressWindow.close();
}

function closeProgressWindow(){
	setTimeout("DoClose();",1500);
}

function openPrintWindow(openThis){	
		var windowW = 650;
		var windowH = 450;
	
		var url = openThis;
				
		options = "scrollbars=yes,width="+windowW+",height="+windowH;
	
		info = window.open(url, "PrintView", options);
		
		info.focus();
}
function openWindow(openThis, widthThis, heightThis, labelThis, ResizeYesOrNo){	
		var windowW = widthThis;
		var windowH = heightThis;
	
		var url = openThis;
				
		options = "scrollbars=yes,resizable="+ResizeYesOrNo+",width="+windowW+",height="+windowH;
	
		info = window.open(url, labelThis, options);
		
		info.focus();
}

function selectStatus(option,listID,url,key,originalValue,getargs) {
	if(option.value == 'Delete') {
		if(confirm("Are you sure you want to remove this Listing #"+listID+"?"))
			window.location.href='?option=listings&task=listingdetail&op=destroy&listingid='+escape(listID);
		else
			option.selectedIndex = originalValue;
			return false;
	}
	else {
		window.location.href='?option=listings&task=listingdetail'+getargs+'&op=newstatus'+'&newstatus='+escape(key)+'&listingid='+escape(listID);
	}
}