var SiteURL;
//SiteURL = "http://localhost/TheHillsNJ/" 
SiteURL = "http://www.thehillsnj.com/" 

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

var preload;

//Pre-Cache all green buttons
var greenArray = new Array()
greenArray[0]  = new Image(163,17)
greenArray[1]  = new Image(163,17)
greenArray[2]  = new Image(163,17)
greenArray[3]  = new Image(163,17)
greenArray[4]  = new Image(163,17)
greenArray[5]  = new Image(163,17)
greenArray[6]  = new Image(163,17)
greenArray[7]  = new Image(163,17)
greenArray[8]  = new Image(163,17)
greenArray[9]  = new Image(163,17)
greenArray[10] = new Image(163,17)

//Set the source
greenArray[0].src  = SiteURL + "images/leftnav/home_over.gif"
greenArray[1].src  = SiteURL + "images/leftnav/the_hills_calendar_over.gif"
greenArray[2].src  = SiteURL + "images/leftnav/hills_concierge_over.gif"
greenArray[3].src  = SiteURL + "images/leftnav/events_over.gif"
greenArray[4].src  = SiteURL + "images/leftnav/real_estate_over.gif"
greenArray[5].src  = SiteURL + "images/leftnav/professional_services_over.gif"
greenArray[6].src  = SiteURL + "images/leftnav/home_experts_over.gif"
greenArray[7].src  = SiteURL + "images/leftnav/hills_associations_over.gif"
greenArray[8].src  = SiteURL + "images/leftnav/utilities_over.gif"
greenArray[9].src  = SiteURL + "images/leftnav/contact_us_over.gif"
greenArray[10].src = SiteURL + "images/leftnav/the_hills_magazine_over.gif"


//Pre-Cache all grey buttons
var greyArray = new Array()
greyArray[0]  = new Image(163,17)
greyArray[1]  = new Image(163,17)
greyArray[2]  = new Image(163,17)
greyArray[3]  = new Image(163,17)
greyArray[4]  = new Image(163,17)
greyArray[5]  = new Image(163,17)
greyArray[6]  = new Image(163,17)
greyArray[7]  = new Image(163,17)
greyArray[8]  = new Image(163,17)
greyArray[9]  = new Image(163,17)
greyArray[10] = new Image(163,17)

//Set the source
greyArray[0].src  = SiteURL + "images/leftnav/home.gif"
greyArray[1].src  = SiteURL + "images/leftnav/the_hills_calendar.gif"
greyArray[2].src  = SiteURL + "images/leftnav/hills_concierge.gif"
greyArray[3].src  = SiteURL + "images/leftnav/events.gif"
greyArray[4].src  = SiteURL + "images/leftnav/real_estate.gif"
greyArray[5].src  = SiteURL + "images/leftnav/professional_services.gif"
greyArray[6].src  = SiteURL + "images/leftnav/home_experts.gif"
greyArray[7].src  = SiteURL + "images/leftnav/hills_associations.gif"
greyArray[8].src  = SiteURL + "images/leftnav/utilities.gif"
greyArray[9].src  = SiteURL + "images/leftnav/contact_us.gif"
greyArray[10].src = SiteURL + "images/leftnav/the_hills_magazine.gif"

preload = true;	


function ImageGreen(i)
{
	if(isIE5 || isNS6 & preload)
	{
		var elm = document.getElementById(i);
		elm.src = greenArray[i].src;
	}else if(isNS4 || isIE4 & preload){
		document[i].src = greenArray[i].src;
	}
}

function ImageGrey(i)
{
	if(isIE5 || isNS6 & preload)
	{
		var elm = document.getElementById(i);
		elm.src = greyArray[i].src;
	}else if(isNS4 || isIE4 & preload){
		document[i].src = greyArray[i].src;
	}
}

isIE  = (document.images) ? true :false;
isNS4 = (document.layers) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function OpenWindow(GIF,TITLE,WIDTH,HEIGHT)
{
	if(isNS6 || isNS4)
	{
		HEIGHT = parseInt(HEIGHT) + 17;
		HEIGHT = HEIGHT.toString();
			
		WIDTH = parseInt(WIDTH) + 17;
		WIDTH = WIDTH.toString();	
		//alert(height);
	}else{
	if(isIE)
		HEIGHT = parseInt(HEIGHT) + 25;
		HEIGHT = HEIGHT.toString();
			
		WIDTH = parseInt(WIDTH) + 0;
		WIDTH = WIDTH.toString();	
	}
		
	window.open(SiteURL + 'popup.asp?gif=' + GIF + '&title=' + TITLE,'','HEIGHT=' + HEIGHT + ',WIDTH=' + WIDTH + ',STATUS=NO');
}

function WindowOpen(URL,HEIGHT,WIDTH)
{
	if(isNS6 || isNS4)
	{
		HEIGHT = parseInt(HEIGHT) + 17;
		HEIGHT = HEIGHT.toString();
			
		WIDTH = parseInt(WIDTH) + 17;
		WIDTH = WIDTH.toString();	
		//alert(height);
	}else{
	if(isIE)
		HEIGHT = parseInt(HEIGHT) + 25;
		HEIGHT = HEIGHT.toString();
			
		WIDTH = parseInt(WIDTH) + 0;
		WIDTH = WIDTH.toString();	
	}
	
	window.open(URL,'','HEIGHT='+HEIGHT+',WIDTH='+WIDTH+',scrollbars');
}