
function isValidPostalCode(postalCode){

		var filter = /^[a-z][0-9][a-z]\s*?[0-9][a-z][0-9]$/i;
		return filter.test(postalCode);
}

function  isValidEmail(email){

		var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;

		return filter.test(email);
}

function isValidWebsite(website){

	var filter = /^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i;

	return filter.test(website);
}

function isEmpty(val){
	return (val == null || val == '');
}


function vtip() {
    this.xOffset = 30; // x distance from mouse
    this.yOffset = -30; // y distance from mouse       
    
    jQuery(".vtip").unbind().hover(    
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            
            jQuery('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );
                        
            jQuery('p#vtip #vtipArrow').attr("src", '/casaguru-july-2011-theme/images/casaguru/tooltip-arrow.png');
            jQuery('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
            
        },
        function() {
            this.title = this.t;
            jQuery("p#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);
                         
            jQuery("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );            
}
