// JavaScript Document

var xmlHttp

function renderMainNav() {
document.write('<ul>');
document.write('<li id="mn-economic"><a href="/economic-development/index.aspx" title="Economic Development">Economic Development</a></li>');
//document.write('<li id="mn-industries"><a href="/industries/index.html" title="Industries">Industries</a></li>');
document.write('<li id="mn-trade"><a href="/international-business/index.html" title="International Business">International Business</a></li>');
document.write('<li id="mn-living"><a href="/living-here/index.aspx" title="Living Here">Living Here</a></li>');
document.write('<li id="mn-pp"><a href="/greater-houston-partnership/public-policy/index.html" title="Public Policy">Public Policy</a></li>');
document.write('<li id="mn-pshp"><a href="/greater-houston-partnership/index.html" title="Partnership">Partnership</a></li>');
document.write('<li id="mn-mem"><a href="/greater-houston-partnership/members/index.asp" title="Members Only">Members Only</a></li>');
document.write('<li id="mn-mem"><a href="/greater-houston-partnership/events/index.asp" title="Events">Events</a></li>');
document.write('<li id="mn-ophou" class="last"><a href="/opportunity-houston/index.aspx" title="Opportunity Houston">Opportunity Houston</a></li>');
document.write('</ul>');
}

function mailpage() {
mail_str = "mailto:?subject=Check out the " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at " + location.href;
location.href = mail_str;
}

//function renderIndFacts() {
//document.write('<div class="industry-facts">');
//document.write('<div class="inner"><img src="/_images/industries/title_industry_facts.gif" alt="Industry Facts" border="0"/>');
//document.write('<ul>');
//document.write('<li><a target="_blank" href="#">Employment by Industry</a></li>');
//document.write('<li><a target="_blank" href="#">Gross Area Product by Industry</a></li>');
//document.write('<li><a target="_blank" href="/pdf/research/16AW001.pdf">Industry Profile</a></li>');
//document.write('<li><a target="_blank" href="/pdf/research/14EW001.pdf">Largest Companies</a></li>');
//document.write('<li><a target="_blank" href="/pdf/research/16ACW001.pdf">Aerospace Industry</a></li>');
//document.write('<li><a target="_blank" href="/pdf/research/16BW010.pdf">Energy Industry</a></li>');
//document.write('<li><a target="_blank" href="/pdf/research/16TW035.pdf">Nanotechnology</a></li>');
//document.write('<li><a target="_blank" href="#">Health Care</a></li>');
//document.write('<li><a target="_blank" href="#">Information Technology</a></li>');
//document.write('</ul>');
//document.write('<a href=""><img src="/_images/industries/btn_facts_sheets.gif" alt="Industry Fact Sheets" /></a></div>');
//document.write('</div>');
//}

 // JavaScript  - News and Events Include //
function renderNewsEvents() {
document.write('<div class="news-events">');
document.write('<div id="vertical_container" >');
//Start News Div
document.write('<h2 class="accordion_toggle">News</h2>');
document.write('<div class="news accordion_content ext">');
//Render News
document.write('<h3 class="first">In the News »</h3>');
document.write('<ul>');
document.write('<li><a href="http://www.cnbc.com/id/15840232?video=789947678&play=1" target="_blank">Texas: #1 State for business</a> <em>CNBC.com</em></li>');
document.write('<li><a href="http://www.newsweek.com/id/142633" target="_blank">Houston, we have no problems</a> <em>Newsweek</em></li>');
document.write('<li><a href="http://abcnews.go.com/WN/story?id=5397007&page=1" target="_blank">Houston: The U.S. Boomtown</a> <em>ABC News</em></li>');
document.write('<li><a href="http://www.nysun.com/opinion/houston-new-york-has-a-problem/81989/" target="_blank">Houston, New York Has a Problem</a> <em>The New York Sun</em></li>');
document.write('<li><a href="http://www.washingtonpost.com/wp-dyn/content/article/2008/06/22/AR2008062202084.html" target="_blank">Houston\'s pipeline of prosperity</a> <em>Washington Post</em></li>');
document.write('</ul>');
document.write('<p class="nobkg"><a href="/economic-development/ratings-rankings/index.aspx">More »</a></p>');
//End News Articles
document.write('</div>');
//End News Div

// Events accordian removed from here

// News accordian removed from here


//error fixing div
//document.write('<div class="accordion_toggle"></div>');
//document.write('<div class="accordion_content end"></div>');
//End error div
//end facts div
document.write('<div class="clear"></div>');
document.write('</div>');
}


function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("events").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


// clears the search field when someone types something in
function checkclear(what){
if(!what._haschanged){
  what.value=''
};
what._haschanged=true;
}


// use this instead of href target blank
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

function hov(loc,cls){
	if(loc.className)
		loc.className=cls;
}

function renderLoginToken() 
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="http://www.houston.org/includes/member_login.asp";
	//url=url+"?fun="+FunctionCode;
	//url=url+"&eid="+EventCode;
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedlogin;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//function stateChangedlogin() 
//{ 
//	if (xmlHttp.readyState==4)
//	{ 
//		document.getElementById("login").innerHTML=xmlHttp.responseText;
//	}
//}




window.onload = function() {
	// check to see that the browser supports the getElementsByTagName method
	// if not, exit the loop 
	if (!document.getElementsByTagName) {
		return false; 
	} 
	// create an array of objects of each link in the document 
	var popuplinks = document.getElementsByTagName("a");
	// loop through each of these links (anchor tags) 	
	for (var i=0; i < popuplinks.length; i++) {	
		// if the link has a class of "popup"...	
		if (popuplinks[i].getAttribute("class") == "popup") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			openPopUp(this.getAttribute("href"));	
			return false; 	
			} 	
		}
	} 
} 

//function openPopUp(linkURL) {
//window.open(linkURL,'popup','width=900,height=500,scrollbars=yes,resize=yes')
//}

window.onload = doIt;

function doIt() {

var allLinks = document.getElementsByTagName('a');
for (var i = 0, thisLink; thisLink = allLinks[i]; i++) {
if (thisLink.className == 'popup') {
thisLink.onclick = function() {
var newWin = window.open(this.href,'popup','width=900,height=500,scrollbars=yes,resize=yes');
return false;
}
}
}

}

