﻿function CL() { 

	var Clicked =0;
	var C11967976851612= "reg1021_.php";
	var FormName="reg";
	var C11967976851611= "http://husseyrealestategroup.com/pages/";
	//var C11967976851611= "http://66.153.118.118/husseyrealestategroup/pages/";
//var C11967976851611= "http://192.168.1.20/husseyrealestategroup/pages/";

	Clicked++;
	if(Clicked > 1) 
	{ 
		return; 
	}
	eval("document."+FormName+".action='"+C11967976851611+C11967976851612+"'");
}

function get_news(filename, curItem, total) {
				var path='news/' + filename;
				/*alert(path);*/
				
				
				dojo.byId('newhomedictionary_box').innerHTML = '<img src="../media/images/loading.gif" width="32" height="32" alt="loading" style="margin-left:200px" />';
				
				dojo.io.bind({
					url: path,
					load: function(type, data, evt){
						dojo.byId('newhomedictionary_box').innerHTML = data;
						
					},
					mimetype: "text/plain"
				});							
}





/* Dropdown function */
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

///change out rendering on project page
function swap_renderings(style,link_obj,img_obj,rendering_filename,count)
{
	i = 1;
	
	for (i = 1; i <= count; i++ )
	{
		obj = 'r_' + i;
		//if ( obj != link_obj )
		//{
			document.getElementById(obj).className = 'fp_nav_off';
		//}
	}
	document.getElementById(img_obj).src='../media/images/renderings/' + rendering_filename;
	document.getElementById(link_obj).className = style;
}


// browser detection
var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;

// DHTML functions
var DHTML = (document.getElementById || document.all || document.layers);

function lightup(imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + "_on.src");
      document[imgName].src= imgOn;
    }
 }

function turnoff(imgName)
 {
   if (document.images)
    {
      imgOff=eval(imgName + "_off.src");
      document[imgName].src= imgOff;
    }
 }

function getObj(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else
	if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else
	if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

// return document object by id;
function getobject(obj){
if (document.getElementById)
	return document.getElementById(obj)
else if (document.all)
	return document.all[obj]
}

// set obj class style
function setStyle(obj, className) {		
	if(getobject(obj).className != className) {
	getobject(obj).className = className;
	}
}

/// popup window function
function popup(URL,w,h) {

day = new Date();
id = day.getTime();

var width = w;
var height = h;

var left = ((screen.width-width)/2);
var top = ((screen.height-height)/2);

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + '');");
}

/// popup window function with name
function wpopup(URL,n,w,h,sb) {

day = new Date();

var name = n;
var width = w;
var height = h;
if(sb==null){var scrollbar=1}else{var scrollbar=sb}

var left = ((screen.width-width)/2);
var top = ((screen.height-height)/2);


var features = 'toolbar=0,scrollbars=' + scrollbar + ',location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;

//eval("page" + name + " = window.open(URL, '" + name + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + '');");
    
var popWin = window.open(URL, name, features);
popWin.focus();

}


function popWindow(url, name, features) 
{
    var host = location.hostname;
	window.top.name = "opener";
	var popupWin = window.open( url, name, features );
	
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
			popupWin.focus();
		}
	}
}


function enable_other()
{
	if (document.getElementById('clubs_other_check').checked)
	{
		document.getElementById('clubs_other').disabled = false;
		document.getElementById('clubs_other').focus();
	}
	else
	{
		document.getElementById('clubs_other').disabled = true;
		document.getElementById('clubs_other').value = "";
	}
}


/////
///onKeyPress="return numbersonly(this, event)";
/////

function numbersonly(myfield, e, dec)
{
	var key;
	var keychar;
	if (window.event){
		key = window.event.keyCode;
	}else if (e){
		key = e.which;
	}else{
		return true;
	}
	keychar = String.fromCharCode(key);
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ){
		return true;
	}else if ((("+1234567890").indexOf(keychar) > -1)){
		return true;
	}else if (dec && (keychar == ".")){
		myfield.form.elements[dec].focus();
		return false;
	}else{
		return false;
	}
}

///// onKeyUp="numTyped(this.value,p3,'3')"
/// jump phone number fields
function numTyped(current, next,maxlen) {
  var len = current.length;
  if (len==maxlen) {
    next.focus();
  }
}

//// form validation

/// form validation starts here

var new_fieldname = ""

//this is the onclick that calls this function
//
// onClick="return check(form,form.elements.length)"
//


function checkEmail(email) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{
		return (true)
	}
	else
	{
		return (false)
	}
}

/*

function check(form,x)

{

	var message = ""
	var more_message = new Array //(4)
	var showmsg = "no"
	var doItNow = "yes"

	var required = new Array (12)

	if (doItNow == "yes") 	{

			var i = 0;

						
						if (count_checkboxes('clubs[]') >= 0 && count_checkboxes('clubs[]') < 3)
							{more_message [i++] = "\nPlease Select at least 3 choices from the activities section"}
						else if (count_checkboxes('clubs[]') > 3)
							{more_message [i++] = "\nPlease Only Select 3 choices from the activities section"}
						
						if (document.getElementById('clubs_other_check').checked && form.clubs_other.value == "")
						{
							more_message [i++] = "\nPlease enter what your other club is";	
						}
						/// end construct messgaes
						if (more_message != "") {

								if (message == "") {message = more_message}

									else

									{message = message + "\n" + more_message}

				        }

						if (message > "")

								{showmsg = "yes"}																

						if (showmsg == "yes")

			{
				alert("The following form field(s) were incomplete or incorrect:\n\n" + message + "\n\n Please complete or correct the form and submit again.")
				return false;
			}
			else
			{ 
				form.submit()
				return true;
			}

		}

}
*/

/// functions for form validation script

function count_checkboxes(element_name)
{ 
	box_checked = 0;
	with (document.form) { 
		for (var i=0; i < elements.length; i++) { 
			if (elements[i].name == element_name)
				if (  elements[i].checked )
				{ 
						box_checked += 1;
				}
		}
	}
	return box_checked;
}
 
function chkAll(frm, arr, mark) {
  for (i = 0; i <= frm.elements.length; i++) {
   try{
     if(frm.elements[i].name == arr) {
       frm.elements[i].checked = mark;
     }
   } catch(er) {}
  }
}



/* Random Image Animation */

/* 
var c = 1;
   //list of images
var image1 = new Image();
image1.src = "1.jpg";
var image2 = new Image();
image2.src = "2.jpg";
var image3 = new Image();
image3.src = "3.jpg";


function disp_img(w)
   {
   if (c == 4) 
      {
      c = 1;
      }
   var img_src = c + ".jpg"; 
   document.aniImages.src = img_src; // The "name" in html need to match the .aniImages
   c++;
   }
t = setInterval("disp_img(c)", 2500); // diplay image in time, 1000 = time, the bigger the slower
*/
