//used to show help info
function pophelp(e)
{
	var h = $("#help-"+e).html().toString().replace(/\<br\>/ig,"\n");	
	alert(h);	
}

//used on featured style pages
function swapimg(propid,photonum)
{
	$("#bigpic-"+propid).fadeOut("fast",function() {
		$("#bigpic-"+propid).attr({"src":"http://properties.villaleisure.com/prop_imgs/"+propid+"/orig/"+photonum+".jpg"});
		$("#bigpic-"+propid).fadeIn("fast",null);	
	});
}

//used in search results
var ptimer = '';
var curid = '';
var curcount = 1;
function setupswap(id)
{
	//ptimer = setTimeout("startpicswap("+id+")",1000);	
}

//used in search results
function startpicswap(id)
{
	clearTimeout(ptimer);
	curid = id;
	curcount++;
	if (curcount == 2) curcount = 3;
	if (curcount == 6) curcount = 1;
	$("#pic-"+id).attr({"src":"http://properties.villaleisure.com/prop_imgs/"+id+"/"+curcount+".jpg"});
	ptimer = setTimeout("startpicswap("+id+")",1500);
}

//used in search results
function endpicswap(id)
{
	clearTimeout(ptimer);
}

//startup options
$(document).ready(function() {
	$(".flip").hover(function() {
		$(this).attr({"src":$(this).attr("src").replace("images/","images/hover/")});							  
	},function() {
	    $(this).attr({"src":$(this).attr("src").replace("images/hover/","images/")});
	});
	
	$("table.cform tr td .inp").bind("focus",function() {
		$(this).addClass("active");
	});
	
	$("table.cform tr td .inp").bind("blur",function() {
		$(this).removeClass("active");												  
	});
	
	$("table.infoclass tr:even td").addClass("even");
	$("table.infoclass tr:odd td").addClass("odd");
	
	//if ($(".date_input").length > 0) $(".date_input").date_input();
	

});

function checkform()
{
	var invalid = false;
	$("#requiredfields .inp").each(function() {
		if ($(this).val() == '') invalid = true;										
	});
	if (invalid == true) 
	{
		alert("Please fill in the required fields: Full Name, E-Mail Address, and \na Phone Number where we can reach you.");
		return false;
	}
	else return true;
	
}
