function getPopUps() {
	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].className == "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; 	
			} 	
		}
		// and for closing the popup window
		if (popuplinks[i].className == "closeWindow") {
			popuplinks[i].onclick = function() {
			opener.location.reload(true);
			window.close(this);
			return false; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL, width, height) {
	window.open(linkURL,'popup','top=5,left=5,scrollbars=1,width=400,height=475')
}

function pageSelect(){
	if (!document.getElementById) return false;
	if (!document.getElementById("page")) return false;
	pageView = document.getElementById("page");
	pageView.onchange = function() {
		window.location = '/'+pageView.value;
	}
}

function demoClick() {

    if (!document.getElementById) return false;
    if (!document.getElementById("demo_bt")) return false;
    alert('test');
    if (!document.getElementById("modalBackground")) return false;
    if (!document.getElementById("demoLogin")) return false; 
    
    
     
    modalBackground = document.getElementById("modalBackground");
    demoBt = document.getElementById("demo_bt");
    demoLogin = document.getElementById("demoLogin");
    demoBt.onclick = function() {  
        modalBackground.style.display = "block";
        demoLogin.style.display = "block";
        return false;
    }
}

function horizonWindowsClick(){
    if (!document.getElementById) return false;
    if (!document.getElementById("dataHousingLink")) return false;
    if (!document.getElementById("modalBackground")) return false;
    if (!document.getElementById("dataHousingModal")) return false;  
    modalBackground = document.getElementById("modalBackground");
    dataHousingLink = document.getElementById("dataHousingLink"); 
    dataHousingModal = document.getElementById("dataHousingModal"); 
    dataHousingLink.onclick = function() {  
        modalBackground.style.display = "block";
        dataHousingModal.style.display = "block";
        return false;
    }  
}

function loginSubmit(){
    if (!document.getElementById) return false;
    if (!document.getElementById("Login2")) return false;
    if (!document.getElementById("demoLogin_modal2")) return false;
    if (!document.getElementById("demoLogin_modal3")) return false;
    demoLogin_modal2 = document.getElementById("demoLogin_modal2");
    demoLogin_modal3 = document.getElementById("demoLogin_modal3");
    
    
    loginBt = document.getElementById("Login2");
    
    loginBt.onclick = function() {
        //window.location = '/feedback'; 
        demoLogin_modal2.style.display = 'none';
        demoLogin_modal3.style.display = 'block';
        return true;    
    }
}

addLoadEvent(loginSubmit);
//addLoadEvent(horizonWindowsClick);
//addLoadEvent(pageSelect);