/**************************************************************
Create query string parser to grab qs params before default fields in form are populated
***************************************************************/
	function querySt(ji) {
		hu = window.location.search.substring(1);
		gy = hu.split("&");
		for (i=0;i<gy.length;i++) {
			ft = gy[i].split("=");
			if (ft[0] == ji) {
				return ft[1];
			}
		}
	}
/**************************************************************
Generate the variables that will be passed in the swf file for search based on deeplink.
***************************************************************/
var campaign="";
var CG="";
var CA="";
var CBD="";
var CBM="";
var CO="";
var CST="";
var CL="";
var CP="";
var sponRes="";
var pause="0";
var isSoftFeature = false;
if(querySt("campaign")){campaign=querySt("campaign")};
if(querySt("xxwvCampaign")){campaign=querySt("xxwvCampaign")};
if(querySt("CG")){CG=querySt("CG").toUpperCase()};
if(querySt("xxwvGender")){CG=querySt("xxwvGender").toUpperCase()};
if(querySt("CA")){CA=querySt("CA")};
if(querySt("xxwvAge")){CA=querySt("xxwvAge")};
if(querySt("CBD")){CBD=querySt("CBD")};
if(querySt("xxwvDay")){CBD=querySt("xxwvDay")};
if(querySt("CBM")){CBM=querySt("CBM")};
if(querySt("xxwvMonth")){CBM=querySt("xxwvMonth")};
if(CBM.length==1){CBM="0" + CBM}
if(CBD.length==1){CBD="0" + CBD};
if(querySt("xxwvBirthDate")){var arBirthDate=querySt("xxwvBirthDate").split("/")};
if(arBirthDate){
	CBM=arBirthDate[0];
	CBD=arBirthDate[1];
}
if(querySt("CO")){CO=querySt("CO")};
if(querySt("CST")){CO=querySt("CST")};
if(querySt("xxwvOrphan")){CO=querySt("xxwvOrphan")};
if(querySt("CL")){CL=querySt("CL")};
if(querySt("xxwvLocation")){CL=querySt("xxwvLocation")};
if(querySt("CP")){CP=querySt("CP")};
if(querySt("xxwvProject")){CP=querySt("xxwvProject")};
if(querySt("sponRes")){sponRes=querySt("sponRes")};
if(querySt("xxwvRes")){sponRes=querySt("xxwvRes")};
if(querySt("pause")){pause=querySt("pause")};
/**************************************************************
Initiate the functions and global vars that will be loaded once the HTML elements are rendered
***************************************************************/
//Change the form index values to match the query string parameters using the changeIndexes function
loadSearchType =setInterval('changeSearchType()',800);
var TimeToFade = 1000.0;
childImageIsLoaded=false;
/**************************************************************
Functions for child image animation
***************************************************************/
function childImageTransition(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 
function fadeImageIn(imageURL){
	if(document.getElementById('childInfoPicture') && document.getElementById("loadingDiv")){
		if(document.getElementById("loadingDiv"))document.getElementById("loadingDiv").style.display="none";
		
		//if(document.getElementById('childInfoPicture').style.opacity == 0 ){
			if(document.getElementById("childInfoPicture"))document.getElementById('childInfoPicture').style.visibility='visible';
			if(document.getElementById("childInfoPictureShadow"))document.getElementById('childInfoPictureShadow').style.visibility='visible';
			if(document.getElementById("childInfoPictureShadow"))document.getElementById('childInfoPictureShadow').style.opacity = 0;
			if(document.getElementById("childInfoPictureShadow"))document.getElementById('childInfoPictureShadow').style.filter = 'alpha(opacity=0)';
			if(document.getElementById("childInfoPicture"))document.getElementById('childInfoPicture').style.opacity = 0;
			if(document.getElementById("childInfoPicture"))document.getElementById('childInfoPicture').style.filter = 'alpha(opacity=0)';
			if(document.getElementById("childInfoPicture"))childImageTransition('childInfoPicture',0,100,500);
			if(document.getElementById("childInfoPictureShadow"))childImageTransition('childInfoPictureShadow',0,100,500);
			if(document.getElementById("imageURL"))document.getElementById("imageURL").src = imageURL;
			childImageIsLoaded=true;
		//}
	}	
}
var divLoaded = false;
function fadeImageOut(){
	if (document.getElementById('childInfoPicture')){
	  var ni = document.getElementById('childInfoPicture');
	  if (divLoaded==false){
	  	//if(document.getElementById("childInfoPicture"))document.getElementById("childInfoPicture").style.marginLeft="-9px";
	  	if(document.getElementById("childInfoPicture"))childImageTransition('childInfoPicture',100,50,200);
		if(document.getElementById("childInfoPictureShadow"))childImageTransition('childInfoPictureShadow',100,50,500);
	  	document.getElementById('childInfoPicture').style.textAlign="center";
	  	var loadingDiv = document.createElement('div');
	  	var divIdName = 'loadingDiv';
	  	loadingDiv.setAttribute('id',divIdName);
	  	loadingDiv.innerHTML = '<div style="display:block;position:relative;z-index:12;verticalAlign:middle;top:-150px;"><img src="http://media.worldvision.org/csws/images/loader.gif"></div>';
	  	ni.appendChild(loadingDiv);
	  	divLoaded = true;
	  }else{
		//if(document.getElementById("childInfoPicture"))document.getElementById("childInfoPicture").style.marginLeft="-9px";
	  	if(document.getElementById("childInfoPicture"))childImageTransition('childInfoPicture',99,50,300);
		if(document.getElementById("childInfoPictureShadow"))childImageTransition('childInfoPictureShadow',90,50,500);
	  	document.getElementById("loadingDiv").style.display="block";
	  }
	}
}
/**************************************************************
If the page will reside in istore, generate a different path to donation
***************************************************************/
if(window.location.href.indexOf("tprod.worldvision.org")!=-1){
	var path="tprod.worldvision.org";
}
else if(window.location.href.indexOf("othniel.wvus.org")!=-1){
	path="othniel.wvus.org"
}
else {
	path="donate.worldvision.org";
}
/**************************************************************
Flash Return Functions
***************************************************************/
function nextButton() {
	if(pause=="0")document.CWS_AS3.nextButton("next");
}
function previousButton() {
	if(pause=="0")document.CWS_AS3.previousButton("previous");
}
function resetEventRes(){
	if(pause=="0")document.CWS_AS3.resetEventRes("N");
}
function sendSearchVars(){
	var myListType = document.getElementById("searchType").options[document.getElementById("searchType").selectedIndex].value;
	var gender = document.getElementById("CG").options[document.getElementById("CG").selectedIndex].value;
                //if(gender=="&quot;&quot");gender="";
	var age = (document.getElementById("CA").selectedIndex - 1).toString();
                //if(age=="-1")age="";
	var birthDay= document.getElementById("CBD").options[document.getElementById("CBD").selectedIndex].text;
                //if (birthDay=="dd")birthDay="";
	var birthMonth = document.getElementById("CBM").options[document.getElementById("CBM").selectedIndex].text;
                //if(birthMonth=="mm")birthMonth="";
	var searchType = document.getElementById("searchType").options[document.getElementById("searchType").selectedIndex].value;
	var reservation = "N";
	if(myListType == "ALL"){
		var childLocation = document.getElementById("dlgTypeAll").options[document.getElementById("dlgTypeAll").selectedIndex].value;
	}else if(myListType=="NONHOPE"){
		childLocation = document.getElementById("dlgTypeNon").options[document.getElementById("dlgTypeNon").selectedIndex].value;
	}else if(myListType=="HOPE"){
		childLocation = document.getElementById("dlgTypeHope").options[document.getElementById("dlgTypeHope").selectedIndex].value;
	}
	if (gender && age && birthDay && birthMonth && searchType && childLocation){
		document.CWS_AS3.sendSearchVars(gender,age,birthDay,birthMonth,searchType,childLocation);
	}
	
}
/*
function fadeImageIn(imageURL){
	childImageIsLoaded=false;
	
	//Create the new child image and load the child object's url into it.	
	childImage = new Image();
	childImage.src =  imageURL;
	
	if(document.getElementById('childInfoPicture')){
		if(childImageIsLoaded==false){
			checkImageLoaded = setInterval('fadeImageIn(childImage)',500);
		}
	}
}
*/
	
/**************************************************************
The Flash has returned child information, which we can now populate into the HTML
***************************************************************/
function populateChildInfo(item,errorMsg,buyRoute,formAction,cssPath,section,childId,ChildTitle,firstName,country,project,imageURL,price,preDonation,instructions,born,grade,subject,health,play,gender,chores,reqGender,project,birthdate,birthMonth,birthDay,age,location,handicap,orphan,childArray,arrayLoc,searchType,org,language,campaign,eventRes,secID,story){	

	renderErrorMsg(errorMsg);

	if(preDonation.indexOf("HopeChild")!=-1){
	   isHopeChild=true;
	}else{
	   isHopeChild=false;
	}

	story = unescape(story);
	
	if(document.getElementById("childTitle"))document.getElementById("childTitle").innerHTML = ChildTitle;
	if(document.getElementById("smallSponsorLink"))document.getElementById("smallSponsorLink").href = buyRoute;
	if(document.getElementById("childImageLink"))document.getElementById("childImageLink").href = buyRoute;
	if(document.getElementById("largeSponsorLink"))document.getElementById("largeSponsorLink").href = buyRoute;
	
	if(document.getElementById("imageURL"))document.getElementById("imageURL").src = imageURL;
	if(document.getElementById("Name"))document.getElementById("Name").innerHTML = firstName;
	if(document.getElementById("Gender"))document.getElementById("Gender").innerHTML = gender;
	if(document.getElementById("Born"))document.getElementById("Born").innerHTML = born;
	if(document.getElementById("Grade"))document.getElementById("Grade").innerHTML = grade;
	trimmedCountry=country.substring(0,18);
	if(document.getElementById("Country"))document.getElementById("Country").innerHTML = trimmedCountry;
	trimmedCountry="";
	if(document.getElementById("Health"))document.getElementById("Health").innerHTML = health;
	if(document.getElementById("Amt"))document.getElementById("Amt").innerHTML = price;
	if(document.getElementById("smallSponsorButton"))document.getElementById("smallSponsorButton").style.color="white";
	if(document.getElementById("smallSponsorButton"))document.getElementById("smallSponsorButton").innerHTML = "Sponsor " + firstName + " now";
	if(document.getElementById("child-story") && typeof story!="undefined")document.getElementById("child-story").innerHTML=story;
  	if(document.getElementById("child-story-imageLink") && typeof story!="undefined")document.getElementById("child-story-imageLink").href= buyRoute;
  	if(document.getElementById("child-story-imageURL") && typeof story!="undefined")document.getElementById("child-story-imageURL").src= imageURL;
	if(document.getElementById("largeSponsorLink") && document.getElementById("child-story") && typeof story!="undefined" && querySt("ver")!="soft")document.getElementById("largeSponsorLink").innerHTML = "Sponsor " + firstName + " now";
   	
	if(document.getElementById("sponsorChildTitle"))document.getElementById("sponsorChildTitle").innerHTML = "Sponsor " + firstName + " in " + country;

	if(document.getElementById("sponsorChildTitleLink"))document.getElementById("sponsorChildTitleLink").innerHTML = "<a id='sponsorChildTitleA' href='"+buyRoute+"'>Sponsor " + firstName + " in " + country + "</a>";

if(document.getElementById("sponsorChildTitleLink-FirstPerson"))document.getElementById("sponsorChildTitleLink-FirstPerson").innerHTML = "Hi!  My name is " + firstName;
	if(document.getElementById("largeSponsorshipButton"))document.getElementById("largeSponsorshipButton").innerHTML = "Sponsor<br>" + firstName + "<br>now";

if(document.getElementById("largeSponsorshipButton2"))document.getElementById("largeSponsorshipButton2").innerHTML = "Sponsor<br>" + firstName + "<br>now";
	
	if(isHopeChild){
		if(document.getElementById("AIDSAffectedLogo"))document.getElementById("AIDSAffectedLogo").style.display="block";
	}else{
		if(document.getElementById("AIDSAffectedLogo"))document.getElementById("AIDSAffectedLogo").style.display="none";
	}
	if (unescape(chores) == "Doesn'T Help - Too Young"){
			chores = "Too Young";
	}
	if(unescape(play) == "Does Not Play - Too Young"){
			play="Too Young";
	}
	if(unescape(play) == "Local Traditional Games"){
			play="Local Traditional";
	}
	if(unescape(play) == "Other Creative Activities"){
			play="Creative Activities";
	}
	if(document.getElementById("Chores"))document.getElementById("Chores").innerHTML = unescape(chores);
	if(document.getElementById("Subject"))document.getElementById("Subject").innerHTML = unescape(subject);
	if(document.getElementById("Play"))document.getElementById("Play").innerHTML = play;
	if(document.getElementById("childInfo"))document.getElementById("childInfo").innerHTML = preDonation;
	
	if(document.getElementById("dynBodyLink1")){
	document.getElementById("dynBodyLink1").innerHTML = "<a href='" + buyRoute +"'>save " + firstName + "</a>";
}

if(document.getElementById("dynBodyLink2")){
	document.getElementById("dynBodyLink2").innerHTML = "<a href='" + buyRoute +"'>sponsor " + firstName + "</a>";
}

if(document.getElementById("dynBodyLink3")){
	document.getElementById("dynBodyLink3").innerHTML = "<a href='" + buyRoute +"'>Become a child sponsor through World Vision and sponsor " + firstName + " today</a>!";
}

	if(parseInt(arrayLoc)>0){
		if(document.getElementById("previousButton"))document.getElementById("previousButton").style.display="block";
		if(document.getElementById("previousLink"))document.getElementById("previousLink").style.display="block";
	}else{
		if(document.getElementById("previousButton"))document.getElementById("previousButton").style.display="none";
		if(document.getElementById("previousLink"))document.getElementById("previousLink").style.display="none";
	}
	if( (!imageURL || imageURL=="") && ((typeof isIstore=="undefined") || (isIstore!=true)) ){
		window.location.replace("http://www.worldvision.org/content.nsf/pages/sponsorship-redirect");
	}else if ( (!imageURL) || (imageURL=="") && ((typeof isIstore!="undefined") && (isIstore==true)) ){
		window.location.replace("xxwv2DoChildSearch.jsp");
	}
	
	/**************************************************************
	Disable right click on image
	***************************************************************/
	 var isNS = (navigator.appName == "Netscape") ? 1 : 0;
	  if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
	  function mischandler(){
	   return false;
	 }
	  function mousehandler(e){
	 	var myevent = (isNS) ? e : event;
	 	var eventbutton = (isNS) ? myevent.which : myevent.button;
	    if((eventbutton==2)||(eventbutton==3)) return false;
	 }
	 document.getElementById("imageURL").oncontextmenu = mischandler;
	 document.getElementById("imageURL").onmousedown = mousehandler;
 	 document.getElementById("imageURL").onmouseup = mousehandler;

//BEGIN Omniture SiteCatalyst Code Version H.14 
	if (typeof isIstore!="undefined" && isIstore==true){
		setHollowSiteCat();
	}
	
}


/**************************************************************
Renders the error messaging returned by Web Service, 
If no child is returned matching search criteria.
***************************************************************/
function renderErrorMsg(errorMsg){
	if(errorMsg){
		if(document.getElementById("childInfoContent_div")){
			if((typeof divH =="undefined"||divH=="") && document.getElementById("childInfoContent_div") && document.getElementById("top_div")){
				divH = document.getElementById("childInfoContent_div").style.height;
				divH = divH.substring(0,3);
				divH = parseFloat(divH);
				divH = divH + 35;
				divH2 = divH + 30;
				divH = divH.toString() + "px";
				divH2 = divH2.toString() + "px";
				document.getElementById("childInfoContent_div").style.height = divH;
				document.getElementById("top_div").style.height = divH2;
			}
		}
		document.getElementById("errorMsg").innerHTML = unescape("We apologize, we are unable to locate a child that matches your request, instead below please find a child similar to your original request.");
		document.getElementById("errorMsg").style.display="block";
	}else{
		document.getElementById("errorMsg").innerHTML = "";
		document.getElementById("errorMsg").style.display="none";
		if (typeof divH !="undefined" && divH!=""){
			divH = document.getElementById("childInfoContent_div").style.height;
			divH = divH.substring(0,3);
			divH = parseFloat(divH);
			divH = divH - 35;
			divH2 = divH + 35;
			divH = divH.toString() + "px";
			divH2 = divH2.toString() + "px";
			document.getElementById("childInfoContent_div").style.height = divH;
			document.getElementById("top_div").style.height = divH2;
			divH="";
		}
	}
}

/**************************************************************
Change the selected index of the search fields based on deep link parameters
***************************************************************/
function changeIndexes(){
	loadIndexes =setInterval('changeDropdownIndexes()',600);

	/**************************************************************
	// This redirects if the page takes more than 30 seconds to load the child information.  
	//Technically, not part of changing indexes, but ensures that it gets called without calling another function in the JS.
	 ***************************************************************/
	
	if((typeof (randomRecipe)!="undefined") && (randomRecipe=="Soft")){
		isSoftFeature=true;
	}
	 //if(pause=="0")setTimeout(webSvcDownRedirect,30000);
}


function changeDropdownIndexes(){
if(document.getElementById("dlgTypeAll")){
if(document.getElementById("dlgTypeAll").options.length > 0){
	clearInterval(loadIndexes);
	for (i=0; i <= (document.getElementById("dlgTypeAll").options.length -1);i++)
		{
			if(document.getElementById("dlgTypeAll").options[i].value==CL){
				document.getElementById("dlgTypeAll").options[i].selected=true;
			}
		}
	for (i=0; i <= (document.getElementById("dlgTypeHope").options.length -1);i++)
		{
			if(document.getElementById("dlgTypeHope").options[i].value==CL){
				document.getElementById("dlgTypeHope").options[i].selected=true;
			}
		}
	for (i=0; i <= (document.getElementById("dlgTypeNon").options.length -1);i++)
		{
			if(document.getElementById("dlgTypeNon").options[i].value==CL){
				document.getElementById("dlgTypeNon").options[i].selected=true;
			}
		}
	
	if (CG=="M"){
		document.getElementById("CG").selectedIndex=0;
	}else if(CG=="F"){
		document.getElementById("CG").selectedIndex=1;
	}
	if (CA!=""){
		document.getElementById("CA").selectedIndex = parseInt(querySt("CA")) + 1;
	}
	if (CBM!=""){
		document.getElementById("CBM").selectedIndex = CBM;
	}
	if (CBD!=""){
		document.getElementById("CBD").selectedIndex = CBD;
	}
	if (CO!=""){
		if(CO.toUpperCase()=="ALL"){
			document.getElementById("searchType").selectedIndex = 0;
			if (querySt("CLindex")!=""){
				document.getElementById("dlgTypeAll").selectedIndex = parseFloat(querySt("CLIndex"));
			}
		}else if (CO.toUpperCase()=="HOPE"){
			document.getElementById("searchType").selectedIndex = 1;
			if (querySt("CLindex")!=""){
				document.getElementById("dlgTypeHope").selectedIndex = parseFloat(querySt("CLIndex"));
			}
		}else if (CO.toUpperCase()=="NONHOPE"){
			document.getElementById("searchType").selectedIndex = 2;
			if (querySt("CLindex")!=""){
				document.getElementById("dlgTypeNon").selectedIndex = parseFloat(querySt("CLIndex"));
			}
		}
	}
	
	
	/**************************************************************
	// display proper location drop-down based on spon type
	***************************************************************/
	
	myListType = document.getElementById("searchType").options[document.getElementById("searchType").selectedIndex].value;
	    if (myListType == "ALL")
	    { document.getElementById("dlgTypeAll").style.display = "block";
	      document.getElementById("dlgTypeNon").style.display = "none";
	      document.getElementById("dlgTypeHope").style.display = "none";
	    }
	    if (myListType == "NONHOPE")
	    { document.getElementById("dlgTypeAll").style.display = "none";
	      document.getElementById("dlgTypeNon").style.display = "block";
	      document.getElementById("dlgTypeHope").style.display = "none";
	    }
	    if (myListType == "HOPE")
	    { document.getElementById("dlgTypeAll").style.display = "none";
	      document.getElementById("dlgTypeNon").style.display = "none";
	      document.getElementById("dlgTypeHope").style.display = "block";
    }
    
   
}
}
}
function calcTime(city, offset) {
    // create Date object for current location
    d = new Date();
   
    // convert to msec
    // add local time zone offset
    // get UTC time in msec
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);
   
    // create new Date object for different city
    // using supplied offset
    nd = new Date(utc + (3600000*offset));
   
    // return time as a string
    time = nd.toLocaleString().split(" ");
    return(time[4] + time[5]);
}

function webSvcDownRedirect(errCode){
	if(!errCode)errCode = 0;
	if (typeof deconcept != "undefined") { 
        	FlashVersion  = deconcept.SWFObjectUtil.getPlayerVersion().major+ "."+deconcept.SWFObjectUtil.getPlayerVersion().minor+ "."+deconcept.SWFObjectUtil.getPlayerVersion().rev;
		FlashVersionInt = parseInt(FlashVersion);
			if(FlashVersionInt < 9){
				//passFlash = false;
				errCode = 2;
			}else{
				//passFlash = true;
				errCode = 1;
			}
	}
    	if((!document.getElementById("imageURL").src) || (document.getElementById("imageURL").src.indexOf('webpics')==-1 && pause=="0")){
		
    		var s=s_gi('wvworldvision,wvmastersuite'); s.tl(this,'o','|  |  |  | Online Donations - Child Sponsorship :: time(' + calcTime('PST','-8') + ')err(' + errCode +')');
    		
    		//IF THIS IS A SEARCH OR BANNER CAMPAIGN, REDIRECT TO THE SOFT SEARCH LANDING PAGE, OTHERWISE, REDIRECT TO EGIFT REDIRECT PAGE
		var cmp = querySt("cmp");
		if (!querySt("cmp"))cmp="";
		if( (cmp.indexOf("KNC")!=-1 || cmp.indexOf("BAC")!=-1) && querySt("ttcode")!="redirect"){
    			window.location.replace("search-for-a-child?open&ttcode=redirect&lpos=time(" + calcTime('PST','-8') + ")err(" + errCode +")"+ window.location.search);
		}else if (querySt("ttcode")!="redirect" && typeof isIstore!="undefined" && isIstore==true ){
    			window.location.replace("xxwv2DoChildSearch.jsp?lpos=time(" + calcTime('PST','-8') + ")err(" + errCode +")"+ window.location.search);
    		}else if (querySt("ttcode")!="redirect"){
			window.location.replace("http://www.worldvision.org/content.nsf/pages/sponsorship-redirect?open&lpos=time(" + calcTime('PST','-8') + ")err(" + errCode +")"+ window.location.search);
		}
    	}
    	
    	
    }
function addCountries(i,dropdown,level,id,display) {
	if(pause=="1"){
		var i;
		for(i=dropdown.options.length-1;i>=0;i--)
		{
			dropdown.remove(i);
		}
	}
	var locationAtt = new Object();
	i = parseInt(i);
	locationAtt.level = level;
	locationAtt.id = id;
	locationAtt.display = display;
	document.getElementById(dropdown).options[document.getElementById(dropdown).length] = new Option(display,id);
	
	if(level=="1"){
		document.getElementById(dropdown).options[i].innerHTML = "&nbsp;"+ document.getElementById(dropdown).options[i].innerHTML ;
	}
	if(level=="2"){
		document.getElementById(dropdown).options[i].innerHTML = "&nbsp;&nbsp;"+ document.getElementById(dropdown).options[i].innerHTML ;
	}
	if(level=="3"){
		document.getElementById(dropdown).options[i].innerHTML = "&nbsp;&nbsp;&nbsp;"+ document.getElementById(dropdown).options[i].innerHTML ;
	}
	if(level=="4"){
		document.getElementById(dropdown).options[i].innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;"+ document.getElementById(dropdown).options[i].innerHTML ;
	}
}
function loadCountryLists(){
//Keeping for compatability with older versions
}
function changeSearchType(){
	clearInterval(loadSearchType);
	myListType="ALL";
	//By default, SearchType will load the correct value from the query string, but should only do this on page load.
	if (CO!=""){
		if(CO.toUpperCase()=="ALL"){
			document.getElementById("searchType").selectedIndex = 0;
		}else if (CO.toUpperCase()=="HOPE"){
			document.getElementById("searchType").selectedIndex = 1;
		}else if (CO.toUpperCase()=="NONHOPE"){
			document.getElementById("searchType").selectedIndex = 2;
		}
	}
}

function setPause(value){
pause=value;
}
