
//---------------- POP-UP WINDOWS ----------------//

// Resources window
function showResources(url) {
	if (navigator.OS == 'mac') {
		openCenteredWin(url,"reces",770,460)
	} else {
		openCenteredWin(url,"reces",780,450)
	}
}

// Standard window function
function openWin(url,name,w,h,p) {
	if(!w) w = 640;
	if(!h) h = 475;
	if(!name) name = "popupWindow";
	openCenteredWin(url,name,w,h,p)
}

// text alternative window function
function openTA(url,w,h) {
	if(!w) w = 640;
	if(!h) h = 475;
	var name = "textAlternative";
	var p = 'scrollbars=yes,resizable=yes';
	openCenteredWin(url,name,w,h,p)
}

// Case Studies window function
function caseStudy(url) {
	if(!w) var w = 650;
	if(!h) var h = 550;
	if(!name) var name = "caseStudies";
	var p = 'scrollbars=yes,resizable=yes'
	openCenteredWin(url,name,w,h,p)
}

// Any link that ends with .doc .xls (text alts, text transcripts and other docs)
function showDOC(url, name) {
	if(!name) name = "ta";
	openCenteredWin(url,name,640,475) 
}

// External URL window
function showURL(url) {
	openCenteredWin(url,"http",640,475,"scrollbars,resizable,menubar,status,location,toolbar")
}

function openCenteredWin(url,name,w,h,p) {
	if(p){
		var s = p
	} else {
		var s = "scrollbars,resizable,menubar,status";
	}
	
	// make sure both ie and ns open same size window
	// adjust ns height
	if (navigator.appName == 'Netscape') {
		w = w + 5;
		h = h + 25;
	}
	
	// windows tend to open smaller on MAC IE
	if (navigator.OS == 'mac' && navigator.appName != 'Netscape'){
		w = w + 5;
		h = h + 25;
	}

	s += ",width="+w;
	s += ",height="+h;
	
	if(window.screen) {
		var aH = screen.availHeight;
		var aW = screen.availWidth;
		var cY = (aH - h)/2;
		var cX = (aW - w)/2;
		s += ",left=" + (cX-12);
		s += ",top=" + (cY-50);
	}
	
	myWindow = window.open(url,name,s);
	//if (window.focus) {myWindow.focus()}
}

// fix for NS (Ask perry if any questions :)
function resizeFix(){
	if(navigator.appName == 'Netscape'){
		var resizeFactor = 10;
		if(navigator.userAgent.indexOf('Mac') != -1){
			resizeFactor = 1;
		}
		parent.window.resizeBy(-resizeFactor,0)
		parent.window.resizeBy(resizeFactor,0)
	}
}


// print frame
function printPage(frameName) {
	if ((navigator.userAgent.indexOf("Mac") != -1) && (navigator.appName.indexOf("Microsoft") != -1)) {
		//This is the Mac IE window
		alert("Sorry, your browser doesn't support this feature. Please use the Print option from the browser's File menu");
	} else {
		if(!frameName){
			//These are the other windows (pc ie and ns, mac ns)
			self.print();
		} else {
			var frameToPrint = eval("parent." + frameName);
			frameToPrint.focus();
			frameToPrint.print();		
		}
	}
}

function doStatus(){
	window.status = document.title;
	return true;
}
