// XML Load and Display Routines

function verify() { 		// 0 Object is not initialized 
 if (xmlDoc.readyState != 4)  { // 1 Loading object is loading data 
   return false; 		// 2 Loaded object has loaded data 
 } 				// 3 Data from object can be worked with 
}				// 4 Object completely initialized 

function loadXMLDoc(dname) {				// Load XML Document - under Internet Explorer or Firefox
	try {						//Internet Explorer
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  }
	  catch(e) {
	    try {					//Firefox, Mozilla, Opera, etc.
	      xmlDoc=document.implementation.createDocument("","",null);
	      }
	      catch(e) {alert(e.message)}
	  }
	try {
	  xmlDoc.async=false;
	  xmlDoc.load(dname);
	  return(xmlDoc);
	  }
	  catch(e) {alert(e.message)}
	return(null);
}

function Company_Select() {					// creates drop box for Company selection
	document.write('<SELECT	NAME="Company" size="1">');
	for (i = 0; i < $companies.length; i++) {
		if (typeof $companies[i].text != "undefined") {
			$company = $companies[i].text;
			}
			else {
			$company = $companies[i].firstChild.nodeValue;
			}
 		document.write("<option>" + $company + "</option>");
		}
	document.write('</select>');
}

function Award_Select() {					// creates drop box for Award selection
	$award_codes = ".abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	document.write('<SELECT	NAME="Awards" size="1">');
	for (i = 0; i < $awards.length; i++) {
		$f_ID = $awards[i].attributes.getNamedItem("Award_ID").nodeValue;
		$f_fn = $awards[i].attributes.getNamedItem("Description").nodeValue;
 		document.write("<option value='" + $f_ID + "'>" + $f_fn + "</option>");
		}
	document.write('</select>');
}

// gup - "Get URL Parameter" - returns the value for the URL query string parameter you specify
function gup( name ){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return results;
  else
    return results[1];
}

function Show_Picture($ind) {
	var $path = "data/" + $user_id + "/picture_" + $ind + ".jpg";
	var $alt = "this.src='data/" + $user_id + "/nophoto.gif'";
	if ($ind == '0') {
		$alt = "this.src='data/0000/REALTOR.jpg'";
		document.write('<img src="' + $path + '" onerror="' + $alt + '" align="top" height="125"> ');
		document.write('<BR><INPUT TYPE="button" VALUE="Contact Info" onClick=\'location.href="COE_Display_Contact_Info.asp?Realtor=', $user_id, '"\'>&nbsp;')
		}
		else {
			$alt = "this.src='data/0000/NoImage.gif'";
			document.write('<img src="' + $path + '" onerror="' + $alt + '" align="top" height="125"> ');
//			document.write('<img src="' + $path + '" align="top" height="125"> ');
		}
	if ($ind == "4") {
		document.write("<BR><BR>");
		}
}

function GXNV($node) {						// Get XML Node Value
	if ($node == null) {
		$rv = "";
		return $rv;
		}
	if (typeof $node.text != "undefined") {
		$rv = $node.text;
		} else {
			if ($node.firstChild != null) {
				$rv = $node.firstChild.nodeValue;
				} else {
					$rv="";
					}
			}
	return $rv;
}

function APNBSP($value) {					// At least print Non Breaking Space
	$rv = $value;
	if ($value == "") {
		$rv=" ";
		}
	return $rv;
}


