/*Requires JS include:http://media.worldvision.org/csws/js/csws.jsAlso Requires Function function getSwitchInfo(){var offerswitch = "istore";var additionalmboxParam = "clickWithOffer=false";return [offerswitch,additionalmboxParam];}*//* countrynames Object is used to determine the Country Code based on Country Names instead of Country Alpha or Numeric Codes */var countrynames = {	data: [{name: "albania",numcode: "303" ,alphacode: "alb" ,hopechild: "false"},{name: "armenia",numcode: "305" ,alphacode: "arm" ,hopechild: "false"},{name: "bangladesh",numcode: "201" ,alphacode: "bgd" ,hopechild: "false"},{name: "bolivia",numcode: "149" ,alphacode: "bol" ,hopechild: "false"},{name: "brazil",numcode: "151" ,alphacode: "bra" ,hopechild: "false"},{name: "burundi",numcode: "41" ,alphacode: "bdi" ,hopechild: "true"},{name: "cambodia",numcode: "203" ,alphacode: "cam" ,hopechild: "false"},{name: "chad",numcode: "135" ,alphacode: "tcd" ,hopechild: "false"},{name: "chile",numcode: "153" ,alphacode: "chl" ,hopechild: "false"},{name: "china",numcode: "205" ,alphacode: "chi" ,hopechild: "false"},{name: "colombia",numcode: "155" ,alphacode: "col" ,hopechild: "false"},{name: "costa rica",numcode: "157" ,alphacode: "cri" ,hopechild: "false"},{name: "democratic republic of congo",numcode: "93" ,alphacode: "zar" ,hopechild: "true"},{name: "dominican republic",numcode: "159" ,alphacode: "dom" ,hopechild: "true"},{name: "ecuador",numcode: "161" ,alphacode: "ecu" ,hopechild: "false"},{name: "el salvador",numcode: "183" ,alphacode: "slv" ,hopechild: "false"},{name: "ethiopia",numcode: "49" ,alphacode: "eth" ,hopechild: "true"},{name: "ghana",numcode: "111" ,alphacode: "gha" ,hopechild: "false"},{name: "guatemala",numcode: "163" ,alphacode: "gtm" ,hopechild: "false"},{name: "haiti",numcode: "169" ,alphacode: "hti" ,hopechild: "true"},{name: "honduras",numcode: "167" ,alphacode: "hnd" ,hopechild: "false"},{name: "india",numcode: "213" ,alphacode: "ind" ,hopechild: "false"},{name: "indonesia",numcode: "211" ,alphacode: "idn" ,hopechild: "false"},{name: "jerusalem west bank gaza",numcode: "333" ,alphacode: "jwg" ,hopechild: "false"},{name: "kenya",numcode: "51" ,alphacode: "ken" ,hopechild: "true"},{name: "lebanon",numcode: "339" ,alphacode: "lbn" ,hopechild: "false"},{name: "lesotho",numcode: "77" ,alphacode: "lso" ,hopechild: "true"},{name: "malawi",numcode: "83" ,alphacode: "mwi" ,hopechild: "true"},{name: "mali",numcode: "123" ,alphacode: "mli" ,hopechild: "false"},{name: "mauritania",numcode: "125" ,alphacode: "mrt" ,hopechild: "false"},{name: "mexico",numcode: "173" ,alphacode: "mex" ,hopechild: "false"},{name: "mozambique",numcode: "81" ,alphacode: "moz" ,hopechild: "true"},{name: "myanmar",numcode: "227" ,alphacode: "mya" ,hopechild: "false"},{name: "nicaragua",numcode: "175" ,alphacode: "nic" ,hopechild: "false"},{name: "niger",numcode: "127" ,alphacode: "ner" ,hopechild: "false"},{name: "peru",numcode: "179" ,alphacode: "per" ,hopechild: "false"},{name: "philippines",numcode: "233" ,alphacode: "phl" ,hopechild: "false"},{name: "romania",numcode: "349" ,alphacode: "rom" ,hopechild: "false"},{name: "rwanda",numcode: "53" ,alphacode: "rwa" ,hopechild: "true"},{name: "senegal",numcode: "131" ,alphacode: "sen" ,hopechild: "false"},{name: "sierra leone",numcode: "133" ,alphacode: "sie" ,hopechild: "false"},{name: "south africa",numcode: "89" ,alphacode: "zaf" ,hopechild: "true"},{name: "sri lanka",numcode: "223" ,alphacode: "lka" ,hopechild: "false"},{name: "swaziland",numcode: "87" ,alphacode: "swz" ,hopechild: "true"},{name: "tanzania",numcode: "59" ,alphacode: "tza" ,hopechild: "true"},{name: "thailand",numcode: "243" ,alphacode: "tha" ,hopechild: "false"},{name: "uganda",numcode: "61" ,alphacode: "uga" ,hopechild: "true"},{name: "vietnam",numcode: "253" ,alphacode: "vnm" ,hopechild: "false"},{name: "zambia",numcode: "91" ,alphacode: "zam" ,hopechild: "true"},{name: "zimbabwe",numcode: "95" ,alphacode: "zim" ,hopechild: "true"}],	getData: function(bykey,retKey,val){		bykey = bykey.toLowerCase();		var valret = "";		for(var x=0;x<countrynames.data.length;x++){			if(countrynames.data[x][bykey] == val.toLowerCase()){				valret = countrynames.data[x][retKey];			}		}		return valret;	}};/* buyRouteOpts is an Object that stores the values of the buyRoute */var buyRouteOpts = {	isEgift: true,	eGiftNum: '222',	filter: function(params){		if(buyRouteOpts.isEgift){			buyRouteOpts.iStoreSponURL=  params.buyRouteURL;			buyRouteOpts.buyRouteURL =  "https://www.worldvision.org/worldvision/e-gift.nsf/check-out?OpenForm&num=" + buyRouteOpts.eGiftNum + "&amt=" + params.amt + "&con=" + params.con + "&childid=" + params.childId + "&itemid=" +  params.itemid + "&childfname=" + params.childfname + "&spontype=" + params.spontype;			buyRouteOpts.eGiftSponURL = buyRouteOpts.buyRouteURL;		}			buyRouteOpts.destination = buyRouteOpts.buyRouteURL;			return buyRouteOpts.buyRouteURL;	},	eGiftSponURL:"",	iStoreSponURL:"",	destination: "http://donate.worldvision.org/OA_HTML/xxwvibeCZzpEntry.jsp?go=sponsor&CL=0000&CST=ALL",	links: [],	linksOnClicks:[],	addLink: function(key){		if(typeof key != "undefined"){			var elm = (typeof key == "string") ? document.getElementById(key) : key;			try{				buyRouteOpts.linksOnClicks[buyRouteOpts.linksOnClicks.length] = (typeof elm.onclick == "function") ? elm.onclick : function(){};				var functBody = 'reportTT(); this.href = buyRouteOpts.destination; buyRouteOpts.linksOnClicks['+(buyRouteOpts.linksOnClicks.length - 1)+'](); return true;'				elm.onclick = new Function(functBody);				//alert(elm.onclick.toSource())				buyRouteOpts.links[buyRouteOpts.links.length] = elm;			}catch(e){}			}	},	toEgiftRoute: function(){		if(buyRouteOpts.links.length>0){			for(var l=0;l<buyRouteOpts.links.length;l++){				if(typeof buyRouteOpts.links[l] != "undefined"){					try{						buyRouteOpts.links[l].href = buyRouteOpts.destination;					}catch(e){}				}			}		}	}}/* Rewrite populateChildInfo Function from http://media.worldvision.org/csws/js/csws.js in order to support eGift Sponsorship Donation The new Function is able to take advantage of the parameters that are called through the populateChildInfo function and process the parameter for building an Egift buyRoute URL. */function new_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){	var  childSponType = (preDonation.indexOf("HopeChild")>=0) ? "HOPE_CHILD" : "CHILD";	var wsopts = {"itemid":item,"amt": price,"childId": childId,"childfname": firstName,"spontype": childSponType,"con": countrynames.getData("name","alphacode",country),buyRouteURL:buyRoute}	//alert(wsopts.toSource());	arguments[2] = buyRouteOpts.filter(wsopts);	old_populateChildInfo.apply(this,arguments)	}var old_populateChildInfo = populateChildInfo;populateChildInfo = new_populateChildInfo;function pausecomp(millis){	var date = new Date();	var curDate = null;	do { curDate = new Date();}	while(curDate-date < millis);}function checkSwitch(){	if(getSwitchInfo()[0] == "egift"){		buyRouteOpts.destination = buyRouteOpts.eGiftSponURL;	}else if(getSwitchInfo()[0] == 'istore'){		buyRouteOpts.destination = buyRouteOpts.iStoreSponURL;		}	//alert(buyRouteOpts.destination);	return getSwitchInfo()[1];}function reportTT(){	mboxUpdate("mbox_istore_egift_click","clickToSponsor=true",checkSwitch());	mboxUpdate("mBoxSponsor_A_Child_NowContentTopHeader","clickToSponsor=true");	pausecomp(500);}
