// These functions are used to render
// the navigational elements of the each page
function renderLogInArea(intShowMap)
{
	if (getCookie("alphaorg") != null)
	{
		document.write("<td bgcolor='#CCCCCC' width='368' align='right' valign='top'>");
		QueryString.keys = new Array();
		QueryString.values = new Array();
		QueryString_Parse();		
		if (QueryString("skey") != null && intShowMap == 1)
		{
			document.write("<a href='/app/surveymap.asp?skey=" + QueryString("skey") + "'><img alt='Survey Map' border='0' src='/images/btn_surv_map.gif'></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
		}		
		
		document.write("<img alt='Log In' border='0' src='/images/nav_main_logged_in.gif'>&nbsp;<a href='/app/process_logout.asp'><img alt='Log Out' border='0' src='/images/btn_logout.gif'></a>&nbsp;&nbsp;");
		document.write("</td>");
	}
	else
	{
		document.write("<td bgcolor='#CCCCCC' width='368' align='right' valign='top'><nobr><img alt='Log In' src='/images/nav_main_login.gif'>&nbsp;<input name='email' size=9>&nbsp;<img alt='Password' src='/images/nav_main_pass.gif'>&nbsp;<input size=9 type='password' name='pass'>&nbsp;<input type='image' border='0' src='/images/btn_login.gif'>&nbsp;</nobr></td>");
	}
}

function renderReminderArea()
{
	if (getCookie("alphaorg") != null)
	{
		document.write("<img alt='Spacer' src='/images/reminder_spacer.gif'>&nbsp;</font>")
	}
	else
	{
		document.write("<img alt='Spacer' align='right' src='/images/reminder_spacer.gif'><font size='1'><a href='/app/reminder.asp'>Forget your password?</a></font>")
	}
}

function renderMainTabs(area)
{
	if (getCookie("alphaorg") != null)
	{
		if (area == "home") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_home.gif' usemap='#nav_main' border=0>");
		if (area == "works") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_works.gif' usemap='#nav_main' border=0>");
		if (area == "faqs") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_faqs.gif' usemap='#nav_main' border=0>");
		if (area == "articles") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_articles.gif' usemap='#nav_main' border=0>");
		if (area == "about") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_about.gif' usemap='#nav_main' border=0>");
		if (area == "contact") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_contact.gif' usemap='#nav_main' border=0>");
		if (area == "account") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_account.gif' usemap='#nav_main' border=0>");
		if (area == "my") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_my.gif' usemap='#nav_main' border=0>");
		if (area == "none") document.write("<img alt='Navigation Tabs' src='/images/auth_nav_main_tabs_none.gif' usemap='#nav_main' border=0>");
	}
	else
	{
		if (area == "home") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_home.gif' usemap='#nav_main' border=0>");
		if (area == "works") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_works.gif' usemap='#nav_main' border=0>");
		if (area == "faqs") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_faqs.gif' usemap='#nav_main' border=0>");
		if (area == "articles") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_articles.gif' usemap='#nav_main' border=0>");
		if (area == "about") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_about.gif' usemap='#nav_main' border=0>");
		if (area == "contact") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_contact.gif' usemap='#nav_main' border=0>");
		if (area == "account") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_account.gif' usemap='#nav_main' border=0>");
		if (area == "my") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_none.gif' usemap='#nav_main' border=0>");		
		if (area == "none") document.write("<img alt='Navigation Tabs' src='/images/nav_main_tabs_none.gif' usemap='#nav_main' border=0>");
	}
}

function renderPrimaryNav(area)
{
    document.write("<div class='divNavPrimaryInner'><table class='tblNavPrimary' cellpadding='0' cellspacing='0'>");
    document.write("<tr>");
    
    // Home
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/index.html'>");
    if (area == "home") { document.write("<img alt='AlphaMeasure Home' src='/images/navHome_On.gif' border='0'>"); } else { document.write("<img alt='AlphaMeasure Home' src='/images/navHome.gif' oversrc='/images/navHome_On.gif' border='0'>"); } 
    document.write("</a></td>");
        
    // How
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/employee_survey_experts.html'>");
    if (area == "how") { document.write("<img alt='Employee Survey Experts' src='/images/navHow_On.gif' border='0'>"); } else { document.write("<img alt='Employee Survey Experts' src='/images/navHow.gif' oversrc='/images/navHow_On.gif' border='0'>"); } 
    document.write("</a></td>");
    
    // Employee Surveys
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/product.html'>");
    if (area == "employeesurvs") { document.write("<img alt='Employee Surveys' src='/images/navEmployeeSurvs_On.gif' border='0'>"); } else { document.write("<img alt='Employee Surveys' src='/images/navEmployeeSurvs.gif' oversrc='/images/navEmployeeSurvs_On.gif' border='0'>"); } 
    document.write("</a></td>");
    
    // Manager Surveys
//    document.write("<td class='tdSpacer'>&nbsp;</td>");
//    document.write("<td><a href='/manager_surveys.html'>");
//    if (area == "managersurvs") { document.write("<img alt='Manager Surveys' src='/images/navManagerSurvs_On.gif' border='0'>"); } else { document.write("<img alt='Manager Surveys' src='/images/navManagerSurvs.gif' oversrc='/images/navManagerSurvs_On.gif' border='0'>"); } 
//    document.write("</a></td>");
   
    // About Us
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/about.html'>");
    if (area == "aboutus") { document.write("<img alt='About Us' src='/images/navAboutUs_On.gif' border='0'>"); } else { document.write("<img alt='About Us' src='/images/navAboutUs.gif' oversrc='/images/navAboutUs_On.gif' border='0'>"); } 
    document.write("</a></td>");
    
    // Contact Us
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/app/contact.aspx'>");
    if (area == "contactus") { document.write("<img alt='Contact Us' src='/images/navContactUs_On.gif' border='0'>"); } else { document.write("<img alt='Contact Us' src='/images/navContactUs.gif' oversrc='/images/navContactUs_On.gif' border='0'>"); } 
    document.write("</a></td>");
    
    // Contact Us
    document.write("<td class='tdSpacer'>&nbsp;</td>");
    document.write("<td><a href='/articles.html'>");
    if (area == "community") { document.write("<img alt='Community' src='/images/navCommunity_On.gif' border='0'>"); } else { document.write("<img alt='Community' src='/images/navCommunity.gif' oversrc='/images/navCommunity_On.gif' border='0'>"); } 
    document.write("</a></td>");

	if (getCookie("alphaorg") != null)
	{
	    // My AlphaMeasure
        document.write("<td class='tdSpacer'>&nbsp;</td>");
        document.write("<td><a href='/app/main.asp'>");
        if (area == "myalphameasure") { document.write("<img alt='My AlphaMeasure' src='/images/navMyAlphaMeasure_On.gif' border='0'>"); } else { document.write("<img alt='My AlphaMeasure' src='/images/navMyAlphaMeasure.gif' oversrc='/images/navMyAlphaMeasure_On.gif' border='0'>"); } 
        document.write("</a></td>");
	}
	else
	{
	    // Create Account
	    document.write("<td class='tdSpacer'>&nbsp;</td>");
        document.write("<td><a href='/app/account.aspx'>");
        if (area == "create") { document.write("<img alt='Create Account' src='/images/navCreateAccount_On.gif' border='0'>"); } else { document.write("<img alt='Create Account' src='/images/navCreateAccount.gif' oversrc='/images/navCreateAccount_On.gif' border='0'>"); } 
        document.write("</a></td>");
	}
	
    document.write("<td class='tdSpacer'>&nbsp;</td>");
	document.write("</tr>");
	document.write("</table></div>");
}

function renderSurveyMap()
{
	QueryString.keys = new Array();
	QueryString.values = new Array();
	QueryString_Parse();
    
    if (QueryString("skey") != null)
    {
        document.write("<a class='lnkNavSecondary' href='/app/surveymap.asp?skey=" + QueryString("skey") + "'><img border='0' src='/images/btn_surv_map.gif' /></a>");
    }
}

function renderLoginArea()
{
	if (getCookie("alphaorg") != null)
	{
	    
        document.write("<table class='tblLogin' cellpadding='0' cellspacing='0' border='0'>");
        document.write("<tr valign='top'>");
        document.write("<td class='tdLoginBackLeft'></td>");
        document.write("<td class='tdLoginBack' bgcolor='#990000'>");
        document.write("<table cellpadding='0' cellspacing='0' class='tblLoginArea'>");
        document.write("<tr><td class='tdLoginHeader'>My AlphaMeasure</td><td align='right' style='padding-top: 4px;'><a href='/app/process_logout.asp' class='lnkLoginAreaBold'>Sign Out</a></td></tr>");
        document.write("<tr>");
        document.write("<td colspan='2'>");
        document.write("<a href='/app/main.asp' class='lnkLoginArea'>View Surveys</a>&nbsp;|&nbsp;");
        document.write("<a href='/app/setdivisions.asp' class='lnkLoginArea'>Build Organization</a>&nbsp;|&nbsp;");
        document.write("<a href='/app/setemployees.asp' class='lnkLoginArea'>Manage Emails</a>");
        document.write("</td>");
        document.write("</tr>");
        document.write("<tr>");
        document.write("<td colspan='2' style='padding-top: 6px;'>");
        // document.write("Current Area:&nbsp;");
        // document.write("<select name='product' class='selectLoginArea'>");
        // document.write("<option value='employee'>Employee Surveys</option>");
        // document.write("<option value='manager'>Manager Surveys</option>");
        document.write("</select>");       
        document.write("</td>");
        document.write("</tr>");
        document.write("</table>");
        document.write("</td>");
        document.write("<td class='tdLoginBackRight'></td>");
        document.write("</tr>");
        document.write("</table>");

	}
	else
	{
	    document.write("<form action='/app/process_login.asp' method='post'>");
		document.write("<table class='tblLogin' cellpadding='0' cellspacing='0' border='0'>");
        document.write("<tr valign='top'>");
        document.write("<td class='tdLoginBackLeft'></td>");
        document.write("<td class='tdLoginBack' bgcolor='#990000'>");
        document.write("<table cellpadding='0' cellspacing='0' class='tblLoginArea'>");
        document.write("<tr><td class='tdLoginHeader'>Client Log In</td></tr>");
        document.write("<tr>");
        document.write("<td align='left'>Email:&nbsp;");
        document.write("<input name='Email' size='12' />&nbsp;");
        document.write("&nbsp;Password:&nbsp;");
        document.write("<input name='Pass' type='password' size='12' />&nbsp;");
        document.write("<input type='submit' value='Login' /></td>");
        document.write("</tr>");
        document.write("<tr><td align='right' class='tdTopPadding'><a href='/app/account.aspx' class='lnkLoginArea'>Create Account</a>&nbsp;|&nbsp;<a href='/app/reminder.asp' class='lnkLoginArea'>Forget Password?</a></td></tr>");
        document.write("</table>");
        document.write("</td>");
        document.write("<td class='tdLoginBackRight'></td>");
        document.write("</tr>");
        document.write("</table>");
        document.write("</form>");
	}
}

function renderFooter()
{
    document.write("<table class='tblNavFooter' cellpadding='0' cellspacing='0'>");
    document.write("<tr>");
    document.write("<td>");
    document.write("<a href='index.html' class='lnkFooter'>Home</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>How We Work</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>Employee Surveys</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>Manager Surveys</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>About Us</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>Contact Us</a>&nbsp;|&nbsp;");
    document.write("<a href='index.html' class='lnkFooter'>Create Account</a>");
    document.write("</td>");
    document.write("</tr>");
    document.write("<tr>");
    document.write("<td class='tdCopyright'>");
    document.write("© 2004-2008, AlphaMeasure, Inc. All rights reserved.");
    document.write("</td>");
    document.write("</tr>");
    document.write("</table>");
}

function renderNavMap()
{
	if (getCookie("alphaorg") != null)
	{
		document.write("<map NAME='nav_main'>")
		document.write("<area shape='poly' coords='30,22,54,1,99,1,99,22,99,22' href='/index.html' alt='Home'>")
		document.write("<area shape='poly' coords='99,22,99,15,116,0,209,0,209,22,209,22' href='/product.html' alt='How It Works'>")
		document.write("<area shape='poly' coords='209,22,209,15,225,1,269,1,269,22' href='/faq.html' alt='Frequently Asked Questions'>")
		document.write("<area shape='poly' coords='269,22,269,14,285,1,343,1,343,22' href='/articles.html' alt='Article Archive'>")
		document.write("<area shape='poly' coords='343,22,343,16,360,1,408,1,408,22' href='/about.html' alt='About Us'>")
		document.write("<area shape='poly' coords='408,22,408,15,424,1,483,1,483,22' href='/contact.html' alt='Contact Us'>")
		document.write("<area shape='poly' coords='483,22,483,15,500,1,619,1,619,22' href='/app/main.asp' alt='My AlphaMeasure'>")
		document.write("</map>")
		document.write("<map NAME='nav_home'>")
		document.write("<area shape='rect' coords='0,82,134,10' title='Return Home' href='/index.html' alt='Home'>")
		document.write("</map>")
	}
	else 
	{
		document.write("<map NAME='nav_main'>")
		document.write("<area shape='poly' coords='30,22,54,1,99,1,99,22,99,22' href='/index.html' alt='Home'>")
		document.write("<area shape='poly' coords='99,22,99,15,116,0,209,0,209,22,209,22' href='/product.html' alt='How It Works'>")
		document.write("<area shape='poly' coords='209,22,209,15,225,1,269,1,269,22' href='/faq.html' alt='Frequently Asked Questions'>")
		document.write("<area shape='poly' coords='269,22,269,14,285,1,343,1,343,22' href='/articles.html' alt='Article Archive'>")
		document.write("<area shape='poly' coords='343,22,343,16,360,1,408,1,408,22' href='/about.html' alt='About Us'>")
		document.write("<area shape='poly' coords='408,22,408,15,424,1,483,1,483,22' href='/contact.html' alt='Contact Us'>")
		document.write("<area shape='poly' coords='483,22,483,15,500,1,606,1,606,22' href='/app/account.aspx' alt='Create Account'>")
		document.write("</map>")
		document.write("<map NAME='nav_home'>")
		document.write("<area shape='rect' coords='0,82,134,10' title='Return Home' href='/index.html' alt='Home'>")
		document.write("</map>")
	}	
}

function renderPackagesButton()
{
	if (getCookie("alphaorg") != null)
	{
		document.write("<a href='javascript:history.back()'><img alt='Previous Page' border=0 src='/images/btn_previous_page_FFFFFF.gif'></a>")
	}
	else
	{
		document.write("<a href='/app/account.aspx'><img border=0 alt='Create Account' src='/images/btn_free_account.gif'></a>")
	}
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    
    return unescape(dc.substring(begin + prefix.length, end));
}

function validateInviteList(PCount, ECount, Key)
{
	var URL = "/app/confirmorganization.asp?skey=" + Key;
	
	if (PCount == 0 && ECount != 0)
	{
		if (confirm("There are no employees added to this survey's invite list.\nIf you have chosen employees to invite, be sure to click the 'Set Email Invite List' button before proceeding.\nAre you sure you want to continue?")) location.href = URL;
	}
	else
	{
		location.href = URL;
	}
}

function exitSurvey()
{
	confirm("There are no employees added to this survey's invite list.\nIf you have chosen employees to invite, be sure to click the 'Set Email Invite List' button before proceeding.\nAre you sure you want to continue?");
}

function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}
}

function CheckRadioResponses(formIncoming) {
	var intTotalRadios = 0;
	var intRadiosChecked = 0;
	var strMessage = "";
	var strCurrentRadio = "";
	var objRadios = document.getElementsByTagName("input");
	
	// We're going to loop through the radio buttons and count
	// how many collections have been checked
	for(i=0; i<objRadios.length; i++){
		if(objRadios[i].type == "radio")
		{
			if (strCurrentRadio != objRadios[i].name)
			{
				// Set the current radio button collection
				strCurrentRadio = objRadios[i].name;
				// Increment the total number of radios
				intTotalRadios++;
			}
			
			if (objRadios[i].checked == true) 
			{
				// Count each checked radio button
				intRadiosChecked++;
			}
		}
	}	
	
	if (intRadiosChecked != intTotalRadios) {
		var answer = confirm("You have only supplied answers for " + intRadiosChecked + " out of " + intTotalRadios +  " required answer questions on this page.\nThis survey is set to require an answer to every question, except open text questions.\nIf desired, you can proceed with this survey because you will have an opportunity to revisit any unanswered questions prior to completion.\nAre you sure you want to continue?");
		if (answer) {
			// Move on
			return true;
		} else {
			// Stay put
			return false;
		}
	}
}

function CheckRadioResponsesLocalized(formIncoming, strCultureCode) {
	var intTotalRadios = 0;
	var intRadiosChecked = 0;
	var strMessage = "";
	var strCurrentRadio = "";
	var objRadios = document.getElementsByTagName("input");
	
	// We're going to loop through the radio buttons and count
	// how many collections have been checked
	for(i=0; i<objRadios.length; i++){
		if(objRadios[i].type == "radio")
		{
			if (strCurrentRadio != objRadios[i].name)
			{
				// Set the current radio button collection
				strCurrentRadio = objRadios[i].name;
				// Increment the total number of radios
				intTotalRadios++;
			}
			
			if (objRadios[i].checked == true) 
			{
				// Count each checked radio button
				intRadiosChecked++;
			}
		}
	}	
	
	if (intRadiosChecked != intTotalRadios) {
		if (strCultureCode == "es-mx")
	    {
	        var answer = confirm("Usted a proporcionado unicamente respuestas de " + intRadiosChecked + " de " + intTotalRadios +  " preguntas en esta pagina.\nEsta encuesta requiere respuestas a cada pregunta, excepto por preguntas de redaccion creativa.\nSi usted desea, puede proceder con esta encuesta porque usted tendra la oportunidad de revisar cualquier pregunta no contestada antes de completar la encuesta.\nEsta usted seguro que quiere continuar?");
	    }
	    else
	    {
	        var answer = confirm("You have only supplied answers for " + intRadiosChecked + " out of " + intTotalRadios +  " required answer questions on this page.\nThis survey is set to require an answer to every question, except open text questions.\nIf desired, you can proceed with this survey because you will have an opportunity to revisit any unanswered questions prior to completion.\nAre you sure you want to continue?");
	    }
	    
		if (answer) {
			// Move on
			return true;
		} else {
			// Stay put
			return false;
		}
	}
}

function CheckRadioResponsesSpanish(formIncoming) {
	var intTotalRadios = 0;
	var intRadiosChecked = 0;
	var strMessage = "";
	var strCurrentRadio = "";
	var objRadios = document.getElementsByTagName("input");
	
	// We're going to loop through the radio buttons and count
	// how many collections have been checked
	for(i=0; i<objRadios.length; i++){
		if(objRadios[i].type == "radio")
		{
			if (strCurrentRadio != objRadios[i].name)
			{
				// Set the current radio button collection
				strCurrentRadio = objRadios[i].name;
				// Increment the total number of radios
				intTotalRadios++;
			}
			
			if (objRadios[i].checked == true) 
			{
				// Count each checked radio button
				intRadiosChecked++;
			}
		}
	}	
	
	if (intRadiosChecked != intTotalRadios) {
		var answer = confirm("Usted a proporcionado únicamente respuestas de " + intRadiosChecked + " de " + intTotalRadios +  " preguntas en esta página.\nEsta encuesta requiere respuestas a cada pregunta, excepto por preguntas de redacción creativa.\nSi usted desea, puede proceder con esta encuesta porque usted tendrá la oportunidad de revisar cualquier pregunta no contestada antes de completar la encuesta.\nEsta usted seguro que quiere continuar?");
		if (answer) {
			// Move on
			return true;
		} else {
			// Stay put
			return false;
		}
	}
}

function ConfirmRadioResponsesSpanish(formIncoming) {
	var intTotalRadios = 0;
	var intRadiosChecked = 0;
	var strMessage = "";
	var strCurrentRadio = "";
	var objRadios = document.getElementsByTagName("input");
	
	// We're going to loop through the radio buttons and count
	// how many collections have been checked
	for(i=0; i<objRadios.length; i++){
		if(objRadios[i].type == "radio")
		{
			if (strCurrentRadio != objRadios[i].name)
			{
				// Set the current radio button collection
				strCurrentRadio = objRadios[i].name;
				// Increment the total number of radios
				intTotalRadios++;
			}
			
			if (objRadios[i].checked == true) 
			{
				// Count each checked radio button
				intRadiosChecked++;
			}
		}
	}	
	
	if (intRadiosChecked != intTotalRadios) {
		alert("Usted a proporcionado unicamente respuestas de " + intRadiosChecked + " de " + intTotalRadios +  " preguntas en esta pagina.\nEsta encuesta requiere respuestas a cada pregunta, excepto por preguntas de redaccion creativa.");
		return false;
	}
}

function ConfirmRadioResponses(formIncoming) {
	var intTotalRadios = 0;
	var intRadiosChecked = 0;
	var strMessage = "";
	var strCurrentRadio = "";
	var objRadios = document.getElementsByTagName("input");
	
	// We're going to loop through the radio buttons and count
	// how many collections have been checked
	for(i=0; i<objRadios.length; i++){
		if(objRadios[i].type == "radio")
		{
			if (strCurrentRadio != objRadios[i].name)
			{
				// Set the current radio button collection
				strCurrentRadio = objRadios[i].name;
				// Increment the total number of radios
				intTotalRadios++;
			}
			
			if (objRadios[i].checked == true) 
			{
				// Count each checked radio button
				intRadiosChecked++;
			}
		}
	}	
	
	if (intRadiosChecked != intTotalRadios) {
		alert("You have only supplied answers for " + intRadiosChecked + " out of " + intTotalRadios +  " questions in this survey.\nThis survey is set to require an answer to every question, except open text questions.  You must answer all unanswered multiple choice questions before you can submit this survey.");
		return false;
	}
}

function LinkPage(path, ext)
{
	// Make sure we've got what we need
	if (path != '' && ext != "") {
		// Create the URL and redirect
		var URL = path + "." + ext;
		window.location = URL;
	}
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=250,left = 440,top = 387');");
}

function popUpWithSize(URL, Width, Height) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + Width + ",height=" + Height + ",left = 100,top = 20');");
}

function validateAddSurvey()
{
    if (document.AddSurvey.url.value == "")
    {
        alert("Please provide a survey URL before proceeding.");
        document.AddSurvey.url.focus();
        return false;
    } else {
		return true; // Move on
    }
}

function validateAddAccount()
{
	var strMessage = "";
    if (document.AddAccount.org_name.value == "")
    {
		strMessage = strMessage + "You must provide an organization name.\n";
    }
    if (document.AddAccount.address1.value == "")
    {
		strMessage += "You must provide an address.\n";
    }
    if (document.AddAccount.city.value == "")
    {
		strMessage += "You must provide a city.\n";
    }
    if (document.AddAccount.state.value == "")
    {
		strMessage += "You must provide a state.\n";
    }
    if (document.AddAccount.zipcode.value == "")
    {
		strMessage += "You must provide a postal code.\n";
    }
    if (document.AddAccount.country.value == "")
    {
		strMessage += "You must provide a country.\n";
    }
    if (document.AddAccount.email.value == "")
    {
		strMessage += "You must provide an email.\n";
    }
    if (document.AddAccount.confirm_email.value == "")
    {
		strMessage += "You must provide a confirm email.\n";
    }
    if (document.AddAccount.password.value == "")
    {
		strMessage += "You must provide a password.\n";
    }
    if (document.AddAccount.confirm_password.value == "")
    {
		strMessage += "You must provide a confirm password.\n";
    }    
    if (document.AddAccount.first_name.value == "")
    {
		strMessage += "You must provide a first name.\n";
    }
    if (document.AddAccount.last_name.value == "")
    {
		strMessage += "You must provide a last name.\n";
    }        
    if (document.AddAccount.email.value != "" && document.AddAccount.confirm_email.value != "")
    {
		if (document.AddAccount.email.value != document.AddAccount.confirm_email.value)
		{
			strMessage += "Your email and confirm email do not match.\n";
		}    
	}
    if (document.AddAccount.password.value != "" && document.AddAccount.confirm_password.value != "")
    {
		if (document.AddAccount.password.value != document.AddAccount.confirm_password.value)
		{
			strMessage += "Your password and confirm password do not match.\n";
		}    
	}	
    if (strMessage != "") {
			alert("Please correct the following issues:\n" + strMessage);
			return false;
	}
}

function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}