function image_swap(element_id,image_file)
{
 	document.getElementById(element_id).src = image_file;
}

function update_image_description(element_id,description)
{
	var info = (description == "") ? "" : description ;
	document.getElementById(element_id).innerHTML = info;
}

function toggleRentOrSale(val)
{
	if(val == 89 || val == 90)
	{
		document.getElementById("property_price_for_sale").style.display = 'block';
		document.getElementById("property_price_for_rent").style.display = 'none';
		document.getElementById("property_deals").style.display = 'none';
	}
	else
	{
		document.getElementById("property_price_for_rent").style.display = 'block';
		document.getElementById("property_price_for_sale").style.display = 'none';
		document.getElementById("property_deals").style.display = 'block';		
	}
}

var imageCount = 1;

function addMoreImages(elementId,currentImages)
{	
	//Set Image Count
	if(imageCount == 1)
	{
		imageCount = imageCount + currentImages;
	}
	
	if(imageCount == 20)
	{
		alert("For more than 20 Images, Contact Us.");
		return	
	}
	
	var tbody = document.getElementById(elementId);
	var tr = document.createElement("tr");
	var td = document.createElement("td");
	var td2 = document.createElement("td");
	
	td.innerHTML = '<input type="file" name="userfile[]" />';
	tr.appendChild(td);
	
	td2.innerHTML = '<input type="text" name="img_desc[]" id="img_desc" size="40" />';
	tr.appendChild(td2);
	tbody.appendChild(tr);
	
	imageCount++;
	
}


function addMorePeriods(elementId)
{	

	var tbody = document.getElementById(elementId);
	var tr = document.createElement("tr");
	var td = document.createElement("td");
	var td2 = document.createElement("td");
	var td3 = document.createElement("td");
	var td4 = document.createElement("td");
	var td5 = document.createElement("td");
	var td6 = document.createElement("td");
	var td7 = document.createElement("td");
	
	td.innerHTML = "<input type='text' name='period[]' style='width:75px;'>";
	tr.appendChild(td);
	
	td2.innerHTML = "<input value='MM/DD/YY' onfocus='this.value=\"\"' onblur='ddmmyyFix(this)' type='text' name='stD[]' style='width:75px;' >";
	tr.appendChild(td2);
	
	td3.innerHTML = "<input value='MM/DD/YY' onfocus='this.value=\"\"' onblur='ddmmyyFix(this)' type='text' name='enD[]' style='width:75px;' >";
	tr.appendChild(td3);
	
	td4.innerHTML = "<input value='Price($)' onfocus='this.value=\"\"' onblur='priceFix(this)' type='text' name='daily[]' style='width:60px;'>";
	tr.appendChild(td4);
	
	td5.innerHTML = "<input value='Price($)' onfocus='this.value=\"\"' onblur='priceFix(this)' type='text' name='weekly[]' style='width:60px;'>";
	tr.appendChild(td5);
	
	td6.innerHTML = "<input value='Price($)' onfocus='this.value=\"\"' onblur='priceFix(this)' type='text' name='monthly[]' style='width:60px;'>";
	tr.appendChild(td6);
	
	var str = "<select name='minstay[]'>";
	var cnt = 1;
	while(cnt<91)
	{
		str = str + "<option value='"+ cnt + "'>" + cnt + "</option>";
		cnt++;
	}
	str = str + "</select>";
	
	td7.innerHTML = str;
	tr.appendChild(td7);
	
	tbody.appendChild(tr);
	
}

function popUp(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 	'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=450,left = 590,top = 325');");
}


