//startFlash
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//Handle all the the FSCommand messages in a Flash movie
//clip name should match the 'IDhere'_DoFSCommand
function ipBtn_DoFSCommand(command, args) {
	if (command == "ipLink") {
		window.open(args);
	}
}
//Hook for Internet Explorer for intLinkClip 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub ipBtn_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call ipBtn_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}
//
//endofFlash
//
//startFlash
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
//clip name should match the 'IDhere'_DoFSCommand
function PromoArea_DoFSCommand(command, args) {
	if (command == "internalLink") {
		document.location.href=args;
	}
}
// Hook for Internet Explorer for intLinkClip 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub PromoArea_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call PromoArea_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}
//
//endofFlash
//
//startFlash
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
//clip name should match the 'IDhere'_DoFSCommand
function lvBox_DoFSCommand(command, args) {
	if (command == "internalLink") {
		document.location.href=args;
	}
}
// Hook for Internet Explorer for intLinkClip 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub lvBox_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call lvBox_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}
//
//endofFlash
//
function ValLogin(){
	var isAnError = false;
	var errMsg = "";
	//
	if (document.LoginInfo.un.value == ''){
		errMsg += "You must enter a Username.\n";
		isAnError = true;
	}
	//
	if (document.LoginInfo.pw.value == ''){
		errMsg += "You must enter a Password.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('LoginInfo').submit();
	}
}
//
//Swap images in gallery
function SwapImg(ThumbWidth, ThisSrc) {
	//alert(ThisSrc)
	BigImgSrc = document.getElementById('img01').src;
	ThumbSrc = BigImgSrc.replace(/width=400/, "width="+ThumbWidth);
	ThumbSrc = ThumbSrc.replace(/height=320/, "100");
	//
	Img01Src = ThisSrc.replace("width="+ThumbWidth, "width=400");
	Img01Src = Img01Src.replace(/height=100/, "height=320");
	//
	document.getElementById('img01').src=Img01Src;
	return ThumbSrc;
}
//
function DisableSearch() {
	document.getElementById('sPropType').disabled=true;
	document.getElementById('sLocation').disabled=true;
	document.getElementById('sBedNum').disabled=true;
	document.getElementById('sPriceRange').disabled=true;
	document.getElementById('RefNum').disabled=true;
}
//
function SubmitValues() {
	document.getElementById('PropType').value 	= document.getElementById('sPropType').value;
	document.getElementById('Location').value 	= document.getElementById('sLocation').value;
	document.getElementById('BedNum').value		= document.getElementById('sBedNum').value;
	document.getElementById('PriceRange').value = document.getElementById('sPriceRange').value;
	//
	document.getElementById('sInfo').submit();
}
//
function ResetSearch() {
	document.getElementById('sInfo').action = 'searchBox.asp';
	document.getElementById('sInfo').target = '_self';
	//
	document.getElementById('sPropType').disabled=false;
	document.getElementById('sLocation').disabled=false;
	document.getElementById('sBedNum').disabled=false;
	document.getElementById('sPriceRange').disabled=false;
	document.getElementById('RefNum').disabled=false;
	//
	document.getElementById('sPropType').value = '';
	document.getElementById('sLocation').value = '';
	document.getElementById('sBedNum').value = '';
	document.getElementById('sPriceRange').value = '';
	//
	document.getElementById('Reset').value = 'Yes';
	document.getElementById('PropType').value = '';
	document.getElementById('Location').value = '';
	document.getElementById('BedNum').value = '';
	document.getElementById('PriceRange').value = '';
	document.getElementById('RefNum').value = 'Enter Ref. Nş';
	//
	document.getElementById('sInfo').submit();
}
//
function PopPrint(RefNum) {
	window.open('print.asp?RefNum='+RefNum);
}
//
function ValRecProp(){
	var isAnError = false;
	var errMsg = "You need to enter;\n\n";
	//
	if (document.RecInfo.SenderName.value == ''){
		errMsg += " Your name.\n";
		isAnError = true;
	}
	//
	if (document.RecInfo.SenderEmail.value == ''){
		errMsg += " Your email address.\n";
		isAnError = true;
	}
	//
	if(document.RecInfo.SenderEmail.value != "") {
		if (!isEmail(document.RecInfo.SenderEmail.value)){
			errMsg += " A valid email address for yourself.\n";
			isAnError = true;
		}
	}
	//
	if (document.RecInfo.RecipName.value == ''){
		errMsg += " Your friend\'s name.\n";
		isAnError = true;
	}
	//
	if (document.RecInfo.RecipEmail.value == ''){
		errMsg += " Your friend\'s email address.\n";
		isAnError = true;
	}
	//
	if(document.RecInfo.RecipEmail.value != "") {
		if (!isEmail(document.RecInfo.RecipEmail.value)){
			errMsg += " A valid email address for your friend.\n";
			isAnError = true;
		}
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('RecInfo').submit();
		return true;
	}
}
//
function PopRecPage(ID){
	wStr = 400;
	hStr = 450;
	lStr = 0;
	tStr = 0;
	if (screen){
		lStr = (screen.width/2) - (wStr/2);
		tStr = (screen.height/2) - (hStr/2);
	}
	RecWin = window.open('recProp.asp?ID='+ID,'RecWin','width='+wStr+', height='+hStr+', top='+tStr+', left='+lStr+', status=no');
	if (window.focus) {
		RecWin.focus();
	}
}
//
function PopLifestyleVisit(vName){
	wStr = 400;
	hStr = 496;
	lStr = 0;
	tStr = 0;
	if (screen){
		lStr = (screen.width/2) - (wStr/2);
		tStr = (screen.height/2) - (hStr/2);
	}
	lvWin = window.open('lvForm.asp?vName='+vName,'lvWin','width='+wStr+', height='+hStr+', top='+tStr+', left='+lStr+', status=no');
	if (window.focus) {
		lvWin.focus();
	}
}
//
function isEmail(eml){
	var i = 1;
	var emlLength = eml.length;
	while ((i < emlLength) && (eml.charAt(i) != "@")){
		i++;
	}
	if ((i >= emlLength) || (eml.charAt(i) != "@")) {
		return false;
	}
	else {
		i += 2;
	}
	while ((i < emlLength) && (eml.charAt(i) != ".")){
		i++;
	}
	if ((i >= emlLength - 1) || (eml.charAt(i) != ".")){
		return false;
	}
	else {
		return true;
	}
}
//
function ValGenEnq(){
	var isAnError = false;
	var errMsg = "You need to enter;\n\n";
	//
	if (document.RecInfo.Name.value == ''){
		errMsg += " Your name.\n";
		isAnError = true;
	}
	//
	if (document.RecInfo.Email.value == ''){
		errMsg += " Your email address.\n";
		isAnError = true;
	}
	//
	if(document.RecInfo.Email.value != "") {
		if (!isEmail(document.RecInfo.Email.value)){
			errMsg += " A valid email address.\n";
			isAnError = true;
		}
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		if (document.RecInfo.Comments.value == ''){
			if (confirm('You haven\'t made any comments containing the nature of you enquiry.\n\nDo you want to send anyway?')){
				document.getElementById('RecInfo').submit();
				return true;
			}
		} else {
			document.getElementById('RecInfo').submit();
			return true;
		}
	}
}
//
function ValPropEnq(){
	var isAnError = false;
	var errMsg = "You need to enter;\n\n";
	//
	if (document.RecInfo.Name.value == ''){
		errMsg += " Your name.\n";
		isAnError = true;
	}
	//
	if (document.RecInfo.Email.value == ''){
		errMsg += " Your email address.\n";
		isAnError = true;
	}
	//
	if(document.RecInfo.Email.value != "") {
		if (!isEmail(document.RecInfo.Email.value)){
			errMsg += " A valid email address.\n";
			isAnError = true;
		}
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		if (document.RecInfo.Comments.value == ''){
			if (confirm('You haven\'t made any comments about the property or \nthe nature of your enquiry.\n\nDo you want to send anyway?')){
				document.getElementById('RecInfo').submit();
				return true;
			}
		} else {
			document.getElementById('RecInfo').submit();
			return true;
		}
	}
}
//
function ValLV(){
	var isAnError = false;
	var errMsg = "You need to enter;\n\n";
	//
	if (document.RecInfo.Name.value == ''){
		errMsg += " Your name.\n";
		isAnError = true;
	}
	//
	if (document.RecInfo.Email.value == ''){
		errMsg += " Your email address.\n";
		isAnError = true;
	}
	//
	if(document.RecInfo.Email.value != "") {
		if (!isEmail(document.RecInfo.Email.value)){
			errMsg += " A valid email address.\n";
			isAnError = true;
		}
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('RecInfo').submit();
		return true;
	}
}
//
//
function ShowInfo(ShowThis){
	var DivList = document.getElementsByTagName('div');
	var i = DivList.length; while( i-- ) {
		if( DivList[i].id.indexOf('DevInfo_') === 0 ) {
			DivList[i].style.display = 'none';
		}
	}
	document.getElementById(ShowThis).style.display = 'block';
}
//
function ValUIReg(){
	var isAnError = false;
	var errMsg = "There is a problem with your resgistration.\n\n";
	//
	if (document.uInfo.fn.value == ''){
		errMsg += " Enter your first name.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.ln.value == ''){
		errMsg += " Enter your last name.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.eml.value == ''){
		errMsg += " Enter your email address.\n";
		isAnError = true;
	}
	//
	if(document.uInfo.eml.value != "") {
		if (!isEmail(document.uInfo.eml.value)){
			errMsg += " Enter a valid email address.\n";
			isAnError = true;
		}
	}
	//
	if (document.uInfo.pw.value == ''){
		errMsg += " Enter a password.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.pw.value != '' && document.uInfo.pw.value.length < 6){
		errMsg += " Please use a password with at least 6 characters.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.pw.value != '' && document.uInfo.pw.value.length >= 6 && document.uInfo.cpw.value == ''){
		errMsg += " Confirm your password.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.pw.value.length >= 6 && document.uInfo.cpw.value != '' && (document.uInfo.pw.value != document.uInfo.cpw.value)){
		errMsg += " Your passwords do not match.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//
function ValUIUPD(){
	var isAnError = false;
	var errMsg = "There is a problem with your information.\n\n";
	//
	if (document.uInfo.fn.value == ''){
		errMsg += " Enter your first name.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.ln.value == ''){
		errMsg += " Enter your last name.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.eml.value == ''){
		errMsg += " Enter your email address.\n";
		isAnError = true;
	}
	//
	if(document.uInfo.eml.value != "") {
		if (!isEmail(document.uInfo.eml.value)){
			errMsg += " Enter a valid email address.\n";
			isAnError = true;
		}
	}
	//
	if (document.uInfo.pw.value == ''){
		errMsg += " Enter your password to apply the update.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.pw.value != '' && document.uInfo.pw.value.length < 6){
		errMsg += " Please use a password with at least 6 characters.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//
function ValLOGIN(){
	var isAnError = false;
	var errMsg = "You need to enter.\n\n";
	//
	if (document.uInfo.un.value == ''){
		errMsg += " An email address.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.pw.value == ''){
		errMsg += " A password.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//
function ValUIEML(){
	var isAnError = false;
	var errMsg = "There is a problem with your information.\n\n";
	//
	if (document.uInfo.eml.value == ''){
		errMsg += " Enter your email address.\n";
		isAnError = true;
	}
	//
	if(document.uInfo.eml.value != "") {
		if (!isEmail(document.uInfo.eml.value)){
			errMsg += " Enter a valid email address.\n";
			isAnError = true;
		}
	}
	//
	if (document.uInfo.pw.value == ''){
		errMsg += " Enter your password to apply the update.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//
function ValUPDPW(){
	var isAnError = false;
	var errMsg = "There is a problem with your new password.\n\n";
	//
	if (document.uInfo.opw.value == '' || document.uInfo.npw.value == '' || document.uInfo.cpw.value == ''){
		errMsg += " You need to enter a password in each box.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.npw.value != '' && document.uInfo.npw.value.length < 6){
		errMsg += " Please use a password with at least 6 characters.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.npw.value != '' && document.uInfo.npw.value.length >= 6 && document.uInfo.cpw.value == ''){
		errMsg += " Confirm your password.\n";
		isAnError = true;
	}
	//
	if (document.uInfo.npw.value.length >= 6 && document.uInfo.cpw.value != '' && (document.uInfo.npw.value != document.uInfo.cpw.value)){
		errMsg += " Your passwords do not match.\n";
		isAnError = true;
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//
//
function ValUIREM(){
	var isAnError = false;
	//
	if (document.uInfo.eml.value == ''){
		errMsg = "Please enter an email address.\n";
		isAnError = true;
	}
	//
	if(document.uInfo.eml.value != '') {
		if (!isEmail(document.uInfo.eml.value)){
			errMsg = "Please enter a valid email address.\n";
			isAnError = true;
		}
	}
	//
	if(isAnError){
		alert(errMsg);
		return false;
	}
	//
	if(!isAnError){
		document.getElementById('uInfo').submit();
		return true;
	}
}
//