
function mls_option_toggle(value)
{
    var mls_extra = document.getElementById('mls_extra');

    if ( (value == 'previously_listed') || (value === 'currently_listed'))
    {
        mls_extra.className = "show";
    }
    else
    {
        mls_extra.className = "hidden";
    }
}



function prop_type_other(text)
{
    var prop_div = document.getElementById('prop_type_hidden');
    if (text == 'Other')
    {
        prop_div.className = "show";
    }
    else
    {
        prop_div.className = "hidden";
    }
}

function RemoveImage(image)
{
    var id = "td" + image;
    var ele = document.getElementById(id);

    input = '<input type="file" name="images[]">';
    input += '<input type="hidden" name="removedimages[]" value="' + image + '">';


    ele.innerHTML = input;
}




// change image
function changeImage(newUrl,width, height, full)
{
    
    
    //alert(width);
    //alert(height);
 	var imageId = 'target_image';
	if (document.getElementById(imageId))
	{
		var img = document.getElementById(imageId);
		img.src = newUrl;
	    
		if(full == false)
		{	
    		w = img.width;
    		h = img.height;
    		
    		if (height > 275)
    		{
    		    new_w = width;
    		    new_h = height;
    		    while (new_h > 275)
    		    {
    		        new_h = (new_h / 1.0001);
    		        new_w = (new_w / 1.0001);
    		    }
    		    
                img.width = new_w;
    		    img.height = new_h;
    		}
    		else
    		{
    		    img.width  = width;
    		    img.height = height;
    		}
		}
		else
		{
		    return true;
		}
    		
		
		
	}
	else
	{
		alert('Could not locate image DIV.');
	}
}



var new_win;
function popup(url, width, height)
{
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
new_win = window.open(url, "new_win", "width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes,resizable=yes,location=0")
return new_win;
}


function ShowHide(id)
{
    var ele = document.getElementById(id);
    if (ele.className == 'hidden')
    {
        ele.className = 'show';
    }
    else
    {
        ele.className = 'hidden';
    }
    
}

