// Initialize the Site Map.

// This function loops through all li elements that contain a child h3 tag (signifying it as a sub-menu element) and 

// 1) gives the li element a unique id

// 2) adds a link to the h3 tag and assigns an onclick event to toggle open/close state of the sub-menu (ul sibling to h3)

// 3) Assigns the saved open/close state to each sub-menu

// It then builds the Show/Hide All links

function initList(id)

{

	var newString = getCookie('openElements'); // Retrieve saved open/closed states of each sub-menu

	openElements = newString.split(':'); // Convert cookie string to global array

	var mapList = document.getElementById(id);

	var h3s = mapList.getElementsByTagName('H3'); // H3 elements signify submenus

	var li;

	var a;

	var linkText;

	if (h3s.length > 0) {

		for (var i=0; i < h3s.length; i++) {

			if (h3s[i] && h3s[i].parentNode.nodeName == 'LI') {

				// Access parent li element of h3 element

				li = h3s[i].parentNode; 

				// Assign unique id to each sub-menu li tag

				li.setAttribute('id','list' + i); 

				// Assign saved open/closed state to sub-menu

				if (inArray(li.id,openElements)) {

					openList(li);

				} else {

					closeList(li);

				}

				// Build new link tag and insert it as a child to the h3 element

				a = document.createElement('a');

				linkText = document.createTextNode(h3s[i].firstChild.nodeValue); // Assumes h3 element has only one child text node

				a.appendChild(linkText);

				a.setAttribute('href','#');

				a.onclick = function(){toggle(this.parentNode.parentNode); return false;};

				h3s[i].replaceChild(a,h3s[i].firstChild);

			}

		}

	}

	// Create "open/close all" links and place them above the Site Map

	//h3 = document.createElement('h3');

	//a_show = document.createElement('a');

//	linkText = document.createTextNode('Show All');

//	a_show.appendChild(linkText);

//	a_show.setAttribute('href','#');

//	a_show.onclick = function(){toggleAll(id,'show'); return false;};

//	a_hide = a_show.cloneNode(a_show);

//	a_hide.firstChild.nodeValue = 'Hide';

//	a_hide.onclick = function(){toggleAll(id,'hide'); return false;};

//	img_show = document.createElement('img');

//	img_show.setAttribute('src','images/plus.gif');

//	img_hide = img_show.cloneNode(img_show);

//	img_hide.setAttribute('src','images/minus.gif');

//	h3.appendChild(img_show);

//	h3.appendChild(a_show);

//	h3.appendChild(document.createTextNode(' '));

//	h3.appendChild(img_hide);

//	h3.appendChild(a_hide);

//	h3.id = 'toggle-all';

//	mapList.parentNode.insertBefore(h3,mapList);

}



// Once the Site Map is initialized, toggle() opens and closes individual menus

function toggle(li)

{

	if (li.className && li.className == 'open') {

		closeList(li);

		removeOpenElement(li.id,openElements);

	} else if (li.className && li.className == 'closed') {

		openList(li);

		addOpenElement(li.id,openElements);

	}

	// Save state of open sub-menus

	setCookie("openElements",openElements.join(":"));

}



// Opens or closes all sub-menus at once

function toggleAll(id,mode)

{

	var mapList = document.getElementById(id);

	var h3s = mapList.getElementsByTagName('H3');

	var li;

	var linkText;

	if (h3s.length > 0) {

		for (var i=0; i < h3s.length; i++) {

			if (h3s[i] && h3s[i].parentNode.nodeName == 'LI') {

				li = h3s[i].parentNode; 

				if (mode == 'show') {

					openList(li);

					addOpenElement(li.id,openElements);

				} else {

					closeList(li);

					removeOpenElement(li.id,openElements);

				}

			}

		}

		// Save state

		setCookie("openElements",openElements.join(":"));

	}

}



// Adds the li id to the list of open sub-menus

function addOpenElement(element,array)

{

	if (!inArray(element,array)) {

		array[array.length] = element;

		return true;

	}

	return false;

}



// Removes the li id from the list of open sub-menus

// The use of splice() limits support to modern browsers

function removeOpenElement(element,array)

{

	for (var i = 0; i < array.length; i++) {

		if (array[i] == element) {

			array.splice(i,1);

			return true;

		}

	}

	return false;

}



// Simple function to test presence of an element in an array

function inArray(element,array)

{

	for (var i = 0; i < array.length; i++) {

		if (array[i] == element) {

			return true;

		}

	}

	return false;

}



// Sets a sub-menu state to open; invoked by initList() and toggle()

function openList(li)

{

	li.className = 'open';

	return true;

}



// Sets a subm-menu state to closed; invoked by initList() and toggle()

function closeList(li)

{

	li.className = 'closed';

	return true;

}



// Gets cookie value; invoked by getCookie()

// Source: Javascript and DHTML Cookbook (O'Reilly)

function getCookieVal(offset)

{

	var endstr = document.cookie.indexOf(";",offset);

	if (endstr == -1) {

		endstr = document.cookie.length;

	}

	return unescape(document.cookie.substring(offset,endstr));

}



// Gets cookie information

// Source: Javascript and DHTML Cookbook (O'Reilly)

function getCookie(name)

{

	var arg = name + "=";

	var alen = arg.length;

	var clen = document.cookie.length;

	var i = 0;

	while (i < clen) {

		var j = i + alen;

		if (document.cookie.substring(i,j) == arg) {

			return getCookieVal(j);

		}

		i = document.cookie.indexOf(" ",i) + 1;

		if (i == 0) break;

	}

	return "";

}



// Sets cookie information

// Source: Javascript and DHTML Cookbook (O'Reilly)

function setCookie(name,value,expires,path,domain,secure) {

	document.cookie = name + "=" + escape(value) + 

		((expires) ? "; expires=" + expires : "") +

		((path) ? "; path=" + path : "") +

		((domain) ? "; domain=" + domain : "") +

		((secure) ? "; secure=" + secure : "");

}



var openElements = Array(); // Contains the li ids of all open sub-menus

// Starts the whole shebang

if(document.getElementById && document.createTextNode && openElements.splice)

{

	window.onload=function(){
        
        //Check to see if we have a map-list element first
        if(document.getElementById('map-list') !=null){
		    initList('map-list');
		}

	}

	

}

<!--//--><![CDATA[//><!--



sfHover = function() {

	var sfEls = document.getElementById("nav").getElementsByTagName("LI");

	for (var i=0; i<sfEls.length; i++) {

		sfEls[i].onmouseover=function() {

			this.className+=" sfhover";

		}

		sfEls[i].onmouseout=function() {

			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

		}

	}

}

if (window.attachEvent) window.attachEvent("onload", sfHover);



//--><!]]>



function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

// Form validation for Media Registration

function ValidateAll()
{
	if(CheckName(document.mediareg.name.value) == false) return false;
	if(CheckJobtitle(document.mediareg.title.value) == false) return false;
	if(CheckPubgroup(document.mediareg.pubgroup.value) == false) return false;
	if(CheckCompany(document.mediareg.company.value) == false) return false;
	if(CheckAddress1(document.mediareg.address1.value) == false) return false;
	if(CheckCity(document.mediareg.city.value) == false) return false;
	if(CheckState(document.mediareg.state.value) == false) return false;
	if(CheckZip(document.mediareg.zip.value) == false) return false;
	if(CheckCountry(document.mediareg.country.value) == false) return false;
	if(CheckEmail(document.mediareg.email.value) == false) return false;
	if(CheckPhone(document.mediareg.phone.value) == false) return false;
	if(CheckFax(document.mediareg.fax.value) == false) return false;
	return true;
}

function StripSpacesFromEnds(s)
{
	// developed by willmaster.com
	while((s.indexOf(' ',0) == 0) && (s.length > 1))
	{
		s = s.substring(1,s.length);
	}
	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1)))
	{
		s = s.substring(0,(s.length - 1));
	}
	if((s.indexOf(' ',0) == 0) && (s.length == 1)) s = '';
	return s;
}

function IsItPresent(s,explanation)
{
	// developed by willmaster.com
	s = StripSpacesFromEnds(s);
	if(s.length) return s;
	alert('Please ' + explanation + '.');
	return '';
}

function CheckName(s_name)
{
	// developed by willmaster.com
	s_name = IsItPresent(s_name,'enter your name');
	if(! s_name) return false;

	document.mediareg.name.value = s_name;
	return true;
}

function CheckJobtitle(s_title)
{
	// developed by willmaster.com
	s_title = IsItPresent(s_title,'enter your job title');
	if(! s_title) return false;

	document.mediareg.title.value = s_title;
	return true;
}

function CheckPubgroup(s_pubgroup)
{
	// developed by willmaster.com
	s_pubgroup = IsItPresent(s_pubgroup,'enter your publication/analyst group');
	if(! s_pubgroup) return false;

	document.mediareg.pubgroup.value = s_pubgroup;
	return true;
}
function CheckCompany(s_company)
{
	// developed by willmaster.com
	s_company = IsItPresent(s_company,'enter your company');
	if(! s_company) return false;

	document.mediareg.company.value = s_company;
	return true;
}

function CheckAddress1(s_address1)
{
	// developed by willmaster.com
	s_address1 = IsItPresent(s_address1,'enter your address');
	if(! s_address1) return false;

	document.mediareg.address1.value = s_address1;
	return true;
}

function CheckCity(s_city)
{
	// developed by willmaster.com
	s_city = IsItPresent(s_city,'enter your city');
	if(! s_city) return false;

	document.mediareg.city.value = s_city;
	return true;
}

function CheckState(s_state)
{
	// developed by willmaster.com
	s_state = IsItPresent(s_state,'select your state');
	if(! s_state) return false;

	document.mediareg.state.value = s_state;
	return true;
}
function CheckZip(s_zip)
{
	// developed by willmaster.com
	s_zip = IsItPresent(s_zip,'enter your zip');
	if(! s_zip) return false;

	document.mediareg.zip.value = s_zip;
	return true;
}

function CheckCountry(s_country)
{
	// developed by willmaster.com
	s_country = IsItPresent(s_country,'select your country');
	if(! s_country) return false;

	document.mediareg.country.value = s_country;
	return true;
}


function CheckEmail(s_email)
{
	// developed by willmaster.com
	s_email = IsItPresent(s_email,'enter your email address');
	if(! s_email) return false;
	var i = s_email.indexOf(' ',0);
	while(i > -1)
	{
		s_email = s_email.substring(0,i) +
			s_email.substring((i + 1),s_email.length);
		i = s_email.indexOf(' ',0);
	}
	document.mediareg.email.value = s_email;
	if((s_email.length < 6) ||
	   (s_email.indexOf('@',0) < 1) ||
	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||
	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||
	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||
	   (s_email.indexOf('..',0) > -1) ||
	   (s_email.indexOf('@.',0) > -1) ||
	   (s_email.indexOf('.@',0) > -1) ||
	   (s_email.indexOf(',',0) > -1))
	{
		alert('The email address "' + s_email + '" is not valid. Please re-enter.');
		return false;
	}
	return true;
}


function CheckPhone(s_phone)
{
	// developed by willmaster.com
	s_phone = IsItPresent(s_phone,'enter your phone');
	if(! s_phone) return false;

	document.mediareg.phone.value = s_phone;
	return true;
}
function CheckFax(s_fax)
{
	// developed by willmaster.com
	s_fax = IsItPresent(s_fax,'enter your fax');
	if(! s_fax) return false;

	document.mediareg.fax.value = s_fax;
	return true;
}

// Form validation for awards entry

function hideInputs(object){
  var menuIndex = object.options[object.selectedIndex].value;
    if (menuIndex == 'United States' || menuIndex == 'Canada')
    {
     document.getElementById("hidestate").style.display = 'block';
    }
    else
    {
     document.getElementById("hidestate").style.display = 'none';
     document.summitawardapplication.state.options[0].selected = true;

   }
 }

   function hideInputs2(object){
  var menuIndex = object.options[object.selectedIndex].value;
    if (menuIndex == 'United States' || menuIndex == 'Canada')
    {
     document.getElementById("hidenominator_state").style.display = 'block';
    }
    else
    {
     document.getElementById("hidenominator_state").style.display = 'none';
     document.summitawardapplication.nominator_state.options[0].selected = true;

   }
 }

 function hideCategory(object){
  var menuIndex = object.options[object.selectedIndex].value;

    if (menuIndex == 'Software Publisher')
    {
	 document.getElementById("hidewhysp").style.display = 'block';
    }
    else
    {
	 document.getElementById("hidewhysp").style.display = 'none';
    }

	if (menuIndex == 'Enterprise IT')
    {
	 document.getElementById("hidewhyit").style.display = 'block';
    }
    else
    {
	 document.getElementById("hidewhyit").style.display = 'none';
    }

   }

 function hideHear(object){
  var menuIndex = object.options[object.selectedIndex].value;

    if (menuIndex == 'Other')
    {
     document.getElementById("hidehear").style.display = 'block';
    }
    else
    {
     document.getElementById("hidehear").style.display = 'none';
    }

   }

   function hideOther_affiliation(object){
  var menuIndex = object.options[object.selectedIndex].value;

    if (menuIndex == 'Other2')
    {
     document.getElementById("hideother_affiliation").style.display = 'block';
    }
    else
    {
     document.getElementById("hideother_affiliation").style.display = 'none';
    }

   }


function ValidateAll()
{
	if(CheckOrgtype(document.summitawardapplication.orgtype.value) == false) return false;
	if(CheckAbout_company(document.summitawardapplication.about_company.value) == false) return false;
	if(CheckWhy_company_best(document.summitawardapplication.why_company_best.value) == false) return false;
	if(CheckHow_did_you_hear(document.summitawardapplication.how_did_you_hear.value) == false) return false;
	if(CheckName(document.summitawardapplication.name.value) == false) return false;
	if(CheckJobtitle(document.summitawardapplication.title.value) == false) return false;
	if(CheckCompany(document.summitawardapplication.company.value) == false) return false;
	if(CheckAddress1(document.summitawardapplication.address1.value) == false) return false;
	if(CheckCity(document.summitawardapplication.city.value) == false) return false;
	if(CheckCountry(document.summitawardapplication.country.value) == false) return false;
	if(CheckZip(document.summitawardapplication.zip.value) == false) return false;
	if(CheckPhone(document.summitawardapplication.phone.value) == false) return false;
	if(CheckEmail(document.summitawardapplication.email.value) == false) return false;
	if(CheckIndustry(document.summitawardapplication.industry.value) == false) return false;
	if(CheckUrl(document.summitawardapplication.url.value) == false) return false;
	if(CheckEmployees(document.summitawardapplication.employees.value) == false) return false;
		return true;
}

function StripSpacesFromEnds(s)
{
	// developed by willmaster.com
	while((s.indexOf(' ',0) == 0) && (s.length > 1))
	{
		s = s.substring(1,s.length);
	}
	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1)))
	{
		s = s.substring(0,(s.length - 1));
	}
	if((s.indexOf(' ',0) == 0) && (s.length == 1)) s = '';
	return s;
}

function IsItPresent(s,explanation)
{
	// developed by willmaster.com
	s = StripSpacesFromEnds(s);
	if(s.length) return s;
	alert('Please ' + explanation + '.');
	return '';
}

function CheckName(s_name)
{
	// developed by willmaster.com
	s_name = IsItPresent(s_name,'enter your name');
	if(! s_name) return false;

	document.summitawardapplication.name.value = s_name;
	return true;
}

function CheckJobtitle(s_title)
{
	// developed by willmaster.com
	s_title = IsItPresent(s_title,'enter your job title');
	if(! s_title) return false;

	document.summitawardapplication.title.value = s_title;
	return true;
}


function CheckCompany(s_company)
{
	// developed by willmaster.com
	s_company = IsItPresent(s_company,'enter your company');
	if(! s_company) return false;

	document.summitawardapplication.company.value = s_company;
	return true;
}

function CheckAddress1(s_address1)
{
	// developed by willmaster.com
	s_address1 = IsItPresent(s_address1,'enter your address');
	if(! s_address1) return false;

	document.summitawardapplication.address1.value = s_address1;
	return true;
}

function CheckCity(s_city)
{
	// developed by willmaster.com
	s_city = IsItPresent(s_city,'enter your city');
	if(! s_city) return false;

	document.summitawardapplication.city.value = s_city;
	return true;
}

function CheckCountry(s_country)
{

	s_country = IsItPresent(s_country,'select your country');
	if(! s_country) return false;

	document.summitawardapplication.country.value = s_country;



	if((document.summitawardapplication.country.value == 'United States' || document.summitawardapplication.country.value == 'Canada') && document.summitawardapplication.state && document.summitawardapplication.state.value == "")

	{
	  alert("Please select state");
	  return false;
	}

	return true;
}

function CheckZip(s_zip)
{
	// developed by willmaster.com
	s_zip = IsItPresent(s_zip,'enter your zip/postal code');
	if(! s_zip) return false;

	document.summitawardapplication.zip.value = s_zip;
	return true;
}

function CheckPhone(s_phone)
{
	// developed by willmaster.com
	s_phone = IsItPresent(s_phone,'enter your phone');
	if(! s_phone) return false;

	document.summitawardapplication.phone.value = s_phone;
	return true;
}

function CheckEmail(s_email)
{
	// developed by willmaster.com
	s_email = IsItPresent(s_email,'enter your email address');
	if(! s_email) return false;
	var i = s_email.indexOf(' ',0);
	while(i > -1)
	{
		s_email = s_email.substring(0,i) +
			s_email.substring((i + 1),s_email.length);
		i = s_email.indexOf(' ',0);
	}
	document.summitawardapplication.email.value = s_email;
	if((s_email.length < 6) ||
	   (s_email.indexOf('@',0) < 1) ||
	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||
	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||
	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||
	   (s_email.indexOf('..',0) > -1) ||
	   (s_email.indexOf('@.',0) > -1) ||
	   (s_email.indexOf('.@',0) > -1) ||
	   (s_email.indexOf(',',0) > -1))
	{
		alert('The email address "' + s_email + '" is not valid. Please re-enter.');
		return false;
	}
	return true;
}

function CheckIndustry(s_industry)
{

	s_industry = IsItPresent(s_industry,'select your industry');
	if(! s_industry) return false;

	document.summitawardapplication.industry.value = s_industry;
	return true;
}


function CheckUrl(s_url)
{
	// developed by willmaster.com
	s_url = IsItPresent(s_url,'enter your company URL');
	if(! s_url) return false;

	document.summitawardapplication.url.value = s_url;
	return true;
}

function CheckEmployees(s_employees)
{
	// developed by willmaster.com
	s_employees = IsItPresent(s_employees,'select your number of employees');
	if(! s_employees) return false;

	document.summitawardapplication.employees.value = s_employees;
	return true;
}

function CheckOrgtype(s_orgtype)
{

	s_orgtype = IsItPresent(s_orgtype,'select your organization type');
	if(! s_orgtype) return false;

	document.summitawardapplication.orgtype.value = s_orgtype;

		if((document.summitawardapplication.orgtype.value == 'Software Publisher' ) && document.summitawardapplication.spcategories && document.summitawardapplication.spcategories.value == "")

	{
	  alert("Please select your software category");
	  return false;
	}

	if((document.summitawardapplication.orgtype.value == 'Enterprise IT' ) && document.summitawardapplication.itcategories && document.summitawardapplication.itcategories.value == "")

	{
	  alert("Please select your software category");
	  return false;
	}

	       if((document.summitawardapplication.orgtype.value != 'Enterprise IT' ))

	{

	 document.summitawardapplication.itcategories.value = "";

	 }
	 
	 if((document.summitawardapplication.orgtype.value != 'Software Publisher' ))

	{

	 document.summitawardapplication.spcategories.value = "";

	 }

	return true;
}

function CheckAbout_company(s_about_company)
{
	// developed by willmaster.com
	s_about_company = IsItPresent(s_about_company,', in 100 words or less please tell us what your company does');
	if(! s_about_company) return false;

	document.summitawardapplication.about_company.value = s_about_company;
	return true;
}

function CheckWhy_company_best(s_why_company_best)
{
	// developed by willmaster.com
	s_why_company_best = IsItPresent(s_why_company_best,'use the topic areas listed and, in 500 words or less, provide a high level overview of the problem and goal, the challenges to success, and how success was ultimately achieved');
	if(! s_why_company_best) return false;

	document.summitawardapplication.why_company_best.value = s_why_company_best;
	return true;
}

function CheckHow_did_you_hear(s_how_did_you_hear)
{

	s_how_did_you_hear = IsItPresent(s_how_did_you_hear,'select how you heard about the Summmit Awards program');
	if(! s_how_did_you_hear) return false;

	document.summitawardapplication.how_did_you_hear.value = s_how_did_you_hear;

if((document.summitawardapplication.how_did_you_hear.value == 'Other' ) && document.summitawardapplication.other_description && document.summitawardapplication.other_description.value == "")

	{
	  alert("Please describe how you heard about the Summit Awards program.");
	  return false;
	}

	return true;
}


//for membership form

 function hideInputs(object){
  var menuIndex = object.options[object.selectedIndex].value;
    if (menuIndex == 'Afghanistan' || menuIndex == 'Albania' || menuIndex == 'Algeria' || menuIndex == 'Andorra' || menuIndex == 'Angola' || menuIndex == 'Armenia' || menuIndex == 'Austria' || menuIndex == 'Azerbaijan' || menuIndex == 'Bahrain' || menuIndex == 'Bangladesh' || menuIndex == 'Belarus' || menuIndex == 'Belgium' || menuIndex == 'Benin' || menuIndex == 'Bhutan' || menuIndex == 'Bosnia and Herzegovina' || menuIndex == 'Botswana' || menuIndex == 'Bulgaria' || menuIndex == 'Burkina Faso' || menuIndex == 'Burundi' || menuIndex == 'Cambodia' || menuIndex == 'Cameroon' || menuIndex == 'Cape Verde' || menuIndex == 'Central African Republic' || menuIndex == 'Chad' || menuIndex == 'Comoros' || menuIndex == 'Congo' || menuIndex == 'Croatia' || menuIndex == 'Cyprus' || menuIndex == 'Czech Republic' || menuIndex == 'Denmark' || menuIndex == 'Djibouti' || menuIndex == 'Egypt' || menuIndex == 'Equatorial Guinea' || menuIndex == 'Eritrea' || menuIndex == 'Estonia' || menuIndex == 'Ethiopia' || menuIndex == 'Finland' || menuIndex == 'France' || menuIndex == 'Gabon' || menuIndex == 'Georgia' || menuIndex == 'Germany' || menuIndex == 'Ghana' || menuIndex == 'Greece' || menuIndex == 'Guinea' || menuIndex == 'Guinea-Bissau' || menuIndex == 'Hungary' || menuIndex == 'Iceland' || menuIndex == 'India' || menuIndex == 'Ireland' || menuIndex == 'Israel' || menuIndex == 'Italy' || menuIndex == 'Jordan' || menuIndex == 'Kazakhstan' || menuIndex == 'Kenya' || menuIndex == 'Kuwait' || menuIndex == 'Kyrgyzstan' || menuIndex == 'Latvia' || menuIndex == 'Lebanon' || menuIndex == 'Lesotho' || menuIndex == 'Liberia' || menuIndex == 'Liechtenstein' || menuIndex == 'Lithuania' || menuIndex == 'Luxembourg' || menuIndex == 'Macedonia, The Former Yugoslav Republic' || menuIndex == 'Madagascar' || menuIndex == 'Malawi' || menuIndex == 'Maldives' || menuIndex == 'Mali' || menuIndex == 'Malta' || menuIndex == 'Mauritania' || menuIndex == 'Mauritius' || menuIndex == 'Moldova, Republic of' || menuIndex == 'Monaco' || menuIndex == 'Morocco' || menuIndex == 'Mozambique' || menuIndex == 'Namibia' || menuIndex == 'Nepal' || menuIndex == 'Netherlands' || menuIndex == 'Niger' || menuIndex == 'Nigeria' || menuIndex == 'Norway' || menuIndex == 'Oman' || menuIndex == 'Pakistan' || menuIndex == 'Poland' || menuIndex == 'Portugal' || menuIndex == 'Qatar' || menuIndex == 'Romania' || menuIndex == 'Russian Federation' || menuIndex == 'Rwanda' || menuIndex == 'San Marino' || menuIndex == 'Saudi Arabia' || menuIndex == 'Senegal' || menuIndex == 'Seychelles' || menuIndex == 'Sierra Leone' || menuIndex == 'Slovakia' || menuIndex == 'Slovenia' || menuIndex == 'Somalia' || menuIndex == 'South Africa' || menuIndex == 'Spain' || menuIndex == 'Sri Lanka' || menuIndex == 'Swaziland' || menuIndex == 'Sweden' || menuIndex == 'Switzerland' || menuIndex == 'Tajikistan' || menuIndex == 'Tanzania' || menuIndex == 'Togo' || menuIndex == 'Tunisia' || menuIndex == 'Turkey' || menuIndex == 'Turkmenistan' || menuIndex == 'Uganda' || menuIndex == 'Ukraine' || menuIndex == 'United Arab Emirates' || menuIndex == 'United Kingdom' || menuIndex == 'Uzbekistan' || menuIndex == 'Yemen' || menuIndex == 'Zambia' || menuIndex == 'Zimbabwe'){
      document.getElementById("hide").style.display = 'block';
                               }
     else
     {
       document.getElementById("hide").style.display = 'none';
      }
   
    if (menuIndex == 'United States' || menuIndex == 'Canada')
    { 
     document.getElementById("hidestate").style.display = 'block';
    } 
    else 
    {
     document.getElementById("hidestate").style.display = 'none';
     document.finfo.state.options[0].selected = true;
     
     if(document.finfo.acode)
     {
      document.getElementById("hideacode").style.display = 'none'; 
      document.finfo.acode.options[0].selected = true;
     } 
   }   
 }     
      
 function hideCode(object){
  var menuIndex = object.options[object.selectedIndex].value;
    
    if (menuIndex == 'CA')
    { 
     document.getElementById("hideacode").style.display = 'block';
    } 
    else 
    {
     document.getElementById("hideacode").style.display = 'none';
    } 
   
   }   
      

function hideQualifs(object){
  var menuIndex = object.options[object.selectedIndex].value;
    if (menuIndex == 'CDS Family' || menuIndex == 'SafeDisc' || menuIndex == 'Video Copy Protection'){
      document.getElementById("hideQualifs").style.display = 'block';
                               }
     else
     {
       document.getElementById("hideQualifs").style.display = 'none';
      }
      
}


//Start the content/abstract collapse script



var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

var contractsymbol='<img src="images/minus.gif">' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='<img src="images/plus.gif"> ' //HTML for expand symbol.


if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate
inc++
}
revivestatus()
}


function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0"
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate


//MEMBER CHECKER
function OnLoad(){
 InitLoginWidget();
}
//This function checks for the existance of a cookie called User.
//If it exists it displays Welcome User" in login widget.
//This method needs to be called on every pages BODY  onLoad event where the widget appears.


		    function InitLoginWidget(){
                var User = GetCookieElementByName("User");
                if(User != null){
                    document.getElementById('loginheader').innerHTML ="Registered Member";
                    document.getElementById('loginname').innerHTML = new String(User);
                    document.getElementById('loginhref').style.visibility='hidden';
                    document.getElementById('loginname').style.visibility='visible';
                }
                else{
                    document.getElementById('loginname').style.visibility='hidden';
                    document.getElementById('loginhref').style.visibility='visible';

                }

                document.getElementById('loginheader').style.visibility='visible';
		    }


		    //This function checks for the existance of a cookie called User.
		    //If it exists it navigates to the url passed.
		    //If it does not exist it navigates to the registration form for the widget.
		    function SecureNavigation(url){
		      var User = GetCookieElementByName("User");
                if(User != null){
                 document.location = url;
                }
                else{
                document.location ="subscribe_to_softsummit_newsletter_access.shtml";
                }
		    }

		        //Looks up a cookie from cookie string.
		    function GetCookieElementByName(elementname) {
var lf = "\n";
var CookieName=new String(elementname);
var CookieString = document.cookie;
var CookieSet = CookieString.split (';');
var SetSize = CookieSet.length;
var CookiePieces
var ReturnValue = null;
var x = 0;
for (x = 0; x < SetSize; x++) {


CookiePieces = CookieSet[x].split ('=');

    if (CookiePieces[0].substring (0,1) == ' ') {
        CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
    }
    if (CookiePieces[0] == CookieName) {
        ReturnValue = CookiePieces[1];
        break;
    }
}

return ReturnValue;
}


            //Create the cookie for the user.
		    function CreateRegistrationCookie(username){
                date = new Date();
		        var currentcookie = new String(document.cookie);
                document.cookie = "User=" + new String(username) + "; expires=" + new Date (2020,1,1);
		    }

// Retrieve the value of the cookie with the specified name.
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}
