/*******************************************************************************
 *  Abacast SubScribe JavaScript Functions
 *  
 *  Copyright (c) 2008 Abacast, Inc. All rights reserved World Wide.
 *  
 *******************************************************************************/

//	' ***********************************************************
//	' Update State menu from new Country Option(s)
//	' ***********************************************************
function updateUStateMenu(countryCode,optionString){

	//alert("got here");

	var uStateNew = document.forms['formUserEdit'].uStateCode
	uStateNew.className='inputField';
	uStateNew.options.length = 0;

	var defaultOption = document.createElement('option');
	defaultOption.text = 'No County/State Required.';
	defaultOption.value = '';

	var firstOption = document.createElement('option');
	firstOption.text = 'Please Select a County/State.';
	firstOption.value = '';

	for(var i=0;i<optionString[2].length;i++){
		var selCountry = optionString[2][i];
		if (selCountry == countryCode) {
			if ( uStateNew.options.length == 0 ) {
				uStateNew.add(firstOption);
			}
			var builtOption = document.createElement('option')
			builtOption.value = optionString[0][i];
			builtOption.text = optionString[1][i];
			try {
				uStateNew.add(builtOption, null);
			}
			catch(ex) {
				uStateNew.add(builtOption);
			}
		}
	}
	if ( uStateNew.options.length == 0 ) {
		uStateNew.add(defaultOption);
	} else {
		document.forms['formUserEdit'].uStateCode.focus()
	}
	
}

//' {---------------------------------------------------------------------------------------------}

//	' ***********************************************************
//	' Update State menu from new Country Option(s)
//	' ***********************************************************
function updateStateMenu(countryCode,optionString){

	var cStateNew = document.forms['formCustEdit'].cStateCode
	cStateNew.className='inputField';
	cStateNew.options.length = 0;
	
	var defaultOption = document.createElement('option');
	defaultOption.text = 'No County/State Required.';
	defaultOption.value = '';
	
	var firstOption = document.createElement('option');
	firstOption.text = 'Please Select a County/State.';
	firstOption.value = '';

	for(var i=0;i<optionString[2].length;i++){
		var selCountry = optionString[2][i];
		if (selCountry == countryCode) {
			if ( cStateNew.options.length == 0 ) {
				cStateNew.add(firstOption);
			}
			var builtOption = document.createElement('option')
			builtOption.value = optionString[0][i];
			builtOption.text = optionString[1][i];
			try {
				cStateNew.add(builtOption, null);
			}
			catch(ex) {
				cStateNew.add(builtOption);
			}
		}
	}
	if ( cStateNew.options.length == 0 ) {
		cStateNew.add(defaultOption);
	} else {
		document.forms['formCustEdit'].cStateCode.focus()
	}
	
}


//' {---------------------------------------------------------------------------------------------}
// This function goes through the options for the given
// drop down box and removes them in preparation for
// a new set of values

function emptyList( box ) {
	// Set each option to null thus removing it
	while ( box.options.length ) box.options[0] = null;
}

//' {---------------------------------------------------------------------------------------------}
// This function assigns new drop down options to the given
// drop down box from the list of lists specified
function fillList( box, arr ) {
	// arr[0] holds the display text
	// arr[1] are the values
	for ( i = 0; i < arr[0].length; i++ ) {

		// Create a new drop down option with the
		// display text and value from arr
		option = new Option( arr[0][i], arr[1][i] );

		// Add to the end of the existing options
		box.options[box.length] = option;
	}

	// Preselect option 0
	box.selectedIndex=0;
}

//' {---------------------------------------------------------------------------------------------}
// This function performs a drop down list option change by first
// emptying the existing option list and then assigning a new set

function changeStateList( box, arr ) {
	alert("got here");
	// Isolate the appropriate list by using the value
	// of the currently selected option
	list = arr[box.options[box.selectedIndex].value];

	// Next empty the slave list
	emptyList( box.form.slave );

	// Then assign the new list values
	fillList( box.form.slave, list );
}

function contactOwner(eventid){var contacturl="https://www.seminarstreams.com/contact_form.asp?semid="+seminarid;contacturl=encodeURI(contacturl);contactOwnerWin(contacturl)}
function contactOwnerWin(contacturl){var contactwindow=window.open(contacturl,"contactwindow","scrollbars=yes,resizable=yes,width=680,height=635");if(!contactwindow.opener){contactwindow.opener=self}if(contactwindow.focus){contactwindow.focus()}}
function printFooter(pageURL){document.write('<div id="footerTop">');document.write('<div id="footerTopLeft"><!--  --></div>');document.write('<div id="footerTopRight"><!--  --></div>');document.write('</div>');document.write('<div id="footerContent">');document.write('<div id="footerContentLeft"><a href="http://www.seminarstreams.com">www.seminarstreams.com</a><br /><a href="Privacy-Policy.asp">Privacy Policy</a> | <a href="Terms.asp">Terms</a></div>');document.write('<div id="footerContentRight"><a href="about-us.asp">About Us</a>  | 	<a href="streaming-hosting-plans.asp">Seminar Hosting</a>  |  <a href="Video-Production.asp">Video Production</a>  |  <a href="Marketing.asp">Marketing</a>  |  <a href="Support.asp">Support</a>  |  <a href="contact-seminar-streams.asp">Contact Us</a>  |  <a href="Sitemap.asp">Site Map</a>  |  <a href="index.asp">Gmap</a></div>');document.write('</div>');document.write('<div id="footerBottom">');document.write('<div id="footerCopy">&copy; Copyright 2008, SeminarStreams.com - All Rights Reserved </div>');document.write('</div>')};


//******************************************************************************
//                                  END OF FILE
//******************************************************************************
