
	
/******************************************
Int NAVIGATION 
*************/ 

/*
living at the cliffs

	
living1_1 = new  Image();
living1_1.src = "/_images/interior/cliffs_living_leftnav_01a.gif";
living1_2 = new  Image();
living1_2.src = "/_images/interior/cliffs_living_leftnav_01b.gif";

living2_1 = new  Image();
living2_1.src = "/_images/interior/cliffs_living_leftnav_02a.gif";
living2_2 = new  Image();
living2_2.src = "/_images/interior/cliffs_living_leftnav_02b.gif";

living3_1 = new  Image();
living3_1.src = "/_images/interior/cliffs_living_leftnav_03a.gif";
living3_2 = new  Image();
living3_2.src = "/_images/interior/cliffs_living_leftnav_03b.gif";

living4_1 = new  Image();
living4_1.src = "/_images/interior/cliffs_living_leftnav_04a.gif";
living4_2 = new  Image();
living4_2.src = "/_images/interior/cliffs_living_leftnav_04b.gif";

	


}

function hiLite(name, source) {
	var bn = navigator.appName;
	var vn = navigator.appVersion;

	if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0")) {
	  document.images[name].src = eval(source + ".src");
  }
}

*/
function setLyr(obj,lyr, xOffset)
{
//	if(obj && obj.tagName == 'MAP' && document.all)
	var newX = findPosX(obj);
	//var newY = findPosY(obj);
	var x = new getObj(lyr);
	newX += xOffset //give it a nudge
	if(x.obj) {
		x.style.left = newX + 'px';
		
		//detect bottom edge
		//if(bMax > 0){
		//	if (newY + x.obj.offsetHeight > bMax){
		//		var adj = bMax - x.obj.offsetHeight
		//		adj += (document.all) ? 1 :  29;
		//		x.style.top = adj + 'px'
		//		}
		//	else
		//		x.style.top = newY + 'px';
		//}
	}
	delete x; //free up the memory
}
function iMapDD(pObj,lyr,xOffset) {
	var p = new getObj(pObj);
	if(p.obj)	setLyr(p.obj,lyr,xOffset);
	showLayer(lyr);
	delete p;
}


function findPosY(obj)
{
	var curtop = (document.all) ? 0 : -28;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function getObj(name) {
	visShow = 'visible';
	visHide = 'hidden';
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
		if(this.obj) 
			this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
		this.obj = document.all[name];
		if(this.obj)
			this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
		if(this.obj)
	   	this.style = document.layers[name];
		visShow = 'show';
		visHide = 'hide';
  }
}

//**************************************
// NAV
//**************************************

var visShow, visHide;

function showLayer(layerID) {		
	for (i=0; i< menuArray.length; i++) 
	{
		if (document.getElementById) 
		{
			document.getElementById(menuArray[i]).style.visibility = "hidden";//document.getElementById('selectBox').style.visibility = 'visible'
		}
		else if (document.layers) 
		{
			document.layers[menuArray[i]].visibility = "hide";			
		}
		else 
		{
			document.all(menuArray[i]).style.visibility = "hidden";
		}
	}
	if (layerID != "")
	{
		if (document.getElementById || document.all) 
		{
			if (document.all) 
			{
				//if (layerID == "things") document.all('selectBox').style.visibility = 'hidden';
				layerVis = document.all(layerID).style;
			}
			else
			{
				layerVis = document.getElementById(layerID).style;//if (layerID == "things") document.getElementById('selectBox').style.visibility = 'hidden';
			}
			visShow = "visible";
			visHide = "hidden";
		}	
		else if (document.layers) 
		{
			layerVis = document.layers[layerID];
			visShow = "show";
			visHide = "hide";	
		}
    
		if (layerVis == visShow) 
		{
			layerVis.visibility = visHide;
		}
		else
		{
			layerVis.visibility = visShow;
		}
	}
}

function reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);



var ns6=document.getElementById&&!document.all
var ie=document.all

function over(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore"){
source.style.backgroundColor=highlightcolor;
source.style.coursor='hand';
//source.style.borderBottom = '1px solid #D6C97E';
}
}

function contains_ns6(master, child) {
while (child.parentNode)
if ((child = child.parentNode) == master)
return true;
return false;
}

function out(e,originalcolor){
if
(ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor;
source.style.coursor='hand';
//source.style.borderBottom = '1px solid #D6C97E';
}





/******************************
Drop-Down
*******************************/
function load1(form) {
     var url = form.Llisted.options[form.Llisted.selectedIndex].value;
     if (url != '') {
			location.href = url;
	  }
     return false;
}

function getLoc(){
	if (document.forms['sel']){
	var frm = document.forms['sel'].Llisted;
	var loc = window.location.href;
	for (i = 0;i < frm.length;i++){
	
		if (loc.indexOf(frm[i].value) != -1){
			frm[i].selected = true;
			
			frm.options[frm.selectedIndex].style.backgroundColor = '#FDD663';
			return true;
			}
		}
	}
}
/**************************/


/*********************************************************************
OPEN WINDOW AND CENTER IT
***********************/


// NewWindow('outage_popup.html','OUT',1100,700,'no')
var win = null;
function NewWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =  'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}


function setMaxLength()
{
	var x = document.getElementsByTagName('textarea');
	var counter = document.createElement('div');
	counter.className = 'counter';
	for (var i=0;i<x.length;i++)
	{
		if (x[i].getAttribute('maxlength'))
		{
			var counterClone = counter.cloneNode(true);
			counterClone.relatedElement = x[i];
			counterClone.innerHTML = '<span>0</span>/'+x[i].getAttribute('maxlength');
			x[i].parentNode.insertBefore(counterClone,x[i].nextSibling);
			x[i].relatedElement = counterClone.getElementsByTagName('span')[0];

			x[i].onkeyup = x[i].onchange = checkMaxLength;
			x[i].onkeyup();
		}
	}
}

function checkMaxLength()
{
	var maxLength = this.getAttribute('maxlength');
	var currentLength = this.value.length;
	if (currentLength > maxLength)
		this.relatedElement.className = 'toomuch';
	else
		this.relatedElement.className = '';
	this.relatedElement.firstChild.nodeValue = currentLength;
	// not innerHTML
}





var winit = null;

function InternationalPhotoTour(inputID)
{
   // if (ShowPopupWarning())
	//{
		LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-480)/2 : 0;
		settings =  'height=480,width=600,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable';
		winit = window.open('/cliffs-international/photo-tour.asp?communityID=' + inputID,'PHOTOTOUR',settings);
		winit.focus();
	//}
}

function golfPhotoTour(courseID)
{
   // if (ShowPopupWarning())
	//{
		LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-480)/2 : 0;
		settings =  'height=480,width=600,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable';
		winit = window.open('/golf/photo-tour.asp?courseID=' + courseID,'PHOTOTOUR',settings);
		winit.focus();
	//}
}

function holePopup(strImage)
{

	//strImage = linkObj.all[0].src;
	lgImage = strImage.replace(/_tn/g, "");
	//lgImage = "cliffs_map_glassy_hole01.jpg";
	window.open("/golf/hole_popup.asp?lgImage=" + lgImage, "hole_win", "width=400,height=600,scrollbars=yes,resizable=yes");
}


function ShowPopupWarning()
{
	return confirm('NOTE: This page is best viewed on newer browsers (5.0+)\nPlease disable any Pop-up Blockers and click \'OK\' to continue...');
}




function Obfuscate(Address) {
var RE;
RE = /^(.+)\*(.+)$/;
var openWindow = Address.replace(RE,"mailto:$1@$2");
window.location = openWindow;
return false;
}






/*********************************************************************
FORM VALIDATION w/side message
***********************/


function vAlert()
{

var MAC= (navigator.platform.indexOf("PPC") > 0); //Mac IE is buggy
//var btn = '<br><input type=\"submit\" value=\"Re-Submit\">';
var i;
	for (i = 0;i< formArray.length;i++)
	{	
		if	(document.getElementById && MAC == false)
		{
			//alert(navigator.userAgent);
			var thisText = 'form' + formArray[i];
			var thisError = 'error' + formArray[i];
			//document.getElementById('error_text').style.visibility = 'hidden';
			//document.getElementById(thisError).style.visibility = 'hidden';
			document.form7[formArray[i]].style.borderWidth = "1px";
			document.form7[formArray[i]].style.backgroundColor = "#F1F4F0";
			document.form7[formArray[i]].style.borderColor = "#7F9DB9";
			document.getElementById(thisText).style.color = '';
			document.getElementById(thisError).style.visibility = 'hidden';
			document.getElementById(thisError).InnerHTML = '';
		}	
		if ((formArray[i] == 'email') && ((document.form7[formArray[i]].value.indexOf('@') == -1) || (document.form7[formArray[i]].value.length < 6) || (document.form7[formArray[i]].value.indexOf('.') == -1)))
		{
			if (document.getElementById && MAC == false)
				{
				//document.getElementById("error_text").style.visibility = 'visible';
				document.getElementById(thisError).style.visibility = 'visible';
					if (document.form7[formArray[i]].value == '')
					{
						//document.getElementById("error_text").innerHTML = errtxt + formArrayDesc[i] + " is a required field";
						document.getElementById(thisError).innerHTML =  "&nbsp;[required]";
						
					}
					else
					{
						//document.getElementById("error_text").innerHTML = errtxt + "A valid e-mail address is required";
						document.getElementById(thisError).innerHTML =  "&nbsp;[A valid e-mail address is required]";
					}
				}
			else
				alert('Please enter a properly formatted email address');
			return vLite(formArray[i])
		}
		
		if (document.form7[formArray[i]].type == 'select-one')
		{
			if (document.form7[formArray[i]].selectedIndex == 0)
			{
				if (document.getElementById && MAC == false)
					{
						//document.getElementById('error_text').style.visibility = 'visible';
						//document.getElementById('error_text').innerHTML = errtxt + formArrayDesc[i] + " is a required field";
						document.getElementById(thisError).style.visibility = 'visible';
						document.getElementById(thisError).innerHTML =  "&nbsp;[required]";
					}
				else
					alert(formArrayDesc[i] + ' is a required field');
				return vLite(formArray[i]);
			}
		}
		
	 	if (document.form7[formArray[i]].value == '')
		{
			
			if (document.getElementById && MAC == false)
			{
				//document.getElementById('error_text').style.visibility = 'visible';
				//document.getElementById('error_text').innerHTML = errtxt + formArrayDesc[i] + " is a required field";
				document.getElementById(thisError).style.visibility = 'visible';
				document.getElementById(thisError).innerHTML =  "&nbsp;[required]";
				//document.getElementById(thisError).innerHTML =  "&nbsp;<span class='red'><i>" + formArrayDesc[i] + " is required</i></span>";
			}
			else
				alert(formArrayDesc[i] + ' is a required field');
			return vLite(formArray[i]);
		}
	}
	
		if	(document.getElementById && MAC == false)
		{
			for (i = 0;i< document.form7.length;i++) //FORM PASSED :)
			{
				document.form7[i].style.backgroundColor = "#E6FBE7";
			}
				//document.form7["submit"].style.color = "#ff0000";
		}
		return true;
}
function vLite(item)
{
var MAC= (navigator.platform.indexOf("PPC") > 0);
	var thisText = 'form' + item;
	if	(document.getElementById && MAC == false)
	{
		location.href = '#formtop';
		document.form7[item].style.backgroundColor = "#FFFF6F";
		document.form7[item].style.borderColor = "#7F9DB9";
		document.form7[item].style.borderWidth = "1px";
		document.form7[item].value = document.form7[item].value;
		document.getElementById(thisText).style.color = "#FF0000";
	}
	document.form7[item].focus();
	return false;
}


