﻿/***********************************************
* Ajax Rotating Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//To include a page, invoke ajaxinclude(files_array, "ROTATETYPE") in the BODY of page.
//* file_array is the name of the array containing your list of files to include.
//* For "ROTATETYPE", valid values are "dailyw", "dailym", and "random", for each day of the week, each day of the month, and random, respectively.
//* Included file MUST be from the same domain as the page displaying it.

//Enter path to list of files to display.
//For rotatetype="dailyw", there must be 7 files, and for "dailym", 31 files. Otherwise, no restriction:

var strengthsofthought=[
"strengths_of_thought/01.html", "strengths_of_thought/02.html", "strengths_of_thought/03.html", "strengths_of_thought/04.html", "strengths_of_thought/05.html", "strengths_of_thought/06.html", "strengths_of_thought/07.html", "strengths_of_thought/08.html", "strengths_of_thought/09.html",	"strengths_of_thought/10.html", "strengths_of_thought/11.html", "strengths_of_thought/12.html", "strengths_of_thought/13.html", "strengths_of_thought/14.html", "strengths_of_thought/15.html", "strengths_of_thought/16.html", "strengths_of_thought/17.html", "strengths_of_thought/18.html", "strengths_of_thought/19.html", "strengths_of_thought/20.html", "strengths_of_thought/21.html", "strengths_of_thought/22.html", "strengths_of_thought/23.html", "strengths_of_thought/24.html", "strengths_of_thought/25.html", "strengths_of_thought/26.html", "strengths_of_thought/27.html", "strengths_of_thought/28.html", "strengths_of_thought/29.html", "strengths_of_thought/30.html", "strengths_of_thought/31.html", "strengths_of_thought/32.html", "strengths_of_thought/33.html", "strengths_of_thought/34.html", "strengths_of_thought/35.html", "strengths_of_thought/36.html", "strengths_of_thought/37.html", "strengths_of_thought/38.html", "strengths_of_thought/39.html", "strengths_of_thought/40.html", "strengths_of_thought/41.html", "strengths_of_thought/42.html", "strengths_of_thought/43.html", "strengths_of_thought/44.html", "strengths_of_thought/45.html", "strengths_of_thought/46.html", "strengths_of_thought/47.html", "strengths_of_thought/48.html", "strengths_of_thought/49.html", "strengths_of_thought/50.html"
]

var bibleforyear=[
"bible/feb/01.html", "bible/feb/02.html", "bible/feb/03.html", "bible/feb/04.html", "bible/feb/05.html", "bible/feb/06.html", "bible/feb/07.html", "bible/feb/08.html", "bible/feb/09.html", "bible/feb/10.html", "bible/feb/11.html", "bible/feb/12.html", "bible/feb/13.html", "bible/feb/14.html", "bible/feb/15.html", "bible/feb/16.html", "bible/feb/17.html", "bible/feb/18.html", "bible/feb/19.html", "bible/feb/20.html", "bible/feb/21.html", "bible/feb/22.html", "bible/jan/23.html", "bible/jan/24.html", "bible/jan/25.html", "bible/jan/26.html", "bible/jan/27.html", "bible/jan/28.html", "bible/jan/29.html", "bible/jan/30.html", "bible/jan/31.html"]

var foto=[
"foto/01.html", "foto/02.html", "foto/03.html", "foto/04.html","foto/05.html","foto/06.html","foto/07.html", "foto/08.html", "foto/09.html","foto/10.html", "foto/11.html", "foto/12.html", "foto/13.html", "foto/14.html", "foto/15.html"
]

var rootdomain="http://www.uralcoc.ru/"+window.location.hostname

function ajaxinclude(files_array, rotatetype){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
var url=choosefile(files_array, rotatetype)
if (typeof files_array[url]=="undefined"){
document.write("Ошибка: Информация не найдена")
return
}
else
url=files_array[url]
page_request.open('GET', url, false) //get page synchronously
page_request.send(null)
writecontent(page_request)
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}

function choosefile(files_array, rotatetype){
var today=new Date()
var selectedfile=(rotatetype=="dailyw")? today.getDay() : rotatetype=="dailym"? today.getDate() : Math.floor(Math.random()*files_array.length)
if (rotatetype=="dailyw" && selectedfile==0) //if display type=="week days" and today is Sunday
selectedfile=7
if (rotatetype=="dailyw" || rotatetype=="dailym")
selectedfile-- //remove 1 to sync with array index
return selectedfile
}
