//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 MenuClip_DoFSCommand(command, args) {
	if (command == "menuLink") {
		if(args == "home"){
			args = "default"
		}
		document.location.href=args+".asp";
	}
}
// 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 MenuClip_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call MenuClip_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}
//
//endofFlash
//
//Disable search options
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;
}
//
//Submit search options
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();
}
//
//Reset search options
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 ShowHide(ShowThis){
	//hides then shows selected divs
	for (i = 1; i<6; i++){
		//alert("document.getElementById('img0" + i + "')\n");
		//Hide em all
		document.getElementById('img0'+i).style.display = 'none';
		
	}
	document.getElementById(ShowThis).style.display = 'block';
}
//
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 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){
		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 entered any comments.\n\nDo you wish to continue?')){
				return true;
			} else {
				return false;
			}
		} else {
			return true;
		}
	}
}
//
function PopRecPage(RefNum){
	w = 360;
	h = 370;
	l = 0;
	t = 0;
	if (screen){
		l = (screen.width/2) - (w/2);
		t = (screen.height/2) - (h/2);
	}
	RecWin = window.open('recProp.asp?RefNum='+RefNum,'RecWin','width='+w+', height='+h+', top='+t+', left='+l+', status=no');
	if (window.focus) {
		RecWin.focus();
	}
}
//
function PopPropEnq(RefNum){
	w = 420;
	h = 500;
	l = 0;
	t = 0;
	if (screen){
		l = (screen.width/2) - (w/2);
		t = (screen.height/2) - (h/2);
	}
	RecWin = window.open('PropEnq.asp?RefNum='+RefNum,'RecWin','width='+w+', height='+h+', top='+t+', left='+l+', status=no');
	if (window.focus) {
		RecWin.focus();
	}
}
//