function popup(url) {

    popupFull(url, 400, 565, "popupWindow");
}

function resourcePopup(url,height, width) {
   
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";

	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=yes, resizable=yes";

	var popupWindow = window.open(url, name, size + position + options);
	popupWindow.focus();
}

function popupP(url, height, width) {

    popupFull(url, height, width, "popupWindow");
}

function popupPrintable(url, height, width) {

    popupPrintableFull(url, height, width, "popupWindow");
}

function popupResizeable(url, height, width, name) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";

	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=yes, resizable=yes";

	var popupWindow = window.open(url, name, size + position + options);
	popupWindow.focus();
}
function popupFull(url, height, width, name) {

	url = "/mccann" + url;

    // Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";
       
	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=yes";

	var popupWindow = window.open(url, name, size + position + options);
	popupWindow.focus();
}



function popupFull2(url, ypos, height, width, name) {
    
	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";
       
	var xpos = (screen.width / 2) - (width / 2);
	
	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=yes";

	var popupWindow = window.open(url, name, size + position + options);
	popupWindow.focus();
}

function popupNewFull(url,name) {
    url = "/mccann" + url;
	name=name;		
	var popupWindow = window.open(url, name, 'fullscreen=1');
	popupWindow.focus();
}
function popupNewFull2(url,name) {

	name=name;
	var popupWindow = window.open(url, name);
	popupWindow.focus();
}


function popupTutorialFull(url, name) {
    url = "/mccann" + url;
	name=name;
	var popupWindow = window.open(url, name);
	popupWindow.focus();
}

function popupHelpFull(url) {

    url = "/mccann" + url;
	name="window";
	var popupWindow = window.open(url, name);
	popupWindow.focus();
}

//menu bar is true
function popupPrintableFull(url, height, width, name) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";

	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=yes,scrollbars=yes, resizable=yes";

	var popupWindow = window.open(url, name, size + position + options);
	popupWindow.focus();
}

// temporary created popupP1 (popupP causing problems. Will come back later to figure out where the problem is
function popupP1(url, height, width) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
   
	//var height = 400;
	//var width = 565;

	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=yes";

	var popupWindow = window.open(url, "popupWindow", size + position + options);
	popupWindow.focus();
}

function popupNoScrolls(url, height, width) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    
	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=no";

	var popupWindow = window.open(url, "popupWindow", size + position + options);
	popupWindow.focus();
}

function popupNoScrollsNoResize(url, height, width, xpos, ypos) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    
    if (xpos == null)
		xpos = (screen.width / 2) - (width / 2);
	
	if (ypos == null)
		ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=yes,menubar=no,scrollbars=no,resizable=no,toolbar=no,location=no";

	var popupWindow = window.open(url, "popupWindow", size + position + options);
	popupWindow.focus();
}

function popupNoScrollsName(url, name, height, width) {

	url = "/mccann" + url;
	
	// Set height, width, and name if the values arent being passed in.
    if(height == null)
       height = 500;
    if(width == null)
       width = 600;
    if(name == null)
       name = "newWindow";

	var xpos = (screen.width / 2) - (width / 2);
	var ypos = (screen.height / 2) - (height / 2);

	var size     = "height=" + height + ",width=" + width;
	var position = ",left=" + xpos + ",top=" + ypos + ",screenX=" + xpos + ",screenY=" + ypos;
	var options  = ",status=no,menubar=no,scrollbars=no";

	var popupWindow = window.open(url, name,size + position + options);
	popupWindow.focus();
}

function doClose() {
	// update main window and close popup.
	opener.location.href = opener.location.href;
	self.close();
}

var thewindow = null;

function fullscreen(TestUrl) {
	var browserName = detectBrowser();
	var browserVer = detectVersion();
	var osVer = detectOS();
	var windowName = 'FullScreenTestWindow';

	if ((osVer == 'Windows' && browserName == 'IE' && browserVer >= 4) || (osVer == 'Windows' && browserName == "Netscape" && browserVer >= 5)) {
		open(TestUrl,null,"fullscreen=1");
	}
	else {
		var adjWidth;
		var adjHeight;
		
		if((osVer == 'Macintosh') && (browserName == 'Netscape')) {
  		    adjWidth = 20;
		    adjHeight = 35;
		}
		if((osVer == 'Macintosh') && (browserName == 'IE')) {
		    adjWidth = 10;
		    adjHeight = 100;
		    winOptions = 'fullscreen=yes';
		}
		if((osVer == 'Windows') && (browserName == 'Netscape')) {
		    adjWidth = 30;
		    adjHeight = 30;
		}
		if(browserVer < 4) {
		    self.location.href = TestUrl;
		} else {
		
	
		
		var winWidth = screen.availWidth - adjWidth;
    		var winHeight = screen.availHeight - adjHeight;
	    	var winSize = 'width=' + winWidth + ',height=' + winHeight;
			thewindow = window.open(TestUrl,windowName, 'winSize, scrollbars=yes');
    		thewindow.moveTo(5,0);
		}
	}
}

function fullscreenTestDelivery(TestUrl, isVanguard) {
	var browserName = detectBrowser();
	var browserVer = detectVersion();
	var osVer = detectOS();
	var windowName = 'FullScreenTestWindow';

	if ((osVer == 'Windows' && browserName == 'IE' && browserVer >= 4) || (osVer == 'Windows' && browserName == "Netscape" && browserVer >= 5)) {
		if (!isVanguard) {
			open(TestUrl,null,"fullscreen=1");
		}
		else 
			document.location = TestUrl;
	}
	else {
		var adjWidth;
		var adjHeight;
		
		if((osVer == 'Macintosh') && (browserName == 'Netscape')) {
  		    adjWidth = 20;
		    adjHeight = 35;
		}
		if((osVer == 'Macintosh') && (browserName == 'IE')) {
		    adjWidth = 10;
		    adjHeight = 100;
		    var options  = "resizable=yes,";
		    
		}
		if((osVer == 'Windows') && (browserName == 'Netscape')) {
		    adjWidth = 30;
		    adjHeight = 30;
		}
		if(browserVer < 4) {
		    self.location.href = TestUrl;
		} else {
		
	
		
		var winWidth = screen.availWidth - adjWidth;
    		var winHeight = screen.availHeight - adjHeight;
	    	var winSize = options + 'width=' + winWidth + ',height=' + winHeight;
	    	thewindow = window.open(TestUrl,windowName, 'winSize, scrollbars=yes');
    		thewindow.moveTo(5,0);
    	}
	}
}


function detectVersion() {
    return parseInt(navigator.appVersion);
}

function detectOS() {
    if (navigator.userAgent.indexOf('Win') == -1)
        return 'Macintosh';
    else
        return 'Windows';
}

function detectBrowser() {
    if (navigator.appName.indexOf('Netscape') == -1)
        return 'IE';
	else
	    return 'Netscape';
}

function autoMaximizeOld() {
	
	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

function autoMaximize() {
	
	/*if (isNS()) {
	//alert(opener.countNetscape)	
		if (opener.countNetscape==0)
		{ 
			opener.countNetscape++;
			window.location.href = window.location.href;
		}
		else opener.countNetscape=0;
		
	}*/
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}
function autoMaximizeNS() {
	
	if (isNS()) {
	//alert(opener.countNetscape)	
		if (opener.countNetscape==0)
		{ 
			opener.countNetscape++;
			window.location.href = window.location.href;
		}
		else opener.countNetscape=0;
		
	}
	}
	

