/*----------------------------------------------------------------------------------------------------
General functions for site wide javascripting.  When adding a function, comment in your name, date you 
added the function, what the function does, and describe any parameters your function takes.  
----------------------------------------------------------------------------------------------------*/

//----------------------------------------------------------------------------------------------------
//--  	Name:		openWindow(image, title, newWidth, newHeight, desc)
//--  	Comments:	Pops up a window for screen shots
//--					image: screen shot image name stored in '<%= Application("Images") %>imgname.jpg'
//--					width: width of the window to pop up
//--					height: height of the window to pop up
//--					title: page title for the top of the description
//--					desc: brief description of the screen shot
//--	Mods:
//--	----------------------------------------------------------------------------------------------
//--	6/8/2004	Vince Welter	Created for Picasso project
//----------------------------------------------------------------------------------------------------
function openWindow(image, title, newWidth, newHeight, desc) {
	var calcLeft = 100;
	var calcTop = 100;
	var imageTag;
	var widthTag;
	var heightTag;
	var titleTag;
	var descTag;
	
	titleTag = title;
	imageTag = image;
	widthTag = newWidth;
	heightTag = newHeight;
	descTag = desc;
	
	variables = imageTag + '&width=' + widthTag +'&height=' + heightTag + '&title=' + escape(titleTag) + '&desc=' + escape(descTag);

	if (newWidth < 480) {
	newWidth = 520 }
	else {	
	newWidth = newWidth + 40;
	}
	newHeight = newHeight + 160;
	
	if (parseInt(navigator.appVersion) >= 4){
	  calcTop = screen.availHeight /2 - newHeight / 2;
	  calcLeft = screen.availWidth / 2 - newWidth / 2;}

   remoteWindow = window.open('/shared/text/popup.asp?image=' + variables, + 'remote', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,width=' + newWidth + ',height=' + newHeight + ',left=' + calcLeft + ',top=' + calcTop + ',resizable=yes');

	remoteWindow.focus();
}



//----------------------------------------------------------------------------------------------------
//-- Opens Flash Window
//----------------------------------------------------------------------------------------------------
function openFlashWindow(image, title, newWidth, newHeight, desc, flashLoc, flashWidth, flashHeight) {
	var calcLeft = 100;
	var calcTop = 100;
	var imageTag;
	var widthTag;
	var heightTag;
	var titleTag;
	var descTag;
	var flashWidthTag;
	var flashHeightTag;
	
	titleTag = title;
	imageTag = image;
	widthTag = newWidth;
	heightTag = newHeight;
	descTag = desc;
	flashWidthTag = flashWidth;
	flashHeightTag = flashHeight;
	
	variables = imageTag + '&width=' + widthTag +'&height=' + heightTag + '&title=' + escape(titleTag) + '&desc=' + escape(descTag) + '&flashWidth=' + flashWidth + '&flashHeight=' + flashHeight;

	if (newWidth < 480) {
	newWidth = 520 }
	else {	
	newWidth = newWidth + 40;
	}
	newHeight = newHeight + 200;
	
	if (parseInt(navigator.appVersion) >= 4){
	  calcTop = screen.availHeight /2 - newHeight / 2;
	  calcLeft = screen.availWidth / 2 - newWidth / 2;}

   remoteWindow = window.open(flashLoc + '?image=' + variables, + 'remote', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,width=' + newWidth + ',height=' + newHeight + ',left=' + calcLeft + ',top=' + calcTop + ',resizable=no');

	remoteWindow.focus();
}


//----------------------------------------------------------------------------------------------------
//-- Opens Generic Locked Window
//----------------------------------------------------------------------------------------------------
function openGenericLockedWindow(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}	


//----------------------------------------------------------------------------------------------------
//-- Opens Generic Unlocked Window
//----------------------------------------------------------------------------------------------------
function openGenericUnLockedWindow(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}	


//----------------------------------------------------------------------------------------------------
//-- Opens Generic Unlocked Window 2
//----------------------------------------------------------------------------------------------------
function openGenericUnLockedWindow2(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}	


//----------------------------------------------------------------------------------------------------
//-- open window function to display popup winodws for solution pages 
//-- non image pop ups, just text
//----------------------------------------------------------------------------------------------------
function openSolWindow(title, newWidth, newHeight, desc) {
	var calcLeft = 100;
	var calcTop = 100;
	var widthTag;
	var heightTag;
	var titleTag;
	var descTag;
	
	titleTag = title;
	widthTag = newWidth;
	heightTag = newHeight;
	descTag = desc;
	variables = widthTag +'&height=' + heightTag + '&title=' + escape(titleTag) + '&desc=' + escape(descTag)

	newWidth = newWidth + 40;
	newHeight = newHeight + 160;
	
	if (parseInt(navigator.appVersion) >= 4){
	  calcTop = screen.availHeight /2 - newHeight / 2;
	  calcLeft = screen.availWidth / 2 - newWidth / 2;}

   remoteWindow = window.open('/shared/text/solpopup.asp?width=' + variables, + 'remote', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,width=' + newWidth + ',height=' + newHeight + ',left=' + calcLeft + ',top=' + calcTop + ',resizable=yes');

	remoteWindow.focus();
}


//----------------------------------------------------------------------------------------------------
//-- Opens product wizard in a popup
//----------------------------------------------------------------------------------------------------
function openProductWizard(loc, newWidth, newHeight){
	var newWindow

	newWindow = window.open(loc, 'popup', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	newWindow.focus();

}	

//----------------------------------------------------------------------------------------------------
//-- Opens WRC/WRS Sample Reports in a popup
//----------------------------------------------------------------------------------------------------
function openSampleReports(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}	


//----------------------------------------------------------------------------------------------------
//-- Built for opening WebBoard and eServices in a new window for support 
//----------------------------------------------------------------------------------------------------
function eSupportWindow(gotoURL, winName){
	var arguments;
	var eSupportWindow;
	
	switch(winName) {
		case "eservice":
			arguments = "width=915,height=680,menubar=no,location=no,status=no,scrollbars=yes,toolbar=no,resizable=yes";
			break
		case "webboard":
			arguments = "width=850,height=610,resizable=yes,toolbar=yes,location=yes,directories=yes,addressbar=yes,scrollbars=yes,status=yes,menubar=yes";
			break
		default:
			arguments = "width=850,height=610,resizable=yes,toolbar=yes,location=yes,directories=yes,addressbar=yes,scrollbars=yes,status=yes,menubar=yes";
	} 
	
	eSupportWindow = window.open(gotoURL,winName,arguments);
	eSupportWindow.focus();
}


//----------------------------------------------------------------------------------------------------
//-- Allow user to bookmark a specific page.  Used in Support Sections.  Link is on the sidebar
//----------------------------------------------------------------------------------------------------


function bookmark()
{
	if (document.all)
		{
			window.external.AddFavorite(location.href, document.title); return false
		}
}


//----------------------------------------------------------------------------------------------------
//-- Open new window for prev. html version of the html newsletters
//----------------------------------------------------------------------------------------------------

function NLWindow(NLtype) {
	var NLURL, remoteWindow;
	
	if(NLtype == "net"){
		if ("undefined" == typeof(server)) {
			NLURL = "/shared/newsletters/htmlnewsletters/netresults/default.htm";
		}
		else {
			NLURL = server + "shared/newsletters/htmlnewsletters/netresults/default.htm";
		}
		newWidth = "617";
		newHeight = "548";		
	}
	else if(NLtype == "secure"){
		if ("undefined" == typeof(server)) {
			NLURL = "/shared/newsletters/htmlnewsletters/secureresults/default.htm";
		}
		else {
			NLURL = server + "shared/newsletters/htmlnewsletters/secureresults/default.htm";
		}
		newWidth = "617";
		newHeight = "548";		
	}
	else if(NLtype == "web"){
		if ("undefined" == typeof(server)) {
			NLURL = "/shared/newsletters/htmlnewsletters/webresults/default.htm";
		}
		else {
			NLURL = server + "shared/newsletters/htmlnewsletters/webresults/default.htm";
		}
		newWidth = "617";
		newHeight = "548";
	}
	else if(NLtype == "take10"){
		NLURL = "/webtrends/conversionpopup.asp";
		newWidth = "775";
		newHeight = "479";
	}
	else if(NLtype == "take10Calc"){
		NLURL = "/webtrends/conversioncalc.asp";
		newWidth = "775";
		newHeight = "585";
	}
	
	 remoteWindow = window.open(NLURL, 'newsletter', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	remoteWindow.focus();
}


//----------------------------------------------------------------------------------------------------
//-- Open new window for prev. html version of the html newsletters
//----------------------------------------------------------------------------------------------------

function campaignWindow(campaigntype) {
	var NLURL, remoteWindow;
	
	if(campaigntype == "conversion"){
		campaignURL = "/webtrends/resources/take10/conversionpopup.asp";
		newWidth = "775";
		newHeight = "479";
	}
	else if(campaigntype == "take10Calc"){
		campaignURL = "/webtrends/resources/conversion/conversioncalc.asp";
		newWidth = "775";
		newHeight = "585";
	}
	else if(campaigntype == "sem"){
		campaignURL = "/webtrends/resources/take10/sempopup.asp";
		newWidth = "775";
		newHeight = "479";
	}	
		else if(campaigntype == "ret"){
		campaignURL = "/webtrends/resources/take10/retpopup.asp";
		newWidth = "775";
		newHeight = "479";
	}	
	else if(campaigntype == "semtour"){
		campaignURL = "http://webtrends.breezecentral.com/p98248311/";
		newWidth = "780";
		newHeight = "640";
	}
	else if(campaigntype == "ab"){
		campaignURL = "/webtrends/resources/take10/abpopup.asp";
		newWidth = "780";
		newHeight = "479";
	}	
	else if(campaigntype == "analytics"){
		campaignURL = "/webtrends/resources/take10/analyticspopup.asp";
		newWidth = "780";
		newHeight = "479";
	}
	else if(campaigntype == "wm"){
		campaignURL = "http://webtrends.breezecentral.com/p85068857/";
		newWidth = "780";
		newHeight = "479";
	}
	else if(campaigntype == "flash"){
		campaignURL = "http://webtrends.breezecentral.com/p67943344/";
		newWidth = "780";
		newHeight = "479";
	}	
	else if(campaigntype == "leadgen"){
		campaignURL = "http://webtrends.breezecentral.com/p77461893/";
		newWidth = "780";
		newHeight = "479";
	}	
	 remoteWindow = window.open(campaignURL, 'campaign', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	remoteWindow.focus();
}



