var http = location.href
var httpLocal = http.indexOf("http://127.0.0.1/mmg_live");
var httpRemote1 = http.indexOf("http://192.168.0.4/projects/mmg_live");
var httpRemote2 = http.indexOf("http://www.eye2iproductions.com/projects/mmg_live");
var httpMMG1  = http.indexOf("http://65.61.167.88");
var httpMMG2  = http.indexOf("http://65.61.167.89");
var httpMMG3  = http.indexOf("http://www.mortgagemarketguide.com");
var httpMMG4  = http.indexOf("http://review.mortgagemarketguide.com");
var httpMMG5  = http.indexOf("http://www.themortgagemarketguide.com");
var httpMMG6  = http.indexOf("http://127.0.0.1/mmgreview");
var httpMMG7  = http.indexOf("http://web1.mortgagemarketguide.com");
var httpMMG8  = http.indexOf("http://web2.mortgagemarketguide.com");
var httpMMG9  = http.indexOf("http://web4.mortgagemarketguide.com");
var httpMMG10 = http.indexOf("http://dev.mortgagemarketguide.com");
var httpMMG11 = http.indexOf("http://storage.mortgagemarketguide.com");
var httpMMG12 = http.indexOf("http://65.61.167.93");
var httpMMG13 = http.indexOf("http://65.61.167.94");
var httpMMG14 = http.indexOf("http://65.61.167.84");
var httpMMG15 = http.indexOf("https://www.mortgagemarketguide.com");
var httpMMG16 = http.indexOf("https://dev.mortgagemarketguide.com");
var httpMMG17 = http.indexOf("http://mortgagemarketguide.com");
var httpMMG18  = http.indexOf("http://web5.mortgagemarketguide.com");


menuPath = "http://198.6.95.231/";  //UCG live server
if (httpLocal == 0) {
	menuPath = "http://127.0.0.1/mmg_live/";
}
if (httpRemote1 == 0) {
	menuPath = "http://192.168.0.4/projects/mmg_live/";
}
if (httpRemote2 == 0) {
	menuPath = "http://www.eye2iproductions.com/projects/mmg_live/";
}
if (httpMMG1 == 0) {
	menuPath = "http://65.61.167.88/";
}
if (httpMMG2 == 0) {
	menuPath = "http://65.61.167.89/";
}
if (httpMMG3 == 0) {
	menuPath = "http://www.mortgagemarketguide.com/";
}
if (httpMMG4 == 0) {
	menuPath = "http://review.mortgagemarketguide.com/";
}
if (httpMMG5 == 0) {
	menuPath = "http://www.themortgagemarketguide.com/";
}
if (httpMMG6 == 0) {
	menuPath = "http://127.0.0.1/mmgreview/";
}
if (httpMMG7 == 0) {
	menuPath = "http://web1.mortgagemarketguide.com/";
}
if (httpMMG8 == 0) {
	menuPath = "http://web2.mortgagemarketguide.com/";
}
if (httpMMG9 == 0) {
	menuPath = "http://web4.mortgagemarketguide.com/";
}
if (httpMMG10 == 0) {
	menuPath = "http://dev.mortgagemarketguide.com/";
}
if (httpMMG11 == 0) {
	menuPath = "http://storage.mortgagemarketguide.com/";
}
if (httpMMG12 == 0) {
		menuPath = "http://65.61.167.93/";
}
if (httpMMG13 == 0) {
		menuPath = "http://65.61.167.94/";
}
if (httpMMG14 == 0) {
		menuPath = "http://65.61.167.84/";
}
if (httpMMG15 >= 0) {
	menuPath = "https://www.mortgagemarketguide.com/";
}
if (httpMMG16 >= 0) {
	menuPath = "https://dev.mortgagemarketguide.com/";
}
if (httpMMG17 >= 0) {
	menuPath = "http://mortgagemarketguide.com/";
}
if (httpMMG18 == 0) {
	menuPath = "http://web5.mortgagemarketguide.com/";
}

function callcapture() {
	window.open("http://www.mortgagemarketguidecallcapture.com/");
}

function quicktour(mainChapter,subChapter,xmlFileName) {
	if (!mainChapter) {
		mainChapter = "";
	}
	if (!subChapter) {
		subChapter = "";
	}
	if (!xmlFileName) {
		xmlFileName = "";
	}
	var fileURL = "/membersonly/__quicktour/index.html?mainChapter="+mainChapter+"&subChapter="+subChapter+"&xmlFileName="+xmlFileName;
	//GP_AdvOpenWindow(fileURL,'quicktour','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',830,540,'center','ignoreLink','',0,'');
	var left = (screen.width - 830) / 2;
	var top = (screen.height - 540) / 2;
	var quickTourWindow = window.open(fileURL,'quicktour','left='+left+', top='+top+', width=830, height=540');
	quickTourWindow.focus();

}
function gotoSite(site) {
	MM_openBrWindow(site,'','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
}
function openStream(version) {
	if (version == 'low') {
		GP_AdvOpenWindow('cnbc_low.html','cnbc','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',500,350,'center','ignoreLink','',0,'');
	}
	if (version == 'medium') {
		GP_AdvOpenWindow('cnbc_medium.html','cnbc','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',500,350,'center','ignoreLink','',0,'');
	}
	if (version == 'high') {
		GP_AdvOpenWindow('cnbc_high.html','cnbc','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',500,350,'center','ignoreLink','',0,'');
	}	
}

// TODAY'S DATE FOR CORPORATE SITE
var monthName = new Array(12);
{
monthName[0] = "JANUARY";
monthName[1] = "FEBRUARY";
monthName[2] = "MARCH";
monthName[3] = "APRIL";
monthName[4] = "MAY";
monthName[5] = "JUNE";
monthName[6] = "JULY";
monthName[7] = "AUGUST";
monthName[8] = "SEPTEMBER";
monthName[9] = "OCTOBER";
monthName[10] = "NOVEMBER";
monthName[11] = "DECEMBER";
}
var toDay = new Date();  //  Capture today's date.
var thisYear = toDay.getFullYear();  //  Extract the year,
var thisMonth = monthName[toDay.getMonth()];//  ...the month,
var thisDay = thisMonth  + " " + toDay.getDate() + ", " + (parseInt(thisYear));

// TODAY'S DATE FOR MEMBER PORTAL
var monthNameMB = new Array(12);
{
monthNameMB[0] = "1";
monthNameMB[1] = "2";
monthNameMB[2] = "3";
monthNameMB[3] = "4";
monthNameMB[4] = "5";
monthNameMB[5] = "6";
monthNameMB[6] = "7";
monthNameMB[7] = "8";
monthNameMB[8] = "9";
monthNameMB[9] = "10";
monthNameMB[10] = "11";
monthNameMB[11] = "12";
}
var toDayMB = new Date();  //  Capture today's date.
var thisYearMB = toDayMB.getFullYear();  //  Extract the year,
var thisMonthMB = monthNameMB[toDayMB.getMonth()];//  ...the month,
var thisDayMB = thisMonthMB  + "." + toDayMB.getDate() + "." + (parseInt(thisYearMB));

//LOGIN FUNCTION
function SubmitLoginForm(username, password) {
	var username = username;
	var password = password;
	//document.login.form.action = "";
	//document.login.form.submit();
}

//SITE CREDITS WINDOW POPUP
function siteWindow() {
	GP_AdvOpenWindow(menuPath + 'popups/sitecredits/index.html','sitecredits','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//STOCHASTIC CHARTING POPUP
function popupStochasticChart() {
	GP_OpenWindow(menuPath + 'popups/stochasticchart/index.html','stochasticchart','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',388,265,'center','ignoreLink','',0,'');
}

//HELP - WEB ALERT POPUP
function popupHelpWebAlert(ext, winHeight, winWidth) {
	GP_OpenWindow(menuPath + 'popups/help/help_webalert_' + ext +'.html','webalert_' + ext,'fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',winHeight,winWidth,'center','ignoreLink','',0,'');
}

//HELP - BOND QUOTES (DAY CHANGE) POPUP
function popupHelpBondQuotes() {
	GP_OpenWindow(menuPath + 'membersonly/popups/help/help_bondquotes.html','bondquotes','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',250,100,'center','ignoreLink','',0,'');
}

//INSTANT ALERTS POPUP
function popupInstantAlerts() {
	GP_AdvOpenWindow(menuPath + 'popups/instantalert/index.html','instantalert','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',388,265,'center','ignoreLink','',0,'');
}

//INSTANT FREE TRIAL POPUP
function popupFreeTrial() {
	GP_AdvOpenWindow(menuPath + 'popups/freetrialalert/index.html','freetrialalert','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',388,265,'center','ignoreLink','',0,'');
}

//RECENT ALERTS POPUP
function popupRecentAlerts() {
	GP_AdvOpenWindow(menuPath + 'popups/recentalert/index.html','recentalert','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',388,265,'center','ignoreLink','',0,'');
}

//SUBSCRIPTION SERVICE AGREEMENT POPUP
function popupAgreement() {
	GP_AdvOpenWindow(menuPath + 'popups/agreement/index.html','agreement','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//SUBSCRIPTION SERVICE AGREEMENT POPUP
function popupAgreementWeekly() {
	GP_AdvOpenWindow(menuPath + 'popups/agreement/weekly.html','agreement','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//USER PROFILE SAMPLES
function popupSamples() {
	GP_AdvOpenWindow(menuPath + 'popups/samples/index.html','samples','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//FREE TRIAL AND JOIN NOW PAGE SAMPLES
function popupSamplesCorporate() {
	GP_AdvOpenWindow(menuPath + 'popups/samples/index_corporate.html','samples','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//USER GLOSSARY
function popupGlossary() {
	GP_AdvOpenWindow(menuPath + 'popups/glossary/index.html','glossary','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',525,525,'center','ignoreLink','',0,'');
}

//OPENS UP WEBALERT POP-UP FOR BOND QUOTE PAGE
function popupWebAlert(ID,dir,period,threshold,subname,windowname) {
	var popupPath = "membersonly/popups/webalert/index.mod_perl?ID="+ID+"\&dir="+dir+"\&period="+period+"\&threshold="+threshold+"\&subname="+subname;
	var popupName = "webalert_" + windowname;
	GP_OpenWindow(menuPath + popupPath, popupName,'fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',502,272,'center','ignoreLink','',0,'');
}

//FUNCTION THAT CAN BE USED TO OPEN ANY IMAGE BY SPECIFYING THE NAME, WIDTH, AND HEIGHT OF IMAGE TO BE OPENED
function popupImage(name, width, height) {
	var imageName = "popups/imagepopup/index.html?filename=" + name;
	var imageWidth = parseInt(width);
	var imageWidth = imageWidth + 20;
	var imageHeight = parseInt(height);
	var imageHeight = imageHeight + 83;
	GP_AdvOpenWindow(menuPath + imageName,'imagepopup','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',imageWidth,imageHeight,'center','ignoreLink','',0,'');
}

function popupProductImage(name, width, height) {
	var imageName = "popups/productimagepopup/index.html?filename=" + name;
	var imageWidth = parseInt(width);
	var imageWidth = imageWidth + 20;
	var imageHeight = parseInt(height);
	var imageHeight = imageHeight + 83;
	GP_AdvOpenWindow(menuPath + imageName,'imagepopup','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',imageWidth,imageHeight,'center','ignoreLink','',0,'');
}

function popupMBImage(name, width, height) {
	var imageName = "popups/imagembpopup/index.html?filename=" + name;
	var imageWidth = parseInt(width);
	var imageWidth = imageWidth + 20;
	var imageHeight = parseInt(height);
	var imageHeight = imageHeight + 83;
	GP_AdvOpenWindow(menuPath + imageName,'imagepopup','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',imageWidth,imageHeight,'center','ignoreLink','',0,'');
}

//OPENS UP BOND CHART IMAGE IN MEMBERS PORTAL
function popupChart(name, width, height) {
	var imageName = "popups/chartpopup/index.html?filename=" + name;
	var imageWidth = parseInt(width);
	var imageWidth = imageWidth + 20;
	var imageHeight = parseInt(height);
	var imageHeight = imageHeight + 83;
	GP_AdvOpenWindow(menuPath + imageName,'imagepopup','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no',imageWidth,imageHeight,'center','ignoreLink','',0,'');
}

//IMAGE PRE-LOADER FOR THE MENU SYSTEM

MM_preloadImages(menuPath + '_global/images/buttons/btn_home_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_barryhabib_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_solutions_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_membership_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_bondquotes_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_instantalerts_over.gif')
MM_preloadImages(menuPath + '_global/images/buttons/btn_contactus_over.gif')

//FORM SUBMIT FUNCTIONS

function formSubmitFreeTrial() {
	alert("This form will submit to http://www.mortgagemarketguide.com/cgi-bin/two_weeks.cgi");
}

function formSubmitSignUp() {
	alert("This form will submit to https://www.mortgagemarketguide.com/cgi-bin/newsletter/signup.cgi");
}

//BROWSER AND OS DETECTION: This script will detect either Windows or Mac and the following browsers:
//IE
//Netscape
//Safari

//This detection is used for the Flash based feature ads that are spread through-out the course.
//There is an intermittent error with how Flash is rendered in the different browsers.
//This is due to Netscape and Safari not being able to recognize the Flash property "wmode", which
//is used so that the drop down menu system can be displayed over the top of it. Therefore, I enforce
//Browser and OS detection to either display the Flash file or display an image instead.

function showImage(whichImage) {
	image = menuPath + "_global/images/ads/" + whichImage + ".jpg";
	MM_swapImage('imagetoswap','',image,1)
}
function detectEnvironment() {
	version = navigator.appVersion;
	name = navigator.appName;
	agent = navigator.userAgent;
	
	if (version.toLowerCase().indexOf("win") != -1) { //PC
		if (name.toLowerCase().indexOf("microsoft internet explorer") != -1) {//IE
			sysVersion = "pc_ie";
			//alert(sysVersion);
		}
		if (name.toLowerCase().indexOf("netscape") != -1) {//Netscape 
			sysVersion = "pc_nn";
			//alert(sysVersion);
		}		
	} else if (version.toLowerCase().indexOf("mac") != -1){ //MAC
		if (name.toLowerCase().indexOf("microsoft internet explorer") != -1) {//IE
			sysVersion = "mac_ie";
			//alert(sysVersion);
		}
		if (name.toLowerCase().indexOf("netscape") != -1 && agent.toLowerCase().indexOf("netscape") != -1) {//Netscape 
			sysVersion = "mac_nn";
			//alert(sysVersion);
		}
		if (name.toLowerCase().indexOf("netscape") != -1 && agent.toLowerCase().indexOf("netscape/7.02") != -1) {//Netscape 7
			sysVersion = "mac_nn7";
			//alert(sysVersion);
		}		
		if (name.toLowerCase().indexOf("netscape") != -1 && version.toLowerCase().indexOf("safari") != -1) {//Safari 
			sysVersion = "mac_safari";
			//alert(sysVersion);
		}				
	}
}

function displayFeature(whichFeature) {
	//detectEnvironment();
	/*if (flashinstalled == 2) { //Flash is installed
		if (sysVersion == "pc_ie") {
			displayFlash(whichFeature);
		}
		if (sysVersion == "pc_nn") {
			//displayImage(whichFeature);
			displayFlash(whichFeature);
		}
		if (sysVersion == "mac_ie") {
			displayFlash(whichFeature);
		}
		if (sysVersion == "mac_nn") {
			//displayImage(whichFeature);
			displayFlash(whichFeature);
		}
		if (sysVersion == "mac_nn7") {
			displayFlash(whichFeature);
		}		
		if (sysVersion == "mac_safari") {
			displayFlash(whichFeature);
		}						
	} else {
		displayImage(whichFeature);
	}*/
	displayFlash(whichFeature);
}

function displayImage(whichFeature) { //This function write's the images in place of a Flash file
	if (whichFeature == "homepage") {
		var ran_number= parseInt(Math.random()*4);	
		if (ran_number == 0) {
			var newsHeadline = "Thanks for your updates... You're making me money by better managing my pipeline!";
		} else if (ran_number == 1) {
			var newsHeadline = "Your Guide is the most exciting new tool for loan officers that I have seen in years";
		} else if (ran_number == 2) {
			var newsHeadline = "The MMG service is great... It is written in an easy understandable language";
		} else if (ran_number == 3) {
			var newsHeadline = "I like it (Mortgage Market Guide)... It is direct and concise";
		} else {
			var newsHeadline = "has been extremely valuable in helping me manage my Float/Lock pipeline";
		}
		document.write("<table width=\"780\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\""+menuPath+"_global/images/tile/tile_layout.gif\">");
		document.write("<tr>")
		document.write("<td><div align=\"center\"><img src=\""+menuPath+"_global/images/banners/banner_home_barry.jpg\" width=\"774\" height=\"195\"></div></td>");
		document.write("</tr>");
		document.write("</table>");		
		document.write("<table width=\"780\" height=\"1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\""+menuPath+"_global/images/symbols/spacer.gif\">");
		document.write("<tr>");
		document.write("<td><img src=\""+menuPath+"_global/images/tile/tile_spacer.gif\" width=\"780\" height=\"1\"></td>");
		document.write("</tr>");
		document.write("</table>");
		document.write("<table width=\"780\" height=\"30\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\""+menuPath+"_global/images/tile/tile_spacer.gif\">");
		document.write("<tr>");
		document.write("<td width=\"1\">&nbsp;</td>");
		document.write("<td bgcolor=\"#CCCCCC\" width=\"18\"><div align=\"center\"><img src=\""+menuPath+"_global/images/symbols/sym_arrow_submit.gif\" width=\"16\" height=\"16\"></div></td>");
		document.write("<td bgcolor=\"#CCCCCC\" width=\"10\"> <div align=\"center\"><img src=\""+menuPath+"_global/images/symbols/sym_pipe_news.gif\" width=\"1\" height=\"22\"></div></td>");
		document.write("<td bgcolor=\"#CCCCCC\" width=\"748\"><span class=\"NewsHeadlineHeader\">TESTIMONIALS - </span><a href=\"membership/membercomments.html\" class=\"FeaturesHyperlink\">"+newsHeadline+"</a></td>");
		document.write("<td width=\"3\"> <div align=\"center\"><img src=\""+menuPath+"_global/images/symbols/spacer.gif\" width=\"1\" height=\"22\"></div></td>");		
		document.write("</tr>");
		document.write("</table>");
		document.write("<table width=\"780\" height=\"1\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\""+menuPath+"_global/images/symbols/spacer.gif\">");
		document.write("<tr>");
		document.write("<td><img src=\""+menuPath+"_global/images/tile/tile_spacer.gif\" width=\"780\" height=\"1\"></td>");
		document.write("</tr>");
		document.write("</table>");
	} else {
		var initialImage = "<img src="+menuPath+"_global/images/ads/ad_" + whichFeature + "_1.jpg" + " name=imagetoswap" + " border=0" + " usemap=#Map" + " id=imagetoswap" + ">";
		var image1 = "'ad_" + whichFeature + "_1'";
		var image2 = "'ad_" + whichFeature + "_2'";
		var image3 = "'ad_" + whichFeature + "_3'";
		document.write(initialImage);
		document.write("<map name=\"Map\">");
		if (whichFeature != "instantalerts") {
			document.write("<area shape=\"rect\" coords=\"540,141,555,156\" href=\"javascript:showImage("+image3+");\">");
		}
		document.write("<area shape=\"rect\" coords=\"517,141,532,156\" href=\"javascript:showImage("+image2+");\">");
		document.write("<area shape=\"rect\" coords=\"495,141,510,156\" href=\"javascript:showImage("+image1+");\">");
		document.write("</map>");	
	}			
}

function displayFlash(whichFeature) { //This function dynamically displays a Flash movie.
	if (whichFeature != "homepage") { //Home Page Flash
		flashFile_object = "<param name=movie value=" + menuPath + "_global/flash/mmg_" + whichFeature + ".swf" + ">"
		flashFile_embed = "<embed src="+menuPath+"_global/flash/mmg_" + whichFeature + ".swf" + " width=\"581\" height=\"169\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash\" wmode=\"opaque\" menu=\"false\"></embed></object>";
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"581\" height=\"169\">");
		document.write(flashFile_object);
		document.write("<param name=\"quality\" value=\"high\">");
		document.write("<param name=\"wmode\" value=\"opaque\">");
		document.write("<param name=\"menu\" value=\"false\">");
		document.write(flashFile_embed);
	} else { //Interior Flash banner ads
		document.write("<table width=\"780\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"_global/images/tile/tile_layout.gif\">");
		document.write("<tr>");
		document.write("<td><div align=\"center\">");
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"774\" height=\"227\">");
		document.write("<param name=\"movie\" value=\"_global/flash/home.swf\">");
		document.write("<param name=\"quality\" value=\"high\">");
		document.write("<param name=\"wmode\" value=\"opaque\">");
		document.write("<param name=\"menu\" value=\"false\">");
		document.write("<embed src=\"_global/flash/home.swf\" width=\"774\" height=\"227\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" wmode=\"opaque\" menu=\"false\"></embed></object>");
		document.write("</div></td>");
		document.write("</tr>");
		document.write("</table>");
	}
}

//function to launch japanese candle sitck glossary from Quick Tour
//Added 9/11/2006 Mike Burrows
function launchJapaneseGlossary() {
	var pageName = "/popups/quicktour/japaneseglossary.html";
	var imageWidth = 618;
	var imageHeight = 480;
	GP_AdvOpenWindow(pageName,'japanesecandlestick','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no',imageWidth,imageHeight,'center','ignoreLink','',0,'');
}

//GLOBAL JAVASCRIPT FUNCTIONS

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	if(selObj.value != 0 || selObj.value != "") {
	  if (selObj.value != "http://www.preferredprogram.org/mortgagemarketguide" && selObj.value != "/membership/faq.html") {
	  	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  	if (restore) selObj.selectedIndex=0;
	  } else {
	  	window.open(selObj.value);
	  }
	}
}
function MM_JumpToNewWindow(targ,selObj,restore){ //v3.0
	if(selObj.value != 0 || selObj.value != "") {
	  	window.open(selObj.value);
	}
}

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}


function GP_OpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
/*  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; */ }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
