//<!--

//Open a popup window for the editor
function openPopup(url)
{
	width=520;
	height=550;
	x=parseInt(screen.width/ 2.0) - (width /2.0);
	y=parseInt(screen.height/ 2.0) - (height /2.0);
	
	var win=window.open(url,"editorPopup","top="+y+",left="+x+",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width="+width+",height="+height+",resizable=no");
}

//Popup window for other popups
function openAPopup(url, x, y)
{
	width=x;
	height=y;
	x=parseInt(screen.width/ 2.0) - (width /2.0);
	y=parseInt(screen.height/ 2.0) - (height /2.0);
	
	var win=window.open(url,"popup","top="+y+",left="+x+",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width="+width+",height="+height+",resizable=no");
}

var totalThumbsGlobal = 0;

function showExtras(totalThumbs) {
    totalThumbsGlobal = totalThumbs;
    if(totalThumbs < 4)	            
        document.getElementById("thumbPaneClose").style.display = 'none';
}



function flipPane(way)
{
    if (totalThumbsGlobal > 3)
    {
        document.getElementById("thumbsSurround").style.overflow = way;
        if(way == 'visible')
        {
            document.getElementById("thumbPane").style.padding = '9px';
            document.getElementById("thumbPane").style.border = '1px solid #cc9999';
            document.getElementById("thumbPane").style.background = '#ece9df';
            document.getElementById("thumbPane").style.margin = '0 0 10px 0';
        }
        else
        {
            document.getElementById("thumbPane").style.padding = '10px';
            document.getElementById("thumbPane").style.border = '0px';
            document.getElementById("thumbPane").style.background = 'white';
        }
    }
}

function createUUID() {
    var s = [];
    var hexDigits = '0123456789ABCDEF';
    for (var i = 0; i < 32; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
    }
    s[12] = '4';  // bits 12-15 of the time_hi_and_version field to 0010 
    s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01 
    var uuid = s.join('');
    return uuid;
}


function addHiddenField(theForm, name, value) {
    var e1 = document.createElement("input");
    e1.type = "hidden";
    e1.name = name;
    e1.value = value;
    theForm.appendChild(e1);
}

function doSalesSearch() {

    // create new form to avoid conflict with existing forms
    var theForm = document.createElement("form");
    theForm.setAttribute("method", "post");
    theForm.setAttribute("action", "http://www.dezrez.com/DRApp/DotNetSites/WebEngine/property/Default.aspx");
  
    // Add fields

    var sbedrooms = document.getElementById("bedrooms");
    var smin = document.getElementById("minPrice");
    var smax = document.getElementById("maxPrice");
    var cWinchmore = document.getElementById("cbWinchmore");
    var cWanstead = document.getElementById("cbWanstead");
    
    var branches = new Array();
    if (cWinchmore.checked) {
        branches.push("1905");
    }
    if (cWanstead.checked) {
        branches.push("1888");
    }
    if(0 < branches.length) {
        addHiddenField(theForm, "branchList", branches.join(","));
    }
    addHiddenField(theForm, "bedrooms", sbedrooms.options[sbedrooms.selectedIndex].value);
    addHiddenField(theForm, "minPrice", smin.options[smin.selectedIndex].value);
    addHiddenField(theForm, "maxPrice", smin.options[smax.selectedIndex].value);

    addHiddenField(theForm, "eaid", "1173");
    addHiddenField(theForm, "apikey", "211F43E6-B9FC-49B4-875F-610ADE39A889");
    addHiddenField(theForm, "GUID", createUUID());

    document.body.appendChild(theForm);
    theForm.submit();
}




//-->
