/* ////////////////////////////////////////////////////////////////////Last Updated:  2011-06-20Update By: Jon McQuade //////////////////////////////////////////////////////////////////// *//*****************************************Browser Sniffing Global VariablesAuthor: unknownDate Added:Description: Consolidated from: http://www.worldvision.org/worldvision/master.nsf/wvfunctions.js******************************************/var isie, isns4, isns6;var browser = navigator.appName;//alert(browser);var browserver = navigator.appVersion.substring(0, 1);// Added support for NS6 (which actually equates to a value of 5)//alert(browserver);var ie = "Microsoft Internet Explorer";var ns = "Netscape";// Determine Browser Type/Version Combosif (browser==ie && browserver >=4){ // It is IE and it is version 4 or greater	isie = true;	isns4 = false;	isns6 = false;	showval = 'display';}else if (browser==ns && browserver==4){ // It is NS version 4 (or an incremental release still less than 6)	isns4 = true;	isns6 = false;	isie = false;	showval = 'show';}else if (browser==ns && browserver>=5){ // It is NS 6	isns6 = true;	isns4 = false;	isie = false;	showval = 'show';}//alert("Is it IE 4 or greater?\n" + isie);//alert("Is it NS 4?\n" + isns4);//alert("Is it NS 6 or greater?\n" + isns6);/*****************************************Change protocolAuthor: unknownDate Added:Description: Consolidated from: http://www.worldvision.org/worldvision/master.nsf/homepage.js******************************************/var newwin = null;currLoc = new String(document.location);currProtocol = new String(document.location.protocol);if (currProtocol.indexOf("https") >= 0){ doubleSlashPos = currLoc.indexOf("//"); newLoc = new String(currLoc.substr(doubleSlashPos)); newLoc = "http:" + newLoc; document.location = newLoc;}/*****************************************Function Name: openwinAuthor: Ton HanchaiDate Added:Description:  Pop Up Window ScriptConsolidated from: http://www.worldvision.org/worldvision/master.nsf/global.js******************************************/function openwin(url, _w, _h) {	var w = 480, h = 340;	if (document.all || document.layers) {		w = screen.availWidth;   		h = screen.availHeight;	}	var popW = _w, popH = _h;	var leftPos = (w-popW)/2, topPos = (h-popH)/2;	var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=0');	newWindow.focus();}/*****************************************Function Name: closeWinAuthor: Ton HanchaiDate Added:Description: Close Pop Up WindowConsolidated from: http://www.worldvision.org/worldvision/master.nsf/global.js******************************************/function closeWin() {	window.self.close();}/*****************************************Function Name: changePageAuthor: unknownDate Added:Description: Consolidated from: http://www.worldvision.org/worldvision/master.nsf/homepage.js******************************************//* This is now OLD on the homepage. Instead use openPage() */function changePage(theform) {	var tempPage = theform.selCountry.value;	if (tempPage != "Select a Country")	{	top.location.href = tempPage;	}}/*****************************************Function Name: openPageAuthor: unknownDate Added:Description: Consolidated from: http://www.worldvision.org/worldvision/master.nsf/homepage.js******************************************/// Function used to open new pages on the international gateway select boxfunction openPage(theform){	// grab the value from the form element	var newPage	=	theform.selCountry.value;	// if the selected value is NOT "Select a Country" then open the new	// page based on the value passed into the function.	if(newPage	!=	"Select a Country")	{		//open a new pop up window.		window.open(newPage);	}}/******************************************Function Name: changeMenuAuthor: UnknownDate Added:Description:  Consolidated from: http://www.worldvision.org/worldvision/wvususfo.nsf/selectMenu.js************************************************/function changeMenu(objRef,NewWin){	if(NewWin){		var myWindow = window.open(getMenuValue(objRef));	}else{		location.href = getMenuValue(objRef);	}}/*********************************************Function Name: getMenuValueAuthor: UnknownDate Added:Description:  Consolidated from: http://www.worldvision.org/worldvision/wvususfo.nsf/selectMenu.js************************************************/function getMenuValue(objRef){	return objRef.options[objRef.selectedIndex].value;}/********************************************Function Name: CheckRegExpAuthor: UnknownDate Added:Description:  Consolidated from: http://www.worldvision.org/worldvision/master.nsf/wvfunctions.js**********************************************/function CheckRegExp(input, re){	if (input.search(re) != -1)	{		return true;	}	else	{		return false;	}}/*********************************************Function Name: randomSelectAuthor: UnknownDate Added:Description:  // Returns a random value in the range of [0..iUniverse], but Math.floor drops the remainder // for the returned value, thus if the random number result is 2.5 would return a 2. // randomSelect is seeded with a value of 9, in order to select one in 9 [0..8]. Consolidated from: http://www.worldvision.org/worldvision/master.nsf/wvfunctions.js*********************************************/function randomSelect(iUniverse){ var randomNumber = Math.floor(Math.random() * iUniverse);//   alert(randomNumber);   return(randomNumber);}/*****************************************************************Function Name: include_domAuthor: UnknownDate Added:Description: Function to include external javascript libraries through the DOM tree in the HEAD tag Consolidated from: http://www.worldvision.org/worldvision/master.nsf/wvfunctions.js*******************************************************************/function include_dom(script_filename) {    var html_doc = document.getElementsByTagName('head').item(0);    var js = document.createElement('script');    js.setAttribute('language', 'javascript');    js.setAttribute('type', 'text/javascript');    js.setAttribute('src', script_filename);    html_doc.appendChild(js);    return false;}/********************************************************************Author: UnknownDate Added:Description:  Consolidated from: http://www.worldvision.org/worldvision/master.nsf/homepopunder.js*********************************************************************/function launchpopunder(){   // set randomSelect(24) to get 1 in 24 chance    // to test set randomSelect(2) to get 1 in 2 chance   /*   var randomNum = randomSelect(3);	//alert (randomNum);  	if (randomNum > 1)	{ 	//alert("random: selected");	newwin = window.open('/worldvision/master.nsf/email_signup_popunder_africaboy?OpenPage', 'Popwin', 'screenX=10,screenY=10,top=10,left=10, height=385,width=342,nostatus,resizable=no'); 	//newwin = window.open('/worldvision/sample1.nsf/satisfaction_fy05q3?OpenForm', 'Popwin', 'screenX=10,screenY=10,top=10,left=10, height=385,width=342,nostatus,resizable=no');			 	}	else	{ //alert("random: not selected");	newwin = window.open('/worldvision/master.nsf/email_signup_popunder_new?OpenPage', 'Popwin', 'screenX=10,screenY=10,top=10,left=10,height=385,width=342,nostatus,resizable=no');	}	*/		newwin = window.open('/worldvision/master.nsf/email_signup_popunder?OpenPage', 'Popwin', 'screenX=10,screenY=10,top=10,left=10, height=385,width=375,nostatus,resizable=no');}/********************************************************************Author: Philip KinlowDate: 03/14/2011To Be Removed Later:Modify/Remove The Japan Earthquake and Tsunami Feature*********************************************************************/var attachToOnload = function(fn){	try{		var onloadpage = (typeof window.onload=="function") ? window.onload : function(){};		window.onload = function(){			onloadpage();			try{fn()}catch(e){};		}	}catch(e){return null};	return fn;}// The last line of this function inserts the HTML into the side bin area.  The HTML// Itself is commented out, so that it's easy to modify later, when a new bin needs to be addedattachToOnload(function(){	var isStaging = /staging/.test(location.href);	var isStageSubdomain = /stage/.test(location.hostname);	var isNotesContentDB = /content.nsf/.test(location.href);	var isWorldVisionOrg = /worldvision/.test(location.host);	var isStagingServer = (isStageSubdomain && isStaging);	var isProductionServer = true;		// Page Filter Function, Just Pass In a Function To Pass Or Fail The Filter Based On Function Boolean Return	/*********** DO NOT MODIFY THIS FUNCTION START ****************************/	var page_filters = function(fn){		if(!page_filters.conditions){page_filters.conditions=[];}				if(!page_filters.runconditions){				page_filters.runconditions = function(){				var cond = true;				for(var i=0,len=page_filters.conditions.length;i<len;i++){					try{						if(page_filters.conditions[i]()!==true){					 		cond = false;							break;						}					}catch(e){continue;}				}				return cond;			}		}				if(typeof fn == "function"){page_filters.conditions.push(fn);}	}	/*********** DO NOT MODIFY THIS FUNCTION END ****************************/			// First Filter Set: URL Filter  	page_filters(function(){		var rtnVal = true;				// PLEASE MODIFY: Include Possible String Contained In The URL That Should Not Have The Ad Feature Display		var pagetofilter = [			"/pages/gc-redirect",			"/pages/donate-redirect",			"/pages/sponsorship-redirect",			"/pages/emergency-aid-redirect",			"/pages/message-redirect",			"/give/ways-to-give",		];			// Loop Through Pages		for(var n=0,len=pagetofilter.length;n<len;n++){			if(location.href.indexOf(pagetofilter[n]) > 0){				rtnVal = false;				break;			};		}		return rtnVal;	});		//Include Additional Filter Sets If Needed	// Just Pass In A Function To The page_filters function in order to add another filter condition set	/*	page_filters(function(){		// Include You Condition Here. Be Sure To Include Boolean return value	})	*/		// Execute The runconditions Method To Return True or False if Filter has passed. 	var passFilter = page_filters.runconditions();		// If Condition Passes Than The Action Is Executed To Include Japan Ad Under Left Navigation	if((isWorldVisionOrg && isNotesContentDB) && (isProductionServer && passFilter)){			(function(id,html,attr){						// Create Element To be Added Under The Left v8 Navigation			var parentObj = document.getElementById(id) ? document.getElementById(id) : null ;			if(parentObj == null){return}			var childObj = document.createElement('div');			childObj.id = attr.id ? attr.id : id + "-childcontent";			parentObj.appendChild(childObj);			childObj.innerHTML = html;				// Other Attributes			if(attr){				for(k in attr){					if(k!='id' && k!='innerHTML'){						var myattr = document.createAttribute(k);						myattr.value = attr[k];						childObj.setAttributeNode(myattr); 					}				}			}			//The HTML itself is commented out, so that it's easy to modify later		})('wvussubnav','<div style="text-align:center;margin-top:15px;padding-top:15px;border-top:1px solid #cccccc"><a href="http://donate.worldvision.org/OA_HTML/xxwvibeCZzpEntry.jsp?go=item&item=1754360&section=10324&lpos=lft_img_hoaFamineDonateBanner"><img src="/resources.nsf/main/hoa-famine-2011-banner/$file/hoaFamineBanner.jpg" alt="Horn of Africa Famine - Donate Now"></a></div>',{});		}})
