//**************************Popup class script ******************************
/// creates a popup 800x600 when a link has class="popup on it"
/// example: <a href="default.aspx" class="popup">Home</a>

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].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; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL) {
window.open(linkURL,'popup','location=0,status=0,scrollbars=1,width=850, height=650')
}
// ***** Btn Rollover *****
function roll(imgName,imgState) {
   try{
      document.images[imgName].src = imgState
   }catch( e ){}
}
// ***********************************************************************

// ***** Preload Rollover Images ***************************************
if (document.images) {

    var imgArray = new Array();
	preloadImage( imgArray, "../images/nav/find_your_home_ON.gif" );
	preloadImage( imgArray, "../images/nav/finance_your_home_ON.gif" );
	preloadImage( imgArray, "../images/nav/tour_design_studio_ON.gif" );
	preloadImage( imgArray, "../images/nav/homebuying_experience_ON.gif" );
	preloadImage( imgArray, "../images/nav/customer_care_ON.gif" );
	preloadImage( imgArray, "../images/nav/contact_us_ON.gif" );
	preloadImage( imgArray, "../images/nav/utility_home_ON.gif" );
	preloadImage( imgArray, "../images/nav/utility_about_us_ON.gif" );
	preloadImage( imgArray, "../images/nav/utility_realtors_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_atlanta_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_charleston_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_charlotte_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_nashville_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_raleigh_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_designer_trends_ON.gif" );
	preloadImage( imgArray, "../images/nav/sub_partner_products_ON.gif" );
	preloadImage( imgArray, "../images/spacer.gif" );
}

function preloadImage( imageArray, imageSrc ) {
    var img = new Image();
    img.src = imageSrc;
    imageArray[ imageSrc ] = img;
}

// *********************************************************************

// *********************************************************************
// Function to create pop-up windows at a custom size.
// w = width
// h = height
// d = directories
// l = location
// m = menubar
// r = resizeable
// sc = scrollbars
// st = status
// t = toolbar
// EXAMPLE CALL: <a href="javascript:popUp('[URL]','[WINDOW NAME]',400,300,1,1,0,0,0,0,0);">LINK</a>
// *********************************************************************
function popUp(URL,name,w,h,d,l,m,r,sc,st,t) {
	var featureStr = "";
	featureStr = "width=" + w + ",height=" + h + ",directories=" + d + ",location=" + l + ",menubar=" + m + ",resizable=" + r + ",scrollbars=" + sc + ",status=" + st + ",toolbar=" + t;
	window.open(URL,name,featureStr);
}


function goToPage(list) { 
	var url
	url = (list.options[list.selectedIndex].value)
	if (url != "") 
	{ 
		document.location=url;
	}
}

