// JavaScript Document

	//server hosts default.htm
	var serverPath = 'http://www.lhm.org/'       
//	var serverPath = 'http://10.1.2.666/'   		 
//	var serverPath = 'http://ois-dongx-gx/LHM/'   
	
	//server hosts Booklets. 
	var BookletsPath = 'http://www.lhm.org/booklets/'       
//	var BookletsPath = 'http://10.2.2.191/booklets/'        
//	var BookletsPath = 'http://ois-dongx-gx/LHM/booklets/'   
	
	var theImagePath = 'Assets/images/'
	var LeagueImagePath = 'leagueservices/images/'
	
	var theImages = new Array()
	theImages[0] = 'page_pic1.gif'
  theImages[1] = 'page_pic2.gif'
	theImages[2] = 'page_pic3.gif'
	theImages[3] = 'page_pic4.gif'
	theImages[4] = 'page_pic5.gif'
	theImages[5] = 'page_pic6.gif'
	var p = theImages.length;
  var whichImage = Math.round(Math.random()*(p-1));
	
	var LeagueImages = new Array()
	LeagueImages[0] = 'league_pic1.gif'
  LeagueImages[1] = 'league_pic2.gif'
	LeagueImages[2] = 'league_pic3.gif'
	LeagueImages[3] = 'league_pic4.gif'
	LeagueImages[4] = 'league_pic5.gif'
	var lp = LeagueImages.length;
 	var LeagueImageIndex = Math.round(Math.random()*(lp-1));
  
	function showImage(){
		document.write('<img src="'+ serverPath + theImagePath + theImages[whichImage]+'">');
  }

	function showLeagueImage(){
		document.write('<img src="'+ serverPath + LeagueImagePath + LeagueImages[LeagueImageIndex]+'">');
  }
	
	function MyPopup(URL) {
  	window.open(URL,'','height=600,width=425,top=200,left=250');
  }
	
	function MyOpenWindow(URL) {
		var windowSettings="toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,"+
								"resizable=yes,width=600,height=425,top=200,left=250";
  	window.open(URL,'',windowSettings);
  }

  	function MyOpenWindow2(URL) {
		var windowSettings="toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,"+
								"resizable=yes,width=800,height=600,top=100,left=100";
  	window.open(URL,'',windowSettings);
  }
  
	function URLHandler(pageURL,newWindow){
		var myPage
		var myNew 
		
		if (pageURL == 'broadcastinformation.htm') { 
			myPage = 'broadcastinformation.asp';
			myNew = 0;	
		}	
		else {
			myPage = pageURL;
			myNew = newWindow;
		}

		if (myPage.substr(0,4) !='http'){
			myPage = serverPath + myPage;
		}
		
	  if (myNew != 1) {
			location.href = myPage;
		}
		else {
  		window.open(myPage);
		}
	}
	
	function GoLink(selObj){
	  var URL = selObj.options[selObj.selectedIndex].value;
		var c = URL.charAt(0);
		var PageURL

		if (c=='0' || c=='1') {
			pageURL = URL.substr(1, URL.length-1);
		}
		else {
			pageURL = URL;	
		}	

		if (pageURL.substr(0,4) !='http'){
			pageURL = serverPath + pageURL;
		}

 		switch (c)	{
				case	"1" :
								winSettings="toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,"+
								"resizable=yes,width=600,height=425,top=200,left=250";
			          window.open(pageURL,'',winSettings);
				        break;
				case  "0" :
				        location.href=pageURL;
				        break;
 				default :
							location.href=pageURL;
							break;
          			}
		selObj.selectedIndex=0;
	}
 
	function GoDevotions() {  
//		var date = new Date();
//		var day  = date.getDate();
//		var month = date.getMonth() + 1;
//		var yy = date.getYear();
//		var year = (yy < 1000) ? yy + 1900 : yy;
//		
//		var sDay = (day <10) ? '0' + day : '' + day;
//		var sMonth = (month < 10) ? '0' + month : '' + month;
//		
//		if (((year + sMonth + sDay) < '20021201') || ((year + sMonth + sDay) > '20030106')) {
//			location.href = serverPath + 'devotions/' + month + '.'  + day + '.' + year + '.htm';
//		}
//		else {
//		  location.href = 'http://www.adventdevotions.net/' + month + '.'  + day + '.' + year + '.htm';
//		}
// JTH 11/14/2003 - CHANGED LOCATION.HREF TO ABSOLUTE PATH SINCE FILES IN SUBFOLDERS ALSO USE THIS SCRIPT.
//                  PAGE WAS NOT BEING LOCATED.
//		location.href = serverPath + 'dailydevotions.asp'
		location.href = 'http://www.lhm.org/dailydevotions.asp'
	}

	function GoBooklet(pageURL){
	  //var PageURL 
		
		//pageURL = selObj.options[selObj.selectedIndex].value;

		if (pageURL.substr(0,4) !='http'){
			pageURL = BookletsPath + pageURL;
		}
		
		location.href=pageURL;
//		selObj.selectedIndex=0;
	}

 	function PopHelp(URL,h,w,t,l) {
		var sWindowFeature = 'titlebar=yes,toolbar=no,scrollbars=yes,resizable=yes,menubar=no';
	  window.open(URL,'','height=' + h +',width=' + w + ',top=' + t + ',left=' + l + sWindowFeature);
  }

	// XD added 4-8-05
	function SearchOpenWindow(URL) {
		var windowSettings="toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,"+
								"resizable=yes,width=700,height=500,top=200,left=200";
  	window.open(URL,'',windowSettings);
  }
								

